aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins/userbutton/UserWidget.h
blob: 132969ad0fc9ac18b58b15a5006ff731585d27f8 (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
//===========================================
//  Lumina-DE source code
//  Copyright (c) 2014, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
//  This panel plugin allows the user to quickly access user favorites and applications
//===========================================
#ifndef _LUMINA_PANEL_USER_BUTTON_WIDGET_H
#define _LUMINA_PANEL_USER_BUTTON_WIDGET_H

#include <QWidget>
#include <QString>
#include <QList>
#include <QHash>
#include <QVBoxLayout>
#include <QScrollArea>
#include <QDateTime>

#include <LuminaXDG.h>
#include <LuminaOS.h>
#include "UserItemWidget.h"

//#define APPSTORE QString("/usr/local/share/applications/softmanager.desktop")
//#define CONTROLPANEL QString("/usr/local/share/applications/pccontrol.desktop")
//#define QTCONFIG QString("/usr/local/bin/qtconfig-qt4")
#define SSAVER QString("xscreensaver-demo")

namespace Ui{
	class UserWidget;
};

class UserWidget : public QWidget{
	Q_OBJECT
public:
	UserWidget(QWidget *parent=0);
	~UserWidget();

public slots:
	void UpdateMenu();

private:
	Ui::UserWidget *ui;
	QHash<QString, QList<XDGDesktop> > *sysapps;
	QDateTime lastUpdate;
	int cfav; //current favorite category
	void ClearScrollArea(QScrollArea *area);

private slots:
	void LaunchItem(QString cmd);

	//Favorites Tab
	void FavChanged(); //for ensuring radio-button-like behaviour
	void updateFavItems();

	//Apps Tab
	void updateAppCategories();
	void updateApps();
	
	//Home Tab
	void updateHome();

	//Slots for the special buttons
	void openStore(){
	  LaunchItem("lumina-open \""+LOS::AppStoreShortcut()+"\"");
	}
	void openControlPanel(){
	  LaunchItem("lumina-open \""+LOS::ControlPanelShortcut()+"\"");
	}
	void openDeskSettings(){
	  LaunchItem("lumina-config");
	}
	void openQtConfig(){
	  LaunchItem( LOS::QtConfigShortcut() );
	}
	void openScreenSaverConfig(){
	  LaunchItem(SSAVER);
	}

signals:
	void CloseMenu();

};

#endif
bgstack15