C

Qt Quick Ultralite Thermostat Demo

/****************************************************************************** ** ** Copyright (C) 2023 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 function hide() { if (Configuration.enableFadingAnimations) { hideAnimation.running = true; } else { dialog.visible = false; } } function show() { if (Configuration.enableFadingAnimations) { showAnimation.running = true; } else { dialog.visible = true; } } color: "#88000000" opacity: Configuration.enableFadingAnimations ? 0 : 1 visible: false Behavior on opacity { NumberAnimation { } } SequentialAnimation { id: showAnimation alwaysRunToEnd: true ScriptAction { script: dialog.visible = true } PropertyAnimation { duration: 50 from: 0.0 property: "opacity" target: dialog to: 1.0 } } SequentialAnimation { id: hideAnimation alwaysRunToEnd: true PropertyAnimation { duration: 50 from: 1.0 property: "opacity" target: dialog to: 0.0 } ScriptAction { script: dialog.visible = false } } MouseArea { anchors.fill: parent } Image { id: background anchors.centerIn: parent source: "popup-bg.png" Item { id: titleBar height: Theme.dialogBarHeight width: background.width ColorizedImage { id: close color: ColorStyle.greyDark4 source: "close.png" anchors { right: parent.right rightMargin: Theme.dialogRightMargin topMargin: 22 verticalCenter: parent.verticalCenter } } MouseArea { onClicked: { dialog.hide(); } anchors { fill: close margins: -close.width } } Text { id: title font.pixelSize: Theme.topBarFontSize //% "Language Settings" text: qsTrId("id-languagesettings") anchors { left: parent.left leftMargin: Theme.dialogLeftMargin verticalCenter: parent.verticalCenter } } } Column { id: langCards anchors { left: titleBar.left leftMargin: Theme.dialogLeftMargin verticalCenter: parent.verticalCenter verticalCenterOffset: titleBar.height / 2 } // No ButtonGroup yet so exclusive checking is implemented manualy LanguageButton { id: english checked: Qt.uiLanguage == "en_GB" enabled: !checked flag: "UK.png" text: "English" onCheckedChanged: { if (checked) { Qt.uiLanguage = "en_GB"; german.checked = false; japanese.checked = false; arabic.checked = false; thai.checked = false; hindi.checked = false; } } } LanguageButton { id: german checked: Qt.uiLanguage == "de_DE" enabled: !checked flag: "GERMANY.png" text: "Deutsch" 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 checked: Qt.uiLanguage == "ja_JP" enabled: !checked flag: "JAPAN.png" text: "日本語" 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 checked: Qt.uiLanguage == "ar_EG" enabled: !checked flag: "EGYPT.png" text: "عربي" visible: FontConfiguration.enableComplexScripts 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 checked: Qt.uiLanguage == "th_TH" enabled: !checked flag: "THAILAND.png" text: "ไทย" visible: FontConfiguration.enableComplexScripts 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 checked: Qt.uiLanguage == "hi_IN" enabled: !checked flag: "INDIA.png" text: "हिन्दी" visible: FontConfiguration.enableComplexScripts onCheckedChanged: { if (checked) { english.checked = false; german.checked = false; japanese.checked = false; arabic.checked = false; thai.checked = false; Qt.uiLanguage = "hi_IN"; } } } } } }