diff options
Diffstat (limited to 'qml')
-rw-r--r-- | qml/DesktopGridView.qml | 116 | ||||
-rw-r--r-- | qml/HomePage.qml | 55 | ||||
-rw-r--r-- | qml/Main.qml | 167 | ||||
-rw-r--r-- | qml/StatusBar.qml | 149 | ||||
-rw-r--r-- | qml/SystrayView.qml | 32 | ||||
-rw-r--r-- | qml/VKeyboard.qml | 14 |
6 files changed, 533 insertions, 0 deletions
diff --git a/qml/DesktopGridView.qml b/qml/DesktopGridView.qml new file mode 100644 index 0000000..c5bf588 --- /dev/null +++ b/qml/DesktopGridView.qml @@ -0,0 +1,116 @@ +import QtQuick +import QtQuick.Controls +import org.kazoe.xdg + +ListView { + id: desktopgridview + property string category + property int nbrow + clip: true + orientation: ListView.Horizontal + anchors.margins: 5 + height: 150 + spacing: 15 + + + model: DesktopFilter { + id: filtermodel + model: xdgEntries + category: desktopgridview.category + onRowsInserted: { + desktopgridview.nbrow = rowCount() + } + + onRowsRemoved: { + desktopgridview.nbrow = rowCount() + } + + Component.onCompleted: { + desktopgridview.nbrow = rowCount() + } + } + + delegate: Rectangle { + property string applicationIcon: appIcon + property string applicationTitle: name + property string xdgPath: path + property alias highlighted: btn.highlighted + id: entryItem + width: desktopgridview.height * 0.8 + height: desktopgridview.height * 0.8 + highlighted: keywords.includes("running") + color: (btn.highlighted)?(currentTheme.highlight):(currentTheme.window) + radius: 4 + + Button { + id: btn + icon.source: "file://" + entryItem.applicationIcon + icon.name: entryItem.applicationIcon + icon.width: btn.width + icon.height: btn.height + + font.pixelSize: 12 + font.bold: true + height: entryItem.height * 0.5 + width: entryItem.width * 0.5 + anchors.top: parent.top + anchors.topMargin: 10 + anchors.horizontalCenter: parent.horizontalCenter + + background: Rectangle { + color: "transparent" + } + } + + Text { + anchors.top: btn.bottom + anchors.left: parent.left + anchors.right: parent.right + height: entryItem.height * 0.4 + text: entryItem.applicationTitle + font: btn.font + fontSizeMode: Text.Fit + opacity: enabled ? 1.0 : 0.3 + color: (btn.highlighted)?("white"):("grey") + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + + MouseArea { + id: zone + anchors.fill: parent + enabled: parent.enabled + property bool locked: false + + onClicked: { + if(zone.locked) + zone.locked = false + else + xdgEntries.start(entryItem.xdgPath) + } + + + Timer { + id: longPressTimer + + interval: 1000 + repeat: false + running: false + + onTriggered: { + xdgEntries.stop(entryItem.xdgPath) + zone.locked = true + } + } + + onPressedChanged: { + if ( pressed ) { + longPressTimer.running = true; + } else { + longPressTimer.running = false; + } + } + } + } +} diff --git a/qml/HomePage.qml b/qml/HomePage.qml new file mode 100644 index 0000000..fbcfd70 --- /dev/null +++ b/qml/HomePage.qml @@ -0,0 +1,55 @@ +import QtQuick + +Rectangle { + id: homepage + clip: true + property string selected: "tests" + + ListView { + id: category + anchors.fill: parent + model: xdgEntries.categories + delegate: Rectangle { + Component.onCompleted: { + console.debug("MANAGE CATEGORY [" + modelData + "]") + } + + property bool isshow: modelData !== "System" && modelData !== "Debug" + width: homepage.width + height: (isshow) ? (entriesView.nbrow > 0 ? entriesView.height + categoryTitle.height : 0) : 0 + color: currentTheme.base + visible: isshow && entriesView.nbrow > 0 + + Rectangle { + id: categoryTitle + height: 20 + width: parent.width - 2 + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: 4 + anchors.topMargin: 4 + color: currentTheme.mid + + + Text { + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + text: modelData + font.pixelSize: 15 + font.bold: true + color: currentTheme.windowText + } + } + + DesktopGridView { + id: entriesView + category: modelData + anchors.top: categoryTitle.bottom + anchors.left: parent.left + anchors.right: parent.right + } + } + } +} diff --git a/qml/Main.qml b/qml/Main.qml new file mode 100644 index 0000000..c3470fc --- /dev/null +++ b/qml/Main.qml @@ -0,0 +1,167 @@ +import QtQuick +import QtWayland.Compositor +import QtWayland.Compositor.XdgShell +import QtQuick.Window +import QtQuick.Controls +import org.kazoe.desktop +import org.kazoe.xdg + +WaylandCompositor { + id: comp + property string defaultTitle: "" + property int appHeight: win.height - statusBar.height + property int appWidth: win.width + property bool showHomepage: true + property string statusBarModel: "StatusBar" + property alias statusBarHeight: statusBar.height + + SystemPalette { + id: currentTheme + colorGroup: SystemPalette.Active + } + + DesktopEntries { + id: xdgEntries + + onRaiseProcess: { + manager.currentSurface = waylandEntries.getSurface(pid) + } + } + + AutoStart { + id: autostarter + Component.onCompleted: { + autostarter.start("Desktop Entry/X-DESKTOPMGR-AUTOSTART", "true") + } + } + + DesktopFilter { + id: sysbar + section: "X-DESKTOPMGR-SYSBAR" + showAll: true + model: xdgEntries + } + + DesktopFilter { + id: systray + section: "X-DESKTOPMGR-SYSTRAY" + showAll: true + model: xdgEntries + } + + WaylandEntries { + id: entries + } + + Connections { + target: manager + function onCurrentSurfaceChanged() { + comp.showHomepage = false + } + + function onGotoHome() { + comp.showHomepage = true + } + } + + + WaylandOutput { + id: output + sizeFollowsWindow: true + transform: WaylandOutput.Transform90 + scaleFactor: 4 + window: Window { + id: win + visible: true + width: 800 + height: 480 + + VKeyboard { + id: keyboard + anchors.fill: parent + } + + Flickable { + anchors.fill: parent + id: appZoneView + clip: true + contentWidth: win.width + contentHeight: win.height + flickableDirection: Flickable.VerticalFlick + interactive: false + + property int textInputY: keyboard.textInputY + property int textInputHeight: keyboard.textInputHeight + property bool keyboardActive: keyboard.active + property int keyboardHeight: keyboard.implicitHeight + property int wantOffset: (appZoneView.height - keyboardHeight) / 2 + + onTextInputYChanged: { + if(appZoneView.keyboardActive && appZoneView.contentY == 0) + { + if(textInputY > (appZoneView.height - keyboardHeight)) + { + appZoneView.contentY = textInputY - textInputHeight - wantOffset + } + } + } + + onKeyboardActiveChanged: { + appZoneView.contentY = 0 + } + + StatusBar { + id: statusBar + width: parent.width + z: 20 + } + + HomePage { + id: homepageview + anchors.top: statusBar.bottom + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + visible: comp.showHomepage + } + + ShellSurfaceItem { + id: appZone + visible: !comp.showHomepage + anchors.top: statusBar.bottom + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + + shellSurface: manager.currentSurface + autoCreatePopupItems: true + + onWidthChanged: { + if(manager.currentSurface) + manager.currentSurface.toplevel.sendResizing(Qt.size(appZone.width, appZone.height)) + } + + onHeightChanged: { + if(manager.currentSurface) + manager.currentSurface.toplevel.sendResizing(Qt.size(appZone.width, appZone.height)) + } + } + } + } + } + + XdgShell { + onToplevelCreated: function(toplevel, xdgSurface) { + toplevel.sendResizing(Qt.size(appZone.width, appZone.height)); + entries.addSurface(xdgSurface) + manager.currentSurface = xdgSurface + } + } + + XdgDecorationManagerV1 { + preferredMode: XdgToplevel.ServerSideDecoration + } + + // Extension for Input Method (QT_IM_MODULE) support at compositor-side + TextInputManager {} +} diff --git a/qml/StatusBar.qml b/qml/StatusBar.qml new file mode 100644 index 0000000..3758657 --- /dev/null +++ b/qml/StatusBar.qml @@ -0,0 +1,149 @@ +import QtQuick +import QtQuick.Controls +import org.kazoe.desktop +import org.kazoe.xdg + +Rectangle { + id: statusBar + height: 46 + property int batteryLevelWarning: 15 + + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + + gradient: Gradient { + GradientStop { position: 0.0; color: currentTheme.window } + GradientStop { position: 1.0; color: currentTheme.window } + } + + Rectangle { + id: bottomline + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + height: 1 + width: undefined + color: "black" + } + + Button { + id: backHome + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + height: comp.statusBarHeight + anchors.margins: 4 + palette.buttonText: "white" + font.pointSize: 9 + highlighted: comp.showHomepage + display: AbstractButton.IconOnly + + icon.name: "home" + + background: Rectangle { + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + width: backHome.width + height: backHome.height + border.color: backHome.highlighted ? currentTheme.highlight : currentTheme.alternateBase + border.width: backHome.highlighted ? 2 : 1 + radius: 4 + color: currentTheme.mid + } + + onClicked: { + comp.showHomepage = true + } + } + + ListView { + id: taskbar + anchors.left: backHome.right + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.right: systrayview.left + anchors.leftMargin: 4 + anchors.topMargin: 4 + clip: true + model: entries + orientation: Qt.Horizontal + spacing: 4 + + delegate: Button { + id: taskapp + palette.buttonText: "white" + font.pointSize: 9 + highlighted: (comp.showHomepage === false) && (manager.currentSurface === wl_surface) + + height: taskbar.height - 4 + display: AbstractButton.TextBesideIcon + /* + * TODO: Find app icon with wayland + icon.name: wl_surface.surface + icon.color: "#0aa4da" + */ + Entry { + id: xdgapp + desktopFile: "/usr/share/applications/" + appId + ".desktop" + } + icon.name: xdgapp.icon + icon.color: "transparent" + + background: Rectangle { + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + width: taskapp.width + height: taskapp.height + border.color: taskapp.highlighted ? currentTheme.highlight : currentTheme.alternateBase + border.width: taskapp.highlighted ? 2 : 1 + radius: 4 + color: currentTheme.mid + } + text: title + + onClicked: { + manager.currentSurface = wl_surface + comp.showHomepage = false + } + + Timer { + id: longPressTimer + + interval: 1000 + repeat: false + running: false + + onTriggered: { + if(manager.currentSurface == wl_surface) + { + comp.showHomepage = true + } + + entries.stop(pid) + } + } + + onPressedChanged: { + if ( pressed ) { + longPressTimer.running = true; + } else { + longPressTimer.running = false; + } + } + } + } + + SystrayView { + id: systrayview + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.topMargin: 2 + anchors.bottomMargin: 2 + anchors.rightMargin: 2 + + width: systrayview.contentWidth + spacing: 1 + } +} diff --git a/qml/SystrayView.qml b/qml/SystrayView.qml new file mode 100644 index 0000000..3b21152 --- /dev/null +++ b/qml/SystrayView.qml @@ -0,0 +1,32 @@ +import QtQuick +import QtQuick.Controls +import QtWayland.Compositor +import org.kazoe.desktop +import org.kazoe.xdg + +ListView { + id: systrayView + width: systrayView.contentWidth + orientation: ListView.Horizontal + model: systray + delegate: Item { + id: trayitem + + Component.onCompleted: { + var qmlcode + var c + if(exec.startsWith("qml://")) { + var ur = exec.split("/") + qmlcode = "import " + ur[2] + " " + ur[3] + "; " + ur[4] + " {}" + c = Qt.createQmlObject(qmlcode, trayitem, ur[4]) + } + else + { + console.debug("Item not supported for systray:" + exec) + } + + trayitem.width = Qt.binding(() => {return c.width}) + trayitem.height = Qt.binding(() => {return c.height}) + } + } +} diff --git a/qml/VKeyboard.qml b/qml/VKeyboard.qml new file mode 100644 index 0000000..c97e120 --- /dev/null +++ b/qml/VKeyboard.qml @@ -0,0 +1,14 @@ +import QtQuick +import QtQuick.VirtualKeyboard +import QtQuick.VirtualKeyboard.Settings +import QtQuick.Window + +InputPanel { + id: panel + visible: active + y: active ? 0 : parent.height + anchors.left: parent.left + anchors.right: parent.right + property int textInputHeight: InputContext.cursorRectangle.height + property int textInputY: InputContext.cursorRectangle.y +} |