small fixes
authorMarcus Eggenberger <egs@quassel-irc.org>
Mon, 24 Aug 2009 19:23:53 +0000 (21:23 +0200)
committerMarcus Eggenberger <egs@quassel-irc.org>
Mon, 24 Aug 2009 19:54:07 +0000 (21:54 +0200)
src/common/network.cpp
src/common/network.h
src/common/signalproxy.cpp
src/common/syncableobject.cpp
src/core/corebacklogmanager.cpp
src/qtui/settingspages/networkssettingspage.cpp

index b5f9e17..0dae357 100644 (file)
@@ -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 &currentServer) {
@@ -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<Server>(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 &param, const QString &value) {
index 9642162..4c5baf6 100644 (file)
@@ -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);
index a738715..ebcf507 100644 (file)
@@ -231,16 +231,17 @@ SignalProxy::SignalProxy(ProxyMode mode, QIODevice* device, QObject* parent)
 }
 
 SignalProxy::~SignalProxy() {
-  QList<SyncableObject *> syncObjects;
   QHash<QByteArray, ObjectId>::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;
 
index b8c8d5b..325f0be 100644 (file)
@@ -50,10 +50,11 @@ SyncableObject::SyncableObject(const SyncableObject &other, QObject *parent)
 }
 
 SyncableObject::~SyncableObject() {
-  QList<SignalProxy *> proxies = _signalProxies;
-  _signalProxies.clear();
-  for(int i = 0; i < proxies.count(); i++) {
-    proxies[i]->stopSynchronize(this);
+  QList<SignalProxy *>::iterator proxyIter = _signalProxies.begin();
+  while(proxyIter != _signalProxies.end()) {
+    SignalProxy *proxy = (*proxyIter);
+    proxyIter = _signalProxies.erase(proxyIter);
+    proxy->stopSynchronize(this);
   }
 }
 
index 0184653..1c3fae9 100644 (file)
@@ -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<Message> msgList;
   msgList = Core::requestAllMsgs(coreSession()->user(), first, last, limit);
index c45c972..516fb3c 100644 (file)
@@ -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 &)));