Commit some preliminary work on the settingspage stuff.
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 17 Dec 2007 00:58:58 +0000 (00:58 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 17 Dec 2007 00:58:58 +0000 (00:58 +0000)
Quassel.kdevelop.filelist
src/qtui/settingsdlg.cpp
src/qtui/settingsdlg.h
src/qtui/ui/settingsdlg.ui
src/uisupport/settingspage.cpp [new file with mode: 0644]
src/uisupport/settingspage.h [moved from src/qtui/settingspage.h with 83% similarity]
src/uisupport/uisupport.pri

index ab15a61..0bcef57 100644 (file)
@@ -186,6 +186,10 @@ src/qtui/ui/settingsdlg.ui
 src/qtui/ui/topicwidget.ui
 src/qtui/ui/usermgmtpage.ui
 src/uisupport
+src/uisupport/action.cpp
+src/uisupport/action.h
+src/uisupport/actioncollection.cpp
+src/uisupport/actioncollection.h
 src/uisupport/bufferview.cpp
 src/uisupport/bufferview.h
 src/uisupport/bufferviewfilter.cpp
@@ -194,6 +198,7 @@ src/uisupport/inputline.cpp
 src/uisupport/inputline.h
 src/uisupport/nickview.cpp
 src/uisupport/nickview.h
+src/uisupport/settingspage.cpp
 src/uisupport/tabcompleter.cpp
 src/uisupport/tabcompleter.h
 src/uisupport/uistyle.cpp
index bb6521c..422f64d 100644 (file)
@@ -31,11 +31,10 @@ SettingsDlg::SettingsDlg(QWidget *parent) : QDialog(parent) {
   connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
 }
 
-/*
+
 void SettingsDlg::registerSettingsPage(SettingsPage *sp) {
-  QWidget *w = sp->widget();
-  w->setParent(this);
-  ui.settingsStack->addWidget(w);
+  sp->setParent(this);
+  ui.settingsStack->addWidget(sp);
 
   QTreeWidgetItem *cat;
   QList<QTreeWidgetItem *> cats = ui.settingsTree->findItems(sp->category(), Qt::MatchExactly);
@@ -45,11 +44,11 @@ void SettingsDlg::registerSettingsPage(SettingsPage *sp) {
     cat->setFlags(Qt::ItemIsEnabled);
   } else cat = cats[0];
   QTreeWidgetItem *p = new QTreeWidgetItem(cat, QStringList(sp->title()));
-  pages[QString("%1$%2").arg(sp->category()).arg(sp->title())] = sp;
+  pages[QString("%1$%2").arg(sp->category()sp->title())] = sp;
 }
 
 void SettingsDlg::selectPage(const QString &cat, const QString &title) {
-  QWidget *w = pages[QString("%1$%2").arg(cat).arg(title)]->widget();
+  QWidget *w = pages[QString("%1$%2").arg(cat, title)];
   Q_ASSERT(w);
   ui.settingsStack->setCurrentWidget(w);
 }
@@ -88,4 +87,4 @@ void SettingsDlg::applyChanges() {
   //SettingsInterface *sp = qobject_cast<SettingsInterface *>(ui.settingsStack->currentWidget());
   //if(sp) sp->applyChanges();
 }
-*/
+
index 1bbc956..c4640bd 100644 (file)
@@ -32,7 +32,7 @@ class SettingsDlg : public QDialog {
     SettingsDlg(QWidget *parent = 0);
     void registerSettingsPage(SettingsPage *);
     void unregisterSettingsPage(SettingsPage *);
-/*
+
   public slots:
     void selectPage(const QString &category, const QString &title);
 
@@ -40,7 +40,7 @@ class SettingsDlg : public QDialog {
     void itemSelected();
     void buttonClicked(QAbstractButton *);
     void applyChanges();
-*/
+
   private:
     Ui::SettingsDlg ui;
 
index 8649999..683c82d 100644 (file)
@@ -20,7 +20,7 @@
      </property>
      <widget class="QTreeWidget" name="settingsTree" >
       <property name="sizePolicy" >
-       <sizepolicy vsizetype="Expanding" hsizetype="MinimumExpanding" >
+       <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
         <horstretch>0</horstretch>
         <verstretch>0</verstretch>
        </sizepolicy>
@@ -66,7 +66,7 @@
       <enum>Qt::Horizontal</enum>
      </property>
      <property name="standardButtons" >
-      <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+      <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
      </property>
     </widget>
    </item>
diff --git a/src/uisupport/settingspage.cpp b/src/uisupport/settingspage.cpp
new file mode 100644 (file)
index 0000000..0417751
--- /dev/null
@@ -0,0 +1,42 @@
+/***************************************************************************
+ *   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 "settingspage.h"
+
+SettingsPage::SettingsPage(const QString &category, const QString &title, QWidget *parent) : QWidget(parent),
+     _category(category), _title(title) {
+
+}
+
+QString SettingsPage::category() const {
+  return _category;
+}
+
+QString SettingsPage::title() const {
+  return _title;
+}
+
+void SettingsPage::changed() {
+  emit changed(true);
+}
+
+void SettingsPage::changeState(bool hasChanged) {
+  emit changed(hasChanged);
+}
similarity index 83%
rename from src/qtui/settingspage.h
rename to src/uisupport/settingspage.h
index 49c4c6b..91171df 100644 (file)
@@ -31,7 +31,7 @@ class SettingsPage : public QWidget {
     SettingsPage(const QString &category, const QString &name, QWidget *parent = 0);
     virtual ~SettingsPage() {};
     virtual QString category() const;
-    virtual QString name() const;
+    virtual QString title() const;
 
     virtual bool hasChanged() const = 0;
 
@@ -40,9 +40,19 @@ class SettingsPage : public QWidget {
     virtual void load() = 0;
     virtual void defaults() = 0;
 
+  protected slots:
+    //! Calling this slot is equivalent to emitting changed(true).
+    void changed();
+
+  protected:
+    //! This should be called whenever the widget state changes from unchanged to change or the other way round.
+    void changeState(bool hasChanged = true);
+
   signals:
-    void changed(bool hasChanged = true);
+    void changed(bool hasChanged);
 
+  private:
+    QString _category, _title;
 };
 
 #endif
index 0a8cb81..a67affb 100644 (file)
@@ -1,8 +1,8 @@
 DEPMOD = common client
 QT_MOD = core gui network
 
-SRCS += bufferview.cpp bufferviewfilter.cpp inputline.cpp nickview.cpp tabcompleter.cpp uisettings.cpp uistyle.cpp
-HDRS += bufferview.h bufferviewfilter.h inputline.h nickview.h tabcompleter.h uisettings.h uistyle.h
+SRCS += bufferview.cpp bufferviewfilter.cpp inputline.cpp nickview.cpp settingspage.cpp tabcompleter.cpp uisettings.cpp uistyle.cpp
+HDRS += bufferview.h bufferviewfilter.h inputline.h nickview.h settingspage.h tabcompleter.h uisettings.h uistyle.h
 
 FORMNAMES =