-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleaned up mess in main.rs and added settings wrapper
- Loading branch information
Showing
10 changed files
with
281 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
interface EQSettings { | ||
[key: string]: string; | ||
} | ||
|
||
class Settings { | ||
static async readSettings(): Promise<Map<string, string>> { | ||
try { | ||
const settings: { [key: string]: string } = await window.__TAURI__.invoke('read_settings'); | ||
return new Map(Object.entries(settings)); | ||
} catch (error) { | ||
console.error('Error reading settings:', error); | ||
throw error; | ||
} | ||
} | ||
|
||
static async readEQSettings(): Promise<Map<string, string>> { | ||
try { | ||
const eqSettings: { [key: string]: string } = await window.__TAURI__.invoke('read_eq_settings'); | ||
return new Map(Object.entries(eqSettings)); | ||
} catch (error) { | ||
console.error('Error reading EQ settings:', error); | ||
throw error; | ||
} | ||
} | ||
|
||
static async writeEQSettings(eqSettings: EQSettings): Promise<void> { | ||
try { | ||
await window.__TAURI__.invoke('write_eq_settings', { eqSettings }); | ||
} catch (error) { | ||
console.error('Error writing EQ settings:', error); | ||
throw error; | ||
} | ||
} | ||
|
||
static async updateUserSetting(key: string, value: string): Promise<void> { | ||
try { | ||
await window.__TAURI__.invoke('update_user_setting', { key, value }); | ||
} catch (error) { | ||
console.error('Error updating user setting:', error); | ||
throw error; | ||
} | ||
} | ||
} | ||
|
||
export default Settings; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.