diff options
-rw-r--r-- | basicsuite/launchersettings/SettingsButtonStyle.qml | 68 | ||||
-rw-r--r-- | basicsuite/launchersettings/SettingsCheckBoxStyle.qml (renamed from basicsuite/launchersettings/WifiController.qml) | 31 | ||||
-rw-r--r-- | basicsuite/launchersettings/SettingsGroupBoxStyle.qml | 81 | ||||
-rw-r--r-- | basicsuite/launchersettings/SettingsRadioButtonStyle.qml | 66 | ||||
-rw-r--r-- | basicsuite/launchersettings/WifiGroupBox.qml | 11 | ||||
-rw-r--r-- | basicsuite/launchersettings/WifiNetworkList.qml (renamed from basicsuite/launchersettings/NetworkList.qml) | 56 | ||||
-rw-r--r-- | basicsuite/launchersettings/main.qml | 240 | ||||
-rw-r--r-- | basicsuite/shared/SharedMain.qml | 3 | ||||
-rw-r--r-- | basicsuite/shared/engine.cpp | 2 | ||||
-rw-r--r-- | basicsuite/shared/engine.h | 11 | ||||
-rw-r--r-- | basicsuite/shared/main_landscape.qml | 5 |
11 files changed, 354 insertions, 220 deletions
diff --git a/basicsuite/launchersettings/SettingsButtonStyle.qml b/basicsuite/launchersettings/SettingsButtonStyle.qml new file mode 100644 index 0000000..9d0b4b0 --- /dev/null +++ b/basicsuite/launchersettings/SettingsButtonStyle.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 + +ButtonStyle { + panel: Item { + implicitHeight: engine.smallFontSize() * 2.4 + implicitWidth: engine.centimeter() * 5 + + BorderImage { + anchors.fill: parent + antialiasing: true + border.bottom: 8 + border.top: 8 + border.left: 8 + border.right: 8 + anchors.margins: control.pressed ? -4 : 0 + source: control.pressed ? "images/button_pressed.png" : "images/button_default.png" + Text { + text: control.text + anchors.centerIn: parent + color: "white" + font.pixelSize: engine.smallFontSize() + renderType: Text.NativeRendering + } + } + } +} diff --git a/basicsuite/launchersettings/WifiController.qml b/basicsuite/launchersettings/SettingsCheckBoxStyle.qml index 3725478..2f615b7 100644 --- a/basicsuite/launchersettings/WifiController.qml +++ b/basicsuite/launchersettings/SettingsCheckBoxStyle.qml @@ -38,21 +38,24 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.0 -import Qt.labs.wifi 0.1 as Wifi +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 -QtObject { - function createWifiGroupBox() - { - if (Wifi.Interface.wifiSupported()) { - var component = Qt.createComponent("WifiGroupBox.qml"); - var wifi = component.createObject(wifiOptions.contentItem); - if (wifi == null) { - wifiOptions.visible = false - print("Error creating WifiGroupBox"); +CheckBoxStyle { + indicator: Rectangle { + implicitWidth: engine.mm(7) + implicitHeight: engine.mm(7) + radius: 10 + border.color: "black" + border.width: 2 + Rectangle { + visible: control.checked + color: "#45b7e2" + border.color: "darkblue" + radius: 10 + anchors.margins: engine.mm(1) + anchors.fill: parent } - } else { - wifiOptions.visible = false - } } } diff --git a/basicsuite/launchersettings/SettingsGroupBoxStyle.qml b/basicsuite/launchersettings/SettingsGroupBoxStyle.qml new file mode 100644 index 0000000..4758d2c --- /dev/null +++ b/basicsuite/launchersettings/SettingsGroupBoxStyle.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 +import QtQuick.Controls.Private 1.0 + +// GroupBoxStyle currently is not available as a public API, +// so we write our own by importing private Styles API. +Style { + // The margin from the content item to the groupbox + padding { + top: (control.title.length > 0 ? TextSingleton.implicitHeight : 0) + 30 + left: 8 + right: 8 + bottom: 8 + } + // The groupbox frame + property Component panel: Item { + anchors.fill: parent + + Text { + id: label + anchors.bottom: borderImage.top + anchors.margins: 2 + text: control.title + font.pixelSize: engine.smallFontSize() * 1.1 + color: "white" + renderType: Text.NativeRendering + } + + BorderImage { + id: borderImage + anchors.fill: parent + anchors.topMargin: padding.top - 7 + source: "images/groupbox.png" + border.left: 4 + border.right: 4 + border.top: 4 + border.bottom: 4 + } + } +} diff --git a/basicsuite/launchersettings/SettingsRadioButtonStyle.qml b/basicsuite/launchersettings/SettingsRadioButtonStyle.qml new file mode 100644 index 0000000..9959ea1 --- /dev/null +++ b/basicsuite/launchersettings/SettingsRadioButtonStyle.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of the examples of the Qt Enterprise Embedded. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 + +RadioButtonStyle { + indicator: Rectangle { + implicitWidth: engine.mm(7) + implicitHeight: engine.mm(7) + radius: 40 + border.color: "black" + border.width: 2 + Rectangle { + anchors.fill: parent + visible: control.checked + color: "#45b7e2" + border.color: "darkblue" + radius: 40 + anchors.margins: engine.mm(1) + } + } + label: Label { + text: control.text + font.pixelSize: engine.smallFontSize() * 0.8 + color: "white" + } +} diff --git a/basicsuite/launchersettings/WifiGroupBox.qml b/basicsuite/launchersettings/WifiGroupBox.qml index a37c741..124a705 100644 --- a/basicsuite/launchersettings/WifiGroupBox.qml +++ b/basicsuite/launchersettings/WifiGroupBox.qml @@ -38,10 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.0 +import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Layouts 1.0 - import Qt.labs.wifi 0.1 ColumnLayout { @@ -61,7 +60,7 @@ ColumnLayout { Button { id: wifiOnOffButton Layout.fillWidth: true - style: root.buttonStyle + style: SettingsButtonStyle {} text: (wifiManager.backendReady) ? "Switch Off" : "Switch On" onClicked: { if (wifiManager.backendReady) { @@ -77,7 +76,7 @@ ColumnLayout { Button { id: listNetworksButton Layout.fillWidth: true - style: root.buttonStyle + style: SettingsButtonStyle {} visible: wifiManager.backendReady text: (networkList.visible) ? "Hide wifi networks" : "List available wifi networks" @@ -85,9 +84,9 @@ ColumnLayout { } } - NetworkList { + WifiNetworkList { id: networkList - implicitHeight: 400 + implicitHeight: engine.centimeter(7) Layout.fillWidth: true visible: false clip: true diff --git a/basicsuite/launchersettings/NetworkList.qml b/basicsuite/launchersettings/WifiNetworkList.qml index beab37e..40f3874 100644 --- a/basicsuite/launchersettings/NetworkList.qml +++ b/basicsuite/launchersettings/WifiNetworkList.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.0 +import QtQuick 2.2 import QtQuick.Controls 1.2 import Qt.labs.wifi 0.1 @@ -46,11 +46,13 @@ Item { Component { id: listDelegate Rectangle { - id: delegateBackground property bool expanded: false property bool connected: wifiManager.connectedSSID == network.ssid property bool actingNetwork: networkView.currentNetworkSsid == network.ssid - height: (expanded ? (connected ? 180: 260) : 70) + property int notExpandedHeight: ssidLabel.height + bssidLabel.height + engine.mm(4) + property int expandedHeight: notExpandedHeight + passwordInput.height + connectionButton.height + engine.mm(7) + property int connectedExpandedHeight: notExpandedHeight + connectionButton.height + engine.mm(4) + height: (expanded ? (connected ? connectedExpandedHeight : expandedHeight) : notExpandedHeight) width: parent.width clip: true // ### fixme color: "#5C5C5C" @@ -76,8 +78,9 @@ Item { id: ssidLabel anchors.top: parent.top anchors.left: parent.left - anchors.margins: 10 - font.pixelSize: 20 + anchors.margins: engine.mm(1) + anchors.leftMargin: engine.mm(2) + font.pixelSize: engine.smallFontSize() font.bold: true color: "#E6E6E6" text: network.ssid + (actingNetwork ? networkView.networkStateText : ""); @@ -87,41 +90,43 @@ Item { id: bssidLabel anchors.top: ssidLabel.bottom anchors.left: parent.left - anchors.margins: 5 - anchors.leftMargin: 40 + anchors.margins: engine.mm(1) + anchors.leftMargin: engine.mm(6) text: network.bssid color: "#E6E6E6" - font.pixelSize: ssidLabel.font.pixelSize * 0.5 + font.pixelSize: ssidLabel.font.pixelSize * 0.8 } Text { id: flagsLabel - x: 200 anchors.top: bssidLabel.top + anchors.left: bssidLabel.right + anchors.leftMargin: engine.mm(7) text: (network.supportsWPA2 ? "WPA2 " : "") + (network.supportsWPA ? "WPA " : "") + (network.supportsWEP ? "WEP " : "") + (network.supportsWPS ? "WPS " : ""); color: "#E6E6E6" - font.pixelSize: ssidLabel.font.pixelSize * 0.5 + font.pixelSize: ssidLabel.font.pixelSize * 0.8 font.italic: true } Rectangle { id: signalStrengthBar - height: 20 - radius: 10 + height: engine.mm(3) + radius: 20 antialiasing: true - anchors.margins: 20 + anchors.margins: engine.mm(2) anchors.right: parent.right anchors.top: parent.top color: "#BF8888" border.color: "#212126" - + // ### TODO - Qt Wifi library should provide alternative methods + // of describing signal strength besides dBm. property int strengthBarWidth: Math.max(100 + network.signalStrength, 0) / 100 * parent.width onStrengthBarWidthChanged: { - if (strengthBarWidth > parent.width * 0.7) - signalStrengthBar.width = parent.width * 0.7 + if (strengthBarWidth > parent.width * 0.55) + signalStrengthBar.width = parent.width * 0.55 else signalStrengthBar.width = strengthBarWidth } @@ -135,19 +140,24 @@ Item { TextField { id: passwordInput - y: 100 - height: 50 - width: 300 + anchors.top: flagsLabel.bottom + anchors.topMargin: engine.mm(3) + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width * 0.36 + height: font.pixelSize * 2.4 placeholderText: "Enter Password" visible: !connected - anchors.horizontalCenter: parent.horizontalCenter - font.pixelSize: 18 + font.pixelSize: engine.smallFontSize() * 0.8 + echoMode: TextInput.Password inputMethodHints: Qt.ImhNoPredictiveText } Button { - style: root.buttonStyle - y: passwordInput.visible ? passwordInput.y + passwordInput.height + 20 : passwordInput.y + id: connectionButton + style: SettingsButtonStyle {} + y: connected ? passwordInput.y + : passwordInput.y + passwordInput.height + engine.mm(2) + width: passwordInput.width anchors.horizontalCenter: parent.horizontalCenter text: connected ? "Disconnect" : "Connect" onClicked: connected ? wifiManager.disconnect() diff --git a/basicsuite/launchersettings/main.qml b/basicsuite/launchersettings/main.qml index 9d8eca5..b1b1d3d 100644 --- a/basicsuite/launchersettings/main.qml +++ b/basicsuite/launchersettings/main.qml @@ -38,211 +38,94 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.0 - +import QtQuick 2.2 import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.0 +import QtQuick.Layouts 1.1 import QtQuick.Controls.Styles 1.2 -import QtQuick.Controls.Private 1.0 -import QtQuick.Window 2.1 import QtQuick.Enterprise.VirtualKeyboard.Settings 1.2 +import Qt.labs.wifi 0.1 as Wifi Rectangle { - id: root - width: 1280 - height: 800 + anchors.fill: parent color: "#212126" - property alias buttonStyle: buttonStyle - - // ******************************* STYLES ********************************** - Component { - id: buttonStyle - ButtonStyle { - panel: Item { - implicitHeight: 50 - implicitWidth: 320 - BorderImage { - anchors.fill: parent - antialiasing: true - border.bottom: 8 - border.top: 8 - border.left: 8 - border.right: 8 - anchors.margins: control.pressed ? -4 : 0 - source: control.pressed ? "images/button_pressed.png" : "images/button_default.png" - Text { - text: control.text - anchors.centerIn: parent - color: "white" - font.pixelSize: 22 - renderType: Text.NativeRendering - } - } - } - } - } - - // GroupBoxStyle currently is not available as a public API, so we write our own... - Component { - id: groupBoxStyle - Style { - // The margin from the content item to the groupbox - padding { - top: (control.title.length > 0 ? TextSingleton.implicitHeight : 0) + 30 - left: 8 - right: 8 - bottom: 8 - } - // The groupbox frame - property Component panel: Item { - anchors.fill: parent - - Text { - id: label - anchors.bottom: borderImage.top - anchors.margins: 2 - text: control.title - font.pixelSize: 22 - color: "white" - renderType: Text.NativeRendering - } - - BorderImage { - id: borderImage - anchors.fill: parent - anchors.topMargin: padding.top - 7 - source: "images/groupbox.png" - border.left: 4 - border.right: 4 - border.top: 4 - border.bottom: 4 - } - } - } - } - - Component { - id: checkboxStyle - CheckBoxStyle { - indicator: Rectangle { - implicitWidth: 36 - implicitHeight: 36 - radius: 10 - border.color: "black" - border.width: 2 - Rectangle { - visible: control.checked - color: "#45b7e2" - border.color: "darkblue" - radius: 10 - anchors.margins: 4 - anchors.fill: parent - } - } - } - } - - Component { - id: radioButtonStyle - RadioButtonStyle { - indicator: Rectangle { - implicitWidth: 36 - implicitHeight: 36 - radius: 20 - border.color: "black" - border.width: 2 - Rectangle { - anchors.fill: parent - visible: control.checked - color: "#45b7e2" - border.color: "darkblue" - radius: 20 - anchors.margins: 4 - } - } - label: Label { - text: control.text - font.pixelSize: 18 - color: "white" - } - } - } - // ******************************** UI **************************************** Loader { id: rebootActionLoader; source: "RebootAction.qml" } Loader { id: poweroffActionLoader; source: "PoweroffAction.qml" } Loader { id: brightnessControllerLoader; source: "BrightnessController.qml" } Loader { id: networkControllerLoader; source: "NetworkController.qml" } - Loader { id: wifiControllerLoader; source: "WifiController.qml" } Flickable { anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter - anchors.margins: 10 - anchors.topMargin: 50 + anchors.topMargin: engine.mm(5) height: parent.height width: parent.width - contentHeight: mainLayout.height + 100 + contentHeight: mainLayout.height + engine.centimeter(2) contentWidth: mainLayout.width flickableDirection: Flickable.VerticalFlick - leftMargin: (width - contentWidth) / 2 + leftMargin: (width - contentWidth) * 0.5 ColumnLayout { id: mainLayout - // can not use size of "root" here, it will shrink UI when virtual keyboard is open - width: Math.min(Screen.width, Screen.height) + width: Math.min(engine.screenWidth(), engine.screenHeight()) height: implicitHeight anchors.left: parent.left anchors.right: parent.right + spacing: engine.mm(4) GroupBox { id: powerOptions title: "Power" Layout.fillWidth: true - style: groupBoxStyle + style: SettingsGroupBoxStyle {} implicitWidth: 0 + height: implicitHeight RowLayout { - id: powerButtonRow - anchors.fill: parent Button { - style: buttonStyle + style: SettingsButtonStyle {} text: "Shut Down" Layout.fillWidth: true action: poweroffActionLoader.item; enabled: action != undefined - } Button { - style: buttonStyle + style: SettingsButtonStyle {} text: "Reboot" Layout.fillWidth: true action: rebootActionLoader.item; enabled: action != undefined } } - } GroupBox { id: displayOptions title: "Display" - style: groupBoxStyle + style: SettingsGroupBoxStyle {} Layout.fillWidth: true implicitWidth: 0 + height: implicitHeight GridLayout { - id: displayGrid - rows: 2 flow: GridLayout.TopToBottom anchors.fill: parent - Label { text: "Brightness: "; font.pixelSize: 18; color: "white" } - Label { text: "Display FPS: "; font.pixelSize: 18; color: "white" } + Label { + text: "Brightness: " + font.pixelSize: engine.smallFontSize() * 0.8 + color: "white" + } + + Label { + text: "Display FPS: " + font.pixelSize: engine.smallFontSize() * 0.8 + color: "white" + } Slider { maximumValue: 255 @@ -254,9 +137,20 @@ Rectangle { brightnessControllerLoader.item.setBrightness(value); } } + style: SliderStyle { + handle: Rectangle { + anchors.centerIn: parent + color: "white" + border.color: "gray" + border.width: 2 + width: engine.mm(6) + height: engine.mm(6) + radius: 20 + } + } } CheckBox { - style: checkboxStyle + style: SettingsCheckBoxStyle {} checked: engine.fpsEnabled onCheckedChanged: engine.fpsEnabled = checked } @@ -266,27 +160,26 @@ Rectangle { GroupBox { id: vkbOptions title: "Virtual Keyboard Style" - style: groupBoxStyle + style: SettingsGroupBoxStyle {} Layout.fillWidth: true - implicitWidth: 0 function updateVKBStyle(styleRadioButton) { VirtualKeyboardSettings.styleName = styleRadioButton.text.toLowerCase() } Row { - spacing: 30 + spacing: engine.mm(6) ExclusiveGroup { id: vkbStyleGroup } RadioButton { id: defaultStyle - style: radioButtonStyle + style: SettingsRadioButtonStyle {} text: "Default" exclusiveGroup: vkbStyleGroup onClicked: vkbOptions.updateVKBStyle(defaultStyle) } RadioButton { id: retroStyle - style: radioButtonStyle + style: SettingsRadioButtonStyle {} text: "Retro" exclusiveGroup: vkbStyleGroup onClicked: vkbOptions.updateVKBStyle(retroStyle) @@ -304,41 +197,48 @@ Rectangle { GroupBox { id: networkOptions title: "Network" - style: groupBoxStyle + style: SettingsGroupBoxStyle {} Layout.fillWidth: true implicitWidth: 0 + height: implicitHeight GridLayout { - id: networkGrid - rows: 2 columns: 3 flow: GridLayout.TopToBottom anchors.fill: parent - Label { text: "Hostname: "; font.pixelSize: 18; color: "white" } - Label { text: "IP address: "; font.pixelSize: 18; color: "white"} + Label { + text: "Hostname: " + font.pixelSize: engine.smallFontSize() * 0.8 + color: "white" + } + + Label { + text: "IP address: " + font.pixelSize: engine.smallFontSize() * 0.8 + color: "white" + } TextField { id: hostname - implicitHeight: hostnameButton.height - 8 text: if (networkControllerLoader.item != undefined) { networkControllerLoader.item.getHostname(); } - font.pixelSize: 18 + font.pixelSize: engine.smallFontSize() Layout.fillWidth: true + Layout.preferredHeight: font.pixelSize * 2.4 } Label { text: if (networkControllerLoader.item != undefined) { networkControllerLoader.item.getIPAddress(); } - font.pixelSize: 18 + font.pixelSize: engine.smallFontSize() color: "white" Layout.columnSpan: 2 } Button { id: hostnameButton - style: buttonStyle + style: SettingsButtonStyle {} text: "Change hostname" - implicitWidth: 260 onClicked: networkControllerLoader.item.setHostname(hostname.text); enabled: networkControllerLoader.item != undefined } @@ -349,15 +249,23 @@ Rectangle { GroupBox { id: wifiOptions title: "Wifi" - style: groupBoxStyle + style: SettingsGroupBoxStyle {} Layout.fillWidth: true - } + visible: false + + function createWifiGroupBox() + { + if (Wifi.Interface.wifiSupported()) { + var component = Qt.createComponent("WifiGroupBox.qml") + var wifi = component.createObject(wifiOptions.contentItem) + if (wifi) + wifiOptions.visible = true + else + print("Error creating WifiGroupBox") + } + } - Component.onCompleted: { - if (wifiControllerLoader.item != undefined) - wifiControllerLoader.item.createWifiGroupBox() - else - wifiOptions.visible = false + Component.onCompleted: wifiOptions.createWifiGroupBox() } } } diff --git a/basicsuite/shared/SharedMain.qml b/basicsuite/shared/SharedMain.qml index 98ca779..0a7ba0c 100644 --- a/basicsuite/shared/SharedMain.qml +++ b/basicsuite/shared/SharedMain.qml @@ -16,7 +16,7 @@ ** ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Enterprise.VirtualKeyboard 1.1 +import QtQuick.Enterprise.VirtualKeyboard 1.2 Item { id: root @@ -26,7 +26,6 @@ Item { anchors.top: parent.top anchors.right: parent.right anchors.bottom: inputPanel.top - source: "main.qml" } diff --git a/basicsuite/shared/engine.cpp b/basicsuite/shared/engine.cpp index da021e5..2b39efd 100644 --- a/basicsuite/shared/engine.cpp +++ b/basicsuite/shared/engine.cpp @@ -32,4 +32,6 @@ DummyEngine::DummyEngine(QObject *parent) float high = 20; float screenSizeCM = qMax<float>(qMin(m_screenSize.width(), m_screenSize.height()) / m_dpcm, low); m_dpcm *= (screenSizeCM - low) / (high - low) * 0.5 + 0.5; + m_screenWidth = m_screenSize.width(); + m_screenHeight = m_screenSize.height(); } diff --git a/basicsuite/shared/engine.h b/basicsuite/shared/engine.h index 43713c8..8d083ef 100644 --- a/basicsuite/shared/engine.h +++ b/basicsuite/shared/engine.h @@ -23,11 +23,6 @@ #include <QString> #include <QUrl> -class QQmlEngine; -class QQuickItem; -class FpsCounter; -class QQuickWindow; - /*! A simplified version of the one used by b2qt-launcher */ @@ -42,11 +37,15 @@ public: Q_INVOKABLE int smallFontSize() const { return qMax<int>(m_dpcm * 0.4, 10); } Q_INVOKABLE int fontSize() const { return qMax<int>(m_dpcm * 0.6, 14); } Q_INVOKABLE int titleFontSize() const { return qMax<int>(m_dpcm * 0.9, 20); } - Q_INVOKABLE int centimeter() const { return m_dpcm; } + Q_INVOKABLE int centimeter(int val = 1) const { return (m_dpcm * val); } + Q_INVOKABLE int mm(int val) const { return (int)(m_dpcm * val * 0.1); } + Q_INVOKABLE int screenWidth() const { return m_screenWidth; } + Q_INVOKABLE int screenHeight() const { return m_screenHeight; } private: QSize m_screenSize; qreal m_dpcm; + int m_screenWidth, m_screenHeight; }; #endif // ENGINE_H diff --git a/basicsuite/shared/main_landscape.qml b/basicsuite/shared/main_landscape.qml index 46b7fc5..233ef77 100644 --- a/basicsuite/shared/main_landscape.qml +++ b/basicsuite/shared/main_landscape.qml @@ -18,9 +18,8 @@ import QtQuick 2.0 Item { - width: 800 - height: 1280 - + width: engine.screenWidth() + height: engine.screenHeight() SharedMain { anchors.centerIn: parent width: parent.height |