diff options
author | Ken Moore <ken@pcbsd.org> | 2015-04-17 08:15:57 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-04-17 08:15:57 -0400 |
commit | 77775ca3ff616e7dc798a5ffe5546be2b894330c (patch) | |
tree | e5145835fe1fb092a8ee69c91668f2e54a01a726 /lumina-desktop/panel-plugins | |
parent | Fix the session chimes (and possible stability issue) by removing the special... (diff) | |
download | lumina-77775ca3ff616e7dc798a5ffe5546be2b894330c.tar.gz lumina-77775ca3ff616e7dc798a5ffe5546be2b894330c.tar.bz2 lumina-77775ca3ff616e7dc798a5ffe5546be2b894330c.zip |
Update the system dashboard behavior a bit:
1) Add a signal collector/combiner for screen brightness changes (1/10 second delay) - since hardware brightness changes cannot usually be spammed too quickly.
2) Update the battery icon notifications on the panel button. If less than 5% left, leave the low battery icon there all the time, if less than 15% cause the low battery icon to flash intermittently, if greater than that don't show any battery icon.
Diffstat (limited to 'lumina-desktop/panel-plugins')
3 files changed, 17 insertions, 5 deletions
diff --git a/lumina-desktop/panel-plugins/systemdashboard/LSysDashboard.cpp b/lumina-desktop/panel-plugins/systemdashboard/LSysDashboard.cpp index 8f663b0f..45de0126 100644 --- a/lumina-desktop/panel-plugins/systemdashboard/LSysDashboard.cpp +++ b/lumina-desktop/panel-plugins/systemdashboard/LSysDashboard.cpp @@ -51,9 +51,9 @@ void LSysDashboard::updateIcon(bool force){ else if(force || button->icon().isNull()){ resetIcon(); } }else if(!charging){ //Not charging (critical level or just unplugged) - if(bat<1){ button->setIcon( LXDG::findIcon("battery-missing","") ); QTimer::singleShot(5000, this, SLOT(resetIcon()));} + if(bat<5){ button->setIcon( LXDG::findIcon("battery-missing","") ); } else if(bat < 15){ button->setIcon( LXDG::findIcon("battery-low","") ); QTimer::singleShot(5000, this, SLOT(resetIcon())); } - else if(bat < 30){ button->setIcon( LXDG::findIcon("battery-caution","") ); QTimer::singleShot(5000, this, SLOT(resetIcon()));} + else if(bat < 30 && batcharging){ button->setIcon( LXDG::findIcon("battery-caution","") ); QTimer::singleShot(5000, this, SLOT(resetIcon()));} else if(bat < 50 && batcharging){ button->setIcon( LXDG::findIcon("battery-040","")); QTimer::singleShot(5000, this, SLOT(resetIcon()));} else if(bat < 70 && batcharging){ button->setIcon( LXDG::findIcon("battery-060","")); QTimer::singleShot(5000, this, SLOT(resetIcon()));} else if(bat < 90 && batcharging){ button->setIcon( LXDG::findIcon("battery-080","")); QTimer::singleShot(5000, this, SLOT(resetIcon()));} diff --git a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp index 1e28a72a..08ab49d0 100644 --- a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp +++ b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp @@ -13,6 +13,9 @@ LSysMenuQuick::LSysMenuQuick(QWidget *parent) : QWidget(parent), ui(new Ui::LSysMenuQuick){ ui->setupUi(this); settings = new QSettings("panel-plugins","systemdashboard"); + brighttimer = new QTimer(this); + brighttimer->setSingleShot(true); + brighttimer->setInterval(100); //100ms delay in setting the new value //Now reset the initial saved settings (if any) LOS::setScreenBrightness( settings->value("screenbrightness",100).toInt() ); //default to 100% LOS::setAudioVolume( settings->value("audiovolume", 100).toInt() ); //default to 100% @@ -23,6 +26,7 @@ LSysMenuQuick::LSysMenuQuick(QWidget *parent) : QWidget(parent), ui(new Ui::LSys connect(ui->tool_wk_next, SIGNAL(clicked()), this, SLOT(nextWorkspace()) ); connect(ui->tool_logout, SIGNAL(clicked()), this, SLOT(startLogout()) ); connect(ui->tool_vol_mixer, SIGNAL(clicked()), this, SLOT(startMixer()) ); + connect(brighttimer, SIGNAL(timeout()), this, SLOT(setCurrentBrightness()) ); //And setup the default icons ui->label_bright_icon->setPixmap( LXDG::findIcon("preferences-system-power-management","").pixmap(ui->label_bright_icon->maximumSize()) ); ui->tool_wk_prev->setIcon( LXDG::findIcon("go-previous-view","")); @@ -114,12 +118,18 @@ void LSysMenuQuick::startMixer(){ } void LSysMenuQuick::brightSliderChanged(){ + //Brightness controls cannot operate extremely quickly - combine calls as necessary + if(brighttimer->isActive()){ brighttimer->stop(); } + brighttimer->start(); +} + +void LSysMenuQuick::setCurrentBrightness(){ int val = ui->slider_brightness->value(); LOS::setScreenBrightness(val); settings->setValue("screenbrightness",val); QString txt = QString::number(val)+"%"; if(val<100){ txt.prepend(" "); } //make sure no widget resizing - ui->label_bright_text->setText( txt ); + ui->label_bright_text->setText( txt ); } void LSysMenuQuick::nextWorkspace(){ diff --git a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.h b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.h index 7b3c2d09..816eb009 100644 --- a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.h +++ b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.h @@ -32,12 +32,14 @@ public: private: Ui::LSysMenuQuick *ui; QSettings *settings; - + QTimer *brighttimer; + QString getRemainingTime(); //battery time left private slots: void volSliderChanged(); - void brightSliderChanged(); + void brightSliderChanged(); //start the delay/collection timer + void setCurrentBrightness(); //perform the change void startMixer(); void nextWorkspace(); void prevWorkspace(); |