and switch to SettingsPage instead, which will offer support for change notification and stuff.
Work is only partly done right now, nothing really works, so the SettingsDlg is disabled for now.
Checking in now primarily because I will tackle QxtRPCPeer now with higher priority.
src/qtgui/tabcompleter.h
src/qtgui/ui
src/qtgui/ui/aboutdlg.ui
-src/qtgui/ui/buffermgmntsettingspage.ui
src/qtgui/ui/bufferviewwidget.ui
src/qtgui/ui/bufferwidget.ui
src/qtgui/ui/channelwidget.ui
-src/qtgui/ui/connectionsettingspage.ui
src/qtgui/ui/coreconnectdlg.ui
src/qtgui/ui/coresettingspage.ui
src/qtgui/ui/identitiesdlg.ui
src/qtgui/guisettings.cpp
src/common/ircuser.h
src/common/ircuser.cpp
+src/qtgui/settingspage.h
* the application's settings dialog.
* This is also used by built-in settings dialogs.
*/
+/*
class SettingsInterface {
public:
virtual ~SettingsInterface() {};
Q_DECLARE_INTERFACE(SettingsInterface,
"eu.quassel.plugins.SettingsInterface/1.0");
+*/
/** Plugins implementing this interface will be provided with the raw text the users enters.
* The output they generate is in turn treated like generic user input. Note that the order in
SET(qtgui_SRCS bufferview.cpp bufferviewfilter.cpp bufferwidget.cpp channelwidgetinput.cpp chatline.cpp chatwidget.cpp coreconnectdlg.cpp
- guisettings.cpp identities.cpp mainwin.cpp qtgui.cpp serverlist.cpp settingsdlg.cpp settingspages.cpp style.cpp tabcompleter.cpp)
-SET(qtgui_HDRS style.h)
+ guisettings.cpp identities.cpp mainwin.cpp qtgui.cpp serverlist.cpp settingsdlg.cpp style.cpp tabcompleter.cpp)
+SET(qtgui_HDRS style.h settingspage.h)
SET(qtgui_MOCS bufferview.h bufferviewfilter.h bufferwidget.h channelwidgetinput.h chatline.h chatwidget.h coreconnectdlg.h
- guisettings.h identities.h mainwin.h qtgui.h serverlist.h settingsdlg.h settingspages.h tabcompleter.h)
+ guisettings.h identities.h mainwin.h qtgui.h serverlist.h settingsdlg.h tabcompleter.h)
SET(qtgui_UICS identitiesdlg.ui identitieseditdlg.ui networkeditdlg.ui mainwin.ui
nickeditdlg.ui serverlistdlg.ui servereditdlg.ui coreconnectdlg.ui
bufferviewwidget.ui bufferwidget.ui settingsdlg.ui
- buffermgmntsettingspage.ui connectionsettingspage.ui)
+ buffermgmtpage.ui connectionpage.ui usermgmtpage.ui)
# This prepends ui/ to the UIC names, so we don't have to do this ourselves.
FOREACH(ui ${qtgui_UICS})
#include "coreconnectdlg.h"
#include "serverlist.h"
#include "settingsdlg.h"
-#include "settingspages.h"
+//#include "settingspage.h"
MainWin::MainWin(QtGui *_gui, QWidget *parent) : QMainWindow(parent), gui(_gui) {
ui.setupUi(this);
serverListDlg = new ServerListDlg(this);
serverListDlg->setVisible(serverListDlg->showOnStartup());
- setupSettingsDlg();
+ //setupSettingsDlg();
setupMenus();
setupViews();
connect(ui.actionNetworkList, SIGNAL(triggered()), this, SLOT(showServerList()));
connect(ui.actionEditIdentities, SIGNAL(triggered()), serverListDlg, SLOT(editIdentities()));
connect(ui.actionSettingsDlg, SIGNAL(triggered()), this, SLOT(showSettingsDlg()));
- //ui.actionSettingsDlg->setEnabled(false);
+ ui.actionSettingsDlg->setEnabled(false);
connect(ui.actionAboutQt, SIGNAL(triggered()), QApplication::instance(), SLOT(aboutQt()));
// for debugging
connect(ui.actionImportBacklog, SIGNAL(triggered()), this, SLOT(importBacklog()));
ui.settingsFrame->setWidget(ui.settingsStack);
ui.settingsTree->setRootIsDecorated(false);
- connect(ui.settingsTree, SIGNAL(itemSelectionChanged()), this, SLOT(pageSelected()));
+ connect(ui.settingsTree, SIGNAL(itemSelectionChanged()), this, SLOT(itemSelected()));
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
}
-void SettingsDlg::registerSettingsPage(SettingsInterface *sp) {
- QWidget *w = sp->settingsWidget();
+void SettingsDlg::registerSettingsPage(SettingsPage *sp) {
+ QWidget *w = sp->widget();
w->setParent(this);
ui.settingsStack->addWidget(w);
cat->setFlags(Qt::ItemIsEnabled);
} else cat = cats[0];
QTreeWidgetItem *p = new QTreeWidgetItem(cat, QStringList(sp->title()));
- p->setData(0, Qt::UserRole, QVariant::fromValue(w));
+ pages[QString("%1$%2").arg(sp->category()).arg(sp->title())] = sp;
}
-void SettingsDlg::pageSelected() {
+void SettingsDlg::selectPage(const QString &cat, const QString &title) {
+ QWidget *w = pages[QString("%1$%2").arg(cat).arg(title)]->widget();
+ Q_ASSERT(w);
+ ui.settingsStack->setCurrentWidget(w);
+}
+
+void SettingsDlg::itemSelected() {
QList<QTreeWidgetItem *> items = ui.settingsTree->selectedItems();
if(!items.count()) {
return;
} else {
- QWidget *sp = items[0]->data(0, Qt::UserRole).value<QWidget *>();
- Q_ASSERT(sp);
- ui.settingsStack->setCurrentWidget(sp);
+ QTreeWidgetItem *parent = items[0]->parent();
+ if(!parent) return;
+ QString cat = parent->text(0);
+ QString title = items[0]->text(0);
+ selectPage(cat, title);
}
}
}
void SettingsDlg::applyChanges() {
- SettingsInterface *sp = qobject_cast<SettingsInterface *>(ui.settingsStack->currentWidget());
- if(sp) sp->applyChanges();
+ //SettingsInterface *sp = qobject_cast<SettingsInterface *>(ui.settingsStack->currentWidget());
+ //if(sp) sp->applyChanges();
}
#include <QtGui>
#include "ui_settingsdlg.h"
-#include "plugin.h"
+#include "settingspage.h"
class SettingsDlg : public QDialog {
Q_OBJECT
public:
SettingsDlg(QWidget *parent = 0);
- void registerSettingsPage(SettingsInterface *);
- void unregisterSettingsPage(SettingsInterface *);
+ void registerSettingsPage(SettingsPage *);
+ void unregisterSettingsPage(SettingsPage *);
+
+ public slots:
+ void selectPage(const QString &category, const QString &title);
private slots:
- void pageSelected();
+ void itemSelected();
void buttonClicked(QAbstractButton *);
void applyChanges();
private:
Ui::SettingsDlg ui;
+ QHash<QString, SettingsPage *> pages;
};
/*
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-07 by The Quassel IRC Development 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 _SETTINGSPAGE_H_
+#define _SETTINGSPAGE_H_
+
+//! Interface that needs to be implemented by pages of the settings dialog.
+class SettingsPage {
+ public:
+ virtual ~SettingsPage() {};
+ virtual QString category() = 0;
+ virtual QString title() = 0;
+ virtual QWidget *widget() = 0;
+ virtual void saveSettings() = 0;
+ virtual void loadSettings() = 0;
+
+ virtual bool hasChanged() = 0;
+
+ signals:
+ void modified();
+
+};
+
+Q_DECLARE_INTERFACE(SettingsPage, "org.quassel-irc.iface.SettingsPage/1.0");
+
+#endif
settingsDlg->registerSettingsPage(new BufferManagementSettingsPage());
settingsDlg->registerSettingsPage(new ConnectionSettingsPage());
+ settingsDlg->registerSettingsPage(new AccountManagementSettingsPage());
}
void ConnectionSettingsPage::applyChanges() {
+}
+
+AccountManagementSettingsPage::AccountManagementSettingsPage() {
+ ui.setupUi(this);
+
+}
+
+void AccountManagementSettingsPage::applyChanges() {
+
}
#include <QtCore>
#include <QtGui>
-#include "plugin.h"
-#include "settingsdlg.h"
+#include "settingspage.h"
#include "ui_buffermgmntsettingspage.h"
#include "ui_connectionsettingspage.h"
+#include "ui_usermgmtsettingspage.h"
class BufferManagementSettingsPage : public QWidget, public SettingsInterface {
Q_OBJECT
- Q_INTERFACES(SettingsInterface)
+ Q_INTERFACES(SettingsInterface);
public:
QString category() { return tr("Buffers"); }
class ConnectionSettingsPage : public QWidget, public SettingsInterface {
Q_OBJECT
- Q_INTERFACES(SettingsInterface)
+ Q_INTERFACES(SettingsInterface);
public:
QString category() { return tr("Behavior"); }
};
+class AccountManagementSettingsPage : public QWidget, public SettingsInterface {
+ Q_OBJECT
+ Q_INTERFACES(SettingsInterface);
+
+ public:
+ QString category() { return tr("Administration"); }
+ QString title() { return tr("Account Management"); }
+ QWidget *settingsWidget() { return this; }
+
+ AccountManagementSettingsPage();
+
+ void applyChanges();
+
+ private:
+ Ui::AccountManagementSettingsPage ui;
+
+};
--- /dev/null
+<ui version="4.0" >
+ <class>AccountManagementSettingsPage</class>
+ <widget class="QWidget" name="AccountManagementSettingsPage" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>376</width>
+ <height>287</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Trebuchet MS'; font-size:10pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Bitstream Vera Sans'; font-size:11pt;"><span style=" font-weight:600;">Account Management</span></p></body></html></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QListWidget" name="listWidget" />
+ </item>
+ <item>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QPushButton" name="pushButton_3" >
+ <property name="text" >
+ <string>Add...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButton_2" >
+ <property name="text" >
+ <string>Remove</string>
+ </property>
+ </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>
+ <item>
+ <widget class="QPushButton" name="pushButton" >
+ <property name="text" >
+ <string>Rename</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButton_4" >
+ <property name="text" >
+ <string>Password...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBox" >
+ <property name="text" >
+ <string>Admin</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>