| 1 | // Copyright (C) 2021 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 | |
| 4 | #ifndef RESOURCESERVER_H |
| 5 | #define RESOURCESERVER_H |
| 6 | |
| 7 | #include "message.h" |
| 8 | |
| 9 | #include <QtCore/qstring.h> |
| 10 | #include <QtCore/qpointer.h> |
| 11 | |
| 12 | #include <QtNetwork/qlocalserver.h> |
| 13 | #include <QtNetwork/qlocalsocket.h> |
| 14 | |
| 15 | QT_BEGIN_NAMESPACE |
| 16 | |
| 17 | class ResourceServer : public QObject |
| 18 | { |
| 19 | Q_OBJECT |
| 20 | public: |
| 21 | ResourceServer(const QString &serverName); |
| 22 | bool init(); |
| 23 | |
| 24 | Q_SIGNALS: |
| 25 | void messageReceived(Message::MessagePtr message); |
| 26 | |
| 27 | public Q_SLOTS: |
| 28 | void sendMessage(const Message::MessagePtr &message); |
| 29 | |
| 30 | private: |
| 31 | QString m_serverName; |
| 32 | QLocalServer m_server; |
| 33 | QPointer<QLocalSocket> m_connection; |
| 34 | }; |
| 35 | |
| 36 | QT_END_NAMESPACE |
| 37 | |
| 38 | #endif // RESOURCESERVER_H |
| 39 |
