From f8036895f95acc49f484af564d2b56f14c158dd9 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Tue, 16 Nov 2021 08:10:18 +0100 Subject: Rename unity* source files --- examples/ayatanaqmlmenumodel.qml | 118 +++++++++++++++++++++++++++++++++++++++ examples/unityqmlmenumodel.qml | 118 --------------------------------------- 2 files changed, 118 insertions(+), 118 deletions(-) create mode 100644 examples/ayatanaqmlmenumodel.qml delete mode 100644 examples/unityqmlmenumodel.qml (limited to 'examples') diff --git a/examples/ayatanaqmlmenumodel.qml b/examples/ayatanaqmlmenumodel.qml new file mode 100644 index 0000000..e7360e0 --- /dev/null +++ b/examples/ayatanaqmlmenumodel.qml @@ -0,0 +1,118 @@ +/* + * Copyright 2013 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Authors: Lars Uebernickel + */ + +import QtQuick 2.0 +import QMenuModel 0.1 + +Item { + width: 400; + height: 500; + + UnityMenuModel { + id: menu + busName: "org.ayatana.indicator.sound" + actions: { "indicator": "/org/ayatana/indicator/sound" } + menuObjectPath: "/org/ayatana/indicator/sound/desktop" + } + + ListView { + id: listview + anchors.fill: parent + anchors.margins: 10 + spacing: 3 + model: menu + + delegate: Loader { + sourceComponent: { + if (isSeparator) { + return separator; + } + else if (type == "org.ayatana.indicator.slider") { + listview.model.loadExtendedAttributes(index, {'min-icon': 'icon', + 'max-icon': 'icon'}); + return slider; + } + else { + return menuitem; + } + } + + Component { + id: separator + Rectangle { + width: listview.width + height: 4 + color: "blue" + } + } + + Component { + id: slider + Rectangle { + width: listview.width + color: "#ddd" + height: 40 + Row { + anchors.fill: parent + Image { + source: ext.minIcon + } + Text { + text: model.actionState + } + Image { + source: ext.maxIcon + } + } + } + } + + Component { + id: menuitem + Rectangle { + width: listview.width + height: 40 + color: "#ddd" + Row { + anchors.fill: parent + anchors.margins: 5 + Image { + source: icon + } + Text { + height: parent.height + verticalAlignment: Text.AlignVCenter + color: sensitive ? "black" : "#aaa"; + text: label + } + } + MouseArea { + anchors.fill: parent + onClicked: { + var submenu = listview.model.submenu(index); + if (submenu) + listview.model = submenu; + else + action.activate(); + } + } + } + } + } + } +} diff --git a/examples/unityqmlmenumodel.qml b/examples/unityqmlmenumodel.qml deleted file mode 100644 index e7360e0..0000000 --- a/examples/unityqmlmenumodel.qml +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2013 Canonical Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * Authors: Lars Uebernickel - */ - -import QtQuick 2.0 -import QMenuModel 0.1 - -Item { - width: 400; - height: 500; - - UnityMenuModel { - id: menu - busName: "org.ayatana.indicator.sound" - actions: { "indicator": "/org/ayatana/indicator/sound" } - menuObjectPath: "/org/ayatana/indicator/sound/desktop" - } - - ListView { - id: listview - anchors.fill: parent - anchors.margins: 10 - spacing: 3 - model: menu - - delegate: Loader { - sourceComponent: { - if (isSeparator) { - return separator; - } - else if (type == "org.ayatana.indicator.slider") { - listview.model.loadExtendedAttributes(index, {'min-icon': 'icon', - 'max-icon': 'icon'}); - return slider; - } - else { - return menuitem; - } - } - - Component { - id: separator - Rectangle { - width: listview.width - height: 4 - color: "blue" - } - } - - Component { - id: slider - Rectangle { - width: listview.width - color: "#ddd" - height: 40 - Row { - anchors.fill: parent - Image { - source: ext.minIcon - } - Text { - text: model.actionState - } - Image { - source: ext.maxIcon - } - } - } - } - - Component { - id: menuitem - Rectangle { - width: listview.width - height: 40 - color: "#ddd" - Row { - anchors.fill: parent - anchors.margins: 5 - Image { - source: icon - } - Text { - height: parent.height - verticalAlignment: Text.AlignVCenter - color: sensitive ? "black" : "#aaa"; - text: label - } - } - MouseArea { - anchors.fill: parent - onClicked: { - var submenu = listview.model.submenu(index); - if (submenu) - listview.model = submenu; - else - action.activate(); - } - } - } - } - } - } -} -- cgit v1.2.3