// SPDX-License-Identifier: GPL-3.0-or-later /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright (C) 2013 - 2024, nymea GmbH * Copyright (C) 2024 - 2025, chargebyte austria GmbH * * This file is part of nymea-app. * * nymea-app is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * nymea-app is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with nymea-app. If not, see . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ import QtQuick import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Layouts import Nymea import "../components" SettingsPageBase { id: root title: qsTr("Look and feel") SettingsPageSectionHeader { text: qsTr("Appearance") } RowLayout { Layout.fillWidth: true Layout.leftMargin: app.margins Layout.rightMargin: app.margins visible: !styleController.locked Label { Layout.fillWidth: true text: "Style" } ComboBox { model: styleController.allStyles currentIndex: styleController.allStyles.indexOf(styleController.currentStyle) onActivated: (index) => { styleController.currentStyle = model[index] } } Connections { target: styleController onCurrentStyleChanged: { var popup = styleChangedDialog.createObject(root) popup.open() } } } RowLayout { Layout.fillWidth: true Layout.leftMargin: app.margins Layout.rightMargin: app.margins visible: !kioskMode && Qt.platform.os !== "ios" Label { Layout.fillWidth: true text: qsTr("View mode") } ComboBox { model: [qsTr("Windowed"), qsTr("Maximized"), qsTr("Fullscreen"), qsTr("Automatic")] currentIndex: { switch (settings.viewMode) { case ApplicationWindow.Windowed: return 0; case ApplicationWindow.Maximized: return 1; case ApplicationWindow.FullScreen: return 2; case ApplicationWindow.AutomaticVisibility: return 3; } } onActivated: (index) => { switch (currentIndex) { case 0: settings.viewMode = ApplicationWindow.Windowed; break; case 1: settings.viewMode = ApplicationWindow.Maximized; break; case 2: settings.viewMode = ApplicationWindow.FullScreen; break; case 3: settings.viewMode = ApplicationWindow.AutomaticVisibility; break; } } } } SettingsPageSectionHeader { text: qsTr("Regional") } RowLayout { Layout.fillWidth: true Layout.leftMargin: app.margins Layout.rightMargin: app.margins Label { Layout.fillWidth: true text: qsTr("Unit system") } ComboBox { id: unitsComboBox currentIndex: settings.units === "metric" ? 0 : 1 model: [ qsTr("Metric"), qsTr("Imperial") ] onActivated: (index) => { settings.units = index === 0 ? "metric" : "imperial"; } } } SettingsPageSectionHeader { text: qsTr("Behavior") } CheckDelegate { Layout.fillWidth: true text: qsTr("Return to home on idle") checked: settings.returnToHome onClicked: settings.returnToHome = checked } CheckDelegate { id: screenOffCheck Layout.fillWidth: true text: qsTr("Turn screen off when idle") visible: PlatformHelper.canControlScreen checked: PlatformHelper.screenTimeout > 0 onClicked: PlatformHelper.screenTimeout = (checked ? 15000 : 0) } ItemDelegate { Layout.fillWidth: true Layout.preferredHeight: screenOffCheck.height visible: PlatformHelper.screenTimeout > 0 topPadding: 0 contentItem: RowLayout { Label { Layout.fillWidth: true text: qsTr("Screen off timeout") } SpinBox { value: PlatformHelper.screenTimeout / 1000 onValueModified: { PlatformHelper.screenTimeout = value * 1000 } } Label { text: qsTr("seconds") } } } ItemDelegate { Layout.fillWidth: true visible: PlatformHelper.canControlScreen topPadding: 0 contentItem: RowLayout { Label { Layout.fillWidth: true text: qsTr("Screen brightness") } Slider { Layout.fillWidth: true value: PlatformHelper.screenBrightness onMoved: PlatformHelper.screenBrightness = value from: 0 to: 100 stepSize: 1 } } } Component { id: styleChangedDialog Dialog { width: Math.min(parent.width * .8, contentLabel.implicitWidth) x: (parent.width - width) / 2 y: (parent.height - height) / 2 modal: true title: qsTr("Style changed") standardButtons: Dialog.Ok ColumnLayout { id: content anchors { left: parent.left; top: parent.top; right: parent.right } Label { id: contentLabel Layout.fillWidth: true wrapMode: Text.WrapAtWordBoundaryOrAnywhere text: qsTr("The application needs to be restarted for style changes to take effect.") } } } } }