Skip to content
Permalink
Browse files
Merge pull request #59 from NathanW2/window_theme
[FEATURE] Allow the user to select the Qt windows style they want
  • Loading branch information
timlinux committed Nov 22, 2011
2 parents 1b3c383 + a0dad9c commit ae0771e15ca7e004719b29a073c43a284cbf3856
Showing with 94 additions and 49 deletions.
  1. +9 −5 src/app/main.cpp
  2. +11 −0 src/app/qgsoptions.cpp
  3. +74 −44 src/ui/qgsoptionsbase.ui
@@ -474,13 +474,17 @@ int main( int argc, char *argv[] )
}
#endif

#ifdef Q_WS_WIN
//for windows lets use plastique style!
QApplication::setStyle( new QPlastiqueStyle );
#endif

QSettings mySettings;

// Set the application style. If it's not set QT will use the platform style except on Windows
// as it looks really ugly so we use QPlastiqueStyle.
QString style = mySettings.value("/qgis/style").toString();
if ( !style.isNull() )
QApplication::setStyle( style );
#ifdef Q_WS_WIN
else
QApplication::setStyle( new QPlastiqueStyle );
#endif

/* Translation file for QGIS.
*/
@@ -30,6 +30,7 @@
#include <QLocale>
#include <QToolBar>
#include <QSize>
#include <QStyleFactory>

#if QT_VERSION >= 0x40500
#include <QNetworkDiskCache>
@@ -58,12 +59,19 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
connect( cmbSize, SIGNAL( activated( const QString& ) ), this, SLOT( iconSizeChanged( const QString& ) ) );
connect( cmbSize, SIGNAL( highlighted( const QString& ) ), this, SLOT( iconSizeChanged( const QString& ) ) );
connect( cmbSize, SIGNAL( textChanged( const QString& ) ), this, SLOT( iconSizeChanged( const QString& ) ) );

connect( this, SIGNAL( accepted() ), this, SLOT( saveOptions() ) );

cmbSize->addItem( "16" );
cmbSize->addItem( "24" );
cmbSize->addItem( "32" );

QStringList styles = QStyleFactory::keys();
foreach(QString style, styles )
{
cmbStyle->addItem( style );
}

cmbIdentifyMode->addItem( tr( "Current layer" ), 0 );
cmbIdentifyMode->addItem( tr( "Top down, stop at first" ), 1 );
cmbIdentifyMode->addItem( tr( "Top down" ), 2 );
@@ -270,6 +278,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
// set the theme combo
cmbTheme->setCurrentIndex( cmbTheme->findText( settings.value( "/Themes", "default" ).toString() ) );
cmbSize->setCurrentIndex( cmbSize->findText( settings.value( "/IconSize", 24 ).toString() ) );
QString name = QApplication::style()->objectName();
cmbStyle->setCurrentIndex( cmbStyle->findText( name, Qt::MatchFixedString ) );
//set the state of the checkboxes
//Changed to default to true as of QGIS 1.7
chkAntiAliasing->setChecked( settings.value( "/qgis/enable_anti_aliasing", true ).toBool() );
@@ -589,6 +599,7 @@ void QgsOptions::saveOptions()
settings.setValue( "/qgis/askToSaveProjectChanges", chbAskToSaveProjectChanges->isChecked() );
settings.setValue( "/qgis/warnOldProjectVersion", chbWarnOldProjectVersion->isChecked() );
settings.setValue( "/qgis/nullValue", leNullValue->text() );
settings.setValue( "/qgis/style", cmbStyle->currentText() );

//overlay placement method
int overlayIndex = mOverlayAlgorithmComboBox->currentIndex();
@@ -127,19 +127,6 @@
</property>
</widget>
</item>
<item row="1" column="2">
<spacer>
<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 row="1" column="3">
<widget class="QgsColorButton" name="pbnCanvasColor">
<property name="minimumSize">
@@ -153,7 +140,20 @@
</property>
</widget>
</item>
<item row="0" column="2">
<item row="0" column="4">
<spacer>
<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 row="1" column="4">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -176,22 +176,22 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="textLabel1_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QLabel" name="label_18">
<property name="text">
<string>Icon theme</string>
<string>Style &lt;i&gt;(QGIS restart required)&lt;/i&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<widget class="QComboBox" name="cmbStyle"/>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -203,6 +203,23 @@
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="textLabel1_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Icon theme</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cmbTheme">
<property name="duplicatesEnabled">
@@ -215,6 +232,19 @@
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@@ -232,6 +262,13 @@
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cmbSize">
<property name="duplicatesEnabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
@@ -245,13 +282,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="cmbSize">
<property name="duplicatesEnabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -263,19 +293,6 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<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="cmbLegendDoubleClickAction">
<item>
@@ -290,6 +307,19 @@
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>

0 comments on commit ae0771e

Please sign in to comment.