aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/LSession.h
blob: 3f3d31f9230e772ae9fb17c181cefecf4d42c9a5 (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
90
91
92
93
94
95
96
97
98
//===========================================
//  Lumina-DE source code
//  Copyright (c) 2012, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#ifndef _LUMINA_DESKTOP_SESSION_H
#define _LUMINA_DESKTOP_SESSION_H

#include <QApplication>
#include <QDebug>
#include <QString>
#include <QX11Info>
#include <QEvent>
#include <QTranslator>
#include <QSettings>
#include <QProxyStyle>
#include <QDesktopWidget>
#include <QList>
#include <QThread>

#include "Globals.h"
#include "AppMenu.h"
#include "SettingsMenu.h"
#include "SystemWindow.h"
#include "LDesktop.h"
#include "WMProcess.h"

//LibLumina X11 class
#include <LuminaX11.h>

//SYSTEM TRAY STANDARD DEFINITIONS
//#define SYSTEM_TRAY_REQUEST_DOCK 0
//#define SYSTEM_TRAY_BEGIN_MESSAGE 1
//#define SYSTEM_TRAY_CANCEL_MESSAGE 2

class MenuProxyStyle : public QProxyStyle{
public: 
	int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const{
	  if(metric==PM_SmallIconSize){ return 22; } //override QMenu icon size (make it larger)
	  else{ return QProxyStyle::pixelMetric(metric, option, widget); } //use the current style for everything else
	}
};

class LSession : public QApplication{
	Q_OBJECT
public:
	LSession(int &argc, char **argv);
	~LSession();
	//Functions to be called during startup
	void setupSession();

	virtual bool x11EventFilter(XEvent *event);
	
	bool LoadLocale(QString);

	//System Access
	static void LaunchApplication(QString cmd);
	static AppMenu* applicationMenu();
	static void systemWindow();
	static SettingsMenu* settingsMenu();

	static QSettings* sessionSettings();

	//Play System Audio
	static void playAudioFile(QString filepath);

private:
	WMProcess *WM;
	QList<LDesktop*> DESKTOPS;
	QFileSystemWatcher *watcher;

public slots:
	void launchStartupApps();


private slots:
	void watcherChange(QString);

	//Internal simplification functions
	void checkUserFiles();
	void loadStyleSheet();
	void refreshWindowManager();
	void updateDesktops();

	void SessionEnding();

signals:
	void NewSystemTrayApp(WId); //WinID
	void TrayEvent(XEvent*);
	void WindowListEvent(WId);
	void WindowListEvent();
	void LocaleChanged();
	void DesktopConfigChanged();
	
};

#endif
bgstack15