-moved the style option to general->appearance
authorAlexander von Renteln <phon@quassel-irc.org>
Mon, 31 Mar 2008 18:22:59 +0000 (18:22 +0000)
committerAlexander von Renteln <phon@quassel-irc.org>
Mon, 31 Mar 2008 18:22:59 +0000 (18:22 +0000)
-added template settingspage in dev-notes

dev-notes/blanksettingspage.cpp [new file with mode: 0644]
dev-notes/blanksettingspage.h [new file with mode: 0644]
src/qtui/mainwin.cpp
src/qtui/settingspages/appearancesettingspage.cpp [new file with mode: 0644]
src/qtui/settingspages/appearancesettingspage.h [new file with mode: 0644]
src/qtui/settingspages/appearancesettingspage.ui [new file with mode: 0644]
src/qtui/settingspages/generalsettingspage.cpp
src/qtui/settingspages/generalsettingspage.h
src/qtui/settingspages/generalsettingspage.ui
src/qtui/settingspages/settingspages.pri
version.inc

diff --git a/dev-notes/blanksettingspage.cpp b/dev-notes/blanksettingspage.cpp
new file mode 100644 (file)
index 0000000..55a6333
--- /dev/null
@@ -0,0 +1,74 @@
+/***************************************************************************
+ *   Copyright (C) 2005-08 by the Quassel IRC Team                         *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU Blank Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU Blank Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU Blank Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#include "blanksettingspage.h"
+
+#include "qtui.h"
+#include "uisettings.h"
+
+
+BlankSettingsPage::BlankSettingsPage(QWidget *parent)
+  : SettingsPage(tr("Behaviour"), tr("Blank"), parent) {
+  ui.setupUi(this);
+
+  connect(ui.exampleCheckbox, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
+}
+
+bool BlankSettingsPage::hasDefaults() const {
+  return true;
+}
+
+void BlankSettingsPage::defaults() {
+  ui.exampleCheckbox->setChecked(true);
+
+  widgetHasChanged();
+}
+
+void BlankSettingsPage::load() {
+  UiSettings uiSettings;
+
+  settings["exampleCheckbox"] = uiSettings.value("exampleCheckbox", QVariant(false));
+  ui.exampleCheckbox->setChecked(settings["exampleCheckbox"].toBool());
+
+  setChangedState(false);
+}
+
+void BlankSettingsPage::save() {
+  UiSettings uiSettings;
+  uiSettings.setValue("exampleCheckbox", ui.exampleCheckbox->isChecked());
+
+  load();
+  setChangedState(false);
+}
+
+void BlankSettingsPage::widgetHasChanged() {
+  bool changed = testHasChanged();
+  if(changed != hasChanged()) setChangedState(changed);
+}
+
+bool BlankSettingsPage::testHasChanged() {
+  if(settings["exampleCheckbox"].toBool() != ui.exampleCheckbox->isChecked()) return true;
+
+  return false;
+}
+
+
+
+
diff --git a/dev-notes/blanksettingspage.h b/dev-notes/blanksettingspage.h
new file mode 100644 (file)
index 0000000..8cc0a76
--- /dev/null
@@ -0,0 +1,52 @@
+/***************************************************************************
+ *   Copyright (C) 2005-08 by the Quassel IRC Team                         *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU Blank Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU Blank Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU Blank Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef _BLANKSETTINGSPAGE_H_
+#define _BLANKSETTINGSPAGE_H_
+
+#include <QHash>
+
+#include "settingspage.h"
+#include "ui_blanksettingspage.h"
+
+class BlankSettingsPage : public SettingsPage {
+  Q_OBJECT
+
+  public:
+    BlankSettingsPage(QWidget *parent = 0);
+
+    bool hasDefaults() const;
+
+  public slots:
+    void save();
+    void load();
+    void defaults();
+
+  private slots:
+    void widgetHasChanged();
+
+  private:
+    Ui::BlankSettingsPage ui;
+    QHash<QString, QVariant> settings;
+
+    bool testHasChanged();
+};
+
+#endif
index fcbd228..4f308a1 100644 (file)
@@ -45,6 +45,7 @@
 #include "selectionmodelsynchronizer.h"
 #include "mappedselectionmodel.h"
 
 #include "selectionmodelsynchronizer.h"
 #include "mappedselectionmodel.h"
 
+#include "settingspages/appearancesettingspage.h"
 #include "settingspages/bufferviewsettingspage.h"
 #include "settingspages/colorsettingspage.h"
 #include "settingspages/fontssettingspage.h"
 #include "settingspages/bufferviewsettingspage.h"
 #include "settingspages/colorsettingspage.h"
 #include "settingspages/fontssettingspage.h"
@@ -75,7 +76,7 @@ MainWin::MainWin(QtUi *_gui, QWidget *parent)
   statusBar()->showMessage(tr("Waiting for core..."));
 
   installEventFilter(new JumpKeyHandler(this));
   statusBar()->showMessage(tr("Waiting for core..."));
 
   installEventFilter(new JumpKeyHandler(this));
-  
+
   UiSettings uiSettings;
   QString style = uiSettings.value("Style", QString("")).toString();
   if(style != "") {
   UiSettings uiSettings;
   QString style = uiSettings.value("Style", QString("")).toString();
   if(style != "") {
@@ -200,6 +201,7 @@ void MainWin::setupSettingsDlg() {
   //Category: Behaviour
   settingsDlg->registerSettingsPage(new GeneralSettingsPage(settingsDlg));
   //Category: General
   //Category: Behaviour
   settingsDlg->registerSettingsPage(new GeneralSettingsPage(settingsDlg));
   //Category: General
+  settingsDlg->registerSettingsPage(new AppearanceSettingsPage(settingsDlg));
   settingsDlg->registerSettingsPage(new IdentitiesSettingsPage(settingsDlg));
   settingsDlg->registerSettingsPage(new NetworksSettingsPage(settingsDlg));
   // settingsDlg->registerSettingsPage(new BufferViewSettingsPage(settingsDlg));
   settingsDlg->registerSettingsPage(new IdentitiesSettingsPage(settingsDlg));
   settingsDlg->registerSettingsPage(new NetworksSettingsPage(settingsDlg));
   // settingsDlg->registerSettingsPage(new BufferViewSettingsPage(settingsDlg));
diff --git a/src/qtui/settingspages/appearancesettingspage.cpp b/src/qtui/settingspages/appearancesettingspage.cpp
new file mode 100644 (file)
index 0000000..a6745f6
--- /dev/null
@@ -0,0 +1,94 @@
+/***************************************************************************
+ *   Copyright (C) 2005-08 by the Quassel IRC Team                         *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU Appearance Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU Appearance Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU Appearance Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#include "appearancesettingspage.h"
+
+#include "qtui.h"
+#include "uisettings.h"
+
+#include <QStyleFactory>
+
+AppearanceSettingsPage::AppearanceSettingsPage(QWidget *parent)
+  : SettingsPage(tr("General"), tr("Appearance"), parent) {
+  ui.setupUi(this);
+  initStyleComboBox();
+
+  connect(ui.styleComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(widgetHasChanged())); 
+}
+
+void AppearanceSettingsPage::initStyleComboBox() {
+  QStringList styleList = QStyleFactory::keys();
+  ui.styleComboBox->addItem("<default>");
+  foreach(QString style, styleList) {
+    ui.styleComboBox->addItem(style);
+  }
+}
+
+bool AppearanceSettingsPage::hasDefaults() const {
+  return true;
+}
+
+void AppearanceSettingsPage::defaults() {
+  ui.styleComboBox->setCurrentIndex(0);
+
+  widgetHasChanged();
+}
+
+void AppearanceSettingsPage::load() {
+  UiSettings uiSettings;
+
+  settings["Style"] = uiSettings.value("Style", QString(""));
+  if(settings["Style"].toString() == "") {
+    ui.styleComboBox->setCurrentIndex(0);
+  } else {
+    ui.styleComboBox->setCurrentIndex(ui.styleComboBox->findText(settings["Style"].toString(), Qt::MatchExactly));
+    QApplication::setStyle(settings["Style"].toString());
+  }
+
+  setChangedState(false);
+}
+
+void AppearanceSettingsPage::save() {
+  UiSettings uiSettings;
+
+  if(ui.styleComboBox->currentIndex() < 1) {
+    uiSettings.setValue("Style", QString(""));
+  } else {
+    uiSettings.setValue("Style", ui.styleComboBox->currentText());
+  }
+
+  load();
+  setChangedState(false);
+}
+
+void AppearanceSettingsPage::widgetHasChanged() {
+  bool changed = testHasChanged();
+  if(changed != hasChanged()) setChangedState(changed);
+}
+
+bool AppearanceSettingsPage::testHasChanged() {
+  if(settings["Style"].toString() != ui.styleComboBox->currentText()) return true;
+
+  return false;
+}
+
+
+
+
diff --git a/src/qtui/settingspages/appearancesettingspage.h b/src/qtui/settingspages/appearancesettingspage.h
new file mode 100644 (file)
index 0000000..6a4071f
--- /dev/null
@@ -0,0 +1,53 @@
+/***************************************************************************
+ *   Copyright (C) 2005-08 by the Quassel IRC Team                         *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU Appearance Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU Appearance Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU Appearance Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef _APPEARANCESETTINGSPAGE_H_
+#define _APPEARANCESETTINGSPAGE_H_
+
+#include <QHash>
+
+#include "settingspage.h"
+#include "ui_appearancesettingspage.h"
+
+class AppearanceSettingsPage : public SettingsPage {
+  Q_OBJECT
+
+  public:
+    AppearanceSettingsPage(QWidget *parent = 0);
+
+    bool hasDefaults() const;
+
+  public slots:
+    void save();
+    void load();
+    void defaults();
+
+  private slots:
+    void widgetHasChanged();
+
+  private:
+    Ui::AppearanceSettingsPage ui;
+    QHash<QString, QVariant> settings;
+
+    bool testHasChanged();
+    void initStyleComboBox();
+};
+
+#endif
diff --git a/src/qtui/settingspages/appearancesettingspage.ui b/src/qtui/settingspages/appearancesettingspage.ui
new file mode 100644 (file)
index 0000000..3a9478f
--- /dev/null
@@ -0,0 +1,45 @@
+<ui version="4.0" >
+ <class>AppearanceSettingsPage</class>
+ <widget class="QWidget" name="AppearanceSettingsPage" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" >
+   <item>
+    <widget class="QGroupBox" name="groupBox" >
+     <property name="title" >
+      <string>Client style:</string>
+     </property>
+     <layout class="QVBoxLayout" >
+      <item>
+       <widget class="QComboBox" name="styleComboBox" />
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index a0c0228..5111b4e 100644 (file)
 #include "uisettings.h"
 #include "buffersettings.h"
 
 #include "uisettings.h"
 #include "buffersettings.h"
 
-#include <QStyleFactory>
-
 GeneralSettingsPage::GeneralSettingsPage(QWidget *parent)
   : SettingsPage(tr("Behaviour"), tr("General"), parent) {
   ui.setupUi(this);
 GeneralSettingsPage::GeneralSettingsPage(QWidget *parent)
   : SettingsPage(tr("Behaviour"), tr("General"), parent) {
   ui.setupUi(this);
-  initStyleComboBox();
 
 #ifdef Q_WS_MAC
   ui.useSystemTrayIcon->hide();
 
 #ifdef Q_WS_MAC
   ui.useSystemTrayIcon->hide();
@@ -55,16 +52,6 @@ GeneralSettingsPage::GeneralSettingsPage(QWidget *parent)
 
   connect(ui.displayTopicInTooltip, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
   connect(ui.mouseWheelChangesBuffers, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
 
   connect(ui.displayTopicInTooltip, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
   connect(ui.mouseWheelChangesBuffers, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
-
-  connect(ui.styleComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(widgetHasChanged())); 
-}
-
-void GeneralSettingsPage::initStyleComboBox() {
-  QStringList styleList = QStyleFactory::keys();
-  ui.styleComboBox->addItem("<default>");
-  foreach(QString style, styleList) {
-    ui.styleComboBox->addItem(style);
-  }
 }
 
 bool GeneralSettingsPage::hasDefaults() const {
 }
 
 bool GeneralSettingsPage::hasDefaults() const {
@@ -87,8 +74,6 @@ void GeneralSettingsPage::defaults() {
   ui.displayTopicInTooltip->setChecked(false);
   ui.mouseWheelChangesBuffers->setChecked(true);
 
   ui.displayTopicInTooltip->setChecked(false);
   ui.mouseWheelChangesBuffers->setChecked(true);
 
-  ui.styleComboBox->setCurrentIndex(0);
-
   widgetHasChanged();
 }
 
   widgetHasChanged();
 }
 
@@ -114,14 +99,6 @@ void GeneralSettingsPage::load() {
   settings["DisplayPopupMessages"] = uiSettings.value("DisplayPopupMessages", QVariant(true));
   ui.displayPopupMessages->setChecked(settings["DisplayPopupMessages"].toBool());
 
   settings["DisplayPopupMessages"] = uiSettings.value("DisplayPopupMessages", QVariant(true));
   ui.displayPopupMessages->setChecked(settings["DisplayPopupMessages"].toBool());
 
-  settings["Style"] = uiSettings.value("Style", QString(""));
-  if(settings["Style"].toString() == "") {
-    ui.styleComboBox->setCurrentIndex(0);
-  } else {
-    ui.styleComboBox->setCurrentIndex(ui.styleComboBox->findText(settings["Style"].toString(), Qt::MatchExactly));
-    QApplication::setStyle(settings["Style"].toString());
-  }
-
   // bufferSettings:
   BufferSettings bufferSettings;
   settings["UserMessagesInStatusBuffer"] = bufferSettings.value("UserMessagesInStatusBuffer", QVariant(true));
   // bufferSettings:
   BufferSettings bufferSettings;
   settings["UserMessagesInStatusBuffer"] = bufferSettings.value("UserMessagesInStatusBuffer", QVariant(true));
@@ -149,12 +126,6 @@ void GeneralSettingsPage::save() {
   uiSettings.setValue("AnimateTrayIcon", ui.animateTrayIcon->isChecked());
   uiSettings.setValue("DisplayPopupMessages", ui.displayPopupMessages->isChecked());
 
   uiSettings.setValue("AnimateTrayIcon", ui.animateTrayIcon->isChecked());
   uiSettings.setValue("DisplayPopupMessages", ui.displayPopupMessages->isChecked());
 
-  if(ui.styleComboBox->currentIndex() < 1) {
-    uiSettings.setValue("Style", QString(""));
-  } else {
-    uiSettings.setValue("Style", ui.styleComboBox->currentText());
-  }
-
   BufferSettings bufferSettings;
   bufferSettings.setValue("UserMessagesInStatusBuffer", ui.userMessagesInStatusBuffer->isChecked());
   bufferSettings.setValue("UserMessagesInQueryBuffer", ui.userMessagesInQueryBuffer->isChecked());
   BufferSettings bufferSettings;
   bufferSettings.setValue("UserMessagesInStatusBuffer", ui.userMessagesInStatusBuffer->isChecked());
   bufferSettings.setValue("UserMessagesInQueryBuffer", ui.userMessagesInQueryBuffer->isChecked());
@@ -186,8 +157,6 @@ bool GeneralSettingsPage::testHasChanged() {
   if(settings["DisplayTopicInTooltip"].toBool() != ui.displayTopicInTooltip->isChecked()) return true;
   if(settings["MouseWheelChangesBuffers"].toBool() != ui.mouseWheelChangesBuffers->isChecked()) return true;
 
   if(settings["DisplayTopicInTooltip"].toBool() != ui.displayTopicInTooltip->isChecked()) return true;
   if(settings["MouseWheelChangesBuffers"].toBool() != ui.mouseWheelChangesBuffers->isChecked()) return true;
 
-  if(settings["Style"].toString() != ui.styleComboBox->currentText()) return true;
-
   return false;
 }
 
   return false;
 }
 
index f7fc9e4..42216d8 100644 (file)
@@ -47,7 +47,6 @@ class GeneralSettingsPage : public SettingsPage {
     QHash<QString, QVariant> settings;
 
     bool testHasChanged();
     QHash<QString, QVariant> settings;
 
     bool testHasChanged();
-    void initStyleComboBox();
 };
 
 #endif
 };
 
 #endif
index e857440..4fce47f 100644 (file)
      </layout>
     </widget>
    </item>
      </layout>
     </widget>
    </item>
-   <item>
-    <widget class="QGroupBox" name="groupBox_4" >
-     <property name="title" >
-      <string>Client style:</string>
-     </property>
-     <layout class="QHBoxLayout" >
-      <item>
-       <widget class="QComboBox" name="styleComboBox" />
-      </item>
-     </layout>
-    </widget>
-   </item>
    <item>
     <spacer>
      <property name="orientation" >
    <item>
     <spacer>
      <property name="orientation" >
index 6d7d510..4013905 100644 (file)
@@ -1,6 +1,6 @@
 # Putting $FOO in SETTINGSPAGES automatically includes
 # $FOOsettingspage.cpp, $FOOsettingspage.h and $FOOsettingspage.ui
 # Putting $FOO in SETTINGSPAGES automatically includes
 # $FOOsettingspage.cpp, $FOOsettingspage.h and $FOOsettingspage.ui
-SETTINGSPAGES = color fonts general identities networks bufferview
+SETTINGSPAGES = appearance bufferview color fonts general identities networks  
 
 # Specify additional files (e.g. for subdialogs) here!
 SP_SRCS =
 
 # Specify additional files (e.g. for subdialogs) here!
 SP_SRCS =
index b1798ee..38887a2 100644 (file)
@@ -5,7 +5,7 @@
 
   quasselVersion = "0.2.0-alpha5-pre";
   quasselDate = "2008-03-31";
 
   quasselVersion = "0.2.0-alpha5-pre";
   quasselDate = "2008-03-31";
-  quasselBuild = 676;
+  quasselBuild = 677;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 642;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 642;