aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop
diff options
context:
space:
mode:
authorwi <william.os4y@gmail.com>2015-04-17 14:22:53 +0200
committerwi <william.os4y@gmail.com>2015-04-17 14:22:53 +0200
commitd231558a8be5dea107a2031fb39b9c18ca8b863d (patch)
treeb13752f01be68969208c41acd0ac5a8d7cd0dc43 /lumina-desktop
parentMerge remote-tracking branch 'upstream/master' into deskEditor (diff)
parentUpdate the system dashboard behavior a bit: (diff)
downloadlumina-d231558a8be5dea107a2031fb39b9c18ca8b863d.tar.gz
lumina-d231558a8be5dea107a2031fb39b9c18ca8b863d.tar.bz2
lumina-d231558a8be5dea107a2031fb39b9c18ca8b863d.zip
Merge remote-tracking branch 'upstream/master' into deskEditor
Diffstat (limited to 'lumina-desktop')
-rw-r--r--lumina-desktop/LSession.cpp26
-rw-r--r--lumina-desktop/LSession.h2
-rw-r--r--lumina-desktop/panel-plugins/systemdashboard/LSysDashboard.cpp4
-rw-r--r--lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp12
-rw-r--r--lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.h6
5 files changed, 32 insertions, 18 deletions
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp
index 8f6da9ff..e076210f 100644
--- a/lumina-desktop/LSession.cpp
+++ b/lumina-desktop/LSession.cpp
@@ -24,7 +24,7 @@
#include <X11/extensions/Xdamage.h>
#ifndef DEBUG
-#define DEBUG 0
+#define DEBUG 1
#endif
XCBEventFilter *evFilter = 0;
@@ -54,8 +54,7 @@ LSession::LSession(int &argc, char ** argv) : QApplication(argc, argv){
settingsmenu = 0;
currTranslator=0;
mediaObj=0;
- //audioOut=0;
- audioThread=0;
+ //audioThread=0;
sessionsettings=0;
//Setup the event filter for Qt5
evFilter = new XCBEventFilter(this);
@@ -72,7 +71,6 @@ LSession::~LSession(){
delete appmenu;
delete currTranslator;
if(mediaObj!=0){delete mediaObj;}
- //if(audioOut!=0){delete audioOut; }
}
void LSession::setupSession(){
@@ -176,13 +174,17 @@ void LSession::CleanupSession(){
if(playaudio){
//wait a max of 3 seconds for audio to finish
bool waitmore = true;
- for(int i=0; i<6 && waitmore; i++){
- waitmore = !audioThread->wait(500);
+ for(int i=0; i<60 && waitmore; i++){
+ usleep(50000); //50ms = 50000 us
+ waitmore = (mediaObj->state()==QMediaPlayer::PlayingState);
+ //waitmore = !audioThread->wait(500);
LSession::processEvents();
}
+ if(waitmore){ mediaObj->stop(); } //timed out
}else{
- for(int i=0; i<20; i++){ LSession::processEvents(); usleep(25); } //1/2 second pause
+ for(int i=0; i<20; i++){ LSession::processEvents(); usleep(25000); } //1/2 second pause
}
+ //if(audioThread!=0){ audioThread->exit(0); }
}
int LSession::VersionStringToNumber(QString version){
@@ -469,19 +471,19 @@ void LSession::playAudioFile(QString filepath){
//Setup the audio output systems for the desktop
bool init = false;
if(DEBUG){ qDebug() << "Play Audio File"; }
- if(audioThread==0){ qDebug() << " - Initialize audio systems"; audioThread = new QThread(); init = true; }
+ //if(audioThread==0){ qDebug() << " - Initialize audio systems"; audioThread = new QThread(); init = true; }
if(mediaObj==0){ qDebug() << " - Initialize media player"; mediaObj = new QMediaPlayer(); init = true;}
- if(mediaObj && init){ //in case it errors for some reason
+ /*if(mediaObj && init){ //in case it errors for some reason
qDebug() << " -- Move audio objects to separate thread";
mediaObj->moveToThread(audioThread);
audioThread->start();
- }
+ }*/
if(mediaObj !=0 ){
if(DEBUG){ qDebug() << " - starting playback:" << filepath; }
- mediaObj->setMedia(QUrl::fromLocalFile(filepath));
mediaObj->setVolume(100);
+ mediaObj->setMedia(QUrl::fromLocalFile(filepath));
mediaObj->play();
- if(!audioThread->isRunning()){ audioThread->start(); }
+ //if(!audioThread->isRunning()){ audioThread->start(); }
LSession::processEvents();
}
if(DEBUG){ qDebug() << " - Done with Audio File"; }
diff --git a/lumina-desktop/LSession.h b/lumina-desktop/LSession.h
index 4c9ea15e..5baf72c4 100644
--- a/lumina-desktop/LSession.h
+++ b/lumina-desktop/LSession.h
@@ -97,7 +97,7 @@ private:
SettingsMenu *settingsmenu;
QTranslator *currTranslator;
QMediaPlayer *mediaObj;
- QThread *audioThread;
+ //QThread *audioThread;
QSettings *sessionsettings;
bool cleansession;
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();
bgstack15