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