From d7ff36cb030fb6798d352998d645ab85c5d0fc62 Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Sun, 19 Apr 2015 10:15:19 +0200 Subject: 4 time display modes for panel clock: timeonly (default): display time, date as tooltip dateonly : display date, time as tooltip datetime : display date first then time timedate : display time first then date LSession option: DateTimeOrder (no UI yet) --- lumina-desktop/panel-plugins/clock/LClock.cpp | 21 +++++++++++++++++---- lumina-desktop/panel-plugins/clock/LClock.h | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'lumina-desktop/panel-plugins') 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; -- cgit From e72395a608a739ebaf4e0a23595ea0918fa9af40 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Sun, 19 Apr 2015 13:47:29 -0400 Subject: Adjust te brightness control labelling a bit in the sytem dashboard. Now the label will always stay in sync with the slider (no delay), it is only the backend setting routine which is on a slight (50ms) delay. --- lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lumina-desktop/panel-plugins') 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(){ -- cgit From 570272ccbe285afcad3f5b4ab00a18475ef163ed Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 20 Apr 2015 10:47:57 -0400 Subject: Remove the last libX11 usage in the sytem tray protocols. Move the damage ID creation to XCB, and place it within the embedding routine in LuminaX11 instead. --- lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp | 15 +++++++-------- lumina-desktop/panel-plugins/systemtray/TrayIcon.h | 14 ++------------ 2 files changed, 9 insertions(+), 20 deletions(-) (limited to 'lumina-desktop/panel-plugins') 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 //#include -#include +//#include //#include //static xcb_damage_damage_t dmgID; #include #include - -static int dmgID = 0; +#include +//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 // libLumina includes -#include - -//Local includes +//#include 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 -- cgit