Changed: #1206 Added settings qt style.

This commit is contained in:
dnk-88 2010-12-01 12:24:34 +02:00
parent 1ea4ee67ee
commit e59ad4d6c1
3 changed files with 84 additions and 12 deletions

View file

@ -68,6 +68,10 @@ public:
{
return _SkeletonTreeModel;
}
QPalette getOriginalPalette() const
{
return _originalPalette;
}
private Q_SLOTS:
void open();

View file

@ -24,6 +24,8 @@
#include <QtGui/QWidget>
#include <QtGui/QMessageBox>
#include <QtGui/QFileDialog>
#include <QtGui/QStyleFactory>
#include <QtGui/QStyle>
// NeL includes
#include <nel/misc/path.h>
@ -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()

View file

@ -24,7 +24,7 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<item row="0" column="0" rowspan="2">
<widget class="QListWidget" name="listWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -60,17 +60,7 @@
</item>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="2">
<item row="0" column="1">
<widget class="QStackedWidget" name="stackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
@ -177,6 +167,49 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="qtStyleGroupBox">
<property name="title">
<string>Qt Style</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Style</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="styleComboBox"/>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="paletteCheckBox">
<property name="text">
<string>Use style's standard palette</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -581,6 +614,23 @@
</widget>
</widget>
</item>
<item row="1" column="1">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>