diff options
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; |