aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop
diff options
context:
space:
mode:
authorwi <william.os4y@gmail.com>2015-04-20 21:53:25 +0200
committerwi <william.os4y@gmail.com>2015-04-20 21:53:25 +0200
commita33566d53dab6f5bf3d4b6663014b6b548446525 (patch)
tree6e57deaa6afc289cb6a51a523e2fb1530830bd9c /lumina-desktop
parentThis is a complete adaptation of lumina-fileinfo. (diff)
parentAdd a special flag to prevent the lumina-open crash handler from starting up ... (diff)
downloadlumina-a33566d53dab6f5bf3d4b6663014b6b548446525.tar.gz
lumina-a33566d53dab6f5bf3d4b6663014b6b548446525.tar.bz2
lumina-a33566d53dab6f5bf3d4b6663014b6b548446525.zip
Merge remote-tracking branch 'upstream/master' into deskEditor
Diffstat (limited to 'lumina-desktop')
-rw-r--r--lumina-desktop/LSession.cpp5
-rw-r--r--lumina-desktop/SystemWindow.cpp12
-rw-r--r--lumina-desktop/SystemWindow.h4
-rw-r--r--lumina-desktop/SystemWindow.ui65
-rw-r--r--lumina-desktop/panel-plugins/clock/LClock.cpp21
-rw-r--r--lumina-desktop/panel-plugins/clock/LClock.h2
-rw-r--r--lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp7
-rw-r--r--lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp15
-rw-r--r--lumina-desktop/panel-plugins/systemtray/TrayIcon.h14
9 files changed, 107 insertions, 38 deletions
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp
index e076210f..0fea2fa1 100644
--- a/lumina-desktop/LSession.cpp
+++ b/lumina-desktop/LSession.cpp
@@ -75,6 +75,7 @@ LSession::~LSession(){
void LSession::setupSession(){
qDebug() << "Initializing Session";
+ if(QFile::exists("/tmp/.luminastopping")){ QFile::remove("/tmp/.luminastopping"); }
QTime* timer = 0;
if(DEBUG){ timer = new QTime(); timer->start(); qDebug() << " - Init srand:" << timer->elapsed();}
//Seed random number generator (if needed)
@@ -134,6 +135,8 @@ void LSession::CleanupSession(){
LSession::processEvents();
QDateTime time = QDateTime::currentDateTime();
qDebug() << "Start closing down the session: " << time.toString( Qt::SystemLocaleShortDate);
+ //Create a temporary flag to prevent crash dialogs from opening during cleanup
+ LUtils::writeFile("/tmp/.luminastopping",QStringList() << "yes", true);
//Start the logout chimes (if necessary)
bool playaudio = sessionsettings->value("PlayLogoutAudio",true).toBool();
if( playaudio ){ playAudioFile(LOS::LuminaShare()+"Logout.ogg"); }
@@ -184,6 +187,8 @@ void LSession::CleanupSession(){
}else{
for(int i=0; i<20; i++){ LSession::processEvents(); usleep(25000); } //1/2 second pause
}
+ //Clean up the temporary flag
+ if(QFile::exists("/tmp/.luminastopping")){ QFile::remove("/tmp/.luminastopping"); }
//if(audioThread!=0){ audioThread->exit(0); }
}
diff --git a/lumina-desktop/SystemWindow.cpp b/lumina-desktop/SystemWindow.cpp
index 0540a5d9..02de54b9 100644
--- a/lumina-desktop/SystemWindow.cpp
+++ b/lumina-desktop/SystemWindow.cpp
@@ -17,19 +17,23 @@ SystemWindow::SystemWindow() : QDialog(), ui(new Ui::SystemWindow){
ui->tool_logout->setIcon( LXDG::findIcon("system-log-out","") );
ui->tool_restart->setIcon( LXDG::findIcon("system-reboot","") );
ui->tool_shutdown->setIcon( LXDG::findIcon("system-shutdown","") );
+ ui->tool_suspend->setIcon( LXDG::findIcon("system-suspend","") );
ui->push_cancel->setIcon( LXDG::findIcon("dialog-cancel","") );
ui->push_lock->setIcon( LXDG::findIcon("system-lock-screen","") );
//Connect the signals/slots
connect(ui->tool_logout, SIGNAL(clicked()), this, SLOT(sysLogout()) );
connect(ui->tool_restart, SIGNAL(clicked()), this, SLOT(sysRestart()) );
connect(ui->tool_shutdown, SIGNAL(clicked()), this, SLOT(sysShutdown()) );
+ connect(ui->tool_suspend, SIGNAL(clicked()), this, SLOT(sysSuspend()) );
connect(ui->push_cancel, SIGNAL(clicked()), this, SLOT(sysCancel()) );
connect(ui->push_lock, SIGNAL(clicked()), this, SLOT(sysLock()) );
//Disable the shutdown/restart buttons if necessary
if( !LOS::userHasShutdownAccess() ){
ui->tool_restart->setEnabled(false);
ui->tool_shutdown->setEnabled(false);
+
}
+ ui->tool_suspend->setVisible(LOS::systemCanSuspend());
//Center this window on the screen
QPoint center = QApplication::desktop()->screenGeometry(QCursor::pos()).center(); //get the center of the current screen
this->move(center.x() - this->width()/2, center.y() - this->height()/2);
@@ -55,6 +59,14 @@ void SystemWindow::sysShutdown(){
this->close();
}
+void SystemWindow::sysSuspend(){
+ //Make sure to lock the system first (otherwise anybody can access it again)
+ LUtils::runCmd("xscreensaver-command -lock");
+ //Now suspend the system
+ LOS::systemSuspend();
+ this->close();
+}
+
void SystemWindow::sysLock(){
qDebug() << "Locking the desktop...";
QProcess::startDetached("xscreensaver-command -lock");
diff --git a/lumina-desktop/SystemWindow.h b/lumina-desktop/SystemWindow.h
index 211de5fd..4b1fab44 100644
--- a/lumina-desktop/SystemWindow.h
+++ b/lumina-desktop/SystemWindow.h
@@ -38,6 +38,8 @@ private slots:
void sysShutdown();
+ void sysSuspend();
+
void sysCancel(){
this->close();
}
@@ -45,4 +47,4 @@ private slots:
void sysLock();
};
-#endif \ No newline at end of file
+#endif
diff --git a/lumina-desktop/SystemWindow.ui b/lumina-desktop/SystemWindow.ui
index b03039f5..9e25509b 100644
--- a/lumina-desktop/SystemWindow.ui
+++ b/lumina-desktop/SystemWindow.ui
@@ -14,8 +14,17 @@
<string>System Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
- <property name="margin">
- <number>0</number>
+ <property name="leftMargin">
+ <number>2</number>
+ </property>
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="rightMargin">
+ <number>2</number>
+ </property>
+ <property name="bottomMargin">
+ <number>2</number>
</property>
<item>
<widget class="QFrame" name="frame">
@@ -47,8 +56,8 @@
</property>
<property name="iconSize">
<size>
- <width>60</width>
- <height>60</height>
+ <width>64</width>
+ <height>64</height>
</size>
</property>
<property name="toolButtonStyle">
@@ -63,8 +72,8 @@
</property>
<property name="iconSize">
<size>
- <width>60</width>
- <height>60</height>
+ <width>64</width>
+ <height>64</height>
</size>
</property>
<property name="toolButtonStyle">
@@ -79,8 +88,8 @@
</property>
<property name="iconSize">
<size>
- <width>60</width>
- <height>60</height>
+ <width>64</width>
+ <height>64</height>
</size>
</property>
<property name="toolButtonStyle">
@@ -113,10 +122,19 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
- <widget class="QPushButton" name="push_cancel">
+ <widget class="QToolButton" name="push_cancel">
<property name="text">
<string>Cancel</string>
</property>
+ <property name="iconSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextUnderIcon</enum>
+ </property>
</widget>
</item>
<item>
@@ -133,9 +151,34 @@
</spacer>
</item>
<item>
- <widget class="QPushButton" name="push_lock">
+ <widget class="QToolButton" name="push_lock">
<property name="text">
- <string>Lock Screen</string>
+ <string>Lock</string>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextUnderIcon</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_suspend">
+ <property name="text">
+ <string>Suspend</string>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
diff --git a/lumina-desktop/panel-plugins/clock/LClock.cpp b/lumina-desktop/panel-plugins/clock/LClock.cpp
index 79cae84b..c3eb1451 100644
--- a/lumina-desktop/panel-plugins/clock/LClock.cpp
+++ b/lumina-desktop/panel-plugins/clock/LClock.cpp
@@ -38,10 +38,22 @@ void LClock::updateTime(){
if(useTZ){ CT = CT.toTimeZone(TZ); }
//Now update the display
QString label;
- if(deftime){ label = CT.time().toString(Qt::SystemLocaleShortDate) ; }
- else{ label=CT.toString(timefmt); }
- if(defdate){ labelWidget->setToolTip(CT.date().toString(Qt::SystemLocaleLongDate)); }
- else{ labelWidget->setToolTip(CT.toString(datefmt)); }
+ QString timelabel;
+ QString datelabel;
+ if(deftime){ timelabel = CT.time().toString(Qt::SystemLocaleShortDate) ; }
+ else{ timelabel=CT.toString(timefmt); }
+ if(defdate){ datelabel = CT.date().toString(Qt::SystemLocaleLongDate); }
+ else{ datelabel = CT.toString(datefmt); }
+ if(datetimeorder == "dateonly"){
+ label = datelabel;
+ labelWidget->setToolTip(timelabel);
+ }else if(datetimeorder == "timedate"){
+ label = timelabel + " " + datelabel;
+ }else if(datetimeorder == "datetime"){
+ label = datelabel + " " + timelabel;
+ }else{ label = timelabel;
+ labelWidget->setToolTip(datelabel);
+ }
if( this->layout()->direction() == QBoxLayout::TopToBottom ){
//different routine for vertical text (need newlines instead of spaces)
label.replace(" ","\n");
@@ -54,6 +66,7 @@ void LClock::updateFormats(){
datefmt = LSession::handle()->sessionSettings()->value("DateFormat","").toString();
deftime = timefmt.simplified().isEmpty();
defdate = datefmt.simplified().isEmpty();
+ datetimeorder = LSession::handle()->sessionSettings()->value("DateTimeOrder", "timeonly").toString();
useTZ = LSession::handle()->sessionSettings()->value("CustomTimeZone",false).toBool();
if(useTZ){ TZ = QTimeZone( LSession::handle()->sessionSettings()->value("TimeZoneByteCode", QByteArray()).toByteArray() ); }
diff --git a/lumina-desktop/panel-plugins/clock/LClock.h b/lumina-desktop/panel-plugins/clock/LClock.h
index 8156e7d8..31bf13d6 100644
--- a/lumina-desktop/panel-plugins/clock/LClock.h
+++ b/lumina-desktop/panel-plugins/clock/LClock.h
@@ -26,7 +26,7 @@ public:
private:
QTimer *timer;
QLabel *labelWidget;
- QString timefmt, datefmt;
+ QString timefmt, datefmt, datetimeorder;
bool deftime, defdate, useTZ;
QTimeZone TZ;
diff --git a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp
index 08ab49d0..b470f191 100644
--- a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp
+++ b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp
@@ -15,7 +15,7 @@ LSysMenuQuick::LSysMenuQuick(QWidget *parent) : QWidget(parent), ui(new Ui::LSys
settings = new QSettings("panel-plugins","systemdashboard");
brighttimer = new QTimer(this);
brighttimer->setSingleShot(true);
- brighttimer->setInterval(100); //100ms delay in setting the new value
+ brighttimer->setInterval(50); //50ms 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%
@@ -121,6 +121,11 @@ void LSysMenuQuick::brightSliderChanged(){
//Brightness controls cannot operate extremely quickly - combine calls as necessary
if(brighttimer->isActive()){ brighttimer->stop(); }
brighttimer->start();
+ //*DO* update the label right away
+ int val = ui->slider_brightness->value();
+ QString txt = QString::number(val)+"%";
+ if(val<100){ txt.prepend(" "); } //make sure no widget resizing
+ ui->label_bright_text->setText( txt );
}
void LSysMenuQuick::setCurrentBrightness(){
diff --git a/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp b/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp
index 8d0cacb3..a35db4d7 100644
--- a/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp
+++ b/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp
@@ -8,19 +8,20 @@
//#include <X11/Xlib.h>
//#include <X11/Xutil.h>
-#include <X11/extensions/Xdamage.h>
+//#include <X11/extensions/Xdamage.h>
//#include <xcb/damage.h>
//static xcb_damage_damage_t dmgID;
#include <LSession.h>
#include <QScreen>
-
-static int dmgID = 0;
+#include <LuminaX11.h>
+//static int dmgID = 0;
TrayIcon::TrayIcon(QWidget *parent) : QWidget(parent){
AID = 0; //nothing yet
IID = 0;
+ dmgID = 0;
}
TrayIcon::~TrayIcon(){
@@ -38,12 +39,10 @@ void TrayIcon::attachApp(WId id){
else if(AID!=0){ qWarning() << "Tray Icon is already attached to a window!"; return; }
AID = id;
IID = this->winId(); //embed directly into this widget
- //IID = LX11::CreateWindow( this->winId(), this->rect() ); //Create an intermediate window to be the parent
- if( LSession::handle()->XCB->EmbedWindow(AID, IID) ){
+ dmgID = LSession::handle()->XCB->EmbedWindow(AID, IID);
+ if( dmgID != 0 ){
LX11::RestoreWindow(AID); //make it visible
- //XSelectInput(QX11Info::display(), AID, StructureNotifyMask);
- //xcb_damage_create(QX11Info::connection(), dmgID, AID, XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES);
- dmgID = XDamageCreate( QX11Info::display(), AID, XDamageReportRawRectangles );
+ //dmgID = XDamageCreate( QX11Info::display(), AID, XDamageReportRawRectangles );
qDebug() << "New System Tray App:" << AID;
QTimer::singleShot(1000, this, SLOT(updateIcon()) );
}else{
diff --git a/lumina-desktop/panel-plugins/systemtray/TrayIcon.h b/lumina-desktop/panel-plugins/systemtray/TrayIcon.h
index a3cbac31..18c51a66 100644
--- a/lumina-desktop/panel-plugins/systemtray/TrayIcon.h
+++ b/lumina-desktop/panel-plugins/systemtray/TrayIcon.h
@@ -22,9 +22,7 @@
#include <QImage>
// libLumina includes
-#include <LuminaX11.h>
-
-//Local includes
+//#include <LuminaX11.h>
class TrayIcon : public QWidget{
Q_OBJECT
@@ -42,19 +40,11 @@ public slots:
private:
WId IID, AID; //icon ID and app ID
-
-//private slots:
- //void slotAttach(); //so that the attachment can be done in a new thread
-
+ uint dmgID;
protected:
void paintEvent(QPaintEvent *event);
- //void moveEvent(QMoveEvent *event);
void resizeEvent(QResizeEvent *event);
- //bool x11Event(XEvent *event);
-//signals:
- //void AppClosed();
- //void AppAttached();
};
#endif \ No newline at end of file
bgstack15