aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h
blob: 7914f3f697bead55b2d62c951820e478cc56cb33 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//===========================================
//  Lumina-desktop source code
//  Copyright (c) 2017, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
// This is the base C++ object that is used to pass information to the QML "RootDesktop" object
//===========================================
#ifndef _LUMINA_DESKTOP_QML_BACKEND_ROOT_DESKTOP_OBJECT_H
#define _LUMINA_DESKTOP_QML_BACKEND_ROOT_DESKTOP_OBJECT_H
#include <global-includes.h>
#include <ScreenObject.h>
#include <QThread>

class RootDesktopObject : public QObject{
	Q_OBJECT
	//Define all the QML Properties here (interface between QML and the C++ methods below)
	Q_PROPERTY( QStringList screens READ screens NOTIFY screensChanged)
	Q_PROPERTY( QStringList panels READ panels NOTIFY panelsChanged)
	Q_PROPERTY( QStringList windows READ windows NOTIFY windowsChanged)
	Q_PROPERTY( QStringList trayWindows READ trayWindows NOTIFY trayWindowsChanged)
	Q_PROPERTY( bool hasTrayWindows READ hasTrayWindows NOTIFY trayWindowsChanged)

public:
	//main contructor/destructor
	RootDesktopObject(QObject *parent = 0);
	~RootDesktopObject();

	static void RegisterType();

	//primary interface to fetch the current instance of the class (so only one is running at any given time)
	static RootDesktopObject* instance();

	//QML Read Functions
	Q_INVOKABLE QStringList screens();
	Q_INVOKABLE ScreenObject* screen(QString id);
	Q_INVOKABLE QStringList panels();
	Q_INVOKABLE PanelObject* panel(QString id);
	Q_INVOKABLE QStringList windows();
	Q_INVOKABLE NativeWindowObject* window(QString id);
	Q_INVOKABLE QStringList trayWindows();
	Q_INVOKABLE NativeWindowObject* trayWindow(QString id);
	Q_INVOKABLE bool hasTrayWindows();

	//QML Globals Access
	Q_INVOKABLE OSInterface* os_interface();

	//QML Access Functions
	Q_INVOKABLE void logout();
	Q_INVOKABLE void lockscreen();
	Q_INVOKABLE void mousePositionChanged(bool lowerall = false);
	Q_INVOKABLE void launchApp(QString appOrPath);

private:
	QList<ScreenObject*> s_objects;
	QList<PanelObject*> panel_objects;
	QList<NativeWindowObject*> window_objects;
	QList<NativeWindowObject*> tray_window_objects;
	QPointer<NativeWindowObject> last_window_up;

public slots:
	void updateScreens(); //rescan/update screen objects
	void ChangeWallpaper(QString screen, QString);
	QString CurrentWallpaper(QString screen);

	void setPanels(QList<PanelObject*> list);
	void setPanels(QStringList ids);
	QList<PanelObject*> panelObjectList(){ return panel_objects; }

	void setWindows(QList<NativeWindowObject*> list);
	void setTrayWindows(QList<NativeWindowObject*> list);

private slots:

signals:
	void screensChanged();
	void panelsChanged();
	void windowsChanged();
	void trayWindowsChanged();

	void startLogout();
	void mouseMoved();
	void lockScreen();
	void launchApplication(QString);

	//Internal signals for thread-safety
	void changePanels(QStringList);
};
#endif
bgstack15