diff options
Diffstat (limited to 'src/qtdevicesettings/settingsui')
-rw-r--r-- | src/qtdevicesettings/settingsui/deployment.pri | 27 | ||||
-rw-r--r-- | src/qtdevicesettings/settingsui/icons.qrc | 12 | ||||
-rw-r--r-- | src/qtdevicesettings/settingsui/main.cpp | 41 | ||||
-rw-r--r-- | src/qtdevicesettings/settingsui/main.qml | 170 | ||||
-rw-r--r-- | src/qtdevicesettings/settingsui/qml.qrc | 6 | ||||
-rw-r--r-- | src/qtdevicesettings/settingsui/settingsui.pro | 17 | ||||
-rw-r--r-- | src/qtdevicesettings/settingsui/settingsview.xml | 41 |
7 files changed, 314 insertions, 0 deletions
diff --git a/src/qtdevicesettings/settingsui/deployment.pri b/src/qtdevicesettings/settingsui/deployment.pri new file mode 100644 index 0000000..5441b63 --- /dev/null +++ b/src/qtdevicesettings/settingsui/deployment.pri @@ -0,0 +1,27 @@ +android-no-sdk { + target.path = /data/user/qt + export(target.path) + INSTALLS += target +} else:android { + x86 { + target.path = /libs/x86 + } else: armeabi-v7a { + target.path = /libs/armeabi-v7a + } else { + target.path = /libs/armeabi + } + export(target.path) + INSTALLS += target +} else:unix { + isEmpty(target.path) { + qnx { + target.path = /tmp/$${TARGET}/bin + } else { + target.path = /opt/$${TARGET}/bin + } + export(target.path) + } + INSTALLS += target +} + +export(INSTALLS) diff --git a/src/qtdevicesettings/settingsui/icons.qrc b/src/qtdevicesettings/settingsui/icons.qrc new file mode 100644 index 0000000..8656aa4 --- /dev/null +++ b/src/qtdevicesettings/settingsui/icons.qrc @@ -0,0 +1,12 @@ +<RCC> + <qresource prefix="/"> + <file>../icons/Chevron-left_black_1x.png</file> + <file>../icons/Power_black_1x.png</file> + <file>../icons/Display_qt_6x.png</file> + <file>../icons/Clock_qt_6x.png</file> + <file>../icons/Flag_qt_6x.png</file> + <file>../icons/World_qt_6x.png</file> + <file>../icons/Audio_qt_6x.png</file> + <file>../icons/Bluetooth_qt_6x.png</file> + </qresource> +</RCC> diff --git a/src/qtdevicesettings/settingsui/main.cpp b/src/qtdevicesettings/settingsui/main.cpp new file mode 100644 index 0000000..b345225 --- /dev/null +++ b/src/qtdevicesettings/settingsui/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the FOO module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + + return app.exec(); +} diff --git a/src/qtdevicesettings/settingsui/main.qml b/src/qtdevicesettings/settingsui/main.qml new file mode 100644 index 0000000..4c8080a --- /dev/null +++ b/src/qtdevicesettings/settingsui/main.qml @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the FOO module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import QtQuick.XmlListModel 2.0 +import com.theqtcompany.settings.common 1.0 + +ApplicationWindow { + id: root + title: qsTr("Device settings") + width: 800 + height: 600 + visible: true + property var service + + SystemPalette { id: systemPalette; colorGroup: SystemPalette.Active } + + toolBar:ToolBar { + id: titlebar + property string title: "" + implicitWidth: parent.width + implicitHeight: Math.round(40 * Flat.FlatStyle.scaleFactor) + Item { + anchors.fill: parent + + ToolButton { + iconSource: "../icons/Chevron-left_black_1x.png" + text: "" + visible: stackView.depth > 1 + height: parent.height + width: parent.height + onClicked: stackView.pop(); + } + TextLabel { + id: titleText + font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) + anchors.fill: parent + text: stackView.currentItem.title + } + + + ToolButton { + iconSource: "../icons/Power_black_1x.png" + text: "" + visible: stackView.depth == 1 + height: parent.height + width: parent.height + anchors.right: parent.right + onClicked: { + menu.__xOffset = Math.round(-100 * Flat.FlatStyle.scaleFactor); + menu.popup(); + } + } + } + } + + Menu { + id: menu + title: "" + enabled: false + + MenuItem { + text: qsTr("Reboot") + onTriggered: B2QtDevice.reboot() + } + + MenuItem { + text: qsTr("Shutdown") + onTriggered: B2QtDevice.powerOff() + } + } + + StackView { + id: stackView + initialItem: mainView + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + + Component { + id: mainView + Item { + property string title: qsTr("Device Settings") + XmlListModel { + id: xmlModel + source: "settingsview.xml" + query: "/xml/settings/item" + XmlRole { name: "title"; query: "title/string()"} + XmlRole { name: "icon"; query: "icon/string()"} + XmlRole { name: "plugin"; query: "plugin/string()"} + XmlRole { name: "view"; query: "view/string()"} + } + + GridView { + id: grid + anchors.fill: parent + anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) + cellHeight: Math.round(133 * Flat.FlatStyle.scaleFactor) + spacing + cellWidth: Math.round(117 * Flat.FlatStyle.scaleFactor) + spacing + property int spacing: Math.round(20 * Flat.FlatStyle.scaleFactor) + + model: xmlModel + delegate: + MouseArea { + width: grid.cellWidth - grid.spacing + height: grid.cellHeight - grid.spacing + + Rectangle { + anchors.fill: parent + color: "#d6d6d6" + radius: 5 + visible: pressed + } + + Column { + anchors.fill: parent + anchors.topMargin: Math.round(10 * Flat.FlatStyle.scaleFactor) + Image { + id: image + source: icon + anchors.horizontalCenter: parent.horizontalCenter + } + + TextLabel { + text: title + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) + } + } + + onClicked: { + var url = 'import ' + plugin + '; ' + view + ' {}'; + stackView.push({item: Qt.createQmlObject(url,stackView)}); + titlebar.title = title + } + } + } + } + } + } +} diff --git a/src/qtdevicesettings/settingsui/qml.qrc b/src/qtdevicesettings/settingsui/qml.qrc new file mode 100644 index 0000000..7b1f07b --- /dev/null +++ b/src/qtdevicesettings/settingsui/qml.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + <file>settingsview.xml</file> + </qresource> +</RCC> diff --git a/src/qtdevicesettings/settingsui/settingsui.pro b/src/qtdevicesettings/settingsui/settingsui.pro new file mode 100644 index 0000000..026d911 --- /dev/null +++ b/src/qtdevicesettings/settingsui/settingsui.pro @@ -0,0 +1,17 @@ +TEMPLATE = app + +QT += qml quick +SOURCES += main.cpp + +RESOURCES += \ + qml.qrc \ + icons.qrc + +# Additional import path used to resolve QML modules in Qt Creator's code model +QML_IMPORT_PATH = + +# Default rules for deployment. +include(deployment.pri) + +DISTFILES += \ + settingsview.xml diff --git a/src/qtdevicesettings/settingsui/settingsview.xml b/src/qtdevicesettings/settingsui/settingsview.xml new file mode 100644 index 0000000..b2cfc51 --- /dev/null +++ b/src/qtdevicesettings/settingsui/settingsview.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<xml> + <settings> + <item> + <title>Network</title> + <plugin>com.theqtcompany.settings.network 1.0</plugin> + <view>NetworkSettings</view> + <icon>../icons/World_qt_6x.png</icon> + </item> + <item> + <title>Display</title> + <plugin>com.theqtcompany.settings.general 1.0</plugin> + <view>Display</view> + <icon>../icons/Display_qt_6x.png</icon> + </item> + <item> + <title>Audio</title> + <plugin>com.theqtcompany.settings.general 1.0</plugin> + <view>Sound</view> + <icon>../icons/Audio_qt_6x.png</icon> + </item> + <item> + <title>Date and Time</title> + <plugin>com.theqtcompany.settings.timedate 1.0</plugin> + <view>TimeDate</view> + <icon>../icons/Clock_qt_6x.png</icon> + </item> + <item> + <title>Language</title> + <plugin>com.theqtcompany.settings.locale 1.0</plugin> + <view>Language</view> + <icon>../icons/Flag_qt_6x.png</icon> + </item> + <item> + <title>Bluetooth</title> + <plugin>com.theqtcompany.settings.bluetooth 1.0</plugin> + <view>Bluetooth</view> + <icon>../icons/Bluetooth_qt_6x.png</icon> + </item> + </settings> +</xml> |