aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/LDesktop.h
blob: f052d0ec63a4ada1c7db2f946418bf5a6c2d69f6 (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
99
100
101
102
103
104
105
106
//===========================================
//  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_LDESKTOP_H
#define _LUMINA_DESKTOP_LDESKTOP_H

#include <QCoreApplication>


#include <QSettings>
#include <QFile>
#include <QList>
#include <QDebug>
#include <QTimer>
#include <QFileSystemWatcher>
#include <QLabel>
#include <QWidgetAction>
#include <QMdiArea>
#include <QMdiSubWindow>


#include <LuminaXDG.h>

#include "LPanel.h"
//#include "Globals.h"
#include "AppMenu.h"
#include "desktop-plugins/LDPlugin.h"
#include "desktop-plugins/LDPluginContainer.h"
#include "desktop-plugins/NewDP.h"

class LDesktop : public QObject{
	Q_OBJECT
public:
	LDesktop(int deskNum=0);
	~LDesktop();
	
	int Screen(); //return the screen number this object is managing
	void show();
	void hide();

	WId backgroundID();
	QRect availableScreenGeom();

public slots:
	void SystemLogout();
	void SystemTerminal();
	void SystemFileManager();
	void SystemApplication(QAction*);
	
private:
	QSettings *settings;
	QTimer *bgtimer;
	QDesktopWidget *desktop;
	QString DPREFIX;
	int desktopnumber;
	//int xoffset;
	bool defaultdesktop, desktoplocked, deskupdating, changingsettings, issyncing, usewinmenu, bgupdating;
	QStringList oldBGL;
	QList<LPanel*> PANELS;
	QMdiArea *bgDesktop; //desktop widget area
	QWidget *bgWindow; //full screen background
	QMenu *deskMenu, *winMenu;
	//AppMenu *appmenu;
	QLabel *workspacelabel;
	QWidgetAction *wkspaceact;
	QList<LDPlugin*> PLUGINS;
	QFileSystemWatcher *watcher;
	QString CBG; //current background
	QRect globalWorkRect;
	void CreateDesktopPluginContainer(LDPlugin*);

private slots:
	void InitDesktop();
	void SettingsChanged();
	void UnlockSettings(){ issyncing=false; changingsettings=false;}
	//Menu functions
	void UpdateMenu(bool fast = false);
	void ShowMenu(){
	  UpdateMenu(true); //run the fast version
	  deskMenu->popup(QCursor::pos());
	}
	void UpdateWinMenu();
	void winClicked(QAction*);
	
	//Desktop plugin system functions
	void UpdateDesktop();
	void ToggleDesktopLock();
	void AlignDesktopPlugins();
	void DesktopPluginRemoved(QString);
	
	void UpdatePanels();
	
	void UpdateDesktopPluginArea(); //make sure the area is not underneath any panels

	void UpdateBackground();
	void UpdateGeometry(int screen){
	  if(screen==desktopnumber){
	    bgWindow->setGeometry(desktop->screenGeometry(desktopnumber));
	    QTimer::singleShot(0, this, SLOT(UpdatePanels()));
	  }
	}
};
#endif
bgstack15