aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins/userbutton/UserWidget.h
blob: 6d01e94032a84c418b7b43b1d3eba9b29e946d36 (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
//===========================================
//  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 <QTransform>
#include <QMouseEvent>
#include <QTabWidget>

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

#define SSAVER QString("xscreensaver-demo")

namespace Ui{
	class UserWidget;
};

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

public slots:
	void UpdateAll(); //for re-translation/icon changes
	void UpdateMenu(bool forceall = false); //for item changes

private:
	Ui::UserWidget *ui;
	QHash<QString, QList<XDGDesktop> > *sysapps;
	QDateTime lastUpdate, lastHomeUpdate;
	QStringList favs;
	QFileInfoList homefiles;
	int cfav; //current favorite category
	void ClearScrollArea(QScrollArea *area);
	void SortScrollArea(QScrollArea *area);
	QIcon rotateIcon(QIcon);

private slots:
	void LaunchItem(QString path, bool fix = true);

	//Favorites Tab
	void FavChanged(); //for ensuring radio-button-like behaviour
	void updateFavItems(bool newfilter = true); //if false, will only update if filesystem changes

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

	//Home Tab
	void updateHome();
	void slotGoToDir(QString dir);
	void slotGoHome();
	void slotOpenDir();
	void slotOpenSearch();

	//Slots for the special buttons
	void openStore(){
	  LaunchItem(LOS::AppStoreShortcut());
	}
	void openControlPanel(){
	  LaunchItem(LOS::ControlPanelShortcut());
	}
	void openDeskSettings(){
	  LaunchItem("lumina-config", false);
	}
	void openQtConfig(){
	  LaunchItem( LOS::QtConfigShortcut(), false);
	}
	void openScreenSaverConfig(){
	  LaunchItem(SSAVER, false);
	}
	void openScreenConfig(){
	  LaunchItem("lumina-xconfig",false);
	}
	void openLuminaInfo(){
	  LaunchItem("lumina-info",false);
	}
	
protected:
	void mouseMoveEvent( QMouseEvent *event);

signals:
	void CloseMenu();

};

#endif
bgstack15