C

Qt Quick Ultralite Thermostat Demo

/****************************************************************************** ** ** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** 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 http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/
import QtQuick 2.15 import QtQuickUltralite.Extras 2.0 import Thermo 1.0 import ThermoConfiguration 1.0 Rectangle { id: dialog color: "#88000000" visible: false opacity: Configuration.enableFadingAnimations ? 0 : 1 SequentialAnimation { id: showAnimation alwaysRunToEnd: true ScriptAction { script: dialog.visible = true } PropertyAnimation { target: dialog; property: "opacity"; from: 0.0; to: 1.0; duration: 50} } SequentialAnimation { id: hideAnimation alwaysRunToEnd: true PropertyAnimation { target: dialog; property: "opacity"; from: 1.0; to: 0.0; duration: 50} ScriptAction { script: dialog.visible = false } } Behavior on opacity { NumberAnimation{} } function hide() { if (Configuration.enableFadingAnimations) { hideAnimation.running = true } else { dialog.visible = false } } function show() { if (Configuration.enableFadingAnimations) { showAnimation.running = true } else { dialog.visible = true } } MouseArea { anchors.fill: parent } Image { id: background source: "popup-bg.png" anchors.centerIn: parent Item { id: titleBar height: Theme.dialogBarHeight width: background.width ColorizedImage { id: close anchors { verticalCenter: parent.verticalCenter; topMargin: 22; right: parent.right; rightMargin: Theme.dialogRightMargin } source: "close.png" color: ColorStyle.greyDark4 } MouseArea { anchors { fill: close; margins: -close.width } onClicked: { dialog.hide() } } Text { id: title text: qsTr("Language Settings") anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: Theme.dialogLeftMargin } font.pixelSize: Theme.topBarFontSize } } Column { id: langCards anchors { verticalCenter: parent.verticalCenter verticalCenterOffset: titleBar.height / 2 left: titleBar.left leftMargin: Theme.dialogLeftMargin } // No ButtonGroup yet so exclusive checking is implemented manualy LanguageButton { id: english text: "English" flag: "UK.png" checked: Qt.uiLanguage == "" enabled: !checked onCheckedChanged: { if (checked) { Qt.uiLanguage = "" german.checked = false japanese.checked = false arabic.checked = false thai.checked = false hindi.checked = false } } } LanguageButton { id: german text: "Deutsch" checked: Qt.uiLanguage == "de_DE" enabled: !checked flag: "GERMANY.png" onCheckedChanged: { if (checked) { english.checked = false japanese.checked = false arabic.checked = false thai.checked = false hindi.checked = false Qt.uiLanguage = "de_DE" } } } LanguageButton { id: japanese text: "日本語" checked: Qt.uiLanguage == "ja_JP" enabled: !checked flag: "JAPAN.png" onCheckedChanged: { if (checked) { english.checked = false german.checked = false arabic.checked = false thai.checked = false hindi.checked = false Qt.uiLanguage = "ja_JP" } } } LanguageButton { id: arabic visible: FontConfiguration.enableComplexScripts text: "عربي" checked: Qt.uiLanguage == "ar_EG" enabled: !checked flag: "EGYPT.png" onCheckedChanged: { if (checked) { english.checked = false german.checked = false japanese.checked = false thai.checked = false hindi.checked = false Qt.uiLanguage = "ar_EG" } } } LanguageButton { id: thai visible: FontConfiguration.enableComplexScripts text: "ไทย" checked: Qt.uiLanguage == "th_TH" enabled: !checked flag: "THAILAND.png" onCheckedChanged: { if (checked) { english.checked = false german.checked = false japanese.checked = false arabic.checked = false hindi.checked = false Qt.uiLanguage = "th_TH" } } } LanguageButton { id: hindi visible: FontConfiguration.enableComplexScripts text: "हिन्दी" checked: Qt.uiLanguage == "hi_IN" enabled: !checked flag: "INDIA.png" onCheckedChanged: { if (checked) { english.checked = false german.checked = false japanese.checked = false arabic.checked = false thai.checked = false Qt.uiLanguage = "hi_IN" } } } } } }