From 8f6801a8006bee9ac6340bccf3f55b8b587d2509 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Wed, 1 Dec 2010 12:24:34 +0200 Subject: [PATCH] Changed: #1206 Added settings qt style. --- .../3d/object_viewer_qt/src/main_window.h | 4 + .../object_viewer_qt/src/settings_dialog.cpp | 18 +++++ .../3d/object_viewer_qt/src/settings_form.ui | 74 ++++++++++++++++--- 3 files changed, 84 insertions(+), 12 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/main_window.h b/code/nel/tools/3d/object_viewer_qt/src/main_window.h index a97b10d75..a63a1bbad 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/main_window.h @@ -68,6 +68,10 @@ public: { return _SkeletonTreeModel; } + QPalette getOriginalPalette() const + { + return _originalPalette; + } private Q_SLOTS: void open(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/settings_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/settings_dialog.cpp index 5c57936ac..77b7ea672 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/settings_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/settings_dialog.cpp @@ -24,6 +24,8 @@ #include #include #include +#include +#include // NeL includes #include @@ -278,6 +280,12 @@ void CSettingsDialog::loadGraphicsSettings() ui.enableBloomCheckBox->setChecked(Modules::objView().getBloomEffect()); ui.squareBloomCheckBox->setChecked(NL3D::CBloomEffect::instance().getSquareBloom()); ui.bloomDensityHorizontalSlider->setValue(NL3D::CBloomEffect::instance().getDensityBloom()); + + ui.styleComboBox->addItems(QStyleFactory::keys()); + + ui.styleComboBox->setCurrentIndex(ui.styleComboBox->findText(Modules::config().getValue("QtStyle", std::string("")).c_str())); + + ui.paletteCheckBox->setChecked(Modules::config().getValue("QtPalette", false)); } void CSettingsDialog::loadSoundSettings() @@ -326,6 +334,16 @@ void CSettingsDialog::saveGraphicsSettings() Modules::config().getConfigFile().getVar("BloomEffect").setAsInt(ui.enableBloomCheckBox->isChecked()); Modules::config().getConfigFile().getVar("BloomSquare").setAsInt(ui.squareBloomCheckBox->isChecked()); Modules::config().getConfigFile().getVar("BloomDensity").setAsInt(ui.bloomDensityHorizontalSlider->value()); + + Modules::config().getConfigFile().getVar("QtStyle").setAsString(ui.styleComboBox->currentText().toStdString()); + Modules::config().getConfigFile().getVar("QtPalette").setAsInt(ui.paletteCheckBox->isChecked()); + + QApplication::setStyle(QStyleFactory::create(ui.styleComboBox->currentText())); + + if (ui.paletteCheckBox->isChecked()) + QApplication::setPalette(QApplication::style()->standardPalette()); + else + QApplication::setPalette(Modules::mainWin().getOriginalPalette()); } void CSettingsDialog::saveSoundSettings() diff --git a/code/nel/tools/3d/object_viewer_qt/src/settings_form.ui b/code/nel/tools/3d/object_viewer_qt/src/settings_form.ui index b836a7301..03df2ecd5 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/settings_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/settings_form.ui @@ -24,7 +24,7 @@ true - + @@ -60,17 +60,7 @@ - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - + @@ -177,6 +167,49 @@ + + + Qt Style + + + + + + + + Style + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Use style's standard palette + + + + + + + Qt::Vertical @@ -581,6 +614,23 @@ + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + +