From 70283ef877bdf3339fb067667ad9130ceabd8b9a Mon Sep 17 00:00:00 2001 From: Marcus Eggenberger Date: Mon, 24 Aug 2009 21:23:53 +0200 Subject: [PATCH] small fixes --- src/common/network.cpp | 16 ++++++++++++++++ src/common/network.h | 4 +++- src/common/signalproxy.cpp | 12 ++++++------ src/common/syncableobject.cpp | 9 +++++---- src/core/corebacklogmanager.cpp | 1 - src/qtui/settingspages/networkssettingspage.cpp | 17 +---------------- 6 files changed, 31 insertions(+), 28 deletions(-) diff --git a/src/common/network.cpp b/src/common/network.cpp index b5f9e173..0dae357e 100644 --- a/src/common/network.cpp +++ b/src/common/network.cpp @@ -336,6 +336,7 @@ void Network::setCodecForServer(QTextCodec *codec) { _codecForServer = codec; QByteArray codecName = codecForServer(); SYNC_OTHER(setCodecForServer, ARG(codecName)) + emit configChanged(); } QByteArray Network::codecForEncoding() const { @@ -352,6 +353,7 @@ void Network::setCodecForEncoding(QTextCodec *codec) { _codecForEncoding = codec; QByteArray codecName = codecForEncoding(); SYNC_OTHER(setCodecForEncoding, ARG(codecName)) + emit configChanged(); } QByteArray Network::codecForDecoding() const { @@ -368,6 +370,7 @@ void Network::setCodecForDecoding(QTextCodec *codec) { _codecForDecoding = codec; QByteArray codecName = codecForDecoding(); SYNC_OTHER(setCodecForDecoding, ARG(codecName)) + emit configChanged(); } // FIXME use server encoding if appropriate @@ -473,6 +476,7 @@ void Network::setNetworkName(const QString &networkName) { _networkName = networkName; SYNC(ARG(networkName)) emit networkNameSet(networkName); + emit configChanged(); } void Network::setCurrentServer(const QString ¤tServer) { @@ -523,61 +527,73 @@ void Network::setIdentity(IdentityId id) { _identity = id; SYNC(ARG(id)) emit identitySet(id); + emit configChanged(); } void Network::setServerList(const QVariantList &serverList) { _serverList = fromVariantList(serverList); SYNC(ARG(serverList)) + emit configChanged(); } void Network::setUseRandomServer(bool use) { _useRandomServer = use; SYNC(ARG(use)) + emit configChanged(); } void Network::setPerform(const QStringList &perform) { _perform = perform; SYNC(ARG(perform)) + emit configChanged(); } void Network::setUseAutoIdentify(bool use) { _useAutoIdentify = use; SYNC(ARG(use)) + emit configChanged(); } void Network::setAutoIdentifyService(const QString &service) { _autoIdentifyService = service; SYNC(ARG(service)) + emit configChanged(); } void Network::setAutoIdentifyPassword(const QString &password) { _autoIdentifyPassword = password; SYNC(ARG(password)) + emit configChanged(); } void Network::setUseAutoReconnect(bool use) { _useAutoReconnect = use; SYNC(ARG(use)) + emit configChanged(); } void Network::setAutoReconnectInterval(quint32 interval) { _autoReconnectInterval = interval; SYNC(ARG(interval)) + emit configChanged(); } void Network::setAutoReconnectRetries(quint16 retries) { _autoReconnectRetries = retries; SYNC(ARG(retries)) + emit configChanged(); } void Network::setUnlimitedReconnectRetries(bool unlimited) { _unlimitedReconnectRetries = unlimited; SYNC(ARG(unlimited)) + emit configChanged(); } void Network::setRejoinChannels(bool rejoin) { _rejoinChannels = rejoin; SYNC(ARG(rejoin)) + emit configChanged(); } void Network::addSupport(const QString ¶m, const QString &value) { diff --git a/src/common/network.h b/src/common/network.h index 96421626..4c5baf6c 100644 --- a/src/common/network.h +++ b/src/common/network.h @@ -278,7 +278,9 @@ signals: // void latencySet(int latency); void identitySet(IdentityId); -// void serverListSet(QVariantList serverList); + void configChanged(); + + // void serverListSet(QVariantList serverList); // void useRandomServerSet(bool); // void performSet(const QStringList &); // void useAutoIdentifySet(bool); diff --git a/src/common/signalproxy.cpp b/src/common/signalproxy.cpp index a7387151..ebcf5076 100644 --- a/src/common/signalproxy.cpp +++ b/src/common/signalproxy.cpp @@ -231,16 +231,17 @@ SignalProxy::SignalProxy(ProxyMode mode, QIODevice* device, QObject* parent) } SignalProxy::~SignalProxy() { - QList syncObjects; QHash::iterator classIter = _syncSlave.begin(); while(classIter != _syncSlave.end()) { - syncObjects << classIter->values(); + ObjectId::iterator objIter = classIter->begin(); + while(objIter != classIter->end()) { + SyncableObject *obj = objIter.value(); + objIter = classIter->erase(objIter); + obj->stopSynchronize(this); + } classIter++; } _syncSlave.clear(); - foreach(SyncableObject *obj, syncObjects) { - obj->stopSynchronize(this); - } removeAllPeers(); } @@ -414,7 +415,6 @@ void SignalProxy::renameObject(const SyncableObject *obj, const QString &newname } void SignalProxy::objectRenamed(const QByteArray &classname, const QString &newname, const QString &oldname) { - qDebug() << "SignalProxy::objectRenamed" << classname << newname << oldname; if(proxyMode() == Server) return; diff --git a/src/common/syncableobject.cpp b/src/common/syncableobject.cpp index b8c8d5ba..325f0be3 100644 --- a/src/common/syncableobject.cpp +++ b/src/common/syncableobject.cpp @@ -50,10 +50,11 @@ SyncableObject::SyncableObject(const SyncableObject &other, QObject *parent) } SyncableObject::~SyncableObject() { - QList proxies = _signalProxies; - _signalProxies.clear(); - for(int i = 0; i < proxies.count(); i++) { - proxies[i]->stopSynchronize(this); + QList::iterator proxyIter = _signalProxies.begin(); + while(proxyIter != _signalProxies.end()) { + SignalProxy *proxy = (*proxyIter); + proxyIter = _signalProxies.erase(proxyIter); + proxy->stopSynchronize(this); } } diff --git a/src/core/corebacklogmanager.cpp b/src/core/corebacklogmanager.cpp index 0184653f..1c3fae98 100644 --- a/src/core/corebacklogmanager.cpp +++ b/src/core/corebacklogmanager.cpp @@ -75,7 +75,6 @@ QVariantList CoreBacklogManager::requestBacklog(BufferId bufferId, MsgId first, } QVariantList CoreBacklogManager::requestBacklogAll(MsgId first, MsgId last, int limit, int additional) { - qDebug() << "CoreBacklogManager::requestBacklogAll" << first << last << limit << additional; QVariantList backlog; QList msgList; msgList = Core::requestAllMsgs(coreSession()->user(), first, last, limit); diff --git a/src/qtui/settingspages/networkssettingspage.cpp b/src/qtui/settingspages/networkssettingspage.cpp index c45c9729..516fb3ce 100644 --- a/src/qtui/settingspages/networkssettingspage.cpp +++ b/src/qtui/settingspages/networkssettingspage.cpp @@ -337,22 +337,7 @@ 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(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(configChanged()), 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 &))); -- 2.20.1