Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fmt

Richie McIlroy7ef204505d09
diff --git a/apps/desktop/src-tauri/src/export.rs b/apps/desktop/src-tauri/src/export.rs
index 1786561fb..849e9d4a3 100644
--- a/apps/desktop/src-tauri/src/export.rs
+++ b/apps/desktop/src-tauri/src/export.rs
@@ -225,7 +225,7 @@ pub async fn generate_export_preview(
RenderVideoConstants::new(
&recordings.segments,
recording_meta.clone(),
- studio_meta.clone(),
+ (*studio_meta).clone(),
)
.await
.map_err(|e| format!("Failed to create render constants: {e}"))?,
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs
index c6ce3257a..3cc13c8fb 100644
--- a/apps/desktop/src-tauri/src/lib.rs
+++ b/apps/desktop/src-tauri/src/lib.rs
@@ -1456,7 +1456,7 @@ async fn get_video_metadata(path: PathBuf) -> Result<VideoRecordingMetadata, Str
return Err("Unable to get metadata on in-progress recording".to_string());
}
- match meta {
+ match &**meta {
StudioRecordingMeta::SingleSegment { segment } => {
vec![recording_meta.path(&segment.display.path)]
}
@@ -1888,15 +1888,13 @@ impl RecordingMetaWithMetadata {
RecordingMetaInner::Instant(_) => RecordingMode::Instant,
},
status: match &inner.inner {
- RecordingMetaInner::Studio(StudioRecordingMeta::MultipleSegments { inner }) => {
- inner
+ RecordingMetaInner::Studio(meta) => match &**meta {
+ StudioRecordingMeta::MultipleSegments { inner } => inner
.status
.clone()
- .unwrap_or(StudioRecordingStatus::Complete)
- }
- RecordingMetaInner::Studio(StudioRecordingMeta::SingleSegment { .. }) => {
- StudioRecordingStatus::Complete
- }
+ .unwrap_or(StudioRecordingStatus::Complete),
+ StudioRecordingMeta::SingleSegment { .. } => StudioRecordingStatus::Complete,
+ },
RecordingMetaInner::Instant(InstantRecordingMeta::InProgress { .. }) => {
StudioRecordingStatus::InProgress
}
@@ -3072,12 +3070,14 @@ async fn resume_uploads(app: AppHandle) -> Result<(), String> {
// Check if recording is still marked as in-progress and if so mark as failed
// This should only happen if the application crashes while recording
match &mut meta.inner {
- RecordingMetaInner::Studio(StudioRecordingMeta::MultipleSegments { inner }) => {
- if let Some(StudioRecordingStatus::InProgress) = &inner.status {
- inner.status = Some(StudioRecordingStatus::Failed {
- error: "Recording crashed".to_string(),
- });
- needs_save = true;
+ RecordingMetaInner::Studio(meta_box) => {
+ if let StudioRecordingMeta::MultipleSegments { inner } = &mut **meta_box {
+ if let Some(StudioRecordingStatus::InProgress) = &inner.status {
+ inner.status = Some(StudioRecordingStatus::Failed {
+ error: "Recording crashed".to_string(),
+ });
+ needs_save = true;
+ }
}
}
RecordingMetaInner::Instant(InstantRecordingMeta::InProgress { .. }) => {
diff --git a/apps/desktop/src-tauri/src/recording.rs b/apps/desktop/src-tauri/src/recording.rs
index 870236911..92cce11b7 100644
--- a/apps/desktop/src-tauri/src/recording.rs
+++ b/apps/desktop/src-tauri/src/recording.rs
@@ -543,13 +543,13 @@ pub async fn start_recording(
pretty_name: project_name.clone(),
inner: match inputs.mode {
RecordingMode::Studio => {
- RecordingMetaInner::Studio(StudioRecordingMeta::MultipleSegments {
+ RecordingMetaInner::Studio(Box::new(StudioRecordingMeta::MultipleSegments {
inner: MultipleSegments {
segments: Default::default(),
cursors: Default::default(),
status: Some(StudioRecordingStatus::InProgress),
},
- })
+ }))
}
RecordingMode::Instant => {
RecordingMetaInner::Instant(InstantRecordingMeta::InProgress { recording: true })
@@ -1228,9 +1228,9 @@ pub async fn take_screenshot(
project_path: project_file_path.clone(),
pretty_name: project_name,
sharing: None,
- inner: cap_project::RecordingMetaInner::Studio(
+ inner: cap_project::RecordingMetaInner::Studio(Box::new(
cap_project::StudioRecordingMeta::SingleSegment { segment },
- ),
+ )),
upload: None,
};
@@ -1332,7 +1332,7 @@ async fn handle_recording_end(
{
match &mut project_meta.inner {
RecordingMetaInner::Studio(meta) => {
- if let StudioRecordingMeta::MultipleSegments { inner } = meta {
+ if let StudioRecordingMeta::MultipleSegments { inner } = &mut **meta {
inner.status = Some(StudioRecordingStatus::Failed { error });
}
}
@@ -1397,7 +1397,7 @@ async fn handle_recording_finish(
let (meta_inner, sharing) = match completed_recording {
CompletedRecording::Studio { recording, .. } => {
- let meta_inner = RecordingMetaInner::Studio(recording.meta.clone());
+ let meta_inner = RecordingMetaInner::Studio(Box::new(recording.meta.clone()));
if let Ok(mut meta) = RecordingMeta::load_for_project(&recording_dir).map_err(|err| {
error!("Failed to load recording meta while saving finished recording: {err}")
@@ -1509,7 +1509,10 @@ async fn handle_recording_finish(
config.write(&recording_dir).map_err(|e| e.to_string())?;
- (RecordingMetaInner::Studio(updated_studio_meta), None)
+ (
+ RecordingMetaInner::Studio(Box::new(updated_studio_meta)),
+ None,
+ )
}
CompletedRecording::Instant {
recording,
@@ -1911,7 +1914,7 @@ pub fn generate_zoom_segments_from_clicks(
project_path: recording.project_path.clone(),
pretty_name: String::new(),
sharing: None,
- inner: RecordingMetaInner::Studio(recording.meta.clone()),
+ inner: RecordingMetaInner::Studio(Box::new(recording.meta.clone())),
upload: None,
};
@@ -1931,7 +1934,7 @@ pub fn generate_zoom_segments_for_project(
let mut all_clicks = Vec::new();
let mut all_moves = Vec::new();
- match studio_meta {
+ match &**studio_meta {
StudioRecordingMeta::SingleSegment { segment } => {
if let Some(cursor_path) = &segment.cursor {
let mut events = CursorEvents::load_from_file(&recording_meta.path(cursor_path))
diff --git a/apps/desktop/src-tauri/src/screenshot_editor.rs b/apps/desktop/src-tauri/src/screenshot_editor.rs
index 890142c56..8ffcd06dd 100644
--- a/apps/desktop/src-tauri/src/screenshot_editor.rs
+++ b/apps/desktop/src-tauri/src/screenshot_editor.rs
@@ -228,7 +228,7 @@ impl ScreenshotEditorInstances {
project_path: path.parent().unwrap().to_path_buf(),
pretty_name: "Screenshot".to_string(),
sharing: None,
- inner: RecordingMetaInner::Studio(studio_meta.clone()),
+ inner: RecordingMetaInner::Studio(Box::new(studio_meta.clone())),
upload: None,
}
};
@@ -284,7 +284,7 @@ impl ScreenshotEditorInstances {
queue: (*queue).clone(),
device: (*device).clone(),
options,
- meta: studio_meta,
+ meta: *studio_meta,
recording_meta: recording_meta.clone(),
background_textures: Arc::new(tokio::sync::RwLock::new(HashMap::new())),
is_software_adapter,