1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-05 10:32:28 +01:00

Fix enums in qml

This commit is contained in:
Elias Steurer 2023-12-01 17:51:00 +01:00
parent 11063d86c6
commit 276a917ebd
4 changed files with 15 additions and 38 deletions

View File

@ -170,7 +170,7 @@ public slots:
void setFont(QString font);
void setTheme(ScreenPlay::Settings::Theme theme);
void setSteamVersion(bool steamVersion);
void setDesktopEnvironment(DesktopEnvironment desktopEnvironment);
void setDesktopEnvironment(ScreenPlay::Settings::DesktopEnvironment desktopEnvironment);
void setBuildInfos(const QString& buildInfos);
private:

View File

@ -1,6 +1,8 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import ScreenPlay
import ScreenPlayApp
Control {
id: settingsComboBox
@ -21,7 +23,7 @@ Control {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
font.pointSize: 12
//font.family: App.settings.font
font.family: App.settings.font
anchors {
top: parent.top
@ -40,7 +42,7 @@ Control {
horizontalAlignment: Text.AlignLeft
wrapMode: Text.WordWrap
font.pointSize: 10
//font.family: App.settings.font
font.family: App.settings.font
anchors {
top: txtHeadline.bottom
@ -58,7 +60,7 @@ Control {
implicitWidth: 200
textRole: "text"
valueRole: "value"
//font.family: App.settings.font
font.family: App.settings.font
anchors {
right: parent.right

View File

@ -14,14 +14,6 @@ Item {
property Item modalSource
function indexOfValue(model, value) {
for (var i = 0; i < model.length; i++) {
let ourValue = model[i].value;
if (value === ourValue)
return i;
}
return -1;
}
Flickable {
id: flickableWrapper
@ -151,14 +143,8 @@ Item {
headline: qsTr("Language")
description: qsTr("Set the ScreenPlay UI Language")
Component.onCompleted: {
print("as",settingsLanguage.comboBox.currentIndex,settingsLanguage.comboBox.model,App.settings.language )
//settingsLanguage.comboBox.currentIndex = root.indexOfValue(settingsLanguage.comboBox.model, App.settings.language);
//print(settingsLanguage.comboBox.currentIndex )
}
comboBox {
Component.onCompleted: comboBox.currentIndex = comboBox.indexOfValue(App.settings.language)
model: ListModel {
id: lmLangauge
ListElement { value: Settings.Language.En_US; text: "English" }
@ -175,13 +161,9 @@ Item {
ListElement { value: Settings.Language.Tr_TR; text: "Turkish" }
ListElement { value: Settings.Language.Nl_NL; text: "Dutch" }
}
onActivated: (index) => {
print(index,lmLangauge.get(index),lmLangauge.get(index).value,lmLangauge.get(index).text)
print(Settings.Language.Pl_PL)
print("onActivated",settingsLanguage.comboBox.currentValue,index)
// App.settings.setLanguage(settingsLanguage.comboBox.currentValue);
//App.settings.retranslateUI();
onActivated: {
App.settings.setLanguage(settingsLanguage.comboBox.currentValue);
App.settings.retranslateUI();
}
}
}
@ -194,18 +176,14 @@ Item {
headline: qsTr("Theme")
description: qsTr("Switch dark/light theme")
Component.onCompleted: {
//settingsTheme.comboBox.currentIndex = root.indexOfValue(settingsTheme.comboBox.model, App.settings.theme);
}
comboBox {
Component.onCompleted: comboBox.currentIndex = comboBox.indexOfValue(App.settings.theme)
model: ListModel {
ListElement { value: Settings.Theme.System; text: qsTr("System Default") }
ListElement { value: Settings.Theme.Dark; text: qsTr("Dark") }
ListElement { value: Settings.Theme.Light; text: qsTr("Light") }
}
onActivated: {
print("onActivated", settingsTheme.comboBox.currentValue,Settings.Theme.Light)
App.settings.setTheme(settingsTheme.comboBox.currentValue);
}
}
@ -244,11 +222,8 @@ Item {
headline: qsTr("Default Wallpaper Fill Mode")
description: qsTr("Set this property to define how the video is scaled to fit the target area.")
Component.onCompleted: {
cbVideoFillMode.comboBox.currentIndex = root.indexOfValue(cbVideoFillMode.comboBox.model, App.settings.videoFillMode);
}
comboBox {
Component.onCompleted: comboBox.currentIndex = comboBox.indexOfValue(App.settings.videoFillMode)
model: ListModel {
ListElement { value: Video.FillMode.Stretch; text: qsTr("Stretch") }
ListElement { value: Video.FillMode.Fill; text: qsTr("Fill") }

View File

@ -556,7 +556,7 @@ void Settings::setCheckWallpaperVisible(bool checkWallpaperVisible)
emit checkWallpaperVisibleChanged(m_checkWallpaperVisible);
}
void Settings::setVideoFillMode(Video::FillMode videoFillMode)
void Settings::setVideoFillMode(ScreenPlay::Video::FillMode videoFillMode)
{
if (m_videoFillMode == videoFillMode)
return;
@ -567,7 +567,7 @@ void Settings::setVideoFillMode(Video::FillMode videoFillMode)
emit videoFillModeChanged(m_videoFillMode);
}
void Settings::setLanguage(Language language)
void Settings::setLanguage(ScreenPlay::Settings::Language language)
{
if (m_language == language)
return;
@ -587,7 +587,7 @@ void Settings::setFont(QString font)
emit fontChanged(m_font);
}
void Settings::setTheme(Theme theme)
void Settings::setTheme(ScreenPlay::Settings::Theme theme)
{
if (m_theme == theme)
return;