mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 03:53:23 +02:00
theme: set system as first option
To homogenize with language preference, let "System" theme to be the first option in the combobox followed by "Light" and "Dark". GitLab: #723 Change-Id: I8d95c58e4cf08c8dd36304ba661d287dda5c14f6
This commit is contained in:
parent
c48e533b05
commit
4b6c4b8a48
1 changed files with 22 additions and 25 deletions
|
@ -72,16 +72,18 @@ ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.leftMargin: JamiTheme.preferredMarginSize
|
Layout.leftMargin: JamiTheme.preferredMarginSize
|
||||||
|
|
||||||
|
property var nativeDarkThemeShift: UtilsAdapter.hasNativeDarkTheme() ? 1 : 0
|
||||||
|
|
||||||
labelText: JamiStrings.applicationTheme
|
labelText: JamiStrings.applicationTheme
|
||||||
fontPointSize: JamiTheme.settingsFontSize
|
fontPointSize: JamiTheme.settingsFontSize
|
||||||
|
|
||||||
comboModel: ListModel {
|
comboModel: ListModel {
|
||||||
id: themeModel
|
id: themeModel
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
append({ textDisplay: JamiStrings.dark })
|
if (themeComboBoxSettings.nativeDarkThemeShift)
|
||||||
append({ textDisplay: JamiStrings.light })
|
|
||||||
if (UtilsAdapter.hasNativeDarkTheme())
|
|
||||||
append({ textDisplay: JamiStrings.system })
|
append({ textDisplay: JamiStrings.system })
|
||||||
|
append({ textDisplay: JamiStrings.light })
|
||||||
|
append({ textDisplay: JamiStrings.dark })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
widthOfComboBox: itemWidth
|
widthOfComboBox: itemWidth
|
||||||
|
@ -89,29 +91,24 @@ ColumnLayout {
|
||||||
role: "textDisplay"
|
role: "textDisplay"
|
||||||
|
|
||||||
modelIndex: {
|
modelIndex: {
|
||||||
if (UtilsAdapter.hasNativeDarkTheme()) {
|
var theme = UtilsAdapter.getAppValue(Settings.Key.AppTheme)
|
||||||
var theme = UtilsAdapter.getAppValue(Settings.Key.AppTheme)
|
if (themeComboBoxSettings.nativeDarkThemeShift && theme === "System")
|
||||||
if (theme === "Dark") {
|
return 0
|
||||||
return 0
|
if (theme === "Light") {
|
||||||
} else if (theme === "Light") {
|
return 0 + nativeDarkThemeShift
|
||||||
return 1
|
} else if (theme === "Dark") {
|
||||||
}
|
return 1 + nativeDarkThemeShift
|
||||||
return 2
|
|
||||||
}
|
}
|
||||||
return UtilsAdapter.getAppValue(Settings.Key.EnableDarkTheme) ? 0 : 1
|
return nativeDarkThemeShift
|
||||||
}
|
}
|
||||||
|
|
||||||
onActivated: {
|
onActivated: {
|
||||||
if (UtilsAdapter.hasNativeDarkTheme()) {
|
if (modelIndex === 0 + nativeDarkThemeShift)
|
||||||
if (modelIndex === 0)
|
UtilsAdapter.setAppValue(Settings.Key.AppTheme, "Light")
|
||||||
UtilsAdapter.setAppValue(Settings.Key.AppTheme, "Dark")
|
else if (modelIndex === 1 + nativeDarkThemeShift)
|
||||||
else if (modelIndex === 1)
|
UtilsAdapter.setAppValue(Settings.Key.AppTheme, "Dark")
|
||||||
UtilsAdapter.setAppValue(Settings.Key.AppTheme, "Light")
|
else if (modelIndex === 0)
|
||||||
else if (modelIndex === 2)
|
UtilsAdapter.setAppValue(Settings.Key.AppTheme, "System")
|
||||||
UtilsAdapter.setAppValue(Settings.Key.AppTheme, "System")
|
|
||||||
} else {
|
|
||||||
UtilsAdapter.setAppValue(Settings.Key.EnableDarkTheme, modelIndex === 0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,10 +231,10 @@ ColumnLayout {
|
||||||
function onChangeLanguage() {
|
function onChangeLanguage() {
|
||||||
var idx = themeComboBoxSettings.modelIndex
|
var idx = themeComboBoxSettings.modelIndex
|
||||||
themeModel.clear()
|
themeModel.clear()
|
||||||
themeModel.append({ textDisplay: JamiStrings.dark })
|
if (themeComboBoxSettings.nativeDarkThemeShift)
|
||||||
themeModel.append({ textDisplay: JamiStrings.light })
|
|
||||||
if (UtilsAdapter.hasNativeDarkTheme())
|
|
||||||
themeModel.append({ textDisplay: JamiStrings.system })
|
themeModel.append({ textDisplay: JamiStrings.system })
|
||||||
|
themeModel.append({ textDisplay: JamiStrings.light })
|
||||||
|
themeModel.append({ textDisplay: JamiStrings.dark })
|
||||||
themeComboBoxSettings.modelIndex = idx
|
themeComboBoxSettings.modelIndex = idx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue