modernize: Use '= default' instead of empty ctor/dtor bodies
[quassel.git] / src / core / sessionthread.h
index f9280f0..e360754 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-09 by the Quassel Project                          *
+ *   Copyright (C) 2005-2018 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
-#ifndef SESSIONTHREAD_H
-#define SESSIONTHREAD_H
+#pragma once
+
+#include <memory>
 
-#include <QMutex>
 #include <QThread>
 
 #include "types.h"
 
 class CoreSession;
-class QIODevice;
-class SignalProxy;
+class Peer;
+class InternalPeer;
+class RemotePeer;
 
-class SessionThread : public QThread {
-  Q_OBJECT
+class SessionThread : public QObject
+{
+    Q_OBJECT
 
 public:
-  SessionThread(UserId user, bool restoreState, QObject *parent = 0);
-  ~SessionThread();
-
-  void run();
-
-  CoreSession *session();
-  UserId user();
+    SessionThread(UserId user, bool restoreState, bool strictIdentEnabled, QObject *parent = nullptr);
+    ~SessionThread() override;
 
 public slots:
-  void addClient(QObject *peer);
-  void stopSession();
+    void addClient(Peer *peer);
+    void shutdown();
 
 private slots:
-  void setSessionInitialized();
+    void onSessionInitialized();
+    void onSessionDestroyed();
 
 signals:
-  void initialized();
-  void shutdown();
+    void initialized();
+    void shutdownSession();
+    void shutdownComplete(SessionThread *);
 
-  void addRemoteClient(QIODevice *);
-  void addInternalClient(SignalProxy *);
+    void addClientToWorker(Peer *peer);
 
 private:
-  CoreSession *_session;
-  UserId _user;
-  QList<QObject *> clientQueue;
-  bool _sessionInitialized;
-  bool _restoreState;
+    QThread _sessionThread;
+    bool _sessionInitialized{false};
 
-  bool isSessionInitialized();
-  void addClientToSession(QObject *peer);
-  void addRemoteClientToSession(QIODevice *socket);
-  void addInternalClientToSession(SignalProxy *proxy);
+    std::vector<Peer *> _clientQueue;
 };
-
-#endif