aboutsummaryrefslogtreecommitdiffstats
path: root/tools/materialeditor/resourceserver.h
blob: 8347f80fb989ad0a9d2493e238a1b4724d2d0867 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef RESOURCESERVER_H
#define RESOURCESERVER_H

#include "message.h"

#include <QtCore/qstring.h>
#include <QtCore/qpointer.h>

#include <QtNetwork/qlocalserver.h>
#include <QtNetwork/qlocalsocket.h>

QT_BEGIN_NAMESPACE

class ResourceServer : public QObject
{
    Q_OBJECT
public:
    ResourceServer(const QString &serverName);
    bool init();

Q_SIGNALS:
    void messageReceived(Message::MessagePtr message);

public Q_SLOTS:
    void sendMessage(const Message::MessagePtr &message);

private:
    QString m_serverName;
    QLocalServer m_server;
    QPointer<QLocalSocket> m_connection;
};

QT_END_NAMESPACE

#endif // RESOURCESERVER_H