projects
/
quassel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c0c8cea
)
Introducing Network::requestSetNetworkInfo() to simplify client-side updates
author
Manuel Nickschas
<sputnick@quassel-irc.org>
Sun, 17 Aug 2008 22:04:42 +0000
(
00:04
+0200)
committer
Manuel Nickschas
<sputnick@quassel-irc.org>
Sun, 17 Aug 2008 22:05:17 +0000
(
00:05
+0200)
src/client/client.cpp
patch
|
blob
|
history
src/client/client.h
patch
|
blob
|
history
src/common/network.h
patch
|
blob
|
history
src/core/corenetwork.cpp
patch
|
blob
|
history
src/core/corenetwork.h
patch
|
blob
|
history
src/core/coresession.cpp
patch
|
blob
|
history
src/core/coresession.h
patch
|
blob
|
history
src/qtui/settingspages/networkssettingspage.cpp
patch
|
blob
|
history
diff --git
a/src/client/client.cpp
b/src/client/client.cpp
index
2b667e0
..
a2ffd8e
100644
(file)
--- a/
src/client/client.cpp
+++ b/
src/client/client.cpp
@@
-115,7
+115,6
@@
void Client::init() {
p->attachSlot(SIGNAL(identityRemoved(IdentityId)), this, SLOT(coreIdentityRemoved(IdentityId)));
p->attachSignal(this, SIGNAL(requestCreateNetwork(const NetworkInfo &)), SIGNAL(createNetwork(const NetworkInfo &)));
p->attachSlot(SIGNAL(identityRemoved(IdentityId)), this, SLOT(coreIdentityRemoved(IdentityId)));
p->attachSignal(this, SIGNAL(requestCreateNetwork(const NetworkInfo &)), SIGNAL(createNetwork(const NetworkInfo &)));
- p->attachSignal(this, SIGNAL(requestUpdateNetwork(const NetworkInfo &)), SIGNAL(updateNetwork(const NetworkInfo &)));
p->attachSignal(this, SIGNAL(requestRemoveNetwork(NetworkId)), SIGNAL(removeNetwork(NetworkId)));
p->attachSlot(SIGNAL(networkCreated(NetworkId)), this, SLOT(coreNetworkCreated(NetworkId)));
p->attachSlot(SIGNAL(networkRemoved(NetworkId)), this, SLOT(coreNetworkRemoved(NetworkId)));
p->attachSignal(this, SIGNAL(requestRemoveNetwork(NetworkId)), SIGNAL(removeNetwork(NetworkId)));
p->attachSlot(SIGNAL(networkCreated(NetworkId)), this, SLOT(coreNetworkCreated(NetworkId)));
p->attachSlot(SIGNAL(networkRemoved(NetworkId)), this, SLOT(coreNetworkRemoved(NetworkId)));
@@
-207,14
+206,19
@@
void Client::createNetwork(const NetworkInfo &info) {
emit instance()->requestCreateNetwork(info);
}
emit instance()->requestCreateNetwork(info);
}
-void Client::updateNetwork(const NetworkInfo &info) {
- emit instance()->requestUpdateNetwork(info);
-}
-
void Client::removeNetwork(NetworkId id) {
emit instance()->requestRemoveNetwork(id);
}
void Client::removeNetwork(NetworkId id) {
emit instance()->requestRemoveNetwork(id);
}
+void Client::updateNetwork(const NetworkInfo &info) {
+ Network *netptr = instance()->_networks.value(info.networkId, 0);
+ if(!netptr) {
+ qWarning() << "Update for unknown network requested:" << info;
+ return;
+ }
+ netptr->requestSetNetworkInfo(info);
+}
+
void Client::addNetwork(Network *net) {
net->setProxy(signalProxy());
signalProxy()->synchronize(net);
void Client::addNetwork(Network *net) {
net->setProxy(signalProxy());
signalProxy()->synchronize(net);
@@
-257,7
+261,6
@@
void Client::createIdentity(const Identity &id) {
}
void Client::updateIdentity(IdentityId id, const QVariantMap &ser) {
}
void Client::updateIdentity(IdentityId id, const QVariantMap &ser) {
- //emit instance()->requestUpdateIdentity(id);
Identity *idptr = instance()->_identities.value(id, 0);
if(!idptr) {
qWarning() << "Update for unknown identity requested:" << id;
Identity *idptr = instance()->_identities.value(id, 0);
if(!idptr) {
qWarning() << "Update for unknown identity requested:" << id;
diff --git
a/src/client/client.h
b/src/client/client.h
index
8b991bd
..
e626d75
100644
(file)
--- a/
src/client/client.h
+++ b/
src/client/client.h
@@
-153,7
+153,6
@@
signals:
void networkRemoved(NetworkId id);
void requestCreateNetwork(const NetworkInfo &info);
void networkRemoved(NetworkId id);
void requestCreateNetwork(const NetworkInfo &info);
- void requestUpdateNetwork(const NetworkInfo &info);
void requestRemoveNetwork(NetworkId);
public slots:
void requestRemoveNetwork(NetworkId);
public slots:
diff --git
a/src/common/network.h
b/src/common/network.h
index
1371231
..
5d272c5
100644
(file)
--- a/
src/common/network.h
+++ b/
src/common/network.h
@@
-88,7
+88,7
@@
public:
D_CHANMODE = 0x08
};
D_CHANMODE = 0x08
};
-
+
Network(const NetworkId &networkid, QObject *parent = 0);
~Network();
Network(const NetworkId &networkid, QObject *parent = 0);
~Network();
@@
-113,7
+113,7
@@
public:
ChannelModeType channelModeType(const QString &mode);
inline ChannelModeType channelModeType(const QCharRef &mode) { return channelModeType(QString(mode)); }
ChannelModeType channelModeType(const QString &mode);
inline ChannelModeType channelModeType(const QCharRef &mode) { return channelModeType(QString(mode)); }
-
+
inline const QString &networkName() const { return _networkName; }
inline const QString ¤tServer() const { return _currentServer; }
inline const QString &myNick() const { return _myNick; }
inline const QString &networkName() const { return _networkName; }
inline const QString ¤tServer() const { return _currentServer; }
inline const QString &myNick() const { return _myNick; }
@@
-216,14
+216,14
@@
public slots:
virtual QVariantMap initIrcUsersAndChannels() const;
// QStringList initIrcUsers() const;
// QStringList initIrcChannels() const;
virtual QVariantMap initIrcUsersAndChannels() const;
// QStringList initIrcUsers() const;
// QStringList initIrcChannels() const;
-
+
//init seters
void initSetSupports(const QVariantMap &supports);
inline void initSetServerList(const QVariantList &serverList) { setServerList(serverList); }
virtual void initSetIrcUsersAndChannels(const QVariantMap &usersAndChannels);
// void initSetIrcUsers(const QStringList &hostmasks);
// void initSetIrcChannels(const QStringList &channels);
//init seters
void initSetSupports(const QVariantMap &supports);
inline void initSetServerList(const QVariantList &serverList) { setServerList(serverList); }
virtual void initSetIrcUsersAndChannels(const QVariantMap &usersAndChannels);
// void initSetIrcUsers(const QStringList &hostmasks);
// void initSetIrcChannels(const QStringList &channels);
-
+
IrcUser *updateNickFromMask(const QString &mask);
// these slots are to keep the hashlists of all users and the
IrcUser *updateNickFromMask(const QString &mask);
// these slots are to keep the hashlists of all users and the
@@
-232,6
+232,7
@@
public slots:
virtual inline void requestConnect() const { emit connectRequested(); }
virtual inline void requestDisconnect() const { emit disconnectRequested(); }
virtual inline void requestConnect() const { emit connectRequested(); }
virtual inline void requestDisconnect() const { emit disconnectRequested(); }
+ virtual inline void requestSetNetworkInfo(const NetworkInfo &info) { emit setNetworkInfoRequested(info); }
void emitConnectionError(const QString &);
void emitConnectionError(const QString &);
@@
-292,6
+293,7
@@
signals:
void connectRequested(NetworkId id = 0) const;
void disconnectRequested(NetworkId id = 0) const;
void connectRequested(NetworkId id = 0) const;
void disconnectRequested(NetworkId id = 0) const;
+ void setNetworkInfoRequested(const NetworkInfo &) const;
private:
QPointer<SignalProxy> _proxy;
private:
QPointer<SignalProxy> _proxy;
diff --git
a/src/core/corenetwork.cpp
b/src/core/corenetwork.cpp
index
e22a67d
..
6a2149d
100644
(file)
--- a/
src/core/corenetwork.cpp
+++ b/
src/core/corenetwork.cpp
@@
-18,6
+18,7
@@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
+#include "core.h"
#include "corenetwork.h"
#include "coresession.h"
#include "corenetwork.h"
#include "coresession.h"
@@
-44,3
+45,8
@@
void CoreNetwork::requestDisconnect() const {
}
emit disconnectRequested(networkId());
}
}
emit disconnectRequested(networkId());
}
+
+void CoreNetwork::requestSetNetworkInfo(const NetworkInfo &info) {
+ setNetworkInfo(info);
+ Core::updateNetwork(coreSession()->user(), info);
+}
diff --git
a/src/core/corenetwork.h
b/src/core/corenetwork.h
index
4c956cf
..
fd96ff6
100644
(file)
--- a/
src/core/corenetwork.h
+++ b/
src/core/corenetwork.h
@@
-38,6
+38,7
@@
public:
public slots:
virtual void requestConnect() const;
virtual void requestDisconnect() const;
public slots:
virtual void requestConnect() const;
virtual void requestDisconnect() const;
+ virtual void requestSetNetworkInfo(const NetworkInfo &info);
private:
CoreSession *_coreSession;
private:
CoreSession *_coreSession;
diff --git
a/src/core/coresession.cpp
b/src/core/coresession.cpp
index
efdad6e
..
5bdfefe
100644
(file)
--- a/
src/core/coresession.cpp
+++ b/
src/core/coresession.cpp
@@
-71,7
+71,6
@@
CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent)
p->attachSignal(this, SIGNAL(networkCreated(NetworkId)));
p->attachSignal(this, SIGNAL(networkRemoved(NetworkId)));
p->attachSlot(SIGNAL(createNetwork(const NetworkInfo &)), this, SLOT(createNetwork(const NetworkInfo &)));
p->attachSignal(this, SIGNAL(networkCreated(NetworkId)));
p->attachSignal(this, SIGNAL(networkRemoved(NetworkId)));
p->attachSlot(SIGNAL(createNetwork(const NetworkInfo &)), this, SLOT(createNetwork(const NetworkInfo &)));
- p->attachSlot(SIGNAL(updateNetwork(const NetworkInfo &)), this, SLOT(updateNetwork(const NetworkInfo &)));
p->attachSlot(SIGNAL(removeNetwork(NetworkId)), this, SLOT(removeNetwork(NetworkId)));
loadSettings();
p->attachSlot(SIGNAL(removeNetwork(NetworkId)), this, SLOT(removeNetwork(NetworkId)));
loadSettings();
@@
-432,20
+431,10
@@
void CoreSession::createNetwork(const NetworkInfo &info_) {
emit networkCreated(id);
} else {
quWarning() << qPrintable(tr("CoreSession::createNetwork(): Trying to create a network that already exists, updating instead!"));
emit networkCreated(id);
} else {
quWarning() << qPrintable(tr("CoreSession::createNetwork(): Trying to create a network that already exists, updating instead!"));
-
updateNetwork
(info);
+
_networks[info.networkId]->requestSetNetworkInfo
(info);
}
}
}
}
-// FIXME: move to CoreNetwork
-void CoreSession::updateNetwork(const NetworkInfo &info) {
- if(!_networks.contains(info.networkId)) {
- quWarning() << "Update request for unknown network received!";
- return;
- }
- _networks[info.networkId]->setNetworkInfo(info);
- Core::updateNetwork(user(), info);
-}
-
void CoreSession::removeNetwork(NetworkId id) {
// Make sure the network is disconnected!
NetworkConnection *conn = _connections.value(id, 0);
void CoreSession::removeNetwork(NetworkId id) {
// Make sure the network is disconnected!
NetworkConnection *conn = _connections.value(id, 0);
diff --git
a/src/core/coresession.h
b/src/core/coresession.h
index
7dd03c4
..
492208a
100644
(file)
--- a/
src/core/coresession.h
+++ b/
src/core/coresession.h
@@
-93,11
+93,6
@@
public slots:
*/
void createNetwork(const NetworkInfo &info);
*/
void createNetwork(const NetworkInfo &info);
- //! Update a network and propagate the changes to the clients.
- /** \param info The updated network settings.
- */
- void updateNetwork(const NetworkInfo &info);
-
//! Remove identity and propagate that fact to the clients.
/** \param identity The identity to be removed.
*/
//! Remove identity and propagate that fact to the clients.
/** \param identity The identity to be removed.
*/
@@
-163,7
+158,6
@@
private slots:
void destroyNetwork(NetworkId);
void identityUpdated(const QVariantMap &);
void destroyNetwork(NetworkId);
void identityUpdated(const QVariantMap &);
- //void networkUpdated(const QVariantMap &);
//! Called when storage updated a BufferInfo.
/** This emits bufferInfoUpdated() via SignalProxy, iff it's one of our buffers.
//! Called when storage updated a BufferInfo.
/** This emits bufferInfoUpdated() via SignalProxy, iff it's one of our buffers.
diff --git
a/src/qtui/settingspages/networkssettingspage.cpp
b/src/qtui/settingspages/networkssettingspage.cpp
index
7c06ed4
..
1ed468f
100644
(file)
--- a/
src/qtui/settingspages/networkssettingspage.cpp
+++ b/
src/qtui/settingspages/networkssettingspage.cpp
@@
-315,7
+315,7
@@
void NetworksSettingsPage::clientIdentityRemoved(IdentityId id) {
}
QListWidgetItem *NetworksSettingsPage::networkItem(NetworkId id) const {
}
QListWidgetItem *NetworksSettingsPage::networkItem(NetworkId id) const {
- for(int i = 0; i < ui.networkList->count(); i++) {
+ for(int i = 0; i < ui.networkList->count(); i++) {
QListWidgetItem *item = ui.networkList->item(i);
if(item->data(Qt::UserRole).value<NetworkId>() == id) return item;
}
QListWidgetItem *item = ui.networkList->item(i);
if(item->data(Qt::UserRole).value<NetworkId>() == id) return item;
}