aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins/battery
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-04-25 13:08:12 -0400
committerKen Moore <moorekou@gmail.com>2016-04-25 13:08:12 -0400
commited5ecf7ea7a482b4649e66ecb35fbc60af680684 (patch)
treeacc0fa17d228259e847f55c678db9fb0a9b50f0c /lumina-desktop/panel-plugins/battery
parentMerge branch 'master' of github.com:pcbsd/lumina (diff)
downloadlumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.tar.gz
lumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.tar.bz2
lumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.zip
Rearrange the Lumina source tree quite a bit:
Now the utilites are arranged by category (core, core-utils, desktop-utils), so all the -utils may be excluded by a package system (or turned into separate packages) as needed.
Diffstat (limited to 'lumina-desktop/panel-plugins/battery')
-rw-r--r--lumina-desktop/panel-plugins/battery/LBattery.cpp106
-rw-r--r--lumina-desktop/panel-plugins/battery/LBattery.h53
-rw-r--r--lumina-desktop/panel-plugins/battery/NOTES49
3 files changed, 0 insertions, 208 deletions
diff --git a/lumina-desktop/panel-plugins/battery/LBattery.cpp b/lumina-desktop/panel-plugins/battery/LBattery.cpp
deleted file mode 100644
index dda32ecd..00000000
--- a/lumina-desktop/panel-plugins/battery/LBattery.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-//===========================================
-// Lumina-DE source code
-// Copyright (c) 2014, Susanne Jaeckel
-// Available under the 3-clause BSD license
-// See the LICENSE file for full details
-//===========================================
-#include "LBattery.h"
-
-LBattery::LBattery(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){
- iconOld = -1;
- //Setup the widget
- label = new QLabel(this);
- label->setScaledContents(true);
- //label->setAlignment(Qt::AlignCenter);
- this->layout()->addWidget(label);
- //Setup the timer
- timer = new QTimer();
- timer->setInterval(5000); //update every 5 seconds
- connect(timer,SIGNAL(timeout()), this, SLOT(updateBattery()) );
- timer->start();
- QTimer::singleShot(0,this,SLOT(OrientationChange()) ); //update the sizing/icon
-}
-
-LBattery::~LBattery(){
- timer->stop();
- delete timer;
-}
-
-void LBattery::updateBattery(bool force){
- // Get current state of charge
- //QStringList result = LUtils::getCmdOutput("/usr/sbin/apm", QStringList() << "-al");
- int charge = LOS::batteryCharge(); //result.at(1).toInt();
-//qDebug() << "1: " << result.at(0).toInt() << " 2: " << result.at(1).toInt();
- int icon = -1;
- if (charge > 90) { icon = 4; }
- else if (charge > 70) { icon = 3; }
- else if (charge > 50) { icon = 2; }
- else if (charge > 30) { icon = 1; }
- else if (charge > 0 ) { icon = 0; }
- if(LOS::batteryIsCharging()){ icon = icon+10; }
- //icon = icon + result.at(0).toInt() * 10;
- if (icon != iconOld || force) {
- switch (icon) {
- case 0:
- label->setPixmap( LXDG::findIcon("battery-caution", "").pixmap(label->size()) );
- break;
- case 1:
- label->setPixmap( LXDG::findIcon("battery-040", "").pixmap(label->size()) );
- break;
- case 2:
- label->setPixmap( LXDG::findIcon("battery-060", "").pixmap(label->size()) );
- break;
- case 3:
- label->setPixmap( LXDG::findIcon("battery-080", "").pixmap(label->size()) );
- break;
- case 4:
- label->setPixmap( LXDG::findIcon("battery-100", "").pixmap(label->size()) );
- break;
- case 10:
- label->setPixmap( LXDG::findIcon("battery-charging-caution", "").pixmap(label->size()) );
- break;
- case 11:
- label->setPixmap( LXDG::findIcon("battery-charging-040", "").pixmap(label->size()) );
- break;
- case 12:
- label->setPixmap( LXDG::findIcon("battery-charging-060", "").pixmap(label->size()) );
- break;
- case 13:
- label->setPixmap( LXDG::findIcon("battery-charging-080", "").pixmap(label->size()) );
- break;
- case 14:
- label->setPixmap( LXDG::findIcon("battery-charging", "").pixmap(label->size()) );
- break;
- default:
- label->setPixmap( LXDG::findIcon("battery-missing", "").pixmap(label->size()) );
- break;
- }
- iconOld = icon;
- }
- //Now update the display
- QString tt;
- //Make sure the tooltip can be properly translated as necessary (Ken Moore 5/9/14)
- if(icon > 9 && icon < 15){ tt = QString(tr("%1 % (Charging)")).arg(QString::number(charge)); }
- else{ tt = QString( tr("%1 % (%2 Remaining)") ).arg(QString::number(charge), getRemainingTime() ); }
- label->setToolTip(tt);
-}
-
-QString LBattery::getRemainingTime(){
- int secs = LOS::batterySecondsLeft();
- if(secs < 0){ return "??"; }
- QString rem; //remaining
- if(secs > 3600){
- int hours = secs/3600;
- rem.append( QString::number(hours)+"h ");
- secs = secs - (hours*3600);
- }
- if(secs > 60){
- int min = secs/60;
- rem.append( QString::number(min)+"m ");
- secs = secs - (min*60);
- }
- if(secs > 0){
- rem.append(QString::number(secs)+"s");
- }
- return rem;
-}
diff --git a/lumina-desktop/panel-plugins/battery/LBattery.h b/lumina-desktop/panel-plugins/battery/LBattery.h
deleted file mode 100644
index 3d31faad..00000000
--- a/lumina-desktop/panel-plugins/battery/LBattery.h
+++ /dev/null
@@ -1,53 +0,0 @@
-//===========================================
-// 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 <LuminaUtils.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
diff --git a/lumina-desktop/panel-plugins/battery/NOTES b/lumina-desktop/panel-plugins/battery/NOTES
deleted file mode 100644
index 3ea07778..00000000
--- a/lumina-desktop/panel-plugins/battery/NOTES
+++ /dev/null
@@ -1,49 +0,0 @@
-Eventuell mit einem Menü implementieren, mit Einträgen für:
-Anzeige des kompletten Status und Infos
-Herunterfahren des Systems etc.
-
-apm -a
- Zeigt den AC line status an
- 0 = off-line
- 1 = on-line
- 2 = backup-power
-
-apm -b
- Zeigt
- 0 = high
- 1 = low
- 2 = critical
- 3 = charging
-
-apm -l
- Zeit die prozentuale Kapazitaet
- 255 = nicht unterstuetzt
-
-apm -t
- Zeigt die verbleibende Zeit in Sekunden
-
-Aufruf Systemfunktionen: LuminaUtils.h
-
-mit der Methode:
-QStringList LUtils::getCmdOutput(QString cmd, QStringList args)
-
-Icons:
-/usr/local/share/icons/oxygen/22x22/status
-oder unter:
-/usr/local/share/icons/oxygen/16x16/status
-
-battery-040.png // 40 %
-battery-060.png
-battery-080.png
-battery-100.png
-
-battery-caution.png
-battery-charging.png
-battery-charging-040.png
-battery-charging-060.png
-battery-charging-080.png
-battery-charging-caution.png
-
-battery-charging-log.png
-battery-log.png
-battery-missing.png
bgstack15