mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-09 05:09:39 +00:00
Remember custom theme path
This commit is contained in:
@@ -79,7 +79,7 @@ export class SettingsComponent implements OnInit {
|
||||
async getCustomTheme() {
|
||||
const result = await window.electron.invoke.showOpenDialog({
|
||||
title: 'Choose custom theme',
|
||||
defaultPath: this.settingsService.libraryDirectory || '',
|
||||
defaultPath: this.settingsService.customThemePath || '',
|
||||
properties: ['openFile'],
|
||||
filters: [
|
||||
{ name: "Themes", extensions: ["json"] },
|
||||
@@ -87,10 +87,12 @@ export class SettingsComponent implements OnInit {
|
||||
})
|
||||
|
||||
if (result.canceled === false) {
|
||||
const newThemeColors = await window.electron.invoke.getThemeColors(result.filePaths[0])
|
||||
const path = result.filePaths[0].replace(/\\/g, '/')
|
||||
const newThemeColors = await window.electron.invoke.getThemeColors(path)
|
||||
|
||||
if (newThemeColors) {
|
||||
this.settingsService.customTheme = newThemeColors
|
||||
this.settingsService.customThemePath = path.substring(0, path.lastIndexOf('/'))
|
||||
} else {
|
||||
alert(`ERROR: ${result.filePaths[0]} was not a valid JSON file.`)
|
||||
}
|
||||
|
||||
@@ -96,6 +96,13 @@ export class SettingsService {
|
||||
this.settings.customTheme = value
|
||||
this.saveSettings()
|
||||
}
|
||||
get customThemePath() {
|
||||
return this.settings.customThemePath
|
||||
}
|
||||
set customThemePath(value: string | null) {
|
||||
this.settings.customThemePath = value
|
||||
this.saveSettings()
|
||||
}
|
||||
|
||||
get isSng() {
|
||||
return this.settings.isSng
|
||||
|
||||
@@ -26,6 +26,7 @@ export interface Settings {
|
||||
downloadVideos: boolean // If background videos should be downloaded
|
||||
theme: typeof themes[number] // The name of the currently enabled UI theme
|
||||
customTheme: ThemeColors | null // The colors of a custom theme
|
||||
customThemePath: string | null // The last folder that contained the `customTheme`'s file
|
||||
libraryPath: string | undefined // The path to the user's library
|
||||
isSng: boolean // If the chart should be downloaded as a .sng file or as a chart folder
|
||||
isCompactTable: boolean // If the search result table should have reduced padding
|
||||
@@ -41,6 +42,7 @@ export const defaultSettings: Settings = {
|
||||
downloadVideos: true,
|
||||
theme: 'dark',
|
||||
customTheme: null,
|
||||
customThemePath: null,
|
||||
libraryPath: undefined,
|
||||
isSng: false,
|
||||
isCompactTable: false,
|
||||
|
||||
Reference in New Issue
Block a user