X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fsessionthread.cpp;h=6dc47cf7064fa72b98f609b5b0cf6e12127a6e19;hb=db00831bca59a012242d1ad5fac52a20c6cd2956;hp=bdc0a7388d1fcd46dd99db105d2b76db7e54ec5d;hpb=fcacaaf16551524c7ebb6114254d005274cc3d63;p=quassel.git diff --git a/src/core/sessionthread.cpp b/src/core/sessionthread.cpp index bdc0a738..6dc47cf7 100644 --- a/src/core/sessionthread.cpp +++ b/src/core/sessionthread.cpp @@ -18,6 +18,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include "sessionthread.h" + #include #include @@ -25,7 +27,6 @@ #include "coresession.h" #include "internalpeer.h" #include "remotepeer.h" -#include "sessionthread.h" #include "signalproxy.h" namespace { @@ -39,15 +40,14 @@ public: : _userId{userId} , _restoreState{restoreState} , _strictIdentEnabled{strictIdentEnabled} - { - } + {} public slots: void initialize() { _session = new CoreSession{_userId, _restoreState, _strictIdentEnabled, this}; connect(_session, &QObject::destroyed, QThread::currentThread(), &QThread::quit); - connect(_session, SIGNAL(sessionState(Protocol::SessionState)), Core::instance(), SIGNAL(sessionState(Protocol::SessionState))); + connect(_session, &CoreSession::sessionStateReceived, Core::instance(), &Core::sessionStateReceived); emit initialized(); } @@ -58,7 +58,7 @@ public slots: } } - void addClient(Peer *peer) + void addClient(Peer* peer) { if (!_session) { qWarning() << "Session not initialized!"; @@ -89,9 +89,9 @@ private: QPointer _session; }; -} // anon +} // namespace -SessionThread::SessionThread(UserId uid, bool restoreState, bool strictIdentEnabled, QObject *parent) +SessionThread::SessionThread(UserId uid, bool restoreState, bool strictIdentEnabled, QObject* parent) : QObject(parent) { auto worker = new Worker(uid, restoreState, strictIdentEnabled); @@ -108,7 +108,6 @@ SessionThread::SessionThread(UserId uid, bool restoreState, bool strictIdentEnab QTimer::singleShot(0, &_sessionThread, SLOT(start())); } - SessionThread::~SessionThread() { // shut down thread gracefully @@ -116,17 +115,15 @@ SessionThread::~SessionThread() _sessionThread.wait(30000); } - void SessionThread::shutdown() { emit shutdownSession(); } - void SessionThread::onSessionInitialized() { _sessionInitialized = true; - for (auto &&peer : _clientQueue) { + for (auto&& peer : _clientQueue) { peer->setParent(nullptr); peer->moveToThread(&_sessionThread); emit addClientToWorker(peer); @@ -134,13 +131,12 @@ void SessionThread::onSessionInitialized() _clientQueue.clear(); } - void SessionThread::onSessionDestroyed() { emit shutdownComplete(this); } -void SessionThread::addClient(Peer *peer) +void SessionThread::addClient(Peer* peer) { if (_sessionInitialized) { peer->setParent(nullptr);