-#include <stdio.h>
-#include <stdlib.h>
-
-Client::Client(std::unique_ptr<AbstractUi> ui, QObject *parent)
- : QObject(parent), Singleton<Client>(this),
- _signalProxy(new SignalProxy(SignalProxy::Client, this)),
- _mainUi(std::move(ui)),
- _networkModel(new NetworkModel(this)),
- _bufferModel(new BufferModel(_networkModel)),
- _bufferSyncer(0),
- _aliasManager(0),
- _backlogManager(new ClientBacklogManager(this)),
- _bufferViewManager(0),
- _bufferViewOverlay(new BufferViewOverlay(this)),
- _coreInfo(new CoreInfo(this)),
- _dccConfig(0),
- _ircListHelper(new ClientIrcListHelper(this)),
- _inputHandler(new ClientUserInputHandler(this)),
- _networkConfig(0),
- _ignoreListManager(0),
- _highlightRuleManager(0),
- _transferManager(0),
- _transferModel(new TransferModel(this)),
- _messageModel(_mainUi->createMessageModel(this)),
- _messageProcessor(_mainUi->createMessageProcessor(this)),
- _coreAccountModel(new CoreAccountModel(this)),
- _coreConnection(new CoreConnection(this)),
- _connected(false)
-{
- //connect(mainUi(), SIGNAL(connectToCore(const QVariantMap &)), this, SLOT(connectToCore(const QVariantMap &)));
- connect(mainUi(), SIGNAL(disconnectFromCore()), this, SLOT(disconnectFromCore()));
- connect(this, SIGNAL(connected()), mainUi(), SLOT(connectedToCore()));
- connect(this, SIGNAL(disconnected()), mainUi(), SLOT(disconnectedFromCore()));
-
- connect(this, SIGNAL(networkRemoved(NetworkId)), _networkModel, SLOT(networkRemoved(NetworkId)));
- connect(this, SIGNAL(networkRemoved(NetworkId)), _messageProcessor, SLOT(networkRemoved(NetworkId)));
-
- connect(backlogManager(), SIGNAL(messagesReceived(BufferId, int)), _messageModel, SLOT(messagesReceived(BufferId, int)));
- connect(coreConnection(), SIGNAL(stateChanged(CoreConnection::ConnectionState)), SLOT(connectionStateChanged(CoreConnection::ConnectionState)));
-
- SignalProxy *p = signalProxy();
-
- p->attachSlot(SIGNAL(displayMsg(const Message &)), this, SLOT(recvMessage(const Message &)));
- p->attachSlot(SIGNAL(displayStatusMsg(QString, QString)), this, SLOT(recvStatusMsg(QString, QString)));
-
- p->attachSlot(SIGNAL(bufferInfoUpdated(BufferInfo)), _networkModel, SLOT(bufferUpdated(BufferInfo)));
- p->attachSignal(inputHandler(), SIGNAL(sendInput(BufferInfo, QString)));
- p->attachSignal(this, SIGNAL(requestNetworkStates()));
-
- p->attachSignal(this, SIGNAL(requestCreateIdentity(const Identity &, const QVariantMap &)), SIGNAL(createIdentity(const Identity &, const QVariantMap &)));
- p->attachSignal(this, SIGNAL(requestRemoveIdentity(IdentityId)), SIGNAL(removeIdentity(IdentityId)));
- p->attachSlot(SIGNAL(identityCreated(const Identity &)), this, SLOT(coreIdentityCreated(const Identity &)));
- p->attachSlot(SIGNAL(identityRemoved(IdentityId)), this, SLOT(coreIdentityRemoved(IdentityId)));
-
- p->attachSignal(this, SIGNAL(requestCreateNetwork(const NetworkInfo &, const QStringList &)), SIGNAL(createNetwork(const NetworkInfo &, const QStringList &)));
- 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(requestPasswordChange(PeerPtr,QString,QString,QString)), SIGNAL(changePassword(PeerPtr,QString,QString,QString)));
- p->attachSlot(SIGNAL(passwordChanged(PeerPtr,bool)), this, SLOT(corePasswordChanged(PeerPtr,bool)));
-
- p->attachSignal(this, SIGNAL(requestKickClient(int)), SIGNAL(kickClient(int)));
- p->attachSlot(SIGNAL(disconnectFromCore()), this, SLOT(disconnectFromCore()));
+Client::Client(std::unique_ptr<AbstractUi> ui, QObject* parent)
+ : QObject(parent)
+ , Singleton<Client>(this)
+ , _signalProxy(new SignalProxy(SignalProxy::Client, this))
+ , _mainUi(std::move(ui))
+ , _networkModel(new NetworkModel(this))
+ , _bufferModel(new BufferModel(_networkModel))
+ , _backlogManager(new ClientBacklogManager(this))
+ , _bufferViewOverlay(new BufferViewOverlay(this))
+ , _coreInfo(new CoreInfo(this))
+ , _ircListHelper(new ClientIrcListHelper(this))
+ , _inputHandler(new ClientUserInputHandler(this))
+ , _transferModel(new TransferModel(this))
+ , _messageModel(_mainUi->createMessageModel(this))
+ , _messageProcessor(_mainUi->createMessageProcessor(this))
+ , _coreAccountModel(new CoreAccountModel(this))
+ , _coreConnection(new CoreConnection(this))
+{
+#ifdef EMBED_DATA
+ Q_INIT_RESOURCE(data);
+#endif
+
+ connect(mainUi(), &AbstractUi::disconnectFromCore, this, &Client::disconnectFromCore);
+ connect(this, &Client::connected, mainUi(), &AbstractUi::connectedToCore);
+ connect(this, &Client::disconnected, mainUi(), &AbstractUi::disconnectedFromCore);
+
+ connect(this, &Client::networkRemoved, _networkModel, &NetworkModel::networkRemoved);
+ connect(this, &Client::networkRemoved, _messageProcessor, &AbstractMessageProcessor::networkRemoved);
+
+ connect(backlogManager(), &ClientBacklogManager::messagesReceived, _messageModel, &MessageModel::messagesReceived);
+ connect(coreConnection(), &CoreConnection::stateChanged, this, &Client::connectionStateChanged);
+
+ SignalProxy* p = signalProxy();
+
+ p->attachSlot(SIGNAL(displayMsg(Message)), this, &Client::recvMessage);
+ p->attachSlot(SIGNAL(displayStatusMsg(QString,QString)), this, &Client::recvStatusMsg);
+
+ p->attachSlot(SIGNAL(bufferInfoUpdated(BufferInfo)), _networkModel, &NetworkModel::bufferUpdated);
+ p->attachSignal(inputHandler(), &ClientUserInputHandler::sendInput);
+ p->attachSignal(this, &Client::requestNetworkStates);
+
+ p->attachSignal(this, &Client::requestCreateIdentity, SIGNAL(createIdentity(Identity,QVariantMap)));
+ p->attachSignal(this, &Client::requestRemoveIdentity, SIGNAL(removeIdentity(IdentityId)));
+ p->attachSlot(SIGNAL(identityCreated(Identity)), this, &Client::coreIdentityCreated);
+ p->attachSlot(SIGNAL(identityRemoved(IdentityId)), this, &Client::coreIdentityRemoved);
+
+ p->attachSignal(this, &Client::requestCreateNetwork, SIGNAL(createNetwork(NetworkInfo,QStringList)));
+ p->attachSignal(this, &Client::requestRemoveNetwork, SIGNAL(removeNetwork(NetworkId)));
+ p->attachSlot(SIGNAL(networkCreated(NetworkId)), this, &Client::coreNetworkCreated);
+ p->attachSlot(SIGNAL(networkRemoved(NetworkId)), this, &Client::coreNetworkRemoved);
+
+ p->attachSignal(this, &Client::requestPasswordChange, SIGNAL(changePassword(PeerPtr,QString,QString,QString)));
+ p->attachSlot(SIGNAL(passwordChanged(PeerPtr,bool)), this, &Client::corePasswordChanged);
+
+ p->attachSignal(this, &Client::requestKickClient, SIGNAL(kickClient(int)));
+ p->attachSlot(SIGNAL(disconnectFromCore()), this, &Client::disconnectFromCore);