From 4e0445e459c690cfa6013c5ad574e94f9214827b Mon Sep 17 00:00:00 2001 From: Marcus Eggenberger Date: Thu, 27 Mar 2008 17:06:14 +0000 Subject: [PATCH] Fixing BR #128 (Nicklist state not saved correctly) and ci of my current work. --- src/client/client.cpp | 11 ++ src/client/client.h | 5 +- src/common/bufferviewconfig.cpp | 60 ++++++ src/common/bufferviewconfig.h | 71 +++++++ src/common/bufferviewmanager.cpp | 74 ++++++++ src/common/bufferviewmanager.h | 64 +++++++ src/common/common.pri | 6 +- src/core/core.pri | 4 +- src/core/corebufferviewconfig.cpp | 31 +++ src/core/corebufferviewconfig.h | 38 ++++ src/core/corebufferviewmanager.cpp | 57 ++++++ src/core/corebufferviewmanager.h | 38 ++++ src/core/coresession.cpp | 2 + src/core/coresession.h | 2 + src/qtui/mainwin.cpp | 11 +- src/qtui/mainwin.h | 1 - src/qtui/nicklistdock.cpp | 57 ++++++ src/qtui/nicklistdock.h | 36 ++++ src/qtui/nicklistwidget.cpp | 71 +++---- src/qtui/nicklistwidget.h | 10 +- src/qtui/qtui.pri | 4 +- src/qtui/settingsdlg.cpp | 6 +- src/qtui/settingsdlg.h | 1 + src/qtui/settingspages/buffervieweditdlg.ui | 90 +++++++++ .../settingspages/bufferviewsettingspage.cpp | 179 ++++++++++++++++++ .../settingspages/bufferviewsettingspage.h | 92 +++++++++ .../settingspages/bufferviewsettingspage.ui | 163 ++++++++++++++++ src/qtui/settingspages/settingspages.pri | 4 +- version.inc | 4 +- 29 files changed, 1122 insertions(+), 70 deletions(-) create mode 100644 src/common/bufferviewconfig.cpp create mode 100644 src/common/bufferviewconfig.h create mode 100644 src/common/bufferviewmanager.cpp create mode 100644 src/common/bufferviewmanager.h create mode 100644 src/core/corebufferviewconfig.cpp create mode 100644 src/core/corebufferviewconfig.h create mode 100644 src/core/corebufferviewmanager.cpp create mode 100644 src/core/corebufferviewmanager.h create mode 100644 src/qtui/nicklistdock.cpp create mode 100644 src/qtui/nicklistdock.h create mode 100644 src/qtui/settingspages/buffervieweditdlg.ui create mode 100644 src/qtui/settingspages/bufferviewsettingspage.cpp create mode 100644 src/qtui/settingspages/bufferviewsettingspage.h create mode 100644 src/qtui/settingspages/bufferviewsettingspage.ui diff --git a/src/client/client.cpp b/src/client/client.cpp index 1c4b446e..1f2a1517 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -23,6 +23,7 @@ #include "bufferinfo.h" #include "buffersyncer.h" #include "clientbacklogmanager.h" +#include "bufferviewmanager.h" #include "global.h" #include "identity.h" #include "ircchannel.h" @@ -66,6 +67,7 @@ Client::Client(QObject *parent) _bufferModel(0), _bufferSyncer(0), _backlogManager(new ClientBacklogManager(this)), + _bufferViewManager(0), _connectedToCore(false), _syncedToCore(false) { @@ -307,6 +309,9 @@ void Client::setSyncedToCore() { // attach backlog manager signalProxy()->synchronize(backlogManager()); + + // create a new BufferViewManager + _bufferViewManager = new BufferViewManager(signalProxy(), this); _syncedToCore = true; emit connected(); @@ -332,6 +337,12 @@ void Client::disconnectFromCore() { _bufferSyncer->deleteLater(); _bufferSyncer = 0; } + + if(_bufferViewManager) { + _bufferViewManager->deleteLater(); + _bufferViewManager = 0; + } + _networkModel->clear(); QHash::iterator bufferIter = _buffers.begin(); diff --git a/src/client/client.h b/src/client/client.h index fad53acf..509b447b 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -41,6 +41,7 @@ class NetworkModel; class BufferModel; class BufferSyncer; class ClientBacklogManager; +class BufferViewManager; class IrcUser; class IrcChannel; class SignalProxy; @@ -96,7 +97,8 @@ public: static inline SignalProxy *signalProxy() { return instance()->_signalProxy; } static inline ClientBacklogManager *backlogManager() { return instance()->_backlogManager; } - + static inline BufferViewManager *bufferViewManager() { return instance()->_bufferViewManager; } + static AccountId currentCoreAccount(); static AbstractUiMsg *layoutMsg(const Message &); @@ -209,6 +211,7 @@ private: BufferModel * _bufferModel; BufferSyncer * _bufferSyncer; ClientBacklogManager *_backlogManager; + BufferViewManager *_bufferViewManager; ClientMode clientMode; diff --git a/src/common/bufferviewconfig.cpp b/src/common/bufferviewconfig.cpp new file mode 100644 index 00000000..7a893b3e --- /dev/null +++ b/src/common/bufferviewconfig.cpp @@ -0,0 +1,60 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * 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) version 3. * + * * + * 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 "bufferviewconfig.h" + +BufferViewConfig::BufferViewConfig(int bufferViewId, QObject *parent) + : SyncableObject(parent), + _bufferViewId(bufferViewId) +{ + setObjectName(QString::number(bufferViewId)); +} + +void BufferViewConfig::setBufferViewName(const QString &bufferViewName) { + if(_bufferViewName == bufferViewName) + return; + + _bufferViewName = bufferViewName; + emit bufferViewNameSet(bufferViewName); +} + +void BufferViewConfig::setNetworkId(const NetworkId &networkId) { + if(_networkId == networkId) + return; + + _networkId = networkId; + emit networkIdSet(networkId); +} + +void BufferViewConfig::setAddNewBuffersAutomatically(bool addNewBuffersAutomatically) { + if(_addNewBuffersAutomatically == addNewBuffersAutomatically) + return; + + _addNewBuffersAutomatically = addNewBuffersAutomatically; + emit addNewBuffersAutomaticallySet(addNewBuffersAutomatically); +} + +void BufferViewConfig::setSortAlphabetically(bool sortAlphabetically) { + if(_sortAlphabetically == sortAlphabetically) + return; + + _sortAlphabetically = sortAlphabetically; + emit sortAlphabeticallySet(sortAlphabetically); +} diff --git a/src/common/bufferviewconfig.h b/src/common/bufferviewconfig.h new file mode 100644 index 00000000..d728df56 --- /dev/null +++ b/src/common/bufferviewconfig.h @@ -0,0 +1,71 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * 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) version 3. * + * * + * 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 BUFFERVIEWCONFIG_H +#define BUFFERVIEWCONFIG_H + +#include "syncableobject.h" + +#include "types.h" + +class BufferViewConfig : public SyncableObject { + Q_OBJECT + Q_PROPERTY(QString bufferViewName READ bufferViewName WRITE setBufferViewName) + Q_PROPERTY(NetworkId networkId READ networkId WRITE setNetworkId) + Q_PROPERTY(bool addNewBuffersAutomatically READ addNewBuffersAutomatically WRITE setAddNewBuffersAutomatically) + Q_PROPERTY(bool sortAlphabetically READ sortAlphabetically WRITE setSortAlphabetically) + +public: + BufferViewConfig(int bufferViewId, QObject *parent = 0); + +public slots: + inline int bufferViewId() const { return _bufferViewId; } + + inline const QString &bufferViewName() const { return _bufferViewName; } + void setBufferViewName(const QString &bufferViewName); + + inline const NetworkId &networkId() const { return _networkId; } + void setNetworkId(const NetworkId &networkId); + + inline bool addNewBuffersAutomatically() const { return _addNewBuffersAutomatically; } + void setAddNewBuffersAutomatically(bool addNewBuffersAutomatically); + + inline bool sortAlphabetically() const { return _sortAlphabetically; } + void setSortAlphabetically(bool sortAlphabetically); + + virtual inline void requestSetBufferViewName(const QString &bufferViewName) { emit setBufferViewNameRequested(bufferViewName); } + +signals: + void bufferViewNameSet(const QString &bufferViewName); + void networkIdSet(const NetworkId &networkId); + void addNewBuffersAutomaticallySet(bool addNewBuffersAutomatically); + void sortAlphabeticallySet(bool sortAlphabetically); + + void setBufferViewNameRequested(const QString &bufferViewName); + +private: + int _bufferViewId; + QString _bufferViewName; + NetworkId _networkId; + bool _addNewBuffersAutomatically; + bool _sortAlphabetically; +}; + +#endif // BUFFERVIEWCONFIG_H diff --git a/src/common/bufferviewmanager.cpp b/src/common/bufferviewmanager.cpp new file mode 100644 index 00000000..7ab9831f --- /dev/null +++ b/src/common/bufferviewmanager.cpp @@ -0,0 +1,74 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * 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) version 3. * + * * + * 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 "bufferviewmanager.h" + +#include "bufferviewconfig.h" +#include "signalproxy.h" + +BufferViewManager::BufferViewManager(SignalProxy *proxy, QObject *parent) + : SyncableObject(parent), + _proxy(proxy) +{ + _proxy->synchronize(this); +} + +BufferViewConfig *BufferViewManager::bufferViewConfig(int bufferViewId) const { + if(_bufferViewConfigs.contains(bufferViewId)) + return _bufferViewConfigs[bufferViewId]; + else + return 0; +} + +void BufferViewManager::addBufferViewConfig(BufferViewConfig *config) { + if(_bufferViewConfigs.contains(config->bufferViewId())) + return; + + _proxy->synchronize(config); + _bufferViewConfigs[config->bufferViewId()] = config; + emit bufferViewConfigAdded(config->bufferViewId()); +} + +void BufferViewManager::addBufferViewConfig(int bufferViewConfigId) { + if(_bufferViewConfigs.contains(bufferViewConfigId)) + return; + + addBufferViewConfig(new BufferViewConfig(bufferViewConfigId, this)); +} + +QVariantList BufferViewManager::initBufferViewIds() const { + QVariantList bufferViewIds; + BufferViewConfigHash::const_iterator iter = _bufferViewConfigs.constBegin(); + BufferViewConfigHash::const_iterator iterEnd = _bufferViewConfigs.constEnd(); + while(iter != iterEnd) { + bufferViewIds << (*iter)->bufferViewId(); + iter++; + } + return bufferViewIds; +} + +void BufferViewManager::initSetBufferViewIds(const QVariantList bufferViewIds) { + QVariantList::const_iterator iter = bufferViewIds.constBegin(); + QVariantList::const_iterator iterEnd = bufferViewIds.constEnd(); + while(iter != iterEnd) { + newBufferViewConfig((*iter).value()); + iter++; + } +} diff --git a/src/common/bufferviewmanager.h b/src/common/bufferviewmanager.h new file mode 100644 index 00000000..143b4000 --- /dev/null +++ b/src/common/bufferviewmanager.h @@ -0,0 +1,64 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * 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) version 3. * + * * + * 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 BUFFERVIEWMANAGER_H +#define BUFFERVIEWMANAGER_H + +#include "syncableobject.h" + +#include +#include + +class BufferViewConfig; +class SignalProxy; + +class BufferViewManager : public SyncableObject { + Q_OBJECT + +public: + BufferViewManager(SignalProxy *proxy, QObject *parent = 0); + + inline QList bufferViewConfigs() const { return _bufferViewConfigs.values(); } + BufferViewConfig *bufferViewConfig(int bufferViewId) const; + +public slots: + void addBufferViewConfig(BufferViewConfig *config); + void addBufferViewConfig(int bufferViewConfigId); + inline void newBufferViewConfig(int bufferViewConfigId) { addBufferViewConfig(bufferViewConfigId); } + + QVariantList initBufferViewIds() const; + void initSetBufferViewIds(const QVariantList bufferViewIds); + + virtual inline void requestCreateBufferView(const QString &bufferViewName) { emit createBufferViewRequested(bufferViewName); } + +signals: + void bufferViewConfigAdded(int bufferViewConfigId); + void createBufferViewRequested(const QString &bufferViewName); + +protected: + typedef QHash BufferViewConfigHash; + inline const BufferViewConfigHash &bufferViewConfigHash() { return _bufferViewConfigs; } + +private: + BufferViewConfigHash _bufferViewConfigs; + SignalProxy *_proxy; +}; + +#endif // BUFFERVIEWMANAGER_H diff --git a/src/common/common.pri b/src/common/common.pri index 3a9dccee..7326b76a 100644 --- a/src/common/common.pri +++ b/src/common/common.pri @@ -1,6 +1,8 @@ DEPMOD = QT_MOD = network -SRCS += backlogmanager.cpp bufferinfo.cpp buffersyncer.cpp global.cpp identity.cpp logger.cpp message.cpp settings.cpp signalproxy.cpp syncableobject.cpp \ +SRCS += backlogmanager.cpp bufferinfo.cpp buffersyncer.cpp bufferviewconfig.cpp bufferviewmanager.cpp global.cpp identity.cpp \ + logger.cpp message.cpp settings.cpp signalproxy.cpp syncableobject.cpp \ util.cpp network.cpp ircuser.cpp ircchannel.cpp -HDRS += backlogmanager.h bufferinfo.h buffersyncer.h global.h identity.h logger.h message.h settings.h signalproxy.h syncableobject.h \ +HDRS += backlogmanager.h bufferinfo.h buffersyncer.h bufferviewconfig.h bufferviewmanager.h global.h identity.h \ + logger.h message.h settings.h signalproxy.h syncableobject.h \ util.h network.h ircuser.h ircchannel.h types.h diff --git a/src/core/core.pri b/src/core/core.pri index 97823165..722c5301 100644 --- a/src/core/core.pri +++ b/src/core/core.pri @@ -1,6 +1,6 @@ DEPMOD = common QT_MOD = core network sql script -SRCS = core.cpp corebacklogmanager.cpp coresession.cpp coresettings.cpp networkconnection.cpp sqlitestorage.cpp abstractsqlstorage.cpp storage.cpp basichandler.cpp \ +SRCS = core.cpp corebacklogmanager.cpp corebufferviewconfig.cpp corebufferviewmanager.cpp coresession.cpp coresettings.cpp networkconnection.cpp sqlitestorage.cpp abstractsqlstorage.cpp storage.cpp basichandler.cpp \ ircserverhandler.cpp userinputhandler.cpp ctcphandler.cpp coreusersettings.cpp sessionthread.cpp -HDRS = core.h corebacklogmanager.h coresession.h coresettings.h networkconnection.h sqlitestorage.h abstractsqlstorage.h storage.h basichandler.h \ +HDRS = core.h corebacklogmanager.h corebufferviewconfig.h corebufferviewmanager.h coresession.h coresettings.h networkconnection.h sqlitestorage.h abstractsqlstorage.h storage.h basichandler.h \ ircserverhandler.h userinputhandler.h ctcphandler.h coreusersettings.h sessionthread.h diff --git a/src/core/corebufferviewconfig.cpp b/src/core/corebufferviewconfig.cpp new file mode 100644 index 00000000..49686c12 --- /dev/null +++ b/src/core/corebufferviewconfig.cpp @@ -0,0 +1,31 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * 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) version 3. * + * * + * 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 "corebufferviewconfig.h" + +CoreBufferViewConfig::CoreBufferViewConfig(int bufferViewId, QObject *parent) + : BufferViewConfig(bufferViewId, parent) +{ +} + +void CoreBufferViewConfig::requestSetBufferViewName(const QString &bufferViewName) { + qDebug() << "requestSetBufferViewName" << bufferViewName; + setBufferViewName(bufferViewName); +} diff --git a/src/core/corebufferviewconfig.h b/src/core/corebufferviewconfig.h new file mode 100644 index 00000000..06f15cf2 --- /dev/null +++ b/src/core/corebufferviewconfig.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * 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) version 3. * + * * + * 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 "bufferviewconfig.h" + +#ifndef COREBUFFERVIEWCONFIG_H +#define COREBUFFERVIEWCONFIG_H + +class CoreBufferViewConfig : public BufferViewConfig { + Q_OBJECT + +public: + CoreBufferViewConfig(int bufferViewId, QObject *parent = 0); + + virtual const QMetaObject *syncMetaObject() const { return &BufferViewConfig::staticMetaObject; } + +public slots: + virtual void requestSetBufferViewName(const QString &bufferViewName); +}; + +#endif // COREBUFFERVIEWCONFIG_H diff --git a/src/core/corebufferviewmanager.cpp b/src/core/corebufferviewmanager.cpp new file mode 100644 index 00000000..a23a775d --- /dev/null +++ b/src/core/corebufferviewmanager.cpp @@ -0,0 +1,57 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * 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) version 3. * + * * + * 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 "corebufferviewmanager.h" + +#include "corebufferviewconfig.h" + +CoreBufferViewManager::CoreBufferViewManager(SignalProxy *proxy, QObject *parent) + : BufferViewManager(proxy, parent) +{ + return; + // fill in some demo views + CoreBufferViewConfig *config = 0; + for(int i = 0; i < 10; i++) { + config = new CoreBufferViewConfig(i); + config->setBufferViewName(QString("asdf%1").arg(i)); + addBufferViewConfig(config); + } +} + +void CoreBufferViewManager::requestCreateBufferView(const QString &bufferViewName) { + // FIXME retreive new Id from database or whereever this stuff will be stored + int maxId = -1; + BufferViewConfigHash::const_iterator iter = bufferViewConfigHash().constBegin(); + BufferViewConfigHash::const_iterator iterEnd = bufferViewConfigHash().constEnd(); + while(iter != iterEnd) { + if((*iter)->bufferViewName() == bufferViewName) + return; + + if((*iter)->bufferViewId() > maxId) + maxId = (*iter)->bufferViewId(); + + iter++; + } + maxId++; + + CoreBufferViewConfig *config = new CoreBufferViewConfig(maxId); + config->setBufferViewName(bufferViewName); + addBufferViewConfig(config); +} diff --git a/src/core/corebufferviewmanager.h b/src/core/corebufferviewmanager.h new file mode 100644 index 00000000..235c9dcb --- /dev/null +++ b/src/core/corebufferviewmanager.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * 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) version 3. * + * * + * 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 COREBUFFERVIEWMANAGER_H +#define COREBUFFERVIEWMANAGER_H + +#include "bufferviewmanager.h" + +class CoreBufferViewManager : public BufferViewManager { + Q_OBJECT + +public: + CoreBufferViewManager(SignalProxy *proxy, QObject *parent = 0); + + virtual const QMetaObject *syncMetaObject() const { return &BufferViewManager::staticMetaObject; } + +public slots: + virtual void requestCreateBufferView(const QString &bufferViewName); +}; + +#endif // COREBUFFERVIEWMANAGER_H diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index c93324b6..d71144fb 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -27,6 +27,7 @@ #include "signalproxy.h" #include "buffersyncer.h" #include "corebacklogmanager.h" +#include "corebufferviewmanager.h" #include "storage.h" #include "network.h" @@ -43,6 +44,7 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) _signalProxy(new SignalProxy(SignalProxy::Server, 0, this)), _bufferSyncer(new BufferSyncer(this)), _backlogManager(new CoreBacklogManager(this)), + _bufferViewManager(new CoreBufferViewManager(_signalProxy, this)), scriptEngine(new QScriptEngine(this)) { diff --git a/src/core/coresession.h b/src/core/coresession.h index 9965f0d4..88fefaff 100644 --- a/src/core/coresession.h +++ b/src/core/coresession.h @@ -28,6 +28,7 @@ class BufferSyncer; class CoreBacklogManager; +class CoreBufferViewManager; class Identity; class NetworkConnection; class Network; @@ -181,6 +182,7 @@ private: BufferSyncer *_bufferSyncer; CoreBacklogManager *_backlogManager; + CoreBufferViewManager *_bufferViewManager; QScriptEngine *scriptEngine; diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index f5afc10c..846ccc13 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -30,6 +30,7 @@ #include "networkmodel.h" #include "buffermodel.h" #include "nicklistwidget.h" +#include "nicklistdock.h" #include "settingsdlg.h" #include "settingspagedlg.h" #include "signalproxy.h" @@ -43,6 +44,7 @@ #include "selectionmodelsynchronizer.h" #include "mappedselectionmodel.h" +#include "settingspages/bufferviewsettingspage.h" #include "settingspages/colorsettingspage.h" #include "settingspages/fontssettingspage.h" #include "settingspages/generalsettingspage.h" @@ -193,22 +195,21 @@ void MainWin::setupSettingsDlg() { //Category: General settingsDlg->registerSettingsPage(new IdentitiesSettingsPage(settingsDlg)); settingsDlg->registerSettingsPage(new NetworksSettingsPage(settingsDlg)); + // settingsDlg->registerSettingsPage(new BufferViewSettingsPage(settingsDlg)); } void MainWin::setupNickWidget() { // create nick dock - nickDock = new QDockWidget(tr("Nicks"), this); + NickListDock *nickDock = new NickListDock(tr("Nicks"), this); nickDock->setObjectName("NickDock"); nickDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); nickListWidget = new NickListWidget(nickDock); nickDock->setWidget(nickListWidget); - nickListWidget->setShowDockAction(nickDock->toggleViewAction()); - connect(nickDock->toggleViewAction(), SIGNAL(toggled(bool)), nickListWidget, SLOT(changedVisibility(bool))); addDockWidget(Qt::RightDockWidgetArea, nickDock); - - ui.menuViews->addAction(nickListWidget->showNickListAction()); + ui.menuViews->addAction(nickDock->toggleViewAction()); + connect(nickDock->toggleViewAction(), SIGNAL(triggered(bool)), nickListWidget, SLOT(showWidget(bool))); // attach the NickListWidget to the BufferModel and the default selection nickListWidget->setModel(Client::bufferModel()); diff --git a/src/qtui/mainwin.h b/src/qtui/mainwin.h index 32bf286e..0f5e299e 100644 --- a/src/qtui/mainwin.h +++ b/src/qtui/mainwin.h @@ -123,7 +123,6 @@ class MainWin : public QMainWindow { QString currentProfile; QList netViews; - QDockWidget *nickDock; NickListWidget *nickListWidget; QAction *actionEditNetworks; diff --git a/src/qtui/nicklistdock.cpp b/src/qtui/nicklistdock.cpp new file mode 100644 index 00000000..dc24d528 --- /dev/null +++ b/src/qtui/nicklistdock.cpp @@ -0,0 +1,57 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * 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) version 3. * + * * + * 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 "nicklistdock.h" +#include "qtuisettings.h" + +#include +#include +#include +#include + +NickListDock::NickListDock(const QString &title, QWidget *parent) + : QDockWidget(title, parent) +{ + QAction *toggleView = toggleViewAction(); + disconnect(toggleView, SIGNAL(triggered(bool)), this, 0); + + foreach(QAbstractButton *button, findChildren()) { + if(disconnect(button, SIGNAL(clicked()), this, SLOT(close()))) + connect(button, SIGNAL(clicked()), toggleView, SLOT(trigger())); + } + + installEventFilter(this); + + toggleView->setChecked(QtUiSettings().value("ShowNickList", QVariant(true)).toBool()); +} + +NickListDock::~NickListDock() { + QtUiSettings().setValue("ShowNickList", toggleViewAction()->isChecked()); +} + +bool NickListDock::eventFilter(QObject *watched, QEvent *event) { + Q_UNUSED(watched) + if(event->type() != QEvent::Hide && event->type() != QEvent::Show) + return false; + + emit visibilityChanged(event->type() == QEvent::Show); + + return true; +} diff --git a/src/qtui/nicklistdock.h b/src/qtui/nicklistdock.h new file mode 100644 index 00000000..ca610eeb --- /dev/null +++ b/src/qtui/nicklistdock.h @@ -0,0 +1,36 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * 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) version 3. * + * * + * 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 NICKLISTDOCK_H +#define NICKLISTDOCK_H + +#include + +class NickListDock : public QDockWidget { + Q_OBJECT + +public: + NickListDock(const QString &title, QWidget *parent = 0); + ~NickListDock(); + + virtual bool eventFilter(QObject *watched, QEvent *event); +}; + +#endif //NICKLISTDOCK_H diff --git a/src/qtui/nicklistwidget.cpp b/src/qtui/nicklistwidget.cpp index 68a6757c..d6916f99 100644 --- a/src/qtui/nicklistwidget.cpp +++ b/src/qtui/nicklistwidget.cpp @@ -28,33 +28,20 @@ #include "nickviewfilter.h" #include "qtuisettings.h" +#include + NickListWidget::NickListWidget(QWidget *parent) - : AbstractItemView(parent), - _showNickListAction(new QAction(tr("Nicks"), this)), - _showDockAction(0) + : AbstractItemView(parent) { - _showNickListAction->setCheckable(true); - QtUiSettings s; - _showNickListAction->setChecked(s.value("ShowNickListAction", QVariant(true)).toBool()); ui.setupUi(this); - connect(_showNickListAction, SIGNAL(toggled(bool)), this, SLOT(showWidget(bool))); -} - -NickListWidget::~NickListWidget() { - QtUiSettings s; - s.setValue("ShowNickListAction", showNickListAction()->isChecked()); -} - -void NickListWidget::setShowDockAction(QAction *action) { - _showDockAction = action; } -QAction *NickListWidget::showDockAction() const { - return _showDockAction; -} - -QAction *NickListWidget::showNickListAction() const { - return _showNickListAction; +QDockWidget *NickListWidget::dock() const { + QDockWidget *dock = qobject_cast(parent()); + if(dock) + return dock; + else + return 0; } void NickListWidget::showWidget(bool visible) { @@ -62,21 +49,15 @@ void NickListWidget::showWidget(bool visible) { return; QModelIndex currentIndex = selectionModel()->currentIndex(); - if(currentIndex.data(NetworkModel::BufferTypeRole) == BufferInfo::ChannelBuffer && showDockAction()) { - if(visible != showDockAction()->isChecked()) { - // show or hide - showDockAction()->trigger(); - } - } -} - -void NickListWidget::changedVisibility(bool visible) { - if(!selectionModel()) - return; - - QModelIndex currentIndex = selectionModel()->currentIndex(); - if(currentIndex.data(NetworkModel::BufferTypeRole) == BufferInfo::ChannelBuffer && !visible) { - showNickListAction()->setChecked(false); + if(currentIndex.data(NetworkModel::BufferTypeRole) == BufferInfo::ChannelBuffer) { + QDockWidget *dock_ = dock(); + if(!dock_) + return; + + if(visible) + dock_->show(); + else + dock_->close(); } } @@ -85,19 +66,19 @@ void NickListWidget::currentChanged(const QModelIndex ¤t, const QModelInde BufferId newBufferId = current.data(NetworkModel::BufferIdRole).value(); BufferId oldBufferId = previous.data(NetworkModel::BufferIdRole).value(); + if(bufferType != BufferInfo::ChannelBuffer) { ui.stackedWidget->setCurrentWidget(ui.emptyPage); - if(showDockAction() && showDockAction()->isChecked()) { - // hide - showDockAction()->trigger(); + QDockWidget *dock_ = dock(); + if(dock_) { + dock_->close(); } return; } else { - if(showNickListAction()->isChecked()) - if(showDockAction()&& !showDockAction()->isChecked()) { - // show - showDockAction()->trigger(); - } + QDockWidget *dock_ = dock(); + if(dock_ && dock_->toggleViewAction()->isChecked()) { + dock_->show(); + } } if(newBufferId == oldBufferId) diff --git a/src/qtui/nicklistwidget.h b/src/qtui/nicklistwidget.h index 3a6dfe6a..9525803e 100644 --- a/src/qtui/nicklistwidget.h +++ b/src/qtui/nicklistwidget.h @@ -32,19 +32,15 @@ class Buffer; class NickView; +class QDockWidget; class NickListWidget : public AbstractItemView { Q_OBJECT public: NickListWidget(QWidget *parent = 0); - ~NickListWidget(); - void setShowDockAction(QAction *action); - QAction *showDockAction() const; - QAction *showNickListAction() const; public slots: - void changedVisibility(bool visible); void showWidget(bool visible); protected: @@ -60,8 +56,8 @@ private slots: private: Ui::NickListWidget ui; QHash nickViews; - QAction *_showNickListAction; - QPointer _showDockAction; + + QDockWidget *dock() const; }; #endif diff --git a/src/qtui/qtui.pri b/src/qtui/qtui.pri index e410de45..693e3851 100644 --- a/src/qtui/qtui.pri +++ b/src/qtui/qtui.pri @@ -3,12 +3,12 @@ QT_MOD = core gui network SRCS += aboutdlg.cpp bufferwidget.cpp chatitem.cpp chatline.cpp chatline-old.cpp chatscene.cpp chatview.cpp chatwidget.cpp \ coreconfigwizard.cpp coreconnectdlg.cpp configwizard.cpp debugconsole.cpp inputwidget.cpp \ - mainwin.cpp nicklistwidget.cpp qtui.cpp qtuisettings.cpp qtuistyle.cpp settingsdlg.cpp settingspagedlg.cpp \ + mainwin.cpp nicklistdock.cpp nicklistwidget.cpp qtui.cpp qtuisettings.cpp qtuistyle.cpp settingsdlg.cpp settingspagedlg.cpp \ topicbutton.cpp topicwidget.cpp verticaldock.cpp jumpkeyhandler.cpp HDRS += aboutdlg.h bufferwidget.h chatitem.h chatline.h chatline-old.h chatscene.h chatview.h chatwidget.h \ coreconfigwizard.h configwizard.h debugconsole.h inputwidget.h \ - coreconnectdlg.h mainwin.h nicklistwidget.h qtui.h qtuisettings.h qtuistyle.h settingsdlg.h settingspagedlg.h \ + coreconnectdlg.h mainwin.h nicklistdock.h nicklistwidget.h qtui.h qtuisettings.h qtuistyle.h settingsdlg.h settingspagedlg.h \ topicbutton.h topicwidget.h verticaldock.h jumpkeyhandler.h FORMNAMES = aboutdlg.ui mainwin.ui coreaccounteditdlg.ui coreconnectdlg.ui bufferviewwidget.ui bufferwidget.ui nicklistwidget.ui settingsdlg.ui \ diff --git a/src/qtui/settingsdlg.cpp b/src/qtui/settingsdlg.cpp index a249c79b..0b372f62 100644 --- a/src/qtui/settingsdlg.cpp +++ b/src/qtui/settingsdlg.cpp @@ -65,7 +65,7 @@ void SettingsDlg::registerSettingsPage(SettingsPage *sp) { QTreeWidgetItem *item = new QTreeWidgetItem(cat, QStringList(sp->title())); treeItems[sp] = item; pages[QString("%1$%2").arg(sp->category(), sp->title())] = sp; - sp->load(); + pageIsLoaded[sp] = false; // TESTING // selectPage(sp->category(), sp->title()); } @@ -78,6 +78,10 @@ void SettingsDlg::selectPage(const QString &cat, const QString &title) { ui.settingsTree->setCurrentItem(0); return; } + if(!pageIsLoaded[sp]) { + sp->load(); + pageIsLoaded[sp] = true; + } if(sp != currentPage() && currentPage() != 0 && currentPage()->hasChanged()) { int ret = QMessageBox::warning(this, tr("Save changes"), tr("There are unsaved changes on the current configuration page. Would you like to apply your changes now?"), diff --git a/src/qtui/settingsdlg.h b/src/qtui/settingsdlg.h index cefc7806..3cfda437 100644 --- a/src/qtui/settingsdlg.h +++ b/src/qtui/settingsdlg.h @@ -55,6 +55,7 @@ class SettingsDlg : public QDialog { SettingsPage *_currentPage; QHash pages; QHash treeItems; + QHash pageIsLoaded; //QSize recommendedSize; }; diff --git a/src/qtui/settingspages/buffervieweditdlg.ui b/src/qtui/settingspages/buffervieweditdlg.ui new file mode 100644 index 00000000..3237df83 --- /dev/null +++ b/src/qtui/settingspages/buffervieweditdlg.ui @@ -0,0 +1,90 @@ + + BufferViewEditDlg + + + + 0 + 0 + 282 + 131 + + + + Dialog + + + + + + + + Please enter a name for the buffer view: + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + BufferViewEditDlg + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + BufferViewEditDlg + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/qtui/settingspages/bufferviewsettingspage.cpp b/src/qtui/settingspages/bufferviewsettingspage.cpp new file mode 100644 index 00000000..861bdb66 --- /dev/null +++ b/src/qtui/settingspages/bufferviewsettingspage.cpp @@ -0,0 +1,179 @@ +/*************************************************************************** + * 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) version 3. * + * * + * 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 "bufferviewsettingspage.h" + +#include "client.h" +#include "bufferviewmanager.h" +#include "bufferviewconfig.h" + +BufferViewSettingsPage::BufferViewSettingsPage(QWidget *parent) + : SettingsPage(tr("General"), tr("Buffer Views"), parent) +{ + ui.setupUi(this); + reset(); + setEnabled(Client::isConnected()); // need a core connection! + connect(Client::instance(), SIGNAL(coreConnectionStateChanged(bool)), this, SLOT(coreConnectionStateChanged(bool))); +} + +void BufferViewSettingsPage::reset() { + // currentId = 0; + ui.bufferViewList->clear(); + _viewToListPos.clear(); + _listPosToView.clear(); +} + +void BufferViewSettingsPage::load() { + reset(); + + if(!Client::bufferViewManager()) + return; + + const QList bufferViewConfigs = Client::bufferViewManager()->bufferViewConfigs(); + foreach(BufferViewConfig *bufferViewConfig, bufferViewConfigs) { + addBufferView(bufferViewConfig); + } +} + +void BufferViewSettingsPage::save() { +} + +void BufferViewSettingsPage::coreConnectionStateChanged(bool state) { + setEnabled(state); + if(state) { + load(); + connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigAdded(int)), this, SLOT(addBufferView(int))); + } else { + reset(); + } +} + +void BufferViewSettingsPage::addBufferView(BufferViewConfig *config) { + _viewToListPos[config->bufferViewId()] = ui.bufferViewList->count(); + _listPosToView[ui.bufferViewList->count()] = config->bufferViewId(); + ui.bufferViewList->addItem(config->bufferViewName()); + connect(config, SIGNAL(updatedRemotely()), this, SLOT(updateBufferView())); +} + +void BufferViewSettingsPage::addBufferView(int bufferViewId) { + Q_ASSERT(Client::bufferViewManager()); + addBufferView(Client::bufferViewManager()->bufferViewConfig(bufferViewId)); +} + +void BufferViewSettingsPage::newBufferView(const QString &bufferViewName) { + // id's of newly created bufferviews are negative (-1, -2... -n) + int fakeId = -1 * (_newBufferViews.count() + 1); + addBufferView(new BufferViewConfig(fakeId)); +} + +int BufferViewSettingsPage::listPos(BufferViewConfig *config) { + if(_viewToListPos.contains(config->bufferViewId())) + return _viewToListPos[config->bufferViewId()]; + else + return -1; +} + +int BufferViewSettingsPage::bufferViewId(int listPos) { + if(_listPosToView.contains(listPos)) + return _listPosToView[listPos]; + else + return -1; +} + +void BufferViewSettingsPage::updateBufferView() { + BufferViewConfig *config = qobject_cast(sender()); + if(!config) + return; + + int itemPos = listPos(config); + if(itemPos == -1) { + qWarning() << "BufferViewSettingsPage::updateBufferView(): view is unknown:" << config->bufferViewId(); + return; + } + ui.bufferViewList->item(itemPos)->setText(config->bufferViewName()); +} + +void BufferViewSettingsPage::on_addBufferView_clicked() { + if(!Client::bufferViewManager()) + return; + + QStringList existing; + foreach(BufferViewConfig *bufferConfig, Client::bufferViewManager()->bufferViewConfigs()) { + existing << bufferConfig->bufferViewName(); + } + + BufferViewEditDlg dlg(QString(), existing, this); + if(dlg.exec() == QDialog::Accepted) { + newBufferView(dlg.bufferViewName()); + } +} + +void BufferViewSettingsPage::on_renameBufferView_clicked() { + if(ui.bufferViewList->selectedItems().isEmpty()) + return; + + if(!Client::bufferViewManager()) + return; + + BufferViewConfig *config = Client::bufferViewManager()->bufferViewConfig(bufferViewId(ui.bufferViewList->currentRow())); + if(!config) + return; + + QStringList existing; + foreach(BufferViewConfig *bufferConfig, Client::bufferViewManager()->bufferViewConfigs()) { + existing << bufferConfig->bufferViewName(); + } + + BufferViewEditDlg dlg(config->bufferViewName(), existing, this); + if(dlg.exec() != QDialog::Accepted) + return; + + BufferViewConfig *changedConfig; + if(!_changedBufferViews.contains(config)) { + _changedBufferViews[config] = new BufferViewConfig(-1); + _changedBufferViews[config]->fromVariantMap(config->toVariantMap()); + } + + changedConfig = _changedBufferViews[config]; + changedConfig->setBufferViewName(dlg.bufferViewName()); + changed(); +} + + +/************************************************************************** + * BufferViewEditDlg + *************************************************************************/ +BufferViewEditDlg::BufferViewEditDlg(const QString &old, const QStringList &exist, QWidget *parent) : QDialog(parent), existing(exist) { + ui.setupUi(this); + + if(old.isEmpty()) { + // new buffer + setWindowTitle(tr("Add Buffer View")); + on_bufferViewEdit_textChanged(""); // disable ok button + } else { + ui.bufferViewEdit->setText(old); + } +} + + +void BufferViewEditDlg::on_bufferViewEdit_textChanged(const QString &text) { + ui.buttonBox->button(QDialogButtonBox::Ok)->setDisabled(text.isEmpty() || existing.contains(text)); +} + diff --git a/src/qtui/settingspages/bufferviewsettingspage.h b/src/qtui/settingspages/bufferviewsettingspage.h new file mode 100644 index 00000000..a3f32c1d --- /dev/null +++ b/src/qtui/settingspages/bufferviewsettingspage.h @@ -0,0 +1,92 @@ +/*************************************************************************** + * 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) version 3. * + * * + * 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 BUFFERVIEWSETTINGSPAGE_H +#define BUFFERVIEWSETTINGSPAGE_H + +#include "settingspage.h" +#include "ui_bufferviewsettingspage.h" +#include "ui_buffervieweditdlg.h" + +class BufferViewConfig; + +class BufferViewSettingsPage : public SettingsPage { + Q_OBJECT + +public: + BufferViewSettingsPage(QWidget *parent = 0); + +public slots: + void save(); + void load(); + void reset(); + +private slots: + void coreConnectionStateChanged(bool state); + + void addBufferView(BufferViewConfig *config); + void addBufferView(int bufferViewId); + void newBufferView(const QString &bufferViewName); + void updateBufferView(); + + void on_addBufferView_clicked(); + void on_renameBufferView_clicked(); + +private: + Ui::BufferViewSettingsPage ui; + + // mappings for bufferViewId to position in the list and vice versa + QHash _viewToListPos; + QHash _listPosToView; + + // list of bufferviews to create + QList _newBufferViews; + + // Hash of pointers to cloned bufferViewConfigs holding the changes + QHash _changedBufferViews; + + int listPos(BufferViewConfig *config); + int bufferViewId(int listPos); +}; + + +/************************************************************************** + * BufferViewEditDlg + *************************************************************************/ +class BufferViewEditDlg : public QDialog { + Q_OBJECT + +public: + BufferViewEditDlg(const QString &old, const QStringList &existing = QStringList(), QWidget *parent = 0); + + inline QString bufferViewName() const { return ui.bufferViewEdit->text(); } + +private slots: + void on_bufferViewEdit_textChanged(const QString &); + +private: + Ui::BufferViewEditDlg ui; + + QStringList existing; +}; + + + +#endif // BUFFERVIEWSETTINGSPAGE_H diff --git a/src/qtui/settingspages/bufferviewsettingspage.ui b/src/qtui/settingspages/bufferviewsettingspage.ui new file mode 100644 index 00000000..161ecaa1 --- /dev/null +++ b/src/qtui/settingspages/bufferviewsettingspage.ui @@ -0,0 +1,163 @@ + + BufferViewSettingsPage + + + + 0 + 0 + 507 + 485 + + + + Form + + + + + + + + + + + + 0 + 0 + + + + Re&name... + + + :/16x16/actions/oxygen/16x16/actions/edit-rename.png + + + + + + + + 0 + 0 + + + + &Add... + + + :/16x16/actions/oxygen/16x16/actions/list-add.png + + + + 16 + 16 + + + + + + + + + 0 + 0 + + + + De&lete + + + :/16x16/actions/oxygen/16x16/actions/edit-delete.png + + + + + + + + + Buffer View Settings + + + + + + + + Show only Buffers from: + + + + + + + + + + + + Restrict Buffers to: + + + + + + Status Buffers + + + + + + + Channel Buffers + + + + + + + Query Buffers + + + + + + + + + + Add new Buffers automatically + + + + + + + Sort Buffers alphabetically + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/src/qtui/settingspages/settingspages.pri b/src/qtui/settingspages/settingspages.pri index 82256f93..6d7d510f 100644 --- a/src/qtui/settingspages/settingspages.pri +++ b/src/qtui/settingspages/settingspages.pri @@ -1,8 +1,8 @@ # Putting $FOO in SETTINGSPAGES automatically includes # $FOOsettingspage.cpp, $FOOsettingspage.h and $FOOsettingspage.ui -SETTINGSPAGES = color fonts general identities networks +SETTINGSPAGES = color fonts general identities networks bufferview # Specify additional files (e.g. for subdialogs) here! SP_SRCS = SP_HDRS = -SP_FRMS = createidentitydlg.ui saveidentitiesdlg.ui networkeditdlg.ui nickeditdlg.ui servereditdlg.ui +SP_FRMS = buffervieweditdlg.ui createidentitydlg.ui saveidentitiesdlg.ui networkeditdlg.ui nickeditdlg.ui servereditdlg.ui diff --git a/version.inc b/version.inc index 60d47a7a..7b90fb77 100644 --- a/version.inc +++ b/version.inc @@ -4,8 +4,8 @@ { using namespace Global; quasselVersion = "0.2.0-alpha4-pre"; - quasselDate = "2008-03-25"; - quasselBuild = 659; + quasselDate = "2008-03-27"; + quasselBuild = 660; //! Minimum client build number the core needs clientBuildNeeded = 642; -- 2.20.1