qtuimessageprocessor.cpp
qtuisettings.cpp
qtuistyle.cpp
- sessionsettings.cpp
settingsdlg.cpp
settingspagedlg.cpp
simplenetworkeditor.cpp
#include "qtuiapplication.h"
#include "qtuimessageprocessor.h"
#include "qtuisettings.h"
-#include "sessionsettings.h"
#include "settingsdlg.h"
#include "settingspagedlg.h"
#include "systemtray.h"
#include <QSystemTrayIcon>
#include "qtui.h"
-#include "sessionsettings.h"
#include "titlesetter.h"
+#include "uisettings.h"
class ActionCollection;
class BufferView;
#include "cliparser.h"
#include "qtui.h"
#include "qtuisettings.h"
-#include "sessionsettings.h"
QtUiApplication::QtUiApplication(int &argc, char **argv)
#ifdef HAVE_KDE
#include <QSessionManager>
#include "quassel.h"
-#include "sessionsettings.h"
+#include "uisettings.h"
class QtUi;
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-09 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 "sessionsettings.h"
-
-#include <QStringList>
-
-void SessionSettings::setValue(const QString &key, const QVariant &data) {
- setLocalValue(QString("%1/%2").arg(_sessionId, key), data);
-}
-
-QVariant SessionSettings::value(const QString &key, const QVariant &def) {
- return localValue(QString("%1/%2").arg(_sessionId, key), def);
-}
-
-void SessionSettings::removeKey(const QString &key) {
- removeLocalKey(QString("%1/%2").arg(_sessionId, key));
-}
-
-void SessionSettings::cleanup() {
- QStringList sessions = localChildGroups();
- QString str;
- SessionSettings s(sessionId());
- foreach(str, sessions) {
- // load session and check age
- s.setSessionId(str);
- if(s.sessionAge() > 3) {
- s.removeSession();
- }
- }
-}
-
-int SessionSettings::sessionAge() {
- QVariant val = localValue(QString("%1/_sessionAge").arg(_sessionId), 0);
- bool b = false;
- int i = val.toInt(&b);
- if(b) {
- return i;
- } else {
- // no int saved, delete session
- //qDebug() << QString("deleting invalid session %1 (invalid session age found)").arg(_sessionId);
- removeSession();
- }
- return 10;
-}
-
-void SessionSettings::removeSession() {
- QStringList keys = localChildKeys(sessionId());
- foreach(QString k, keys) {
- removeKey(k);
- }
-}
-
-
-SessionSettings::SessionSettings(const QString & sessionId, const QString & group) : ClientSettings(group), _sessionId(sessionId) {
-}
-
-void SessionSettings::setSessionAge(int age) {
- setValue(QString("_sessionAge"),age);
-}
-
-void SessionSettings::sessionAging() {
- QStringList sessions = localChildGroups();
- QString str;
- SessionSettings s(sessionId());
- foreach(str, sessions) {
- // load session and check age
- s.setSessionId(str);
- s.setSessionAge(s.sessionAge()+1);
- }
-}
-
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2005-09 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 _SESSIONSETTINGS_H_
-#define _SESSIONSETTINGS_H_
-
-#include <QVariant>
-
-#include "clientsettings.h"
-
-class SessionSettings : public ClientSettings {
-
- public:
- SessionSettings(const QString &sessionId, const QString &group = "Session");
-
- void setValue(const QString &key, const QVariant &data);
- QVariant value(const QString &key, const QVariant &def = QVariant());
-
- void removeKey(const QString &key);
- void removeSession();
-
- void cleanup();
- void sessionAging();
-
- int sessionAge();
- void setSessionAge(int age);
- inline const QString sessionId() { return _sessionId; };
- inline void setSessionId(const QString &sessionId) { _sessionId = sessionId; }
- private:
- QString _sessionId;
-};
-
-#endif
}
return formats;
}
+
+/**************************************************************************
+ * SessionSettings
+ **************************************************************************/
+
+SessionSettings::SessionSettings(const QString & sessionId, const QString & group)
+: UiSettings(group), _sessionId(sessionId)
+{
+
+}
+
+void SessionSettings::setValue(const QString &key, const QVariant &data) {
+ setLocalValue(QString("%1/%2").arg(_sessionId, key), data);
+}
+
+QVariant SessionSettings::value(const QString &key, const QVariant &def) {
+ return localValue(QString("%1/%2").arg(_sessionId, key), def);
+}
+
+void SessionSettings::removeKey(const QString &key) {
+ removeLocalKey(QString("%1/%2").arg(_sessionId, key));
+}
+
+void SessionSettings::cleanup() {
+ QStringList sessions = localChildGroups();
+ QString str;
+ SessionSettings s(sessionId());
+ foreach(str, sessions) {
+ // load session and check age
+ s.setSessionId(str);
+ if(s.sessionAge() > 3) {
+ s.removeSession();
+ }
+ }
+}
+
+int SessionSettings::sessionAge() {
+ QVariant val = localValue(QString("%1/_sessionAge").arg(_sessionId), 0);
+ bool b = false;
+ int i = val.toInt(&b);
+ if(b) {
+ return i;
+ } else {
+ // no int saved, delete session
+ //qDebug() << QString("deleting invalid session %1 (invalid session age found)").arg(_sessionId);
+ removeSession();
+ }
+ return 10;
+}
+
+void SessionSettings::removeSession() {
+ QStringList keys = localChildKeys(sessionId());
+ foreach(QString k, keys) {
+ removeKey(k);
+ }
+}
+
+void SessionSettings::setSessionAge(int age) {
+ setValue(QString("_sessionAge"),age);
+}
+
+void SessionSettings::sessionAging() {
+ QStringList sessions = localChildGroups();
+ QString str;
+ SessionSettings s(sessionId());
+ foreach(str, sessions) {
+ // load session and check age
+ s.setSessionId(str);
+ s.setSessionAge(s.sessionAge()+1);
+ }
+}
+
public:
UiSettings(const QString &group = "Ui");
- inline void setValue(const QString &key, const QVariant &data) { setLocalValue(key, data); }
- inline QVariant value(const QString &key, const QVariant &def = QVariant()) { return localValue(key, def); }
+ virtual inline void setValue(const QString &key, const QVariant &data) { setLocalValue(key, data); }
+ virtual inline QVariant value(const QString &key, const QVariant &def = QVariant()) { return localValue(key, def); }
+
inline void remove(const QString &key) { removeLocalKey(key); }
};
QList<UiStyle::FormatType> availableFormats();
};
+class SessionSettings : public UiSettings {
+public:
+ SessionSettings(const QString &sessionId, const QString &group = "Session");
+
+ virtual void setValue(const QString &key, const QVariant &data);
+ virtual QVariant value(const QString &key, const QVariant &def = QVariant());
+
+ void removeKey(const QString &key);
+ void removeSession();
+
+ void cleanup();
+ void sessionAging();
+
+ int sessionAge();
+ void setSessionAge(int age);
+ inline const QString sessionId() { return _sessionId; };
+ inline void setSessionId(const QString &sessionId) { _sessionId = sessionId; }
+
+private:
+ QString _sessionId;
+};
+
#endif