Tray options implementation + Voice system rewrite + build fixes
This commit is contained in:
parent
44ea5e46e2
commit
82eddf5d4c
117 changed files with 1300 additions and 2334 deletions
|
|
@ -1,7 +1,7 @@
|
|||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use jarvis_core::{config, db, i18n, APP_CONFIG_DIR, APP_LOG_DIR, DB};
|
||||
use jarvis_core::{config, db, i18n, voices, APP_CONFIG_DIR, APP_LOG_DIR, DB};
|
||||
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
|
|
@ -30,6 +30,16 @@ fn main() {
|
|||
// init i18n
|
||||
i18n::init(&settings.language);
|
||||
|
||||
// init voices
|
||||
if let Err(e) = voices::init(&settings.voice) {
|
||||
eprintln!("Failed to init voices: {}", e);
|
||||
}
|
||||
|
||||
// init audio backend
|
||||
if let Err(e) = jarvis_core::audio::init() {
|
||||
eprintln!("Failed to init audio: {:?}", e);
|
||||
}
|
||||
|
||||
// set db
|
||||
DB.set(Arc::new(RwLock::new(settings)))
|
||||
.expect("DB already initialized");
|
||||
|
|
@ -55,6 +65,8 @@ fn main() {
|
|||
tauri_commands::get_author_name,
|
||||
tauri_commands::get_repository_link,
|
||||
tauri_commands::get_tg_official_link,
|
||||
tauri_commands::get_boosty_link,
|
||||
tauri_commands::get_patreon_link,
|
||||
tauri_commands::get_feedback_link,
|
||||
|
||||
// fs
|
||||
|
|
@ -79,6 +91,15 @@ fn main() {
|
|||
tauri_commands::get_current_language,
|
||||
tauri_commands::set_language,
|
||||
tauri_commands::get_supported_languages,
|
||||
|
||||
// commands
|
||||
tauri_commands::get_commands_count,
|
||||
tauri_commands::get_commands_list,
|
||||
|
||||
// voices
|
||||
tauri_commands::list_voices,
|
||||
tauri_commands::get_voice,
|
||||
tauri_commands::preview_voice,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
|
|
|||
|
|
@ -29,4 +29,12 @@ pub use stt::*;
|
|||
|
||||
// import i18n commands
|
||||
mod i18n;
|
||||
pub use i18n::*;
|
||||
pub use i18n::*;
|
||||
|
||||
// import commands commands xD
|
||||
mod commands;
|
||||
pub use commands::*;
|
||||
|
||||
// import voices commands
|
||||
mod voices;
|
||||
pub use voices::*;
|
||||
22
crates/jarvis-gui/src/tauri_commands/commands.rs
Normal file
22
crates/jarvis-gui/src/tauri_commands/commands.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
use jarvis_core::commands::{self, JCommand, JCommandsList};
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
static COMMANDS: Lazy<Vec<JCommandsList>> = Lazy::new(|| {
|
||||
commands::parse_commands().unwrap_or_default()
|
||||
});
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_commands_count() -> usize {
|
||||
COMMANDS
|
||||
.iter()
|
||||
.map(|list| list.commands.len())
|
||||
.sum()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_commands_list() -> Vec<JCommand> {
|
||||
COMMANDS
|
||||
.iter()
|
||||
.flat_map(|list| list.commands.clone())
|
||||
.collect()
|
||||
}
|
||||
16
crates/jarvis-gui/src/tauri_commands/voices.rs
Normal file
16
crates/jarvis-gui/src/tauri_commands/voices.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
use jarvis_core::voices::{self, structs::VoiceConfig};
|
||||
|
||||
#[tauri::command]
|
||||
pub fn list_voices() -> Vec<VoiceConfig> {
|
||||
voices::list_voices()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_voice(voice_id: String) -> Option<VoiceConfig> {
|
||||
voices::get_voice(&voice_id)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn preview_voice(voice_id: String) {
|
||||
voices::play_preview(&voice_id);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue