diff options
Diffstat (limited to 'basicsuite/launchersettings/main.qml')
-rw-r--r-- | basicsuite/launchersettings/main.qml | 229 |
1 files changed, 113 insertions, 116 deletions
diff --git a/basicsuite/launchersettings/main.qml b/basicsuite/launchersettings/main.qml index 085ec4d..c698aaf 100644 --- a/basicsuite/launchersettings/main.qml +++ b/basicsuite/launchersettings/main.qml @@ -2,7 +2,7 @@ ** ** 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/ +** http://www.qt.io ** ** This file is part of the examples of the Qt Enterprise Embedded. ** @@ -38,133 +38,58 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.0 - -import QtQuick.Controls 1.0 -import QtQuick.Layouts 1.0 -import QtQuick.Controls.Styles 1.0 -import QtQuick.Controls.Private 1.0 -import QtQuick.Window 2.1 +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls.Styles 1.2 +import QtQuick.Enterprise.VirtualKeyboard.Settings 1.2 +import Qt.labs.wifi 0.1 as Wifi import B2Qt.Utils 1.0 Rectangle { - id: root - width: 1280 - height: 800 + anchors.fill: parent color: "#212126" - property int margin: 10 - 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 - } - } - } - } - - // ******************************** UI **************************************** - Loader { id: wifiControllerLoader; source: "WifiController.qml" } Flickable { anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter - anchors.margins: margin - anchors.topMargin: 50 + anchors.topMargin: engine.mm(5) height: parent.height - width: mainLayout.width - contentHeight: mainLayout.height + 100 + width: parent.width + contentHeight: mainLayout.height + engine.centimeter(2) contentWidth: mainLayout.width flickableDirection: Flickable.VerticalFlick + 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 onClicked: B2QtDevice.powerOff(); } Button { - style: buttonStyle + style: SettingsButtonStyle {} text: "Reboot" Layout.fillWidth: true onClicked: B2QtDevice.reboot(); @@ -175,19 +100,27 @@ Rectangle { 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 { id: brightnessSlider @@ -195,11 +128,53 @@ Rectangle { minimumValue: 1 Layout.fillWidth: true value: B2QtDevice.displayBrightness + 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: SettingsCheckBoxStyle {} checked: engine.fpsEnabled - onCheckedChanged: engine.fpsEnabled = checked; + onCheckedChanged: engine.fpsEnabled = checked + } + } + } + + GroupBox { + id: vkbOptions + title: "Virtual Keyboard Style" + style: SettingsGroupBoxStyle {} + Layout.fillWidth: true + + function updateVKBStyle(styleRadioButton) { + VirtualKeyboardSettings.styleName = styleRadioButton.text.toLowerCase() + } + + Row { + spacing: engine.mm(6) + ExclusiveGroup { id: vkbStyleGroup } + RadioButton { + id: defaultStyle + style: SettingsRadioButtonStyle {} + text: "Default" + exclusiveGroup: vkbStyleGroup + onClicked: vkbOptions.updateVKBStyle(defaultStyle) + } + RadioButton { + id: retroStyle + style: SettingsRadioButtonStyle {} + text: "Retro" + exclusiveGroup: vkbStyleGroup + onClicked: vkbOptions.updateVKBStyle(retroStyle) } } @@ -208,34 +183,49 @@ Rectangle { property: "displayBrightness" value: brightnessSlider.value } + + Component.onCompleted: { + if (VirtualKeyboardSettings.styleName == "default") + defaultStyle.checked = true + if (VirtualKeyboardSettings.styleName == "retro") + retroStyle.checked = true + } } 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: B2QtDevice.hostname placeholderText: "Enter hostname" + font.pixelSize: engine.smallFontSize() inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhPreferLowercase | Qt.ImhNoPredictiveText - font.pixelSize: 18 Layout.fillWidth: true + Layout.preferredHeight: font.pixelSize * 2.4 onAccepted: { Qt.inputMethod.commit() Qt.inputMethod.hide() @@ -246,16 +236,15 @@ Rectangle { Label { text: B2QtDevice.ipAddress - 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: hostname.accepted() } } @@ -264,15 +253,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() } } } |