making the requester type configurable
authorMarcus Eggenberger <egs@quassel-irc.org>
Sat, 29 Nov 2008 15:26:13 +0000 (16:26 +0100)
committerMarcus Eggenberger <egs@quassel-irc.org>
Sat, 29 Nov 2008 15:42:39 +0000 (16:42 +0100)
src/client/backlogrequester.h
src/client/backlogsettings.h
src/client/clientbacklogmanager.cpp
src/qtui/mainwin.cpp
src/qtui/settingspages/backlogsettingspage.cpp [new file with mode: 0644]
src/qtui/settingspages/backlogsettingspage.h [new file with mode: 0644]
src/qtui/settingspages/backlogsettingspage.ui [new file with mode: 0644]
src/qtui/settingspages/settingspages.inc
src/uisupport/settingspage.cpp
src/uisupport/settingspage.h

index 4ddc962..95745ab 100644 (file)
@@ -34,9 +34,9 @@ class BacklogRequester {
 public:
   enum RequesterTypes {
     InvalidRequester = 0,
 public:
   enum RequesterTypes {
     InvalidRequester = 0,
-    GlobalUnread,
+    PerBufferFixed,
     PerBufferUnread,
     PerBufferUnread,
-    PerBufferFixed
+    GlobalUnread
   };
 
   BacklogRequester(bool buffering, ClientBacklogManager *backlogManger);
   };
 
   BacklogRequester(bool buffering, ClientBacklogManager *backlogManger);
index f5a0f51..1dcdb59 100644 (file)
@@ -26,7 +26,7 @@
 class BacklogSettings : public ClientSettings {
 public:
   BacklogSettings() : ClientSettings("Backlog") {}
 class BacklogSettings : public ClientSettings {
 public:
   BacklogSettings() : ClientSettings("Backlog") {}
-  inline int requesterType() { return localValue("RequesterType", 0).toInt(); }
+  inline int requesterType() { return localValue("RequesterType", 1).toInt(); }
   inline void setRequesterType(int requesterType) { setLocalValue("RequesterType", requesterType); }
 
   inline int dynamicBacklogAmount() { return localValue("DynamicBacklogAmount", 200).toInt(); }
   inline void setRequesterType(int requesterType) { setLocalValue("RequesterType", requesterType); }
 
   inline int dynamicBacklogAmount() { return localValue("DynamicBacklogAmount", 200).toInt(); }
index 1ffc18a..b698f4f 100644 (file)
@@ -85,8 +85,10 @@ void ClientBacklogManager::requestInitialBacklog() {
   switch(settings.requesterType()) {
   case BacklogRequester::GlobalUnread:
     _requester = new GlobalUnreadBacklogRequester(this);
   switch(settings.requesterType()) {
   case BacklogRequester::GlobalUnread:
     _requester = new GlobalUnreadBacklogRequester(this);
+    break;
   case BacklogRequester::PerBufferUnread:
     _requester = new PerBufferUnreadBacklogRequester(this);
   case BacklogRequester::PerBufferUnread:
     _requester = new PerBufferUnreadBacklogRequester(this);
+    break;
   case BacklogRequester::PerBufferFixed:
   default:
     _requester = new FixedBacklogRequester(this);
   case BacklogRequester::PerBufferFixed:
   default:
     _requester = new FixedBacklogRequester(this);
index 24b89dc..0468152 100644 (file)
@@ -61,6 +61,7 @@
 
 #include "settingspages/aliasessettingspage.h"
 #include "settingspages/appearancesettingspage.h"
 
 #include "settingspages/aliasessettingspage.h"
 #include "settingspages/appearancesettingspage.h"
+#include "settingspages/backlogsettingspage.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"
@@ -584,6 +585,7 @@ void MainWin::showSettingsDlg() {
   dlg->registerSettingsPage(new AppearanceSettingsPage(dlg)); //General
   //Category: Behaviour
   dlg->registerSettingsPage(new GeneralSettingsPage(dlg));
   dlg->registerSettingsPage(new AppearanceSettingsPage(dlg)); //General
   //Category: Behaviour
   dlg->registerSettingsPage(new GeneralSettingsPage(dlg));
+  dlg->registerSettingsPage(new BacklogSettingsPage(dlg));
   dlg->registerSettingsPage(new HighlightSettingsPage(dlg));
   dlg->registerSettingsPage(new AliasesSettingsPage(dlg));
   dlg->registerSettingsPage(new NotificationsSettingsPage(dlg));
   dlg->registerSettingsPage(new HighlightSettingsPage(dlg));
   dlg->registerSettingsPage(new AliasesSettingsPage(dlg));
   dlg->registerSettingsPage(new NotificationsSettingsPage(dlg));
diff --git a/src/qtui/settingspages/backlogsettingspage.cpp b/src/qtui/settingspages/backlogsettingspage.cpp
new file mode 100644 (file)
index 0000000..81ef609
--- /dev/null
@@ -0,0 +1,91 @@
+/***************************************************************************
+ *   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 General 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 General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General 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 "backlogsettingspage.h"
+
+#include "qtui.h"
+#include "backlogsettings.h"
+
+BacklogSettingsPage::BacklogSettingsPage(QWidget *parent)
+  : SettingsPage(tr("Behaviour"), tr("Backlog"), parent)
+{
+  ui.setupUi(this);
+  connect(ui.requesterType, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged()));
+
+  connect(ui.fixedBacklogAmount, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+  connect(ui.globalUnreadLimit, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+  connect(ui.globalUnreadAdditional, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+  connect(ui.perBufferUnreadLimit, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+  connect(ui.perBufferUnreadAdditional, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+
+  connect(ui.dynamicBacklogAmount, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged()));
+}
+
+bool BacklogSettingsPage::hasDefaults() const {
+  return true;
+}
+
+void BacklogSettingsPage::defaults() {
+  //  ui.completionSuffix->setText(": ");
+
+  widgetHasChanged();
+}
+
+void BacklogSettingsPage::load() {
+  BacklogSettings backlogSettings;
+  SettingsPage::load(ui.requesterType, backlogSettings.requesterType() - 1);
+  
+  SettingsPage::load(ui.fixedBacklogAmount, backlogSettings.fixedBacklogAmount());
+  SettingsPage::load(ui.globalUnreadLimit, backlogSettings.globalUnreadBacklogLimit());
+  SettingsPage::load(ui.globalUnreadAdditional, backlogSettings.globalUnreadBacklogAdditional());
+  SettingsPage::load(ui.perBufferUnreadLimit, backlogSettings.perBufferUnreadBacklogLimit());
+  SettingsPage::load(ui.perBufferUnreadAdditional, backlogSettings.perBufferUnreadBacklogAdditional());
+  
+  SettingsPage::load(ui.dynamicBacklogAmount, backlogSettings.dynamicBacklogAmount());
+
+  setChangedState(false);
+}
+
+void BacklogSettingsPage::save() {
+  BacklogSettings backlogSettings;
+  backlogSettings.setRequesterType(ui.requesterType->currentIndex() + 1);
+  backlogSettings.setFixedBacklogAmount(ui.fixedBacklogAmount->value());
+  backlogSettings.setGlobalUnreadBacklogLimit(ui.globalUnreadLimit->value());
+  backlogSettings.setGlobalUnreadBacklogAdditional(ui.globalUnreadAdditional->value());
+  backlogSettings.setPerBufferUnreadBacklogLimit(ui.perBufferUnreadLimit->value());
+  backlogSettings.setPerBufferUnreadBacklogAdditional(ui.perBufferUnreadAdditional->value());
+  
+  backlogSettings.setDynamicBacklogAmount(ui.dynamicBacklogAmount->value());
+
+  load();
+  setChangedState(false);
+}
+
+void BacklogSettingsPage::widgetHasChanged() {
+  bool changed = testHasChanged();
+  if(changed != hasChanged()) setChangedState(changed);
+}
+
+bool BacklogSettingsPage::testHasChanged() {
+  if(SettingsPage::hasChanged(ui.fixedBacklogAmount)) return true;
+  if(SettingsPage::hasChanged(ui.dynamicBacklogAmount)) return true;
+
+  return false;
+}
diff --git a/src/qtui/settingspages/backlogsettingspage.h b/src/qtui/settingspages/backlogsettingspage.h
new file mode 100644 (file)
index 0000000..65f1bd6
--- /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 General 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 General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General 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 BACKLOGSETTINGSPAGE_H
+#define BACKLOGSETTINGSPAGE_H
+
+#include <QHash>
+
+#include "settingspage.h"
+#include "ui_backlogsettingspage.h"
+
+class BacklogSettingsPage : public SettingsPage {
+  Q_OBJECT
+
+public:
+  BacklogSettingsPage(QWidget *parent = 0);
+
+  bool hasDefaults() const;
+
+public slots:
+  void save();
+  void load();
+  void defaults();
+
+private slots:
+  void widgetHasChanged();
+
+private:
+  Ui::BacklogSettingsPage ui;
+  QHash<QString, QVariant> settings;
+
+  bool testHasChanged();
+};
+
+#endif
diff --git a/src/qtui/settingspages/backlogsettingspage.ui b/src/qtui/settingspages/backlogsettingspage.ui
new file mode 100644 (file)
index 0000000..e86d44a
--- /dev/null
@@ -0,0 +1,408 @@
+<ui version="4.0" >
+ <class>BacklogSettingsPage</class>
+ <widget class="QWidget" name="BacklogSettingsPage" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>505</width>
+    <height>362</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout" >
+   <item>
+    <widget class="QComboBox" name="requesterType" >
+     <item>
+      <property name="text" >
+       <string>Fixed Amount per Buffer</string>
+      </property>
+     </item>
+     <item>
+      <property name="text" >
+       <string>Unread Messages per Buffer</string>
+      </property>
+     </item>
+     <item>
+      <property name="text" >
+       <string>Global Unread Messages</string>
+      </property>
+     </item>
+    </widget>
+   </item>
+   <item>
+    <widget class="QStackedWidget" name="stackedWidget" >
+     <property name="currentIndex" >
+      <number>1</number>
+     </property>
+     <widget class="QWidget" name="page" >
+      <property name="geometry" >
+       <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>481</width>
+        <height>259</height>
+       </rect>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_2" >
+       <item>
+        <widget class="QLabel" name="label_9" >
+         <property name="text" >
+          <string>The simplest Requester. It fetches a fixed amount of lines for each buffer from the Backlog.</string>
+         </property>
+         <property name="textFormat" >
+          <enum>Qt::PlainText</enum>
+         </property>
+         <property name="wordWrap" >
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2" >
+         <item>
+          <widget class="QLabel" name="label" >
+           <property name="toolTip" >
+            <string>amount of messages per buffer that are requested after the core connection has been established.</string>
+           </property>
+           <property name="text" >
+            <string>Initial backlog amount:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QSpinBox" name="fixedBacklogAmount" >
+           <property name="maximum" >
+            <number>1000</number>
+           </property>
+           <property name="singleStep" >
+            <number>10</number>
+           </property>
+           <property name="value" >
+            <number>500</number>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_2" >
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0" >
+            <size>
+             <width>263</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <spacer name="verticalSpacer_4" >
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0" >
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="page_2" >
+      <property name="geometry" >
+       <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>481</width>
+        <height>259</height>
+       </rect>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_3" >
+       <item>
+        <widget class="QLabel" name="label_10" >
+         <property name="text" >
+          <string>This requester fetches unread messages for each buffer individually. The amount of lines can be limited per buffer.
+
+You can also chose to fetch additional older chatlines to provide a better context.</string>
+         </property>
+         <property name="textFormat" >
+          <enum>Qt::PlainText</enum>
+         </property>
+         <property name="wordWrap" >
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_3" >
+         <item>
+          <widget class="QLabel" name="label_11" >
+           <property name="toolTip" >
+            <string>Maximum amount of messages to be fetched per buffer.</string>
+           </property>
+           <property name="text" >
+            <string>Limit:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QSpinBox" name="perBufferUnreadLimit" >
+           <property name="toolTip" >
+            <string>Maximum amount of messages to be fetched per buffer.</string>
+           </property>
+           <property name="maximum" >
+            <number>1000</number>
+           </property>
+           <property name="singleStep" >
+            <number>10</number>
+           </property>
+           <property name="value" >
+            <number>200</number>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_12" >
+           <property name="toolTip" >
+            <string>Amount of messages to be fetched in addition to the unread messages. The Limit does not apply here.</string>
+           </property>
+           <property name="text" >
+            <string>Additional Messages:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QSpinBox" name="perBufferUnreadAdditional" >
+           <property name="toolTip" >
+            <string>Amount of messages to be fetched in addition to the unread messages. The Limit does not apply here.</string>
+           </property>
+           <property name="maximum" >
+            <number>1000</number>
+           </property>
+           <property name="singleStep" >
+            <number>10</number>
+           </property>
+           <property name="value" >
+            <number>50</number>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_3" >
+           <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>
+        <spacer name="verticalSpacer_3" >
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0" >
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="Seite" >
+      <layout class="QVBoxLayout" name="verticalLayout_4" >
+       <item>
+        <widget class="QLabel" name="label_15" >
+         <property name="text" >
+          <string>This requester fetches all messages newer than the oldest unread message for all buffers. 
+This requester determines which is the oldest read message of all buffers and then requests one large chunk of messages across all buffers.
+
+Note: this requester is not recommended if you use hidden buffer or have inactive buffers (i.e.: no stale queries or channels).
+It is useful to limit the total amount of the backlog and is probably the fastest.
+
+You can also chose to fetch additional older chatlines to provide a better context similar.</string>
+         </property>
+         <property name="textFormat" >
+          <enum>Qt::PlainText</enum>
+         </property>
+         <property name="wordWrap" >
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_4" >
+         <item>
+          <widget class="QLabel" name="label_13" >
+           <property name="toolTip" >
+            <string>Maximum amount of messages to be fetched over all buffers.</string>
+           </property>
+           <property name="text" >
+            <string>Limit:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QSpinBox" name="globalUnreadLimit" >
+           <property name="toolTip" >
+            <string>Maximum amount of messages to be fetched per buffer.</string>
+           </property>
+           <property name="maximum" >
+            <number>1000</number>
+           </property>
+           <property name="singleStep" >
+            <number>10</number>
+           </property>
+           <property name="value" >
+            <number>200</number>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_14" >
+           <property name="toolTip" >
+            <string>Amount of messages to be fetched in addition to the unread messages. The Limit does not apply here.</string>
+           </property>
+           <property name="text" >
+            <string>Additional Messages:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QSpinBox" name="globalUnreadAdditional" >
+           <property name="toolTip" >
+            <string>Amount of messages to be fetched in addition to the unread messages. The Limit does not apply here.</string>
+           </property>
+           <property name="maximum" >
+            <number>1000</number>
+           </property>
+           <property name="singleStep" >
+            <number>10</number>
+           </property>
+           <property name="value" >
+            <number>50</number>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_3" >
+           <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>
+        <spacer name="verticalSpacer" >
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0" >
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout" >
+     <item>
+      <widget class="QLabel" name="label_2" >
+       <property name="toolTip" >
+        <string>Number of messages to be requested from the core when using scrolling up in the buffer view.</string>
+       </property>
+       <property name="text" >
+        <string>Dynamic backlog amount:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QSpinBox" name="dynamicBacklogAmount" >
+       <property name="maximum" >
+        <number>1000</number>
+       </property>
+       <property name="singleStep" >
+        <number>10</number>
+       </property>
+       <property name="value" >
+        <number>200</number>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer" >
+       <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>
+    <spacer name="verticalSpacer_2" >
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0" >
+      <size>
+       <width>20</width>
+       <height>18</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>requesterType</sender>
+   <signal>currentIndexChanged(int)</signal>
+   <receiver>stackedWidget</receiver>
+   <slot>setCurrentIndex(int)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>146</x>
+     <y>27</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>147</x>
+     <y>142</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
index 7dc6e1a..c1014d0 100644 (file)
@@ -1,7 +1,7 @@
 # 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
 
-set(SETTINGSPAGES aliases appearance bufferview color fonts general highlight identities networks)
+set(SETTINGSPAGES aliases appearance backlog bufferview color fonts general highlight identities networks)
 
 # Specify additional files (e.g. for subdialogs) here!
 set(SP_SOURCES aliasesmodel.cpp notificationssettingspage.cpp)
 
 # Specify additional files (e.g. for subdialogs) here!
 set(SP_SOURCES aliasesmodel.cpp notificationssettingspage.cpp)
index c815d98..9ee7f00 100644 (file)
@@ -21,6 +21,8 @@
 #include "settingspage.h"
 
 #include <QCheckBox>
 #include "settingspage.h"
 
 #include <QCheckBox>
+#include <QComboBox>
+#include <QSpinBox>
 #include <QVariant>
 
 SettingsPage::SettingsPage(const QString &category, const QString &title, QWidget *parent)
 #include <QVariant>
 
 SettingsPage::SettingsPage(const QString &category, const QString &title, QWidget *parent)
@@ -46,3 +48,22 @@ void SettingsPage::load(QCheckBox *box, bool checked) {
 bool SettingsPage::hasChanged(QCheckBox *box) {
   return box->property("StoredValue").toBool() == box->isChecked();
 }
 bool SettingsPage::hasChanged(QCheckBox *box) {
   return box->property("StoredValue").toBool() == box->isChecked();
 }
+
+
+void SettingsPage::load(QComboBox *box, int index) {
+  box->setProperty("StoredValue", index);
+  box->setCurrentIndex(index);
+}
+
+bool SettingsPage::hasChanged(QComboBox *box) {
+  return box->property("StoredValue").toInt() == box->currentIndex();
+}
+
+void SettingsPage::load(QSpinBox *box, int value) {
+  box->setProperty("StoredValue", value);
+  box->setValue(value);
+}
+
+bool SettingsPage::hasChanged(QSpinBox *box) {
+  return box->property("StoredValue").toInt() == box->value();
+}
index 2c5ffb4..7a5bcc6 100644 (file)
@@ -24,6 +24,8 @@
 #include <QWidget>
 
 class QCheckBox;
 #include <QWidget>
 
 class QCheckBox;
+class QComboBox;
+class QSpinBox;
 
 //! A SettingsPage is a page in the settings dialog.
 /** The SettingsDlg provides suitable standard buttons, such as Ok, Apply, Cancel, Restore Defaults and Reset.
 
 //! A SettingsPage is a page in the settings dialog.
 /** The SettingsDlg provides suitable standard buttons, such as Ok, Apply, Cancel, Restore Defaults and Reset.
@@ -63,6 +65,10 @@ public:
   //! sets checked state depending on \checked and stores the value for later comparision
   static void load(QCheckBox *box, bool checked);
   static bool hasChanged(QCheckBox *box);
   //! sets checked state depending on \checked and stores the value for later comparision
   static void load(QCheckBox *box, bool checked);
   static bool hasChanged(QCheckBox *box);
+  static void load(QComboBox *box, int index);
+  static bool hasChanged(QComboBox *box);
+  static void load(QSpinBox *box, int value);
+  static bool hasChanged(QSpinBox *box);
 
 public slots:
   //! Save settings to permanent storage.
 
 public slots:
   //! Save settings to permanent storage.