aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml
blob: f48f7751fda08e77e7f0ac89bed5e1b07be37ed4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//===========================================
//  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 1

import "." as QML

import Lumina.Backend.RootDesktopObject 2.0
import Lumina.Backend.ScreenObject 2.0
import Lumina.Backend.NativeWindowObject 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() */
      contextMenu.popup()
    }
    onPositionChanged: {
      RootObject.mousePositionChanged()
    }
  }

  //Create the context menu itself
 QML.ContextMenu { id: contextMenu }

  //Setup the screens/wallpapers
  Repeater{
    model: RootObject.screens
    QML.Screen{
      screen_id: modelData
      object: RootObject.screen(modelData)
      z: 0+index
    }
  }

  //Setup the windows
  Repeater{
    model: RootObject.windows
    QML.NativeWindow{
      window_id: modelData
      object: RootObject.window(modelData)
      z: 100+index
    }
  }

  //Setup the Panels
  Repeater{
    model: RootObject.panels
    QML.Panel{
      panel_id: modelData
      object: RootObject.panel(panel_id)
      z: 10100+index
    }
  }
}
bgstack15