X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fnetworkssettingspage.cpp;h=edfcbf5cd6c3b5c76c234db6947f388c36476137;hb=1c0ad0ad9c7f7c71e642c868f731fe259f5776c2;hp=8e03ce6204f2bc1202ed35ab345df844973ed08b;hpb=d637a77754d0138f47b10378463d87ef5a98214f;p=quassel.git diff --git a/src/qtui/settingspages/networkssettingspage.cpp b/src/qtui/settingspages/networkssettingspage.cpp index 8e03ce62..edfcbf5c 100644 --- a/src/qtui/settingspages/networkssettingspage.cpp +++ b/src/qtui/settingspages/networkssettingspage.cpp @@ -42,9 +42,11 @@ NetworksSettingsPage::NetworksSettingsPage(QWidget *parent) : SettingsPage(tr("G QByteArray codec = QTextCodec::codecForMib(mib)->name(); ui.sendEncoding->addItem(codec); ui.recvEncoding->addItem(codec); + ui.serverEncoding->addItem(codec); } ui.sendEncoding->model()->sort(0); ui.recvEncoding->model()->sort(0); + ui.serverEncoding->model()->sort(0); currentId = 0; setEnabled(Client::isConnected()); // need a core connection! setWidgetStates(); @@ -63,6 +65,7 @@ NetworksSettingsPage::NetworksSettingsPage(QWidget *parent) : SettingsPage(tr("G connect(ui.useDefaultEncodings, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); connect(ui.sendEncoding, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); connect(ui.recvEncoding, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); + connect(ui.serverEncoding, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); connect(ui.autoReconnect, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); connect(ui.reconnectInterval, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged())); connect(ui.reconnectRetries, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged())); @@ -230,17 +233,13 @@ void NetworksSettingsPage::setItemState(NetworkId id, QListWidgetItem *item) { if(oldid == currentId) { select = true; currentId = 0; + ui.networkList->clearSelection(); } int row = ui.networkList->row(i); if(row >= 0) { - qDebug() << "ABOUT TO REMOVE: id=" << oldid << "from row" << row; QListWidgetItem *olditem = ui.networkList->takeItem(row); - qDebug() << "Successfully removed item from list."; - if(!olditem) { - qWarning() << "NetworksSettingsPage::setItemState(): Why the heck don't we have an itempointer here?"; - Q_ASSERT(olditem); // abort non-gracefully, I need to figure out what's causing this - } - else delete olditem; + Q_ASSERT(olditem); + delete olditem; } networkInfos.remove(oldid); break; @@ -325,7 +324,24 @@ QListWidgetItem *NetworksSettingsPage::networkItem(NetworkId id) const { void NetworksSettingsPage::clientNetworkAdded(NetworkId id) { insertNetwork(id); - connect(Client::network(id), SIGNAL(updatedRemotely()), this, SLOT(clientNetworkUpdated())); + //connect(Client::network(id), SIGNAL(updatedRemotely()), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(identitySet(IdentityId)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(networkNameSet(const QString &)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(serverListSet(QVariantList)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(useRandomServerSet(bool)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(performSet(const QStringList &)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(useAutoIdentifySet(bool)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(autoIdentifyServiceSet(const QString &)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(autoIdentifyPasswordSet(const QString &)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(useAutoReconnectSet(bool)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(autoReconnectIntervalSet(quint32)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(autoReconnectRetriesSet(quint16)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(unlimitedReconnectRetriesSet(bool)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(rejoinChannelsSet(bool)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(codecForServerSet(const QByteArray &)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(codecForEncodingSet(const QByteArray &)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(codecForDecodingSet(const QByteArray &)), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), SIGNAL(connectionStateSet(Network::ConnectionState)), this, SLOT(networkConnectionStateChanged(Network::ConnectionState))); connect(Client::network(id), SIGNAL(connectionError(const QString &)), this, SLOT(networkConnectionError(const QString &))); } @@ -403,7 +419,7 @@ void NetworksSettingsPage::displayNetwork(NetworkId id) { foreach(QVariant v, info.serverList) { ui.serverList->addItem(QString("%1:%2").arg(v.toMap()["Host"].toString()).arg(v.toMap()["Port"].toUInt())); } - setItemState(id); + //setItemState(id); ui.randomServer->setChecked(info.useRandomServer); ui.performEdit->setPlainText(info.perform.join("\n")); ui.autoIdentify->setChecked(info.useAutoIdentify); @@ -412,10 +428,12 @@ void NetworksSettingsPage::displayNetwork(NetworkId id) { if(info.codecForEncoding.isEmpty()) { ui.sendEncoding->setCurrentIndex(ui.sendEncoding->findText(Network::defaultCodecForEncoding())); ui.recvEncoding->setCurrentIndex(ui.recvEncoding->findText(Network::defaultCodecForDecoding())); + ui.serverEncoding->setCurrentIndex(ui.serverEncoding->findText(Network::defaultCodecForServer())); ui.useDefaultEncodings->setChecked(true); } else { ui.sendEncoding->setCurrentIndex(ui.sendEncoding->findText(info.codecForEncoding)); ui.recvEncoding->setCurrentIndex(ui.recvEncoding->findText(info.codecForDecoding)); + ui.serverEncoding->setCurrentIndex(ui.serverEncoding->findText(info.codecForServer)); ui.useDefaultEncodings->setChecked(false); } ui.autoReconnect->setChecked(info.useAutoReconnect); @@ -446,9 +464,11 @@ void NetworksSettingsPage::saveToNetworkInfo(NetworkInfo &info) { if(ui.useDefaultEncodings->isChecked()) { info.codecForEncoding.clear(); info.codecForDecoding.clear(); + info.codecForServer.clear(); } else { info.codecForEncoding = ui.sendEncoding->currentText().toLatin1(); info.codecForDecoding = ui.recvEncoding->currentText().toLatin1(); + info.codecForServer = ui.serverEncoding->currentText().toLatin1(); } info.useAutoReconnect = ui.autoReconnect->isChecked(); info.autoReconnectInterval = ui.reconnectInterval->value();