X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fconnectionsettingspage.cpp;h=a9653dc4f2b907eecb76d8ffb5cea4a14be9e7da;hp=969ccd8c380c4c5da8c824318b31d41475b970d1;hb=a65f42197839da536975b3e2858eedcef420035f;hpb=2cdbd53254371cd538a1437c39d22422249fea1a diff --git a/src/qtui/settingspages/connectionsettingspage.cpp b/src/qtui/settingspages/connectionsettingspage.cpp index 969ccd8c..a9653dc4 100644 --- a/src/qtui/settingspages/connectionsettingspage.cpp +++ b/src/qtui/settingspages/connectionsettingspage.cpp @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005-09 by the Quassel Project * + * Copyright (C) 2005-2019 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. * + * (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 * @@ -15,7 +15,7 @@ * 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. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "connectionsettingspage.h" @@ -24,81 +24,96 @@ #include "networkconfig.h" ConnectionSettingsPage::ConnectionSettingsPage(QWidget *parent) - : SettingsPage(tr("IRC"), QString(), parent) { + : SettingsPage(tr("IRC"), QString(), parent) +{ + ui.setupUi(this); + initAutoWidgets(); - ui.setupUi(this); - initAutoWidgets(); + connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected())); + connect(Client::instance(), SIGNAL(disconnected()), this, SLOT(clientDisconnected())); - connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected())); - connect(Client::instance(), SIGNAL(disconnected()), this, SLOT(clientDisconnected())); - - setEnabled(false); - if(Client::isConnected()) - clientConnected(); + setEnabled(false); + if (Client::isConnected()) + clientConnected(); } -void ConnectionSettingsPage::clientConnected() { - if(Client::networkConfig()->isInitialized()) - initDone(); - else - connect(Client::networkConfig(), SIGNAL(initDone()), SLOT(initDone())); -} -void ConnectionSettingsPage::clientDisconnected() { - setEnabled(false); - setChangedState(false); +void ConnectionSettingsPage::clientConnected() +{ + if (Client::networkConfig()->isInitialized()) + initDone(); + else + connect(Client::networkConfig(), SIGNAL(initDone()), SLOT(initDone())); } -void ConnectionSettingsPage::initDone() { - setEnabled(true); + +void ConnectionSettingsPage::clientDisconnected() +{ + setEnabled(false); + setChangedState(false); } -bool ConnectionSettingsPage::hasDefaults() const { - return true; + +void ConnectionSettingsPage::initDone() +{ + setEnabled(true); } -QVariant ConnectionSettingsPage::loadAutoWidgetValue(const QString &widgetName) { - if(!isEnabled()) - return QVariant(); - NetworkConfig *config = Client::networkConfig(); - if(widgetName == "pingTimeoutEnabled") - return config->pingTimeoutEnabled(); - if(widgetName == "pingInterval") - return config->pingInterval(); - if(widgetName == "maxPingCount") - return config->maxPingCount(); - if(widgetName == "autoWhoEnabled") - return config->autoWhoEnabled(); - if(widgetName == "autoWhoInterval") - return config->autoWhoInterval(); - if(widgetName == "autoWhoNickLimit") - return config->autoWhoNickLimit(); - if(widgetName == "autoWhoDelay") - return config->autoWhoDelay(); - - return SettingsPage::loadAutoWidgetValue(widgetName); + +bool ConnectionSettingsPage::hasDefaults() const +{ + return true; } -void ConnectionSettingsPage::saveAutoWidgetValue(const QString &widgetName, const QVariant &value) { - if(!isEnabled()) - return; - NetworkConfig *config = Client::networkConfig(); - if(widgetName == "pingTimeoutEnabled") - config->requestSetPingTimeoutEnabled(value.toBool()); - else if(widgetName == "pingInterval") - config->requestSetPingInterval(value.toInt()); - else if(widgetName == "maxPingCount") - config->requestSetMaxPingCount(value.toInt()); - else if(widgetName == "autoWhoEnabled") - config->requestSetAutoWhoEnabled(value.toBool()); - else if(widgetName == "autoWhoInterval") - config->requestSetAutoWhoInterval(value.toInt()); - else if(widgetName == "autoWhoNickLimit") - config->requestSetAutoWhoNickLimit(value.toInt()); - else if(widgetName == "autoWhoDelay") - config->requestSetAutoWhoDelay(value.toInt()); - - else - SettingsPage::saveAutoWidgetValue(widgetName, value); + +QVariant ConnectionSettingsPage::loadAutoWidgetValue(const QString &widgetName) +{ + if (!isEnabled()) + return QVariant(); + NetworkConfig *config = Client::networkConfig(); + if (widgetName == "pingTimeoutEnabled") + return config->pingTimeoutEnabled(); + if (widgetName == "pingInterval") + return config->pingInterval(); + if (widgetName == "maxPingCount") + return config->maxPingCount(); + if (widgetName == "autoWhoEnabled") + return config->autoWhoEnabled(); + if (widgetName == "autoWhoInterval") + return config->autoWhoInterval(); + if (widgetName == "autoWhoNickLimit") + return config->autoWhoNickLimit(); + if (widgetName == "autoWhoDelay") + return config->autoWhoDelay(); + if (widgetName == "standardCtcp") + return config->standardCtcp(); + + return SettingsPage::loadAutoWidgetValue(widgetName); } + +void ConnectionSettingsPage::saveAutoWidgetValue(const QString &widgetName, const QVariant &value) +{ + if (!isEnabled()) + return; + NetworkConfig *config = Client::networkConfig(); + if (widgetName == "pingTimeoutEnabled") + config->requestSetPingTimeoutEnabled(value.toBool()); + else if (widgetName == "pingInterval") + config->requestSetPingInterval(value.toInt()); + else if (widgetName == "maxPingCount") + config->requestSetMaxPingCount(value.toInt()); + else if (widgetName == "autoWhoEnabled") + config->requestSetAutoWhoEnabled(value.toBool()); + else if (widgetName == "autoWhoInterval") + config->requestSetAutoWhoInterval(value.toInt()); + else if (widgetName == "autoWhoNickLimit") + config->requestSetAutoWhoNickLimit(value.toInt()); + else if (widgetName == "autoWhoDelay") + config->requestSetAutoWhoDelay(value.toInt()); + else if (widgetName == "standardCtcp") + config->requestSetStandardCtcp(value.toBool()); + + else + SettingsPage::saveAutoWidgetValue(widgetName, value); +}