43 #if (_MSC_VER <= 1916) 44 #define QT_NO_FLOAT16_OPERATORS 48 #include <OpenFlipper/ACGHelper/DrawModeConverter.hh> 49 #include <OpenFlipper/INIFile/INIFile.hh> 52 #include <ACG/GL/ShaderCache.hh> 54 #include "optionsWidget.hh" 55 #include <QColorDialog> 56 #include <QOpenGLContext> 57 #include <QMessageBox> 59 OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyBinding>& _core, InverseKeyMap& _invKeys, QWidget *parent)
64 progressDialog_(NULL),
65 restartRequired_(false),
70 connect(okButton,SIGNAL(clicked()),
this,SLOT(
slotOk()));
71 connect(applyButton,SIGNAL(clicked()),
this,SLOT(
slotApply()));
72 connect(cancelButton,SIGNAL(clicked()),
this,SLOT(
slotCancel()));
74 connect(updateButton,SIGNAL(clicked()),
this,SLOT(
slotGetUpdates()));
75 updateButton->setEnabled(
false);
81 VersionComboBox->clear();
82 VersionComboBox->addItem(
"4.6",QVariant::fromValue(QPair<int, int>(4,6)));
83 VersionComboBox->addItem(
"4.5",QVariant::fromValue(QPair<int, int>(4,5)));
84 VersionComboBox->addItem(
"4.4",QVariant::fromValue(QPair<int, int>(4,4)));
85 VersionComboBox->addItem(
"4.3",QVariant::fromValue(QPair<int, int>(4,3)));
86 VersionComboBox->addItem(
"4.2",QVariant::fromValue(QPair<int, int>(4,2)));
87 VersionComboBox->addItem(
"4.1",QVariant::fromValue(QPair<int, int>(4,1)));
88 VersionComboBox->addItem(
"4.0",QVariant::fromValue(QPair<int, int>(4,0)));
89 VersionComboBox->addItem(
"3.3",QVariant::fromValue(QPair<int, int>(3,3)));
90 VersionComboBox->addItem(
"3.2",QVariant::fromValue(QPair<int, int>(3,2)));
91 VersionComboBox->addItem(
"3.1",QVariant::fromValue(QPair<int, int>(3,1)));
92 VersionComboBox->addItem(
"3.0",QVariant::fromValue(QPair<int, int>(3,0)));
93 VersionComboBox->addItem(
"2.1",QVariant::fromValue(QPair<int, int>(2,1)));
94 VersionComboBox->addItem(
"2.0",QVariant::fromValue(QPair<int, int>(2,0)));
95 VersionComboBox->addItem(
"1.5",QVariant::fromValue(QPair<int, int>(1,5)));
96 VersionComboBox->addItem(
"1.4",QVariant::fromValue(QPair<int, int>(1,4)));
97 VersionComboBox->addItem(
"1.3",QVariant::fromValue(QPair<int, int>(1,3)));
98 VersionComboBox->addItem(
"1.2",QVariant::fromValue(QPair<int, int>(1,2)));
99 VersionComboBox->addItem(
"1.1",QVariant::fromValue(QPair<int, int>(1,1)));
100 VersionComboBox->addItem(
"1.0",QVariant::fromValue(QPair<int, int>(1,0)));
103 connect( restrictFPS, SIGNAL(toggled(
bool)), FPS, SLOT(setEnabled(
bool)) );
105 connect( availDrawModes, SIGNAL(itemChanged(QListWidgetItem*)),
this, SLOT(
viewerSettingsChanged(QListWidgetItem*)) );
111 connect(stereoOpengl, SIGNAL(clicked()),
113 connect(stereoAnaglyph, SIGNAL(clicked()),
115 connect(stereoCustomAnaglyph, SIGNAL(clicked()),
118 connect(focalDistance, SIGNAL(sliderReleased()),
120 connect(eyeDistance, SIGNAL(editingFinished()),
123 ACG::SceneGraph::DrawModes::ModeFlagSet mode(2);
124 for (uint i=1; i < 22; i++) {
127 if ( !dm.empty() && dm[0].trimmed() !=
""){
128 QListWidgetItem* item =
new QListWidgetItem(dm[0]);
130 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
132 item->setCheckState(Qt::Unchecked);
134 availDrawModes->addItem( item );
140 defaultProjectionMode_.resize(4);
141 defaultViewingDirections_.resize(4);
142 defaultRotationLocks_.resize(4);
145 viewerList->addItem(
"Viewer " + QString::number(i+1) );
149 pluginOptionsLayout =
new QVBoxLayout;
150 pluginOptions->setLayout( pluginOptionsLayout );
152 networkMan_ =
new QNetworkAccessManager(
this);
155 connect(networkMan_, SIGNAL(finished(QNetworkReply *)),
156 this, SLOT(httpRequestFinished(QNetworkReply *)));
157 connect(networkMan_,SIGNAL(authenticationRequired(QNetworkReply* , QAuthenticator *)),
162 connect(defaultColorButton, SIGNAL(clicked()),
this, SLOT(getDefaultColor()) );
165 connect(clearSettingsButton, SIGNAL(clicked()),
this, SLOT(
slotClearSettings()));
166 connect(clearINIButton, SIGNAL(clicked()),
this, SLOT(
slotClearINI()));
169 #ifdef OPENFLIPPER_BUILD_APP_STORE_COMPLIANT 171 tabWidget->removeTab(tabWidget->count()-1);
176 QColor newColor = QColorDialog::getColor (
OpenFlipperSettings().value(
"Core/Gui/glViewer/defaultBackgroundColor").value<QColor>() );
178 backgroundColor_ = newColor;
180 QPixmap color(16,16);
181 color.fill( newColor );
182 backgroundButton->setIcon( QIcon(color) );
185 void OptionsWidget::getDefaultColor(){
186 QColor newColor = QColorDialog::getColor ( OpenFlipper::Options::defaultColor() );
188 OpenFlipper::Options::defaultColor( newColor) ;
190 QPixmap color(16,16);
191 color.fill( OpenFlipper::Options::defaultColor() );
192 defaultColorButton->setIcon( QIcon(color) );
201 if ( !updatingViewerSettings_ ){
203 std::vector< QString > mode;
205 for (
int i=0; i < availDrawModes->count(); i++)
206 if (availDrawModes->item(i)->checkState() == Qt::Checked)
207 mode.push_back( availDrawModes->item(i)->text() );
209 defaultDrawModes_[ viewerList->currentRow() ] = descriptionsToDrawMode(mode);
210 defaultProjectionMode_[ viewerList->currentRow() ] = projectionBox->currentIndex() ;
211 defaultViewingDirections_[ viewerList->currentRow() ] = directionBox->currentIndex();
212 defaultRotationLocks_[ viewerList->currentRow() ] = lockRotationBox->isChecked();
214 if ( lockRotationBox->isChecked() )
215 std::cerr <<
"locked" << std::endl;
217 std::cerr <<
"unlocked" << std::endl;
224 if (stereoCustomAnaglyph->isChecked()) {
225 stackedWidget->setCurrentIndex(0);
226 customAnaGlyphSettings->setVisible(
true);
228 stackedWidget->setCurrentIndex(0);
229 customAnaGlyphSettings->setVisible(
false);
236 void OptionsWidget::slotTranslationIndexChanged(
int ) {
242 updatingViewerSettings_ =
true;
244 for (
int i = 0 ; i < availDrawModes->count(); ++i )
245 availDrawModes->item( i )->setCheckState(Qt::Unchecked) ;
248 std::vector< QString > dm = drawModeToDescriptions( defaultDrawModes_[_row] );
250 for (uint i=0; i < dm.size(); i++){
252 QList< QListWidgetItem* > found = availDrawModes->findItems(dm[i],Qt::MatchExactly);
253 for(
int k=0; k < found.count(); k++)
254 (found[k])->setCheckState(Qt::Checked);
258 if ( defaultProjectionMode_[_row] )
259 projectionBox->setCurrentIndex( 1 );
261 projectionBox->setCurrentIndex( 0 );
263 directionBox->setCurrentIndex( defaultViewingDirections_[_row] );
265 lockRotationBox->setChecked( defaultRotationLocks_[_row] );
267 updatingViewerSettings_ =
false;
270 void OptionsWidget::showEvent ( QShowEvent * ) {
273 fullscreen->setChecked(
OpenFlipperSettings().value(
"Core/Gui/fullscreen",
false).toBool() );
275 toolbox->setChecked( !
OpenFlipperSettings().value(
"Core/Gui/ToolBoxes/hidden",
false).toBool() );
277 iconSmall->setChecked(
false);
278 iconNormal->setChecked(
false);
279 iconDefault->setChecked(
false);
282 case 1 : iconSmall->setChecked(
true);
break;
283 case 2 : iconNormal->setChecked(
true);
break;
284 default : iconDefault->setChecked(
true);
break;
287 loggerHidden->setChecked( OpenFlipper::Options::loggerState() == OpenFlipper::Options::Hidden);
288 loggerNormal->setChecked( OpenFlipper::Options::loggerState() == OpenFlipper::Options::Normal);
289 loggerInScene->setChecked( OpenFlipper::Options::loggerState() == OpenFlipper::Options::InScene);
290 enableLogFile->setChecked(
OpenFlipperSettings().value(
"Core/Log/logFileEnabled",
true).toBool() );
293 samples_spinBox->setValue(OpenFlipper::Options::samples());
294 QPalette warning = samplesWarning->palette();
295 samplesWarning->setText(QString::number(QOpenGLContext::currentContext()->format().samples()));
296 if(OpenFlipper::Options::samples() != QOpenGLContext::currentContext()->format().samples())
297 warning.setColor(samplesWarning->foregroundRole(),Qt::red);
299 warning.setColor(samplesWarning->foregroundRole(),Qt::black);
300 samplesWarning->setPalette(warning);
302 stereoCheckBox->setChecked(OpenFlipper::Options::glStereoRequested());
303 QPalette stereoWarn = stereoWarning->palette();
305 QOpenGLContext::currentContext()->format().stereo() ? stereoValue =
"true" : stereoValue =
"false";
306 stereoWarning->setText(stereoValue);
307 QOpenGLContext::currentContext()->format().stereo() == OpenFlipper::Options::glStereoRequested() ?
308 stereoWarn.setColor(stereoWarning->foregroundRole(), Qt::black) :
309 stereoWarn.setColor(stereoWarning->foregroundRole(), Qt::red);
310 stereoWarning->setPalette(stereoWarn);
312 VersionComboBox->setCurrentIndex( VersionComboBox->findData(QVariant::fromValue(OpenFlipper::Options::glVersion())));
313 QPalette version = versionWarning->palette();
314 versionWarning->setText(QString(
"%1.%2").arg(QOpenGLContext::currentContext()->format().version().first)
315 .arg(QOpenGLContext::currentContext()->format().version().second));
316 if(OpenFlipper::Options::glVersion() != QOpenGLContext::currentContext()->format().version())
317 version.setColor(versionWarning->foregroundRole(),Qt::red);
319 version.setColor(versionWarning->foregroundRole(),Qt::black);
320 versionWarning->setPalette(version);
322 QPalette profile = profileWarning->palette();
323 profileComboBox->setCurrentIndex(OpenFlipper::Options::coreProfile()?0:1);
324 if(QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile)
325 profileWarning->setText(
"Core");
326 if(QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CompatibilityProfile)
327 profileWarning->setText(
"Compatibility");
328 if(QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::NoProfile)
329 profileWarning->setText(
"None");
330 if(OpenFlipper::Options::coreProfile() && QOpenGLContext::currentContext()->format().profile() != QSurfaceFormat::CoreProfile)
331 profile.setColor(profileWarning->foregroundRole(),Qt::red);
333 profile.setColor(profileWarning->foregroundRole(),Qt::black);
334 profileWarning->setPalette(profile);
339 rbReloadShaders->setChecked(
OpenFlipperSettings().value(
"Core/File/ReloadShaders",
false).toBool()) ;
340 leShaderOutputDir->setText(
OpenFlipperSettings().value(
"Core/File/ShaderOutputDir",
"").toString());
341 allTarget->setChecked(
OpenFlipperSettings().value(
"Core/File/AllTarget",
false).toBool() );
345 toolBoxOrientation->setCurrentIndex((
OpenFlipperSettings().value(
"Core/Gui/ToolBoxes/ToolBoxOnTheRight",
true).toBool() ? 0 : 1));
347 pickToolbarInScene->setChecked(
OpenFlipperSettings().value(
"Core/Gui/ToolBars/PickToolbarInScene",
true).toBool());
352 if(!OpenFlipper::Options::glStereo()) {
353 stereoOpengl->setDisabled(
true);
355 stereoOpengl->setChecked(OpenFlipper::Options::stereoMode() == OpenFlipper::Options::OpenGL);
358 stereoAnaglyph->setChecked (OpenFlipper::Options::stereoMode() == OpenFlipper::Options::AnaglyphRedCyan);
359 stereoCustomAnaglyph->setChecked (OpenFlipper::Options::stereoMode() == OpenFlipper::Options::AnaglyphCustom);
361 eyeDistance->setValue (
OpenFlipperSettings().value(
"Core/Stereo/EyeDistance").toDouble() );
362 focalDistance->setValue (
OpenFlipperSettings().value(
"Core/Stereo/FocalDistance").toDouble() * 1000);
365 customAnaGlyphSettings->setVisible(
false);
367 stackedWidget->setCurrentIndex(0);
369 if (stereoCustomAnaglyph->isChecked())
370 customAnaGlyphSettings->setVisible(
true);
372 std::vector<float> mat = OpenFlipper::Options::anaglyphLeftEyeColorMatrix ();
373 lcm0->setValue (mat[0]);
374 lcm1->setValue (mat[1]);
375 lcm2->setValue (mat[2]);
376 lcm3->setValue (mat[3]);
377 lcm4->setValue (mat[4]);
378 lcm5->setValue (mat[5]);
379 lcm6->setValue (mat[6]);
380 lcm7->setValue (mat[7]);
381 lcm8->setValue (mat[8]);
383 mat = OpenFlipper::Options::anaglyphRightEyeColorMatrix ();
384 rcm0->setValue (mat[0]);
385 rcm1->setValue (mat[1]);
386 rcm2->setValue (mat[2]);
387 rcm3->setValue (mat[3]);
388 rcm4->setValue (mat[4]);
389 rcm5->setValue (mat[5]);
390 rcm6->setValue (mat[6]);
391 rcm7->setValue (mat[7]);
392 rcm8->setValue (mat[8]);
394 noMousePick->setChecked ( !
OpenFlipperSettings().value(
"Core/Gui/glViewer/stereoMousePick",
true).toBool() );
395 nativeMouse->setChecked (
OpenFlipperSettings().value(
"Core/Gui/glViewer/nativeMouse",
false).toBool() );
401 updateUser->setText(
OpenFlipperSettings().value(
"Core/Update/UserName",
"anonymous").toString() );
402 updatePass->setText(
OpenFlipperSettings().value(
"Core/Update/Pass",
"anonymous").toString() );
406 slotDebugging->setChecked(OpenFlipper::Options::doSlotDebugging());
411 keyTree->disconnect();
413 connect(keyTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
416 connect(keyTree, SIGNAL(itemDoubleClicked (QTreeWidgetItem*,
int)),
420 connect(shortcutButton, SIGNAL(keyChanged()),
this, SLOT(
updateShortcut()) );
425 wZoomFactor->setValue(
OpenFlipperSettings().value(
"Core/Mouse/Wheel/ZoomFactor").toDouble() );
426 wZoomFactorShift->setValue(
OpenFlipperSettings().value(
"Core/Mouse/Wheel/ZoomFactorShift").toDouble() );
427 invertMouseWheelBox->setChecked(
OpenFlipperSettings().value(
"Core/Mouse/Wheel/Invert").toBool() );
429 wheelBox->setChecked(
OpenFlipperSettings().value(
"Core/Gui/glViewer/showControlWheels").toBool() );
432 fieldOfView->setValue(
OpenFlipperSettings().value(
"Core/Projection/FOVY", 45.0).toDouble() );
434 restrictFPS->setChecked(
OpenFlipperSettings().value(
"Core/Gui/glViewer/restrictFrameRate",
false).toBool() );
437 minimalSceneSize->setValue(
OpenFlipperSettings().value(
"Core/Gui/glViewer/minimalSceneSize",0.1).toDouble());
439 QPixmap color(16,16);
440 color.fill(
OpenFlipperSettings().value(
"Core/Gui/glViewer/defaultBackgroundColor").value<QColor>() );
442 backgroundButton->setIcon( QIcon(color) );
444 color.fill( OpenFlipper::Options::defaultColor() );
445 defaultColorButton->setIcon( QIcon(color) );
447 randomDefaultColor->setChecked( OpenFlipper::Options::randomDefaultColor() );
449 viewerList->setCurrentRow(0);
452 defaultDrawModes_[i] = OpenFlipper::Options::defaultDrawMode(i);
453 defaultProjectionMode_[i] = OpenFlipper::Options::defaultPerspectiveProjectionMode(i);
454 defaultViewingDirections_[i] = OpenFlipper::Options::defaultViewingDirection(i);
455 defaultRotationLocks_[i] = OpenFlipper::Options::defaultLockRotation(i);
460 viewerLayout->setCurrentIndex( OpenFlipper::Options::defaultViewerLayout() );
462 if (
OpenFlipperSettings().value(
"Core/Language/Translation",
"en_US").toString() ==
"en_US")
463 translation->setCurrentIndex(0);
464 else if (
OpenFlipperSettings().value(
"Core/Language/Translation",
"en_US").toString() ==
"de_DE")
465 translation->setCurrentIndex(1);
467 translation->setCurrentIndex(2);
470 connect(translation, SIGNAL(currentIndexChanged(
int)),
this, SLOT(slotTranslationIndexChanged(
int)));
480 QString fileName = QDir::home().absolutePath() + OpenFlipper::Options::dirSeparator() +
481 ".OpenFlipper" + OpenFlipper::Options::dirSeparator() +
"Versions.ini" ;
487 QString systemString =
"";
489 if ( OpenFlipper::Options::isWindows() ) {
490 systemString =
"VersionWindows";
491 }
else if (OpenFlipper::Options::isLinux()) {
492 systemString =
"VersionLinux";
494 std::cerr <<
"Unsupported platform for update" << std::endl;
499 updateList->setRowCount(
int(1 + plugins_.size()) );
500 updateList->setColumnCount(3);
504 header <<
"Component" <<
"current Version" <<
"latest Version" ;
505 updateList->setHorizontalHeaderLabels(header);
507 QBrush currentBrush(Qt::white);
509 QTableWidgetItem * newItem = 0;
516 if (
isNewer(OpenFlipper::Options::coreVersion(),coreVersion) ) {
517 currentBrush.setColor(Qt::red);
519 }
else if (
isNewer(coreVersion , OpenFlipper::Options::coreVersion()) )
520 currentBrush.setColor(Qt::blue);
522 currentBrush.setColor(Qt::green);
524 newItem =
new QTableWidgetItem( coreVersion );
529 currentBrush.setColor(Qt::yellow);
531 newItem =
new QTableWidgetItem(
"Not Available" );
534 newItem->setBackground(currentBrush);
535 updateList->setItem(0, 2, newItem);
537 newItem =
new QTableWidgetItem( OpenFlipper::Options::coreVersion() );
538 newItem->setBackground(currentBrush);
539 updateList->setItem(0, 1, newItem);
541 newItem =
new QTableWidgetItem(
"Core" );
542 newItem->setBackground(currentBrush);
543 updateList->setItem(0, 0, newItem);
546 for ( uint i = 0 ; i < plugins_.size(); ++i ) {
547 QString latestVersion;
553 if (
isNewer(plugins_[i].version,latestVersion) ) {
554 currentBrush.setColor(Qt::red);
555 QFileInfo pluginFile(plugins_[i].path );
557 }
else if (
isNewer(latestVersion,plugins_[i].version) )
558 currentBrush.setColor(Qt::blue);
560 currentBrush.setColor(Qt::green);
562 newItem =
new QTableWidgetItem( latestVersion );
567 currentBrush.setColor(Qt::yellow);
569 newItem =
new QTableWidgetItem(
"Not Available" );
572 newItem->setBackground(currentBrush);
573 updateList->setItem( i + 1 , 2, newItem);
575 newItem =
new QTableWidgetItem( plugins_[i].version );
576 newItem->setBackground(currentBrush);
577 updateList->setItem( i + 1 , 1, newItem);
579 newItem =
new QTableWidgetItem( plugins_[i].name );
580 newItem->setBackground(currentBrush);
581 updateList->setItem( i + 1 , 0, newItem);
584 updateList->resizeColumnsToContents();
590 void OptionsWidget::initPluginOptions(){
592 pluginList->disconnect();
594 connect(pluginList, SIGNAL( currentTextChanged(
const QString&) ),
this, SLOT( slotShowPluginOptions(
const QString&) ) );
599 for ( uint i = 0 ; i < plugins_.size(); ++i )
600 if (plugins_[i].optionsWidget != 0){
602 pluginList->addItem( plugins_[i].name );
605 if ( pluginList->count() > 0)
606 pluginList->setCurrentRow(0);
609 void OptionsWidget::slotShowPluginOptions(
const QString& _pluginName ){
612 for (
int i = 0; i < pluginOptionsLayout->count(); ++i){
613 QWidget* w = pluginOptionsLayout->itemAt(i)->widget();
618 pluginOptionsLayout->removeItem( pluginOptionsLayout->itemAt(i) );
622 for ( uint i = 0 ; i < plugins_.size(); ++i )
623 if (plugins_[i].optionsWidget != 0 && plugins_[i].name == _pluginName){
625 pluginOptionsLayout->addWidget( plugins_[i].optionsWidget );
626 pluginOptionsLayout->addStretch();
638 if (loggerHidden->isChecked())
639 OpenFlipper::Options::loggerState( OpenFlipper::Options::Hidden );
640 else if (loggerInScene->isChecked())
641 OpenFlipper::Options::loggerState( OpenFlipper::Options::InScene );
643 OpenFlipper::Options::loggerState( OpenFlipper::Options::Normal );
650 OpenFlipper::Options::glVersion(VersionComboBox->currentData().value<QPair<int,int>>());
651 OpenFlipper::Options::coreProfile(profileComboBox->currentIndex() == 0);
652 OpenFlipper::Options::glStereo(stereoCheckBox->isChecked());
668 if (
OpenFlipperSettings().
value(
"Core/Gui/ToolBars/PickToolbarInScene",
true).toBool() != pickToolbarInScene->isChecked() ) {
673 if ( iconDefault->isChecked() )
675 else if ( iconSmall->isChecked() )
677 else if ( iconNormal->isChecked() )
694 OpenFlipper::Options::randomDefaultColor( randomDefaultColor->isChecked() );
697 if (stereoCustomAnaglyph->isChecked ())
698 OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphCustom);
699 else if (stereoAnaglyph->isChecked ())
700 OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphRedCyan);
702 OpenFlipper::Options::stereoMode(OpenFlipper::Options::OpenGL);
707 std::vector<float> mat (9, 0);
708 mat[0] = lcm0->value ();
709 mat[1] = lcm1->value ();
710 mat[2] = lcm2->value ();
711 mat[3] = lcm3->value ();
712 mat[4] = lcm4->value ();
713 mat[5] = lcm5->value ();
714 mat[6] = lcm6->value ();
715 mat[7] = lcm7->value ();
716 mat[8] = lcm8->value ();
718 OpenFlipper::Options::anaglyphLeftEyeColorMatrix (mat);
720 mat[0] = rcm0->value ();
721 mat[1] = rcm1->value ();
722 mat[2] = rcm2->value ();
723 mat[3] = rcm3->value ();
724 mat[4] = rcm4->value ();
725 mat[5] = rcm5->value ();
726 mat[6] = rcm6->value ();
727 mat[7] = rcm7->value ();
728 mat[8] = rcm8->value ();
730 OpenFlipper::Options::anaglyphRightEyeColorMatrix (mat);
741 OpenFlipper::Options::doSlotDebugging(slotDebugging->isChecked());
745 OpenFlipper::Options::defaultDrawMode( defaultDrawModes_[i], i );
746 OpenFlipper::Options::defaultPerspectiveProjectionMode( defaultProjectionMode_[i], i );
747 OpenFlipper::Options::defaultViewingDirection( defaultViewingDirections_[i], i );
748 OpenFlipper::Options::defaultLockRotation( defaultRotationLocks_[i], i );
751 OpenFlipper::Options::defaultViewerLayout( viewerLayout->currentIndex() );
754 if(restrictFPS->isChecked()) {
764 for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets(); ++i )
766 ((
double) backgroundColor_.greenF()),
767 ((
double) backgroundColor_.blueF()),
770 switch ( translation->currentIndex() ){
778 int restart = QMessageBox::information(
this, tr(
"Restart required!"),
779 tr(
"The changes will take effect after next restart. Do you want to close OpenFlipper now?"),
780 QMessageBox::Yes | QMessageBox::No);
782 if(restart == QMessageBox::Yes) exitOnClose_ =
true;
794 if(exitOnClose_) QCoreApplication::quit();
810 downloadType = VERSIONS_FILE;
811 QString ServerMainURL = updateURL->text();
812 if ( !ServerMainURL.endsWith(
"/") )
813 ServerMainURL +=
"/";
815 ServerMainURL +=
"Versions.ini";
821 std::cerr <<
"Not implemented yet: Get updates" << std::endl;
822 QString url = updateURL->text();
824 if ( !url.endsWith(
"/") )
831 if ( OpenFlipper::Options::isWindows() ) {
833 }
else if ( OpenFlipper::Options::isLinux() ) {
836 std::cerr <<
"Unknown operating system type, aborting update" << std::endl;
840 if ( OpenFlipper::Options::is64bit() ) {
842 }
else if ( OpenFlipper::Options::is32bit() ) {
845 std::cerr <<
"Unknown architecture type, aborting update" << std::endl;
852 std::cerr <<
"Core update not supported!" << std::endl;
861 downloadType = PLUGIN;
868 void OptionsWidget::updateComponent() {
869 std::cerr <<
"Todo : Update component" << std::endl;
873 QString sourceName = QDir::home().absolutePath() + OpenFlipper::Options::dirSeparator() +
878 QFileInfo sourceFileInfo(sourceName);
879 QFileInfo targetFileInfo(targetName);
881 std::cerr << sourceName.toStdString() << std::endl;
882 std::cerr << targetName.toStdString() << std::endl;
884 if ( ! sourceFileInfo.exists() ) {
885 statusLabel->setText(tr(
"Download failed!"));
889 if ( ! targetFileInfo.exists() ) {
890 statusLabel->setText(tr(
"plugin target does not exist"));
895 statusLabel->setText(tr(
"Installing new file"));
898 QFile targetFile(targetName);
902 QFile::copy(sourceName,targetName);
905 QFile sourceFile(sourceName);
908 statusLabel->setText(tr(
"updated ") + currentUpdateName_);
916 QStringList latestVersionParts = _latest.split(
'.');
917 QStringList currentVersionParts = _current.split(
'.');
921 for (
int i = 0 ; i < latestVersionParts.size(); ++i ) {
923 if ( i+1 > currentVersionParts.size() ) {
930 double latest = latestVersionParts[i].toInt(&ok);
931 double current = currentVersionParts[i].toInt(&ok);
934 std::cerr <<
"Error when parsing version strings!" << std::endl;
936 if ( latest > current ) {
948 QString fileName = QDir::home().absolutePath() + OpenFlipper::Options::dirSeparator() +
949 ".OpenFlipper" + OpenFlipper::Options::dirSeparator() +
"Versions.ini" ;
952 if ( ! ini.
connect(fileName,
false) ) {
953 std::cerr <<
"Failed to connect to Versions ini file" << std::endl;
957 statusLabel->setText(tr(
"Checking for new versions"));
959 bool newerVersionsAvailable =
false;
961 QString systemString =
"";
962 if ( OpenFlipper::Options::isWindows() ) {
963 systemString =
"VersionWindows";
964 }
else if (OpenFlipper::Options::isLinux()) {
965 systemString =
"VersionLinux";
967 std::cerr <<
"Unsupported platform for update" << std::endl;
973 if ( ini.
get_entry(coreVersion,
"Core" , systemString )) {
974 if (
isNewer( OpenFlipper::Options::coreVersion(), coreVersion ) ) {
975 newerVersionsAvailable =
true;
979 for ( uint i = 0 ; i < plugins_.size(); ++i ) {
980 QString latestVersion;
981 if ( ini.
get_entry(latestVersion, plugins_[i].name , systemString )) {
982 if (
isNewer( plugins_[i].version, latestVersion ) )
983 newerVersionsAvailable =
true;
987 if ( newerVersionsAvailable ) {
988 statusLabel->setText(tr(
"Updates found"));
990 statusLabel->setText(tr(
"No updates found"));
1000 if (stereoCustomAnaglyph->isChecked ())
1001 OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphCustom);
1002 else if (stereoAnaglyph->isChecked ())
1003 OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphRedCyan);
1005 OpenFlipper::Options::stereoMode(OpenFlipper::Options::OpenGL);
1012 emit applyOptions();
1022 QMessageBox::information(
this, tr(
"Restart required!"),
1023 tr(
"The changes will take effect after next restart."));
1025 OpenFlipper::Options::deleteIniFile(
true);
void disconnect()
Remove connection of this object to a file.
void setDebugOutputDir(const char *_outputDir)
Enable debug output of generated shaders to specified directory.
bool is_connected() const
Check if object is connected to file.
void setTimeCheck(bool _on)
enable or disable checking of the time step of each file
bool get_entry(QString &_val, const QString &_section, const QString &_key) const
Access to a string entry.
DrawMode DEFAULT
use the default (global) draw mode and not the node's own.
int viewers()
Get the number of viewers.
static ShaderCache * getInstance()
Return instance of the ShaderCache singleton.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
void clearCache()
Delete all cached shaders.
ACG::Vec4f backgroundColor()
Get current background color.
Class for the handling of simple configuration files.
bool connect(const QString &name, const bool create)
Connect INIFile object with given filename.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.