aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.h
blob: 6aebcb17383a41b975315894e238c91695a482d3 (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
//===========================================
//  Lumina-DE source code
//  Copyright (c) 2014, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#ifndef _LUMINA_DESKTOP_TASK_MANAGER_PLUGIN_H
#define _LUMINA_DESKTOP_TASK_MANAGER_PLUGIN_H

// Qt includes
#include <QWidget>
#include <QList>
#include <QString>
#include <QDebug>
#include <QTimer>
#include <QEvent>
#include <QDateTime>

// libLumina includes
#include <LuminaX11.h>

// Local includes
#include "LTaskButton.h"
#include "LWinInfo.h"
#include "../LPPlugin.h"

class LTaskManagerPlugin : public LPPlugin{
	Q_OBJECT
public:
	LTaskManagerPlugin(QWidget *parent=0, QString id="taskmanager", bool horizontal=true);
	~LTaskManagerPlugin();

private:
	QList<LTaskButton*> BUTTONS; //to keep track of the current buttons
	QTimer *timer;
	QDateTime updating; //quick flag for if it is currently working
	bool usegroups;

private slots:
	void UpdateButtons();
	void checkWindows();

public slots:
	void LocaleChange(){
	  UpdateButtons();
	}
	void ThemeChange(){
	  UpdateButtons();
	}
	void OrientationChange(){
	  if(this->layout()->direction()==QBoxLayout::LeftToRight){ //horizontal
	    this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
	    this->layout()->setAlignment(Qt::AlignLeft);
	    QSize sz(this->height(), this->height());
	    for(int i=0; i<BUTTONS.length(); i++){
	      BUTTONS[i]->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	      BUTTONS[i]->setIconSize(sz);
	    }
	  }else{ //vertical
	    this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
	    this->layout()->setAlignment(Qt::AlignTop);
	    QSize sz(this->width(), this->width());
	    for(int i=0; i<BUTTONS.length(); i++){
	      BUTTONS[i]->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
	      BUTTONS[i]->setIconSize(sz);
	    }
	  }
	}
};
#endif
bgstack15