-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappcommunicator.h
More file actions
59 lines (40 loc) · 1.52 KB
/
Copy pathappcommunicator.h
File metadata and controls
59 lines (40 loc) · 1.52 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef APPCOMMUNICATOR_H
#define APPCOMMUNICATOR_H
#include <QObject>
// #include <QAbstractNativeEventFilter>
#include <QSharedPointer>
#include <QFileSystemWatcher>
#include <QLocalServer>
#include <QLocalSocket>
class LuaScriptController;
class AppCommunicator : public QObject // : public QAbstractNativeEventFilter
{
Q_OBJECT
public:
explicit AppCommunicator(QSharedPointer<LuaScriptController> ptrLuaScriptController, QObject* parent = Q_NULLPTR);
~AppCommunicator();
// virtual bool nativeEventFilter(const QByteArray& eventType, void* message, qintptr* result) override;
void readXmlFile(const QString& filePath);
QString getRunningFilePath(void) const;
void deleteCommunicationFile(void);
void deleteRunningFile(void);
public:
static bool isInstanceRunning();
static void sendFileToRunningInstance(const QString& filePath);
static void showWindowsMessageBox(const QString& title, const QString& message);
Q_SIGNALS:
void fileReceived(const QString& filePath);
private slots:
void onFileChanged(const QString& path);
void onDirectoryChanged(const QString& path);
void handleNewConnection(void);
private:
static inline const QString serverName = "NOWALuaScriptInstance";
static QString runningFilePath;
private:
QSharedPointer<LuaScriptController> ptrLuaScriptController;
QString watchFilePathName;
QFileSystemWatcher fileWatcher;
QLocalServer* localServer;
};
#endif // APPCOMMUNICATOR_H