diff options
author | Ken Moore <ken@ixsystems.com> | 2018-02-02 13:51:27 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-02-02 13:51:27 -0500 |
commit | 9001eb57798a6c1fb02f811c08b7fd1520564974 (patch) | |
tree | 62d3db3028aa569dd6188af82ec94490b8408ecd /src-qt5/core/lumina-desktop-unified/src-desktop | |
parent | Oops - accidentally left a code stub for some later work... (diff) | |
download | lumina-9001eb57798a6c1fb02f811c08b7fd1520564974.tar.gz lumina-9001eb57798a6c1fb02f811c08b7fd1520564974.tar.bz2 lumina-9001eb57798a6c1fb02f811c08b7fd1520564974.zip |
Add a new "Clock_Digital" plugin
Also ensure the panel plugins are fit to the width/height depending on the type of panel (vertical/horizontal)
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-desktop')
7 files changed, 34 insertions, 3 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp index a0f58e71..9b7b8da7 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp @@ -30,6 +30,9 @@ int PanelObject::x(){ return geom.x(); } int PanelObject::y(){ return geom.y(); } int PanelObject::width(){ return geom.width(); } int PanelObject::height(){ return geom.height(); } +bool PanelObject::isVertical(){ + return ( geom.width() < geom.height() ); +} void PanelObject::setBackground(QString fileOrColor){ if(bg!=fileOrColor){ diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.h index 8cf59dee..04c47e06 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.h @@ -20,6 +20,7 @@ class PanelObject : public QObject { Q_PROPERTY( int y READ y NOTIFY geomChanged) Q_PROPERTY( int width READ width NOTIFY geomChanged) Q_PROPERTY( int height READ height NOTIFY geomChanged) + Q_PROPERTY( bool isVertical READ isVertical NOTIFY geomChanged) private: QString panel_id, bg; @@ -36,6 +37,7 @@ public: Q_INVOKABLE int y(); Q_INVOKABLE int width(); Q_INVOKABLE int height(); + Q_INVOKABLE bool isVertical(); public slots: void setBackground(QString fileOrColor); diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp index b1bd939b..5891028c 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp @@ -200,7 +200,7 @@ void RootDesktopObject::updateCurrentTimeFormat(QString fmt){ else if(fmt.contains("h")){ interval = 30000; } //30 second pings for 1-hour displays currentTimeTimer->setInterval(interval); updateCurrentTime(); //refresh the currently-available time - currentTimeTimer->start();//start the update timer + QTimer::singleShot(0,currentTimeTimer, SLOT(start()) );//start the update timer } void RootDesktopObject::logout(){ diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/Panel.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/Panel.qml index 44abb425..48046648 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/Panel.qml +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/Panel.qml @@ -33,6 +33,14 @@ Rectangle { //hardcode the "status_tray" plugin at the moment PLUGINS.StatusTray{ id: "statustray" + Layout.fillHeight: layout.parent.object.isVertical ? false : true + Layout.fillWidth: layout.parent.object.isVertical ? true : false + + } + PLUGINS.Clock_Digital{ + id: "clock" + Layout.fillHeight: layout.parent.object.isVertical ? false : true + Layout.fillWidth: layout.parent.object.isVertical ? true : false } } diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/Clock_Digital.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/Clock_Digital.qml new file mode 100644 index 00000000..aaa8ddd0 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/Clock_Digital.qml @@ -0,0 +1,17 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2018, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +// This is the QML plugin that displays the OS status/system tray +//=========================================== +import QtQuick 2.2 +import QtQuick.Layouts 1.3 +import QtQuick.Controls 1 + +import Lumina.Backend.RootDesktopObject 2.0 + +ToolButton{ + text: RootObject.currentTime +} diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/plugins.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/plugins.pri index 50eb9c5c..a6296e13 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/plugins.pri +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/plugins.pri @@ -5,6 +5,6 @@ lupdate_only{ $${PWD}/status_tray/VolumeButton.qml \ $${PWD}/status_tray/NetworkButton.qml \ $${PWD}/status_tray/BatteryButton.qml \ - $${PWD}/status_tray/UpdateButton.qml - + $${PWD}/status_tray/UpdateButton.qml \ + $${PWD}/Clock_Digital.qml } diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc index 1da9d5bd..292caea2 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc @@ -11,5 +11,6 @@ <file>plugins/status_tray/NetworkButton.qml</file> <file>plugins/status_tray/BatteryButton.qml</file> <file>plugins/status_tray/UpdateButton.qml</file> + <file>plugins/Clock_Digital.qml</file> </qresource> </RCC> |