diff options
author | Ken Moore <ken@ixsystems.com> | 2016-10-18 13:57:47 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2016-10-18 13:57:47 -0400 |
commit | 6d6708ee7add7951fe598e0a35467fdd00ebc7a2 (patch) | |
tree | 9c8631cc13c7f3e89dc13342662d30ce10b27dd5 /src-qt5/core/lumina-desktop | |
parent | Fix up the "loading" message on directories with no contents. (diff) | |
download | lumina-6d6708ee7add7951fe598e0a35467fdd00ebc7a2.tar.gz lumina-6d6708ee7add7951fe598e0a35467fdd00ebc7a2.tar.bz2 lumina-6d6708ee7add7951fe598e0a35467fdd00ebc7a2.zip |
Adjust the icon for the battery notifications a bit.
1) for the "low" battery icon, move it down to the 5-20% range instead of 20-50%.
2) When battery is between 0-5%, change the background color of the icon to red in addition to the "warning" battery icon.
3) Play an audio file when the battery drops to the 0-5% range( <Lumina Share directory>/low-battery.ogg), if the file exists.
Diffstat (limited to 'src-qt5/core/lumina-desktop')
-rw-r--r-- | src-qt5/core/lumina-desktop/LSession.cpp | 1 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp | 12 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index 9a985b3f..4e0a8f59 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -578,6 +578,7 @@ void LSession::systemWindow(){ //Play System Audio void LSession::playAudioFile(QString filepath){ + if( !QFile::exists(filepath) ){ return; } //Setup the audio output systems for the desktop if(DEBUG){ qDebug() << "Play Audio File"; } if(mediaObj==0){ qDebug() << " - Initialize media player"; mediaObj = new QMediaPlayer(); } diff --git a/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp b/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp index dda32ecd..7b7f5deb 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp @@ -5,6 +5,7 @@ // See the LICENSE file for full details //=========================================== #include "LBattery.h" +#include "LSession.h" LBattery::LBattery(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ iconOld = -1; @@ -34,8 +35,8 @@ void LBattery::updateBattery(bool force){ 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 > 20) { icon = 2; } + else if (charge > 5) { icon = 1; } else if (charge > 0 ) { icon = 0; } if(LOS::batteryIsCharging()){ icon = icon+10; } //icon = icon + result.at(0).toInt() * 10; @@ -75,7 +76,14 @@ void LBattery::updateBattery(bool force){ label->setPixmap( LXDG::findIcon("battery-missing", "").pixmap(label->size()) ); break; } + if(icon<iconOld && icon==0){ + //Play some audio warning chime when + LSession::handle()->playAudioFile(LOS::LuminaShare()+"low-battery.ogg"); + } + if(icon==0){ label->setStyleSheet("background: red;"); } + else{ label->setStyleSheet("background: transparent;"); } iconOld = icon; + } //Now update the display QString tt; |