46 #include <OpenFlipper/ACGHelper/DrawModeConverter.hh> 47 #include <OpenFlipper/INIFile/INIFile.hh> 50 #include <ACG/GL/ShaderCache.hh> 52 #include "optionsWidget.hh" 53 #include <QColorDialog> 54 #include <QOpenGLContext> 55 #include <QMessageBox> 57 OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyBinding>& _core, InverseKeyMap& _invKeys, QWidget *parent)
62 progressDialog_(NULL),
63 restartRequired_(false),
68 connect(okButton,SIGNAL(clicked()),
this,SLOT(
slotOk()));
69 connect(applyButton,SIGNAL(clicked()),
this,SLOT(
slotApply()));
70 connect(cancelButton,SIGNAL(clicked()),
this,SLOT(
slotCancel()));
72 connect(updateButton,SIGNAL(clicked()),
this,SLOT(
slotGetUpdates()));
73 updateButton->setEnabled(
false);
79 VersionComboBox->clear();
80 VersionComboBox->addItem(
"4.6",QVariant::fromValue(QPair<int, int>(4,6)));
81 VersionComboBox->addItem(
"4.5",QVariant::fromValue(QPair<int, int>(4,5)));
82 VersionComboBox->addItem(
"4.4",QVariant::fromValue(QPair<int, int>(4,4)));
83 VersionComboBox->addItem(
"4.3",QVariant::fromValue(QPair<int, int>(4,3)));
84 VersionComboBox->addItem(
"4.2",QVariant::fromValue(QPair<int, int>(4,2)));
85 VersionComboBox->addItem(
"4.1",QVariant::fromValue(QPair<int, int>(4,1)));
86 VersionComboBox->addItem(
"4.0",QVariant::fromValue(QPair<int, int>(4,0)));
87 VersionComboBox->addItem(
"3.3",QVariant::fromValue(QPair<int, int>(3,3)));
88 VersionComboBox->addItem(
"3.2",QVariant::fromValue(QPair<int, int>(3,2)));
89 VersionComboBox->addItem(
"3.1",QVariant::fromValue(QPair<int, int>(3,1)));
90 VersionComboBox->addItem(
"3.0",QVariant::fromValue(QPair<int, int>(3,0)));
91 VersionComboBox->addItem(
"2.1",QVariant::fromValue(QPair<int, int>(2,1)));
92 VersionComboBox->addItem(
"2.0",QVariant::fromValue(QPair<int, int>(2,0)));
93 VersionComboBox->addItem(
"1.5",QVariant::fromValue(QPair<int, int>(1,5)));
94 VersionComboBox->addItem(
"1.4",QVariant::fromValue(QPair<int, int>(1,4)));
95 VersionComboBox->addItem(
"1.3",QVariant::fromValue(QPair<int, int>(1,3)));
96 VersionComboBox->addItem(
"1.2",QVariant::fromValue(QPair<int, int>(1,2)));
97 VersionComboBox->addItem(
"1.1",QVariant::fromValue(QPair<int, int>(1,1)));
98 VersionComboBox->addItem(
"1.0",QVariant::fromValue(QPair<int, int>(1,0)));
101 connect( restrictFPS, SIGNAL(toggled(
bool)), FPS, SLOT(setEnabled(
bool)) );
103 connect( availDrawModes, SIGNAL(itemChanged(QListWidgetItem*)),
this, SLOT(
viewerSettingsChanged(QListWidgetItem*)) );
109 connect(stereoOpengl, SIGNAL(clicked()),
111 connect(stereoAnaglyph, SIGNAL(clicked()),
113 connect(stereoCustomAnaglyph, SIGNAL(clicked()),
116 connect(focalDistance, SIGNAL(sliderReleased()),
118 connect(eyeDistance, SIGNAL(editingFinished()),
121 ACG::SceneGraph::DrawModes::ModeFlagSet mode(2);
122 for (uint i=1; i < 22; i++) {
125 if ( !dm.empty() && dm[0].trimmed() !=
""){
126 QListWidgetItem* item =
new QListWidgetItem(dm[0]);
128 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
130 item->setCheckState(Qt::Unchecked);
132 availDrawModes->addItem( item );
138 defaultProjectionMode_.resize(4);
139 defaultViewingDirections_.resize(4);
140 defaultRotationLocks_.resize(4);
143 viewerList->addItem(
"Viewer " + QString::number(i+1) );
147 pluginOptionsLayout =
new QVBoxLayout;
148 pluginOptions->setLayout( pluginOptionsLayout );
150 networkMan_ =
new QNetworkAccessManager(
this);
153 connect(networkMan_, SIGNAL(finished(QNetworkReply *)),
154 this, SLOT(httpRequestFinished(QNetworkReply *)));
155 connect(networkMan_,SIGNAL(authenticationRequired(QNetworkReply* , QAuthenticator *)),
160 connect(defaultColorButton, SIGNAL(clicked()),
this, SLOT(getDefaultColor()) );
163 connect(clearSettingsButton, SIGNAL(clicked()),
this, SLOT(
slotClearSettings()));
164 connect(clearINIButton, SIGNAL(clicked()),
this, SLOT(
slotClearINI()));
167 #ifdef OPENFLIPPER_BUILD_APP_STORE_COMPLIANT 169 tabWidget->removeTab(tabWidget->count()-1);
174 QColor newColor = QColorDialog::getColor (
OpenFlipperSettings().value(
"Core/Gui/glViewer/defaultBackgroundColor").value<QColor>() );
176 backgroundColor_ = newColor;
178 QPixmap color(16,16);
179 color.fill( newColor );
180 backgroundButton->setIcon( QIcon(color) );
183 void OptionsWidget::getDefaultColor(){
184 QColor newColor = QColorDialog::getColor ( OpenFlipper::Options::defaultColor() );
186 OpenFlipper::Options::defaultColor( newColor) ;
188 QPixmap color(16,16);
189 color.fill( OpenFlipper::Options::defaultColor() );
190 defaultColorButton->setIcon( QIcon(color) );
199 if ( !updatingViewerSettings_ ){
201 std::vector< QString > mode;
203 for (
int i=0; i < availDrawModes->count(); i++)
204 if (availDrawModes->item(i)->checkState() == Qt::Checked)
205 mode.push_back( availDrawModes->item(i)->text() );
207 defaultDrawModes_[ viewerList->currentRow() ] = descriptionsToDrawMode(mode);
208 defaultProjectionMode_[ viewerList->currentRow() ] = projectionBox->currentIndex() ;
209 defaultViewingDirections_[ viewerList->currentRow() ] = directionBox->currentIndex();
210 defaultRotationLocks_[ viewerList->currentRow() ] = lockRotationBox->isChecked();
212 if ( lockRotationBox->isChecked() )
213 std::cerr <<
"locked" << std::endl;
215 std::cerr <<
"unlocked" << std::endl;
222 if (stereoCustomAnaglyph->isChecked()) {
223 stackedWidget->setCurrentIndex(0);
224 customAnaGlyphSettings->setVisible(
true);
226 stackedWidget->setCurrentIndex(0);
227 customAnaGlyphSettings->setVisible(
false);
234 void OptionsWidget::slotTranslationIndexChanged(
int ) {
240 updatingViewerSettings_ =
true;
242 for (
int i = 0 ; i < availDrawModes->count(); ++i )
243 availDrawModes->item( i )->setCheckState(Qt::Unchecked) ;
246 std::vector< QString > dm = drawModeToDescriptions( defaultDrawModes_[_row] );
248 for (uint i=0; i < dm.size(); i++){
250 QList< QListWidgetItem* > found = availDrawModes->findItems(dm[i],Qt::MatchExactly);
251 for(
int k=0; k < found.count(); k++)
252 (found[k])->setCheckState(Qt::Checked);
256 if ( defaultProjectionMode_[_row] )
257 projectionBox->setCurrentIndex( 1 );
259 projectionBox->setCurrentIndex( 0 );
261 directionBox->setCurrentIndex( defaultViewingDirections_[_row] );
263 lockRotationBox->setChecked( defaultRotationLocks_[_row] );
265 updatingViewerSettings_ =
false;
268 void OptionsWidget::showEvent ( QShowEvent * ) {
271 fullscreen->setChecked(
OpenFlipperSettings().value(
"Core/Gui/fullscreen",
false).toBool() );
273 toolbox->setChecked( !
OpenFlipperSettings().value(
"Core/Gui/ToolBoxes/hidden",
false).toBool() );
275 iconSmall->setChecked(
false);
276 iconNormal->setChecked(
false);
277 iconDefault->setChecked(
false);
280 case 1 : iconSmall->setChecked(
true);
break;
281 case 2 : iconNormal->setChecked(
true);
break;
282 default : iconDefault->setChecked(
true);
break;
285 loggerHidden->setChecked( OpenFlipper::Options::loggerState() == OpenFlipper::Options::Hidden);
286 loggerNormal->setChecked( OpenFlipper::Options::loggerState() == OpenFlipper::Options::Normal);
287 loggerInScene->setChecked( OpenFlipper::Options::loggerState() == OpenFlipper::Options::InScene);
288 enableLogFile->setChecked(
OpenFlipperSettings().value(
"Core/Log/logFileEnabled",
true).toBool() );
291 samples_spinBox->setValue(OpenFlipper::Options::samples());
292 QPalette warning = samplesWarning->palette();
293 samplesWarning->setText(QString::number(QOpenGLContext::currentContext()->format().samples()));
294 if(OpenFlipper::Options::samples() != QOpenGLContext::currentContext()->format().samples())
295 warning.setColor(samplesWarning->foregroundRole(),Qt::red);
297 warning.setColor(samplesWarning->foregroundRole(),Qt::black);
298 samplesWarning->setPalette(warning);
300 stereoCheckBox->setChecked(OpenFlipper::Options::glStereoRequested());
301 QPalette stereoWarn = stereoWarning->palette();
303 QOpenGLContext::currentContext()->format().stereo() ? stereoValue =
"true" : stereoValue =
"false";
304 stereoWarning->setText(stereoValue);
305 QOpenGLContext::currentContext()->format().stereo() == OpenFlipper::Options::glStereoRequested() ?
306 stereoWarn.setColor(stereoWarning->foregroundRole(), Qt::black) :
307 stereoWarn.setColor(stereoWarning->foregroundRole(), Qt::red);
308 stereoWarning->setPalette(stereoWarn);
310 VersionComboBox->setCurrentIndex( VersionComboBox->findData(QVariant::fromValue(OpenFlipper::Options::glVersion())));
311 QPalette version = versionWarning->palette();
312 versionWarning->setText(QString(
"%1.%2").arg(QOpenGLContext::currentContext()->format().version().first)
313 .arg(QOpenGLContext::currentContext()->format().version().second));
314 if(OpenFlipper::Options::glVersion() != QOpenGLContext::currentContext()->format().version())
315 version.setColor(versionWarning->foregroundRole(),Qt::red);
317 version.setColor(versionWarning->foregroundRole(),Qt::black);
318 versionWarning->setPalette(version);
320 QPalette profile = profileWarning->palette();
321 profileComboBox->setCurrentIndex(OpenFlipper::Options::coreProfile()?0:1);
322 if(QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile)
323 profileWarning->setText(
"Core");
324 if(QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CompatibilityProfile)
325 profileWarning->setText(
"Compatibility");
326 if(QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::NoProfile)
327 profileWarning->setText(
"None");
328 if(OpenFlipper::Options::coreProfile() && QOpenGLContext::currentContext()->format().profile() != QSurfaceFormat::CoreProfile)
329 profile.setColor(profileWarning->foregroundRole(),Qt::red);
331 profile.setColor(profileWarning->foregroundRole(),Qt::black);
332 profileWarning->setPalette(profile);
337 rbReloadShaders->setChecked(
OpenFlipperSettings().value(
"Core/File/ReloadShaders",
false).toBool()) ;
338 leShaderOutputDir->setText(
OpenFlipperSettings().value(
"Core/File/ShaderOutputDir",
"").toString());
339 allTarget->setChecked(
OpenFlipperSettings().value(
"Core/File/AllTarget",
false).toBool() );
343 toolBoxOrientation->setCurrentIndex((
OpenFlipperSettings().value(
"Core/Gui/ToolBoxes/ToolBoxOnTheRight",
true).toBool() ? 0 : 1));
345 pickToolbarInScene->setChecked(
OpenFlipperSettings().value(
"Core/Gui/ToolBars/PickToolbarInScene",
true).toBool());
350 if(!OpenFlipper::Options::glStereo()) {
351 stereoOpengl->setDisabled(
true);
353 stereoOpengl->setChecked(OpenFlipper::Options::stereoMode() == OpenFlipper::Options::OpenGL);
356 stereoAnaglyph->setChecked (OpenFlipper::Options::stereoMode() == OpenFlipper::Options::AnaglyphRedCyan);
357 stereoCustomAnaglyph->setChecked (OpenFlipper::Options::stereoMode() == OpenFlipper::Options::AnaglyphCustom);
359 eyeDistance->setValue (
OpenFlipperSettings().value(
"Core/Stereo/EyeDistance").toDouble() );
360 focalDistance->setValue (
OpenFlipperSettings().value(
"Core/Stereo/FocalDistance").toDouble() * 1000);
363 customAnaGlyphSettings->setVisible(
false);
365 stackedWidget->setCurrentIndex(0);
367 if (stereoCustomAnaglyph->isChecked())
368 customAnaGlyphSettings->setVisible(
true);
370 std::vector<float> mat = OpenFlipper::Options::anaglyphLeftEyeColorMatrix ();
371 lcm0->setValue (mat[0]);
372 lcm1->setValue (mat[1]);
373 lcm2->setValue (mat[2]);
374 lcm3->setValue (mat[3]);
375 lcm4->setValue (mat[4]);
376 lcm5->setValue (mat[5]);
377 lcm6->setValue (mat[6]);
378 lcm7->setValue (mat[7]);
379 lcm8->setValue (mat[8]);
381 mat = OpenFlipper::Options::anaglyphRightEyeColorMatrix ();
382 rcm0->setValue (mat[0]);
383 rcm1->setValue (mat[1]);
384 rcm2->setValue (mat[2]);
385 rcm3->setValue (mat[3]);
386 rcm4->setValue (mat[4]);
387 rcm5->setValue (mat[5]);
388 rcm6->setValue (mat[6]);
389 rcm7->setValue (mat[7]);
390 rcm8->setValue (mat[8]);
392 noMousePick->setChecked ( !
OpenFlipperSettings().value(
"Core/Gui/glViewer/stereoMousePick",
true).toBool() );
393 nativeMouse->setChecked (
OpenFlipperSettings().value(
"Core/Gui/glViewer/nativeMouse",
false).toBool() );
399 updateUser->setText(
OpenFlipperSettings().value(
"Core/Update/UserName",
"anonymous").toString() );
400 updatePass->setText(
OpenFlipperSettings().value(
"Core/Update/Pass",
"anonymous").toString() );
404 slotDebugging->setChecked(OpenFlipper::Options::doSlotDebugging());
409 keyTree->disconnect();
411 connect(keyTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
414 connect(keyTree, SIGNAL(itemDoubleClicked (QTreeWidgetItem*,
int)),
418 connect(shortcutButton, SIGNAL(keyChanged()),
this, SLOT(
updateShortcut()) );
423 wZoomFactor->setValue(
OpenFlipperSettings().value(
"Core/Mouse/Wheel/ZoomFactor").toDouble() );
424 wZoomFactorShift->setValue(
OpenFlipperSettings().value(
"Core/Mouse/Wheel/ZoomFactorShift").toDouble() );
425 invertMouseWheelBox->setChecked(
OpenFlipperSettings().value(
"Core/Mouse/Wheel/Invert").toBool() );
427 wheelBox->setChecked(
OpenFlipperSettings().value(
"Core/Gui/glViewer/showControlWheels").toBool() );
430 fieldOfView->setValue(
OpenFlipperSettings().value(
"Core/Projection/FOVY", 45.0).toDouble() );
432 restrictFPS->setChecked(
OpenFlipperSettings().value(
"Core/Gui/glViewer/restrictFrameRate",
false).toBool() );
435 minimalSceneSize->setValue(
OpenFlipperSettings().value(
"Core/Gui/glViewer/minimalSceneSize",0.1).toDouble());
437 QPixmap color(16,16);
438 color.fill(
OpenFlipperSettings().value(
"Core/Gui/glViewer/defaultBackgroundColor").value<QColor>() );
440 backgroundButton->setIcon( QIcon(color) );
442 color.fill( OpenFlipper::Options::defaultColor() );
443 defaultColorButton->setIcon( QIcon(color) );
445 randomDefaultColor->setChecked( OpenFlipper::Options::randomDefaultColor() );
447 viewerList->setCurrentRow(0);
450 defaultDrawModes_[i] = OpenFlipper::Options::defaultDrawMode(i);
451 defaultProjectionMode_[i] = OpenFlipper::Options::defaultPerspectiveProjectionMode(i);
452 defaultViewingDirections_[i] = OpenFlipper::Options::defaultViewingDirection(i);
453 defaultRotationLocks_[i] = OpenFlipper::Options::defaultLockRotation(i);
458 viewerLayout->setCurrentIndex( OpenFlipper::Options::defaultViewerLayout() );
460 if (
OpenFlipperSettings().value(
"Core/Language/Translation",
"en_US").toString() ==
"en_US")
461 translation->setCurrentIndex(0);
462 else if (
OpenFlipperSettings().value(
"Core/Language/Translation",
"en_US").toString() ==
"de_DE")
463 translation->setCurrentIndex(1);
465 translation->setCurrentIndex(2);
468 connect(translation, SIGNAL(currentIndexChanged(
int)),
this, SLOT(slotTranslationIndexChanged(
int)));
478 QString fileName = QDir::home().absolutePath() + OpenFlipper::Options::dirSeparator() +
479 ".OpenFlipper" + OpenFlipper::Options::dirSeparator() +
"Versions.ini" ;
485 QString systemString =
"";
487 if ( OpenFlipper::Options::isWindows() ) {
488 systemString =
"VersionWindows";
489 }
else if (OpenFlipper::Options::isLinux()) {
490 systemString =
"VersionLinux";
492 std::cerr <<
"Unsupported platform for update" << std::endl;
497 updateList->setRowCount(
int(1 + plugins_.size()) );
498 updateList->setColumnCount(3);
502 header <<
"Component" <<
"current Version" <<
"latest Version" ;
503 updateList->setHorizontalHeaderLabels(header);
505 QBrush currentBrush(Qt::white);
507 QTableWidgetItem * newItem = 0;
514 if (
isNewer(OpenFlipper::Options::coreVersion(),coreVersion) ) {
515 currentBrush.setColor(Qt::red);
517 }
else if (
isNewer(coreVersion , OpenFlipper::Options::coreVersion()) )
518 currentBrush.setColor(Qt::blue);
520 currentBrush.setColor(Qt::green);
522 newItem =
new QTableWidgetItem( coreVersion );
527 currentBrush.setColor(Qt::yellow);
529 newItem =
new QTableWidgetItem(
"Not Available" );
532 newItem->setBackground(currentBrush);
533 updateList->setItem(0, 2, newItem);
535 newItem =
new QTableWidgetItem( OpenFlipper::Options::coreVersion() );
536 newItem->setBackground(currentBrush);
537 updateList->setItem(0, 1, newItem);
539 newItem =
new QTableWidgetItem(
"Core" );
540 newItem->setBackground(currentBrush);
541 updateList->setItem(0, 0, newItem);
544 for ( uint i = 0 ; i < plugins_.size(); ++i ) {
545 QString latestVersion;
551 if (
isNewer(plugins_[i].version,latestVersion) ) {
552 currentBrush.setColor(Qt::red);
553 QFileInfo pluginFile(plugins_[i].path );
555 }
else if (
isNewer(latestVersion,plugins_[i].version) )
556 currentBrush.setColor(Qt::blue);
558 currentBrush.setColor(Qt::green);
560 newItem =
new QTableWidgetItem( latestVersion );
565 currentBrush.setColor(Qt::yellow);
567 newItem =
new QTableWidgetItem(
"Not Available" );
570 newItem->setBackground(currentBrush);
571 updateList->setItem( i + 1 , 2, newItem);
573 newItem =
new QTableWidgetItem( plugins_[i].version );
574 newItem->setBackground(currentBrush);
575 updateList->setItem( i + 1 , 1, newItem);
577 newItem =
new QTableWidgetItem( plugins_[i].name );
578 newItem->setBackground(currentBrush);
579 updateList->setItem( i + 1 , 0, newItem);
582 updateList->resizeColumnsToContents();
588 void OptionsWidget::initPluginOptions(){
590 pluginList->disconnect();
592 connect(pluginList, SIGNAL( currentTextChanged(
const QString&) ),
this, SLOT( slotShowPluginOptions(
const QString&) ) );
597 for ( uint i = 0 ; i < plugins_.size(); ++i )
598 if (plugins_[i].optionsWidget != 0){
600 pluginList->addItem( plugins_[i].name );
603 if ( pluginList->count() > 0)
604 pluginList->setCurrentRow(0);
607 void OptionsWidget::slotShowPluginOptions(
const QString& _pluginName ){
610 for (
int i = 0; i < pluginOptionsLayout->count(); ++i){
611 QWidget* w = pluginOptionsLayout->itemAt(i)->widget();
616 pluginOptionsLayout->removeItem( pluginOptionsLayout->itemAt(i) );
620 for ( uint i = 0 ; i < plugins_.size(); ++i )
621 if (plugins_[i].optionsWidget != 0 && plugins_[i].name == _pluginName){
623 pluginOptionsLayout->addWidget( plugins_[i].optionsWidget );
624 pluginOptionsLayout->addStretch();
636 if (loggerHidden->isChecked())
637 OpenFlipper::Options::loggerState( OpenFlipper::Options::Hidden );
638 else if (loggerInScene->isChecked())
639 OpenFlipper::Options::loggerState( OpenFlipper::Options::InScene );
641 OpenFlipper::Options::loggerState( OpenFlipper::Options::Normal );
648 OpenFlipper::Options::glVersion(VersionComboBox->currentData().value<QPair<int,int>>());
649 OpenFlipper::Options::coreProfile(profileComboBox->currentIndex() == 0);
650 OpenFlipper::Options::glStereo(stereoCheckBox->isChecked());
666 if (
OpenFlipperSettings().
value(
"Core/Gui/ToolBars/PickToolbarInScene",
true).toBool() != pickToolbarInScene->isChecked() ) {
671 if ( iconDefault->isChecked() )
673 else if ( iconSmall->isChecked() )
675 else if ( iconNormal->isChecked() )
692 OpenFlipper::Options::randomDefaultColor( randomDefaultColor->isChecked() );
695 if (stereoCustomAnaglyph->isChecked ())
696 OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphCustom);
697 else if (stereoAnaglyph->isChecked ())
698 OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphRedCyan);
700 OpenFlipper::Options::stereoMode(OpenFlipper::Options::OpenGL);
705 std::vector<float> mat (9, 0);
706 mat[0] = lcm0->value ();
707 mat[1] = lcm1->value ();
708 mat[2] = lcm2->value ();
709 mat[3] = lcm3->value ();
710 mat[4] = lcm4->value ();
711 mat[5] = lcm5->value ();
712 mat[6] = lcm6->value ();
713 mat[7] = lcm7->value ();
714 mat[8] = lcm8->value ();
716 OpenFlipper::Options::anaglyphLeftEyeColorMatrix (mat);
718 mat[0] = rcm0->value ();
719 mat[1] = rcm1->value ();
720 mat[2] = rcm2->value ();
721 mat[3] = rcm3->value ();
722 mat[4] = rcm4->value ();
723 mat[5] = rcm5->value ();
724 mat[6] = rcm6->value ();
725 mat[7] = rcm7->value ();
726 mat[8] = rcm8->value ();
728 OpenFlipper::Options::anaglyphRightEyeColorMatrix (mat);
739 OpenFlipper::Options::doSlotDebugging(slotDebugging->isChecked());
743 OpenFlipper::Options::defaultDrawMode( defaultDrawModes_[i], i );
744 OpenFlipper::Options::defaultPerspectiveProjectionMode( defaultProjectionMode_[i], i );
745 OpenFlipper::Options::defaultViewingDirection( defaultViewingDirections_[i], i );
746 OpenFlipper::Options::defaultLockRotation( defaultRotationLocks_[i], i );
749 OpenFlipper::Options::defaultViewerLayout( viewerLayout->currentIndex() );
752 if(restrictFPS->isChecked()) {
762 for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets(); ++i )
764 ((
double) backgroundColor_.greenF()),
765 ((
double) backgroundColor_.blueF()),
768 switch ( translation->currentIndex() ){
776 int restart = QMessageBox::information(
this, tr(
"Restart required!"),
777 tr(
"The changes will take effect after next restart. Do you want to close OpenFlipper now?"),
778 QMessageBox::Yes | QMessageBox::No);
780 if(restart == QMessageBox::Yes) exitOnClose_ =
true;
792 if(exitOnClose_) QCoreApplication::quit();
808 downloadType = VERSIONS_FILE;
809 QString ServerMainURL = updateURL->text();
810 if ( !ServerMainURL.endsWith(
"/") )
811 ServerMainURL +=
"/";
813 ServerMainURL +=
"Versions.ini";
819 std::cerr <<
"Not implemented yet: Get updates" << std::endl;
820 QString url = updateURL->text();
822 if ( !url.endsWith(
"/") )
829 if ( OpenFlipper::Options::isWindows() ) {
831 }
else if ( OpenFlipper::Options::isLinux() ) {
834 std::cerr <<
"Unknown operating system type, aborting update" << std::endl;
838 if ( OpenFlipper::Options::is64bit() ) {
840 }
else if ( OpenFlipper::Options::is32bit() ) {
843 std::cerr <<
"Unknown architecture type, aborting update" << std::endl;
850 std::cerr <<
"Core update not supported!" << std::endl;
859 downloadType = PLUGIN;
866 void OptionsWidget::updateComponent() {
867 std::cerr <<
"Todo : Update component" << std::endl;
871 QString sourceName = QDir::home().absolutePath() + OpenFlipper::Options::dirSeparator() +
876 QFileInfo sourceFileInfo(sourceName);
877 QFileInfo targetFileInfo(targetName);
879 std::cerr << sourceName.toStdString() << std::endl;
880 std::cerr << targetName.toStdString() << std::endl;
882 if ( ! sourceFileInfo.exists() ) {
883 statusLabel->setText(tr(
"Download failed!"));
887 if ( ! targetFileInfo.exists() ) {
888 statusLabel->setText(tr(
"plugin target does not exist"));
893 statusLabel->setText(tr(
"Installing new file"));
896 QFile targetFile(targetName);
900 QFile::copy(sourceName,targetName);
903 QFile sourceFile(sourceName);
906 statusLabel->setText(tr(
"updated ") + currentUpdateName_);
914 QStringList latestVersionParts = _latest.split(
'.');
915 QStringList currentVersionParts = _current.split(
'.');
919 for (
int i = 0 ; i < latestVersionParts.size(); ++i ) {
921 if ( i+1 > currentVersionParts.size() ) {
928 double latest = latestVersionParts[i].toInt(&ok);
929 double current = currentVersionParts[i].toInt(&ok);
932 std::cerr <<
"Error when parsing version strings!" << std::endl;
934 if ( latest > current ) {
946 QString fileName = QDir::home().absolutePath() + OpenFlipper::Options::dirSeparator() +
947 ".OpenFlipper" + OpenFlipper::Options::dirSeparator() +
"Versions.ini" ;
950 if ( ! ini.
connect(fileName,
false) ) {
951 std::cerr <<
"Failed to connect to Versions ini file" << std::endl;
955 statusLabel->setText(tr(
"Checking for new versions"));
957 bool newerVersionsAvailable =
false;
959 QString systemString =
"";
960 if ( OpenFlipper::Options::isWindows() ) {
961 systemString =
"VersionWindows";
962 }
else if (OpenFlipper::Options::isLinux()) {
963 systemString =
"VersionLinux";
965 std::cerr <<
"Unsupported platform for update" << std::endl;
971 if ( ini.
get_entry(coreVersion,
"Core" , systemString )) {
972 if (
isNewer( OpenFlipper::Options::coreVersion(), coreVersion ) ) {
973 newerVersionsAvailable =
true;
977 for ( uint i = 0 ; i < plugins_.size(); ++i ) {
978 QString latestVersion;
979 if ( ini.
get_entry(latestVersion, plugins_[i].name , systemString )) {
980 if (
isNewer( plugins_[i].version, latestVersion ) )
981 newerVersionsAvailable =
true;
985 if ( newerVersionsAvailable ) {
986 statusLabel->setText(tr(
"Updates found"));
988 statusLabel->setText(tr(
"No updates found"));
998 if (stereoCustomAnaglyph->isChecked ())
999 OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphCustom);
1000 else if (stereoAnaglyph->isChecked ())
1001 OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphRedCyan);
1003 OpenFlipper::Options::stereoMode(OpenFlipper::Options::OpenGL);
1010 emit applyOptions();
1020 QMessageBox::information(
this, tr(
"Restart required!"),
1021 tr(
"The changes will take effect after next restart."));
1023 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.