Restructure; use DaisyUI

This commit is contained in:
Geomitron
2023-11-28 19:50:45 -06:00
parent 49c3f38f99
commit 2eef4d0bee
727 changed files with 1283 additions and 298840 deletions

View File

@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core'
import { Settings } from 'src/electron/shared/Settings'
import { ElectronService } from './electron.service'
import { Settings } from '../../../../src-shared/Settings'
@Injectable({
providedIn: 'root',
@@ -12,22 +11,20 @@ export class SettingsService {
private settings: Settings
private currentThemeLink: HTMLLinkElement
constructor(private electronService: ElectronService) { }
async loadSettings() {
this.settings = await this.electronService.invoke('get-settings', undefined)
if (this.settings.theme != this.builtinThemes[0]) {
this.settings = await window.electron.invoke.getSettings()
if (this.settings.theme !== this.builtinThemes[0]) {
this.changeTheme(this.settings.theme)
}
}
saveSettings() {
this.electronService.sendIPC('set-settings', this.settings)
window.electron.emit.setSettings(this.settings)
}
changeTheme(theme: string) {
if (this.currentThemeLink != undefined) this.currentThemeLink.remove()
if (theme == 'Default') { return }
if (this.currentThemeLink !== undefined) this.currentThemeLink.remove()
if (theme === 'Default') { return }
const link = document.createElement('link')
link.type = 'text/css'
@@ -36,21 +33,11 @@ export class SettingsService {
this.currentThemeLink = document.head.appendChild(link)
}
async getCacheSize() {
return this.electronService.defaultSession.getCacheSize()
}
async clearCache() {
this.saveSettings()
await this.electronService.defaultSession.clearCache()
await this.electronService.invoke('clear-cache', undefined)
}
// Individual getters/setters
get libraryDirectory() {
return this.settings.libraryPath
}
set libraryDirectory(newValue: string) {
set libraryDirectory(newValue: string | undefined) {
this.settings.libraryPath = newValue
this.saveSettings()
}