removeLocalKey(key);
}
+/***********************************************************************************************/
+// CoreConnectionSettings:
+
+CoreConnectionSettings::CoreConnectionSettings() : ClientSettings("CoreConnection") {}
+
+void CoreConnectionSettings::setNetworkDetectionMode(NetworkDetectionMode mode) {
+ setLocalValue("NetworkDetectionMode", mode);
+}
+
+CoreConnectionSettings::NetworkDetectionMode CoreConnectionSettings::networkDetectionMode() {
+#ifdef HAVE_KDE
+ NetworkDetectionMode def = UseSolid;
+#else
+ NetworkDetectionMode def = UsePingTimeout;
+#endif
+ return (NetworkDetectionMode)localValue("NetworkDetectionMode", def).toInt();
+}
+
+void CoreConnectionSettings::setAutoReconnect(bool autoReconnect) {
+ setLocalValue("AutoReconnect", autoReconnect);
+}
+
+bool CoreConnectionSettings::autoReconnect() {
+ return localValue("AutoReconnect", true).toBool();
+}
+
+void CoreConnectionSettings::setPingTimeoutInterval(int interval) {
+ setLocalValue("PingTimeoutInterval", interval);
+}
+
+int CoreConnectionSettings::pingTimeoutInterval() {
+ return localValue("PingTimeoutInterval", 60).toInt();
+}
+
+void CoreConnectionSettings::setReconnectInterval(int interval) {
+ setLocalValue("ReconnectInterval", interval);
+}
+
+int CoreConnectionSettings::reconnectInterval() {
+ return localValue("ReconnectInterval", 60).toInt();
+}
+
/***********************************************************************************************/
// NotificationSettings:
bool nicksCaseSensitive();
};
+// ========================================
+// CoreConnectionSettings
+// ========================================
+
+class CoreConnectionSettings : public ClientSettings {
+public:
+ enum NetworkDetectionMode {
+ UseSolid,
+ UsePingTimeout,
+ NoActiveDetection
+ };
+
+ CoreConnectionSettings();
+
+ void setNetworkDetectionMode(NetworkDetectionMode mode);
+ NetworkDetectionMode networkDetectionMode();
+
+ void setAutoReconnect(bool autoReconnect);
+ bool autoReconnect();
+
+ void setPingTimeoutInterval(int interval);
+ int pingTimeoutInterval();
+
+ void setReconnectInterval(int interval);
+ int reconnectInterval();
+};
+
// ========================================
// TabCompletionSettings
// ========================================
void Settings::notify(const QString &key, QObject *receiver, const char *slot) {
QObject::connect(notifier(normalizedKey(group, key)), SIGNAL(valueChanged(const QVariant &)),
- receiver, slot);
+ receiver, slot);
+}
+
+void Settings::initAndNotify(const QString &key, QObject *receiver, const char *slot, const QVariant &defaultValue) {
+ notify(key, receiver, slot);
+ emit notifier(normalizedKey(group, key))->valueChanged(localValue(key, defaultValue));
}
uint Settings::version() {
enum Mode { Default, Custom };
public:
+ //! Call the given slot on change of the given key
virtual void notify(const QString &key, QObject *receiver, const char *slot);
+
+ //! Sets up notification and calls the given slot to set the initial value
+ void initAndNotify(const QString &key, QObject *receiver, const char *slot, const QVariant &defaultValue = QVariant());
+
virtual uint version();
protected:
#include "settingspages/chatviewsettingspage.h"
#include "settingspages/connectionsettingspage.h"
#include "settingspages/coreaccountsettingspage.h"
+#include "settingspages/coreconnectionsettingspage.h"
#include "settingspages/highlightsettingspage.h"
#include "settingspages/identitiessettingspage.h"
#include "settingspages/ignorelistsettingspage.h"
// Category: Remote Cores
if(Quassel::runMode() != Quassel::Monolithic) {
dlg->registerSettingsPage(new CoreAccountSettingsPage(dlg));
+ dlg->registerSettingsPage(new CoreConnectionSettingsPage(dlg));
}
dlg->show();
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2009 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) 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 "coreconnectionsettingspage.h"
+
+CoreConnectionSettingsPage::CoreConnectionSettingsPage(QWidget *parent)
+ : SettingsPage(tr("Remote Cores"), tr("Connection"), parent) {
+ ui.setupUi(this);
+#ifndef HAVE_KDE
+ ui.useSolid->hide();
+#endif
+
+ initAutoWidgets();
+
+ connect(ui.useSolid, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
+ connect(ui.usePingTimeout, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
+ connect(ui.useNoTimeout, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
+}
+
+void CoreConnectionSettingsPage::widgetHasChanged() {
+ bool hasChanged = false;
+ CoreConnectionSettings::NetworkDetectionMode mode = modeFromRadioButtons();
+ if(mode != _detectionMode)
+ hasChanged = true;
+
+ setChangedState(hasChanged);
+}
+
+void CoreConnectionSettingsPage::defaults() {
+#ifdef HAVE_KDE
+ setRadioButtons(CoreConnectionSettings::UseSolid);
+#else
+ setRadioButtons(CoreConnectionSettings::UsePingTimeout);
+#endif
+
+ SettingsPage::defaults();
+}
+
+void CoreConnectionSettingsPage::load() {
+ CoreConnectionSettings s;
+ _detectionMode = s.networkDetectionMode();
+ setRadioButtons(_detectionMode);
+ SettingsPage::load();
+}
+
+void CoreConnectionSettingsPage::save() {
+ _detectionMode = modeFromRadioButtons();
+ CoreConnectionSettings s;
+ s.setNetworkDetectionMode(_detectionMode);
+ SettingsPage::save();
+}
+
+void CoreConnectionSettingsPage::setRadioButtons(CoreConnectionSettings::NetworkDetectionMode mode) {
+ switch(mode) {
+#ifdef HAVE_KDE
+ case CoreConnectionSettings::UseSolid:
+ ui.useSolid->setChecked(true);
+ break;
+#endif
+ case CoreConnectionSettings::UsePingTimeout:
+ ui.usePingTimeout->setChecked(true);
+ break;
+ default:
+ ui.useNoTimeout->setChecked(true);
+ }
+}
+
+CoreConnectionSettings::NetworkDetectionMode CoreConnectionSettingsPage::modeFromRadioButtons() const {
+#ifdef HAVE_KDE
+ if(ui.useSolid->isChecked())
+ return CoreConnectionSettings::UseSolid;
+#endif
+ if(ui.usePingTimeout->isChecked())
+ return CoreConnectionSettings::UsePingTimeout;
+
+ return CoreConnectionSettings::NoActiveDetection;
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2009 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) 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 COREACCOUNTSETTINGSPAGE_H
+#define COREACCOUNTSETTINGSPAGE_H
+
+#include "clientsettings.h"
+#include "settingspage.h"
+
+#include "ui_coreconnectionsettingspage.h"
+
+class CoreConnectionSettingsPage : public SettingsPage {
+ Q_OBJECT
+
+public:
+ CoreConnectionSettingsPage(QWidget *parent = 0);
+
+ inline bool hasDefaults() const { return true; }
+
+public slots:
+ void save();
+ void load();
+ void defaults();
+
+signals:
+
+private slots:
+ void widgetHasChanged();
+
+private:
+ Ui::CoreConnectionSettingsPage ui;
+ CoreConnectionSettings::NetworkDetectionMode _detectionMode;
+
+ void setRadioButtons(CoreConnectionSettings::NetworkDetectionMode mode);
+ CoreConnectionSettings::NetworkDetectionMode modeFromRadioButtons() const;
+
+ inline QString settingsKey() const { return QString("CoreConnection"); }
+};
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CoreConnectionSettingsPage</class>
+ <widget class="QWidget" name="CoreConnectionSettingsPage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>446</width>
+ <height>465</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Network Status Detection</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QRadioButton" name="useSolid">
+ <property name="toolTip">
+ <string>Rely on KDE's hardware layer to detect if we're online. Recommended for most KDE users</string>
+ </property>
+ <property name="text">
+ <string>Use KDE's network status detection (via Solid)</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QRadioButton" name="usePingTimeout">
+ <property name="toolTip">
+ <string>Actively ping the remote core and disconnect if we didn't get a reply after a certain time</string>
+ </property>
+ <property name="text">
+ <string>Ping timeout after</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="pingTimeout">
+ <property name="toolTip">
+ <string>Actively ping the remote core and disconnect if we didn't get a reply after a certain time</string>
+ </property>
+ <property name="suffix">
+ <string> seconds</string>
+ </property>
+ <property name="minimum">
+ <number>30</number>
+ </property>
+ <property name="maximum">
+ <number>3600</number>
+ </property>
+ <property name="singleStep">
+ <number>30</number>
+ </property>
+ <property name="value">
+ <number>60</number>
+ </property>
+ <property name="settingsKey" stdset="0">
+ <string notr="true">PingTimeoutInterval</string>
+ </property>
+ <property name="defaultValue" stdset="0">
+ <UInt>60</UInt>
+ </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>
+ <widget class="QRadioButton" name="useNoTimeout">
+ <property name="toolTip">
+ <string>Only disconnect if the network socket gets closed by the operating system. This may take a long time after actually losing connectivity</string>
+ </property>
+ <property name="text">
+ <string>Never time out actively</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="autoReconnect">
+ <property name="text">
+ <string>Automatically reconnect on network failures</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="settingsKey" stdset="0">
+ <string notr="true">AutoReconnect</string>
+ </property>
+ <property name="defaultValue" stdset="0">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="reconnectLabel">
+ <property name="text">
+ <string>Retry every</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="reconnectInterval">
+ <property name="toolTip">
+ <string>Actively ping the remote core and disconnect if we didn't get a reply after a certain time</string>
+ </property>
+ <property name="suffix">
+ <string> seconds</string>
+ </property>
+ <property name="minimum">
+ <number>30</number>
+ </property>
+ <property name="maximum">
+ <number>3600</number>
+ </property>
+ <property name="singleStep">
+ <number>30</number>
+ </property>
+ <property name="value">
+ <number>60</number>
+ </property>
+ <property name="settingsKey" stdset="0">
+ <string notr="true">ReconnectInterval</string>
+ </property>
+ <property name="defaultValue" stdset="0">
+ <UInt>60</UInt>
+ </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>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>usePingTimeout</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>pingTimeout</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>134</x>
+ <y>79</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>208</x>
+ <y>81</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>autoReconnect</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>reconnectLabel</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>75</x>
+ <y>141</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>72</x>
+ <y>178</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>autoReconnect</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>reconnectInterval</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>136</x>
+ <y>142</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>134</x>
+ <y>178</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
# Putting $FOO in SETTINGSPAGES automatically includes
# $FOOsettingspage.cpp, $FOOsettingspage.h and $FOOsettingspage.ui
-set(SETTINGSPAGES aliases appearance backlog bufferview chatview connection chatmonitor coreaccount
+set(SETTINGSPAGES aliases appearance backlog bufferview chatview connection coreconnection chatmonitor coreaccount
highlight identities ignorelist inputwidget itemview networks topicwidget)
# Specify additional files (e.g. for subdialogs) here!