aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop/panel-plugins/battery
diff options
context:
space:
mode:
authorWeblate <noreply@weblate.org>2017-12-15 22:52:34 +0000
committerWeblate <noreply@weblate.org>2017-12-15 22:52:34 +0000
commit9155556b94b0fe25ef3d5398a7f70dcdc1841d69 (patch)
treeae5af06e4741c8767344be6d90a7307bcddb5b5d /src-qt5/core/lumina-desktop/panel-plugins/battery
parentTranslated using Weblate (Russian) (diff)
parentAnother minor networking fix. (diff)
downloadlumina-9155556b94b0fe25ef3d5398a7f70dcdc1841d69.tar.gz
lumina-9155556b94b0fe25ef3d5398a7f70dcdc1841d69.tar.bz2
lumina-9155556b94b0fe25ef3d5398a7f70dcdc1841d69.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src-qt5/core/lumina-desktop/panel-plugins/battery')
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp7
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.h16
2 files changed, 18 insertions, 5 deletions
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 be5b8488..69ea5faa 100644
--- a/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp
+++ b/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp
@@ -20,6 +20,7 @@ LBattery::LBattery(QWidget *parent, QString id, bool horizontal) : LPPlugin(pare
connect(timer,SIGNAL(timeout()), this, SLOT(updateBattery()) );
timer->start();
QTimer::singleShot(0,this,SLOT(OrientationChange()) ); //update the sizing/icon
+ sessionsettings = new QSettings("lumina-desktop", "sessionsettings");
}
LBattery::~LBattery(){
@@ -76,9 +77,11 @@ void LBattery::updateBattery(bool force){
label->setPixmap( LXDG::findIcon("battery-unknown", "battery-missing").pixmap(label->size()) );
break;
}
+ }
if(icon<iconOld && icon==0){
- //Play some audio warning chime when
- QString sfile = LSession::handle()->sessionSettings()->value("audiofiles/batterylow", LOS::LuminaShare()+"low-battery.ogg").toString();
+ //Play some audio warning chime when
+ bool playaudio = sessionsettings->value("PlayBatteryLowAudio",true).toBool();
+ if( playaudio ){ QString sfile = LSession::handle()->sessionSettings()->value("audiofiles/batterylow", LOS::LuminaShare()+"low-battery.ogg").toString();
LSession::handle()->playAudioFile(sfile);
}
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.h b/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.h
index 29562d5d..3c23be1c 100644
--- a/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.h
+++ b/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.h
@@ -25,12 +25,13 @@ class LBattery : public LPPlugin{
public:
LBattery(QWidget *parent = 0, QString id = "battery", bool horizontal=true);
~LBattery();
-
+
private:
QTimer *timer;
QLabel *label;
int iconOld;
-
+ QSettings *sessionsettings;
+
private slots:
void updateBattery(bool force = false);
QString getRemainingTime();
@@ -39,7 +40,7 @@ public slots:
void LocaleChange(){
updateBattery(true);
}
-
+
void OrientationChange(){
if(this->layout()->direction()==QBoxLayout::LeftToRight){
label->setFixedSize( QSize(this->height(), this->height()) );
@@ -48,6 +49,15 @@ public slots:
}
updateBattery(true); //force icon refresh
}
+protected:
+ void changeEvent(QEvent *ev){
+ LPPlugin::changeEvent(ev);
+ QEvent::Type tmp = ev->type();
+ if(tmp==QEvent::ThemeChange || tmp==QEvent::LanguageChange || tmp==QEvent::LocaleChange){
+ updateBattery(true);
+ }
+ }
+
};
#endif
bgstack15