File indexing completed on 2024-02-25 05:08:51

0001 /*
0002     Copyright (C) 2009-2010 Collabora Ltd <info@collabora.co.uk>
0003       @author George Goldberg <george.goldberg@collabora.co.uk>
0004       @author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
0005     Copyright (C) 2007 Alessandro Praduroux <pradu@pradu.it>
0006 
0007     This program is free software; you can redistribute it and/or
0008     modify it under the terms of the GNU General Public
0009     License as published by the Free Software Foundation; either
0010     version 2 of the License, or (at your option) any later version.
0011 
0012     This program is distributed in the hope that it will be useful,
0013     but WITHOUT ANY WARRANTY; without even the implied warranty of
0014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015     GNU General Public License for more details.
0016 
0017     You should have received a copy of the GNU Lesser General Public License
0018     along with this program.  If not, see <http://www.gnu.org/licenses/>.
0019 */
0020 #ifndef RFBSERVERMANAGER_H
0021 #define RFBSERVERMANAGER_H
0022 
0023 #include "rfb.h"
0024 #include "framebuffer.h"
0025 #include <QObject>
0026 #include <QVariantMap>
0027 
0028 class RfbClient;
0029 struct RfbServerManagerStatic;
0030 class RfbServer;
0031 
0032 class RfbServerManager : public QObject
0033 {
0034     Q_OBJECT
0035 public:
0036     static RfbServerManager *instance();
0037 
0038     QSharedPointer<FrameBuffer> framebuffer() const;
0039     static QVariantMap s_pluginArgs;
0040 Q_SIGNALS:
0041     void clientConnected(RfbClient *cc);
0042     void clientDisconnected(RfbClient *cc);
0043 
0044 private Q_SLOTS:
0045     void init();
0046     void updateFrameBuffer();
0047     void updateScreens();
0048     void cleanup();
0049 
0050 private:
0051     void registerServer(RfbServer *server);
0052     void unregisterServer(RfbServer *server);
0053 
0054     rfbScreenInfoPtr newScreen();
0055 
0056     void addClient(RfbClient *cc);
0057     void removeClient(RfbClient *cc);
0058 
0059     RfbServerManager();
0060     ~RfbServerManager() override;
0061     Q_DISABLE_COPY(RfbServerManager)
0062 
0063     friend class RfbServer;
0064     friend struct RfbServerManagerStatic;
0065 
0066     struct Private;
0067     Private *const d;
0068 };
0069 
0070 #endif // RFBSERVERMANAGER_H