aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-10-25 12:11:53 -0400
committerKen Moore <ken@ixsystems.com>2017-10-25 12:13:40 -0400
commit50cda0d1b7c6061cccb89389f44f9173026a678b (patch)
treecb70e562c6265d4ece4b0db0fee7732ff709ded7 /src-qt5/core/lumina-desktop-unified/src-desktop/src-qml
parentMerge branch 'master' of http://github.com/trueos/lumina (diff)
downloadlumina-50cda0d1b7c6061cccb89389f44f9173026a678b.tar.gz
lumina-50cda0d1b7c6061cccb89389f44f9173026a678b.tar.bz2
lumina-50cda0d1b7c6061cccb89389f44f9173026a678b.zip
Re-arrange the 2.0 desktop sources (QML + associated C++ files).
Also another checkpoint commit with some of the QML desktop stuff (have a working context menu, wallpapers not working yet though)
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-desktop/src-qml')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml36
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml57
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/WallpaperImage.qml25
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri7
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc7
5 files changed, 132 insertions, 0 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml
new file mode 100644
index 00000000..e5bac0b5
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml
@@ -0,0 +1,36 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2017, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+import QtQuick 2.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 2.0
+
+import Lumina.Backend.RootDesktopObject 2.0
+
+Menu {
+ id: contextMenu
+ closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
+ MenuItem {
+ text: "Lock Screen"
+ onTriggered: {
+ RootObject.lockscreen()
+ }
+ }
+
+ MenuItem {
+ text: "Logout"
+ //iconName: "system-log-out"
+ indicator: Image{
+ asynchronous: true
+ //autoTransform: true
+ //source: "image://theme/system-logout"
+ source: "file:///usr/local/share/icons/material-design-light/scalable/actions/system-log-out.svg"
+ }
+ onTriggered: {
+ RootObject.logout()
+ }
+ }
+ }
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml
new file mode 100644
index 00000000..a1a9164f
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml
@@ -0,0 +1,57 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2017, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This is the base QML script the launches/controls the desktop interface itself
+//===========================================
+// NOTE: This needs to be paired/used with the corresponding C++ class: RootDesktopObject
+// Which should be added as the "RootObject" context property to the QML engine
+//------------------
+// Example Code:
+// RootDesktopObject *rootobj = new RootDesktopObject();
+// QQuickView *root = new QQuickView();
+// root->setResizeMode(QQuickView::SizeRootObjectToView);
+// root->engine()->rootContext()->setContextProperty("RootObject", rootobj);
+//===========================================
+import QtQuick 2.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 2.0
+
+import "." as QML
+
+import Lumina.Backend.RootDesktopObject 2.0
+import Lumina.Backend.ScreenObject 2.0
+
+Rectangle {
+ id: rootCanvas
+ color: "black"
+
+ //Setup the right-click context menu
+ MouseArea {
+ anchors.fill: rootCanvas
+ acceptedButtons: Qt.RightButton
+ onClicked: {
+ contextMenu.x = mouseX
+ contextMenu.y = mouseY
+ contextMenu.open()
+ }
+ onPositionChanged: {
+ RootObject.mousePositionChanged()
+ }
+ }
+
+ //Create the context menu itself
+ QML.ContextMenu { id: contextMenu }
+
+ //Setup the wallpapers
+ Repeater{
+ model: RootObject.screens
+ QML.WallpaperImage{
+ //console.log( modelData.name() )
+ object: modelData
+ z: 0+index
+ }
+ }
+}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/WallpaperImage.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/WallpaperImage.qml
new file mode 100644
index 00000000..4d39b0b8
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/WallpaperImage.qml
@@ -0,0 +1,25 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2017, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+import QtQuick 2.2
+import QtQuick.Window 2.2
+import QtQuick.Controls 2.0
+
+import Lumina.Backend.ScreenObject 2.0
+
+AnimatedImage {
+ //C++ backend object
+ property ScreenObject object
+
+ //Normal geometries/placements
+ asynchronous: true
+ clip: true
+ source: object.background
+ x: object.x
+ y: object.y
+ width: object.width
+ height: object.height
+ }
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri
new file mode 100644
index 00000000..99905253
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri
@@ -0,0 +1,7 @@
+#Show the QML files to lupdate for translation purposes - not for the actual build
+lupdate_only{
+ SOURCES *= $${PWD}/RootDesktop.qml \
+ $${PWD}/ContextMenu.qml
+}
+
+RESOURCES *= $${PWD}/src-qml.qrc
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
new file mode 100644
index 00000000..ebdcc606
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="qml">
+ <file>RootDesktop.qml</file>
+ <file>ContextMenu.qml</file>
+ <file>WallpaperImage.qml</file>
+ </qresource>
+</RCC>
bgstack15