blob: 0d6d623c53f49463647a9d4847a30eb3e953515b (
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
|
//===========================================
// 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();
// int vertsizeicon;
// int *dpi; //this comes from the PCDM dpi
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 UpdateButton(WId win);
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());
// QSize sz(this->width(), this->height()); //we want to increase the width but not the height of the icons
for(int i=0; i<BUTTONS.length(); i++){
BUTTONS[i]->setToolButtonStyle(Qt::ToolButtonIconOnly);
// BUTTONS[i]->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
// if( dpi = 196 ){ int vertsizeicon = ; BUTTONS[i]->setIconSize(vertsizeicon);}
// elseif( dpi = 144 ) { int vertsizeicon = ; BUTTONS[i]->setIconSize(vertsizeicon);}
// elseif( dpi = 96 ) { int vertsizeicon = ; BUTTONS[i]->setIconSize(vertsizeicon);}
// elseif( dpi = 48 ) { int vertsizeicon = ; BUTTONS[i]->setIconSize)vertsizeicon);}
BUTTONS[i]->setIconSize(sz);
}
}
}
};
#endif
|