aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.h
blob: 29562d5d82d93a6d69cfa8080a2ce999c77c00a2 (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
//===========================================
//  Lumina-DE source code
//  Copyright (c) 2014, Susanne Jaeckel
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#ifndef _LUMINA_DESKTOP_BATTERY_H
#define _LUMINA_DESKTOP_BATTERY_H

#include <QTimer>
#include <QWidget>
#include <QString>
#include <QLabel>

#include <LUtils.h>
#include <LuminaXDG.h>
#include <LuminaOS.h>

#include "../../Globals.h"
//#include "../LTBWidget.h"
#include "../LPPlugin.h"

class LBattery : public LPPlugin{
	Q_OBJECT
public:
	LBattery(QWidget *parent = 0, QString id = "battery", bool horizontal=true);
	~LBattery();
	
private:
	QTimer *timer;
	QLabel *label;
	int iconOld;
	
private slots:
	void updateBattery(bool force = false);
	QString getRemainingTime();

public slots:
	void LocaleChange(){
	  updateBattery(true);
	}
	
	void OrientationChange(){
	  if(this->layout()->direction()==QBoxLayout::LeftToRight){
	    label->setFixedSize( QSize(this->height(), this->height()) );
	  }else{
	    label->setFixedSize( QSize(this->width(), this->width()) );
	  }
	  updateBattery(true); //force icon refresh
	}
};

#endif
bgstack15