mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-10-27 02:27:18 +00:00
clarify filename
This commit is contained in:
1 parent
11709316d2
commit
adbf89e318
16 files changed
+573
-61
No files matched your search
@@ -113,10 +113,8 @@ fn write_unsaved<R: Runtime>(
|
||||
state.core(move |core| {
|
||||
let result = core
|
||||
.workspace
|
||||
.save(&core.engine, &ids, &chosen, folder.as_deref());
|
||||
core.keep_workspace();
|
||||
core.announce(None);
|
||||
result.map(|()| true)
|
||||
.save(&mut core.engine, &ids, &chosen, folder.as_deref());
|
||||
core.wrote(result)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -180,10 +178,8 @@ pub fn save_file_as<R: Runtime>(
|
||||
return Ok(false);
|
||||
};
|
||||
state.core(move |core| {
|
||||
let result = core.workspace.save_as(&core.engine, file_id, &path);
|
||||
core.keep_workspace();
|
||||
core.announce(None);
|
||||
result.map(|()| true)
|
||||
let result = core.workspace.save_as(&mut core.engine, file_id, &path);
|
||||
core.wrote(result)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,28 @@
|
||||
//! Editing the metadata, the style, the structure and the waypoints of the files, and the tools:
|
||||
//! reversing, cropping, reducing, timestamps, merging, cleaning...
|
||||
|
||||
use gpx_engine::{CleanType, MergeType, SplitType, api};
|
||||
use gpx_engine::{CleanType, FileId, MergeType, Selection, SplitType, api};
|
||||
use tauri::State;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::state::AppState;
|
||||
|
||||
/// Names and describes the selected files or tracks. A file on the disk is renamed with it (and back
|
||||
/// when it is undone): its name is one that a file can have, and not the one of another file.
|
||||
#[tauri::command(async)]
|
||||
pub fn metadata(state: State<AppState>, name: String, desc: String) -> api::Outcome {
|
||||
state.run(move |e| api::metadata(e, &name, &desc))
|
||||
state.core(move |core| {
|
||||
let mut name = name;
|
||||
if let Selection::File { file_ids } = core.engine.selection() {
|
||||
for FileId(id) in file_ids.clone() {
|
||||
name = core.workspace.valid_name(id, &name);
|
||||
if let Err(error) = core.workspace.renamed_path(id, &name) {
|
||||
return api::Outcome::failed(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
core.edit(move |e| api::metadata(e, &name, &desc))
|
||||
})
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
|
||||
@@ -109,10 +109,10 @@ pub fn move_elements(
|
||||
|
||||
#[tauri::command(async)]
|
||||
pub fn undo(state: State<AppState>) -> api::Outcome {
|
||||
state.run(api::undo)
|
||||
state.edit(api::undo)
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
pub fn redo(state: State<AppState>) -> api::Outcome {
|
||||
state.run(api::redo)
|
||||
state.edit(api::redo)
|
||||
}
|
||||
Reference in new issue
Block a user