fix: use global config for global properties
This commit is contained in:
parent
129b063381
commit
b8d17ad8ef
20 changed files with 28 additions and 28 deletions
|
|
@ -106,7 +106,7 @@ Item {
|
|||
Layout.alignment: Qt.AlignTop
|
||||
Layout.topMargin: Tokens.padding.large * 1.4 * root.clockScale
|
||||
|
||||
active: Config.services.useTwelveHourClock
|
||||
active: GlobalConfig.services.useTwelveHourClock
|
||||
visible: active
|
||||
|
||||
sourceComponent: StyledText {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ StyledRect {
|
|||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
horizontalAlignment: StyledText.AlignHCenter
|
||||
text: Time.format(Config.services.useTwelveHourClock ? "hh\nmm\nA" : "hh\nmm")
|
||||
text: Time.format(GlobalConfig.services.useTwelveHourClock ? "hh\nmm\nA" : "hh\nmm")
|
||||
font.pointSize: Tokens.font.size.smaller
|
||||
font.family: Tokens.font.family.mono
|
||||
color: root.colour
|
||||
|
|
|
|||
|
|
@ -100,13 +100,13 @@ ColumnLayout {
|
|||
|
||||
PropertyRow {
|
||||
label: qsTr("Special prefix")
|
||||
value: Config.launcher.specialPrefix || qsTr("None")
|
||||
value: GlobalConfig.launcher.specialPrefix || qsTr("None")
|
||||
}
|
||||
|
||||
PropertyRow {
|
||||
showTopMargin: true
|
||||
label: qsTr("Action prefix")
|
||||
value: Config.launcher.actionPrefix || qsTr("None")
|
||||
value: GlobalConfig.launcher.actionPrefix || qsTr("None")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Item {
|
|||
readonly property int minWidth: 400 + 400 + Tokens.spacing.normal + 120 + Tokens.padding.large * 2
|
||||
|
||||
function displayTemp(temp: real): string {
|
||||
return `${Math.ceil(Config.services.useFahrenheitPerformance ? temp * 1.8 + 32 : temp)}°${Config.services.useFahrenheitPerformance ? "F" : "C"}`;
|
||||
return `${Math.ceil(GlobalConfig.services.useFahrenheitPerformance ? temp * 1.8 + 32 : temp)}°${GlobalConfig.services.useFahrenheitPerformance ? "F" : "C"}`;
|
||||
}
|
||||
|
||||
implicitWidth: Math.max(minWidth, content.implicitWidth)
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ Item {
|
|||
|
||||
StyledText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: Config.services.useFahrenheit ? forecastItem.modelData.maxTempF + "°" + " / " + forecastItem.modelData.minTempF + "°" : forecastItem.modelData.maxTempC + "°" + " / " + forecastItem.modelData.minTempC + "°"
|
||||
text: GlobalConfig.services.useFahrenheit ? forecastItem.modelData.maxTempF + "°" + " / " + forecastItem.modelData.minTempF + "°" : forecastItem.modelData.maxTempC + "°" + " / " + forecastItem.modelData.minTempC + "°"
|
||||
font.weight: 600
|
||||
color: Colours.palette.m3tertiary
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ Item {
|
|||
asynchronous: true
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
active: Config.services.useTwelveHourClock
|
||||
active: GlobalConfig.services.useTwelveHourClock
|
||||
visible: active
|
||||
|
||||
sourceComponent: StyledText {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ StyledListView {
|
|||
|
||||
state: {
|
||||
const text = search.text;
|
||||
const prefix = Config.launcher.actionPrefix;
|
||||
const prefix = GlobalConfig.launcher.actionPrefix;
|
||||
if (text.startsWith(prefix)) {
|
||||
for (const action of ["calc", "scheme", "variant"])
|
||||
if (text.startsWith(`${prefix}${action} `))
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ Item {
|
|||
topPadding: Tokens.padding.larger
|
||||
bottomPadding: Tokens.padding.larger
|
||||
|
||||
placeholderText: qsTr("Type \"%1\" for commands").arg(Config.launcher.actionPrefix)
|
||||
placeholderText: qsTr("Type \"%1\" for commands").arg(GlobalConfig.launcher.actionPrefix)
|
||||
|
||||
onAccepted: {
|
||||
const currentItem = list.currentList?.currentItem;
|
||||
|
|
@ -88,8 +88,8 @@ Item {
|
|||
Wallpapers.previewColourLock = true;
|
||||
Wallpapers.setWallpaper(currentItem.modelData.path);
|
||||
root.visibilities.launcher = false;
|
||||
} else if (text.startsWith(Config.launcher.actionPrefix)) {
|
||||
if (text.startsWith(`${Config.launcher.actionPrefix}calc `))
|
||||
} else if (text.startsWith(GlobalConfig.launcher.actionPrefix)) {
|
||||
if (text.startsWith(`${GlobalConfig.launcher.actionPrefix}calc `))
|
||||
currentItem.onClicked();
|
||||
else
|
||||
currentItem.modelData.onClicked(list.currentList);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Item {
|
|||
required property int padding
|
||||
required property int rounding
|
||||
|
||||
readonly property bool showWallpapers: search.text.startsWith(`${Config.launcher.actionPrefix}wallpaper `)
|
||||
readonly property bool showWallpapers: search.text.startsWith(`${GlobalConfig.launcher.actionPrefix}wallpaper `)
|
||||
readonly property var currentList: showWallpapers ? wallpaperList.item : appList.item // Can be either ListView or PathView, so can't type properly
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ Item {
|
|||
asynchronous: true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
active: root.modelData && Strings.testRegexList(Config.launcher.favouriteApps, root.modelData.id)
|
||||
active: root.modelData && Strings.testRegexList(GlobalConfig.launcher.favouriteApps, root.modelData.id)
|
||||
|
||||
sourceComponent: MaterialIcon {
|
||||
text: "favorite"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Item {
|
|||
id: root
|
||||
|
||||
required property var list
|
||||
readonly property string math: list.search.text.slice(`${Config.launcher.actionPrefix}calc `.length)
|
||||
readonly property string math: list.search.text.slice(`${GlobalConfig.launcher.actionPrefix}calc `.length)
|
||||
|
||||
function onClicked(): void {
|
||||
Quickshell.execDetached(["wl-copy", Qalculator.rawResult]);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Searcher {
|
|||
id: root
|
||||
|
||||
function transformSearch(search: string): string {
|
||||
return search.slice(Config.launcher.actionPrefix.length);
|
||||
return search.slice(GlobalConfig.launcher.actionPrefix.length);
|
||||
}
|
||||
|
||||
list: variants.instances
|
||||
|
|
@ -39,7 +39,7 @@ Searcher {
|
|||
return;
|
||||
|
||||
if (command[0] === "autocomplete" && command.length > 1) {
|
||||
list.search.text = `${Config.launcher.actionPrefix}${command[1]} `;
|
||||
list.search.text = `${GlobalConfig.launcher.actionPrefix}${command[1]} `;
|
||||
} else if (command[0] === "setMode" && command.length > 1) {
|
||||
list.visibilities.launcher = false;
|
||||
Colours.setMode(command[1]);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Searcher {
|
|||
}
|
||||
|
||||
function search(search: string): list<var> {
|
||||
const prefix = Config.launcher.specialPrefix;
|
||||
const prefix = GlobalConfig.launcher.specialPrefix;
|
||||
|
||||
if (search.startsWith(`${prefix}i `)) {
|
||||
keys = ["id", "name"];
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Searcher {
|
|||
id: root
|
||||
|
||||
function transformSearch(search: string): string {
|
||||
return search.slice(`${Config.launcher.actionPrefix}variant `.length);
|
||||
return search.slice(`${GlobalConfig.launcher.actionPrefix}variant `.length);
|
||||
}
|
||||
|
||||
list: [
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Searcher {
|
|||
property string currentVariant
|
||||
|
||||
function transformSearch(search: string): string {
|
||||
return search.slice(`${Config.launcher.actionPrefix}scheme `.length);
|
||||
return search.slice(`${GlobalConfig.launcher.actionPrefix}scheme `.length);
|
||||
}
|
||||
|
||||
function selector(item: var): string {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ ColumnLayout {
|
|||
Layout.leftMargin: Tokens.spacing.small
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
|
||||
active: Config.services.useTwelveHourClock
|
||||
active: GlobalConfig.services.useTwelveHourClock
|
||||
visible: active
|
||||
|
||||
sourceComponent: StyledText {
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ ColumnLayout {
|
|||
|
||||
StyledText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: Config.services.useFahrenheit ? `${forecastHour.modelData?.tempF ?? 0}°F` : `${forecastHour.modelData?.tempC ?? 0}°C`
|
||||
text: GlobalConfig.services.useFahrenheit ? `${forecastHour.modelData?.tempF ?? 0}°F` : `${forecastHour.modelData?.tempC ?? 0}°C`
|
||||
color: Colours.palette.m3secondary
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ Item {
|
|||
|
||||
icon: Icons.getVolumeIcon(value, root.muted)
|
||||
value: root.volume
|
||||
to: Config.services.maxVolume
|
||||
to: GlobalConfig.services.maxVolume
|
||||
onMoved: Audio.setVolume(value)
|
||||
}
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ Item {
|
|||
|
||||
icon: Icons.getMicVolumeIcon(value, root.sourceMuted)
|
||||
value: root.sourceVolume
|
||||
to: Config.services.maxVolume
|
||||
to: GlobalConfig.services.maxVolume
|
||||
onMoved: Audio.setSourceVolume(value)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ StyledRect {
|
|||
id: activeText
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: qsTr("Active since %1").arg(Qt.formatTime(IdleInhibitor.enabledSince, Config.services.useTwelveHourClock ? "hh:mm a" : "hh:mm"))
|
||||
text: qsTr("Active since %1").arg(Qt.formatTime(IdleInhibitor.enabledSince, GlobalConfig.services.useTwelveHourClock ? "hh:mm a" : "hh:mm"))
|
||||
color: Colours.palette.m3onPrimary
|
||||
font.pointSize: Math.round(Tokens.font.size.small * 0.9)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ Singleton {
|
|||
|
||||
readonly property string icon: cc ? Icons.getWeatherIcon(cc.weatherCode) : "cloud_alert"
|
||||
readonly property string description: cc?.weatherDesc ?? qsTr("No weather")
|
||||
readonly property string temp: Config.services.useFahrenheit ? `${cc?.tempF ?? 0}°F` : `${cc?.tempC ?? 0}°C`
|
||||
readonly property string feelsLike: Config.services.useFahrenheit ? `${cc?.feelsLikeF ?? 0}°F` : `${cc?.feelsLikeC ?? 0}°C`
|
||||
readonly property string temp: GlobalConfig.services.useFahrenheit ? `${cc?.tempF ?? 0}°F` : `${cc?.tempC ?? 0}°C`
|
||||
readonly property string feelsLike: GlobalConfig.services.useFahrenheit ? `${cc?.feelsLikeF ?? 0}°F` : `${cc?.feelsLikeC ?? 0}°C`
|
||||
readonly property int humidity: cc?.humidity ?? 0
|
||||
readonly property real windSpeed: cc?.windSpeed ?? 0
|
||||
readonly property string sunrise: cc ? Qt.formatDateTime(new Date(cc.sunrise), Config.services.useTwelveHourClock ? "h:mm A" : "h:mm") : "--:--"
|
||||
readonly property string sunset: cc ? Qt.formatDateTime(new Date(cc.sunset), Config.services.useTwelveHourClock ? "h:mm A" : "h:mm") : "--:--"
|
||||
readonly property string sunrise: cc ? Qt.formatDateTime(new Date(cc.sunrise), GlobalConfig.services.useTwelveHourClock ? "h:mm A" : "h:mm") : "--:--"
|
||||
readonly property string sunset: cc ? Qt.formatDateTime(new Date(cc.sunset), GlobalConfig.services.useTwelveHourClock ? "h:mm A" : "h:mm") : "--:--"
|
||||
|
||||
readonly property var cachedCities: new Map()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue