feat(workspace): refresh desktop editing experience and prepare 0.1.2
Gitea CI / Build Android APK (pull_request) Canceled after 0s
Gitea CI / Build Windows x64 app (pull_request) Canceled after 0s
Gitea CI / Audit and package Windows x64 (pull_request) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (pull_request) Canceled after 0s
Gitea CI / Gitea CI passed (pull_request) Canceled after 0s
Gitea CI / Check code and tests (pull_request) Canceled after 6m29s
Gitea CI / Build Android APK (pull_request) Canceled after 0s
Gitea CI / Build Windows x64 app (pull_request) Canceled after 0s
Gitea CI / Audit and package Windows x64 (pull_request) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (pull_request) Canceled after 0s
Gitea CI / Gitea CI passed (pull_request) Canceled after 0s
Gitea CI / Check code and tests (pull_request) Canceled after 6m29s
This commit is contained in:
1 parent
aa5255d1e4
commit
2e0033ce2d
260 files changed
+43963
-5591
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import '../../shared/widgets/presentation_list.dart';
|
||||
|
||||
import 'package:cutdex/shared/widgets/error_notification_host.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -44,12 +46,50 @@ class BackgroundTasksContent extends ConsumerWidget {
|
||||
final ProcessingResourceRepository? repository;
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final snapshot = ref.watch(
|
||||
backgroundTasksProvider(registry: registry, session: session),
|
||||
final tasksProvider = backgroundTasksProvider(
|
||||
registry: registry,
|
||||
session: session,
|
||||
);
|
||||
ref.watch(
|
||||
tasksProvider.select(
|
||||
(snapshot) => (
|
||||
PresentationList(
|
||||
snapshot.subtitles.map(
|
||||
(entry) => (entry.owner.session, entry.job.id),
|
||||
),
|
||||
),
|
||||
PresentationList(
|
||||
snapshot.removals.map(
|
||||
(entry) => (entry.owner.session, entry.task.id),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
final snapshot = ref.read(tasksProvider);
|
||||
if (repository != null) {
|
||||
ref.watch(
|
||||
processingResourcesProvider(repository!).select(
|
||||
(snapshot) => (
|
||||
snapshot.subtitleDownloading,
|
||||
PresentationList(
|
||||
snapshot.installs
|
||||
.where(
|
||||
(install) =>
|
||||
install.state == ProcessingResourceState.downloading ||
|
||||
install.state == ProcessingResourceState.failed,
|
||||
)
|
||||
.map(
|
||||
(install) => (install.package.capability, install.state),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
final resources = repository == null
|
||||
? null
|
||||
: ref.watch(processingResourcesProvider(repository!));
|
||||
: ref.read(processingResourcesProvider(repository!));
|
||||
final subtitleEntries = snapshot.subtitles;
|
||||
final removalEntries = snapshot.removals;
|
||||
final subtitleDownloading = resources?.subtitleDownloading == true;
|
||||
@@ -118,9 +158,11 @@ class BackgroundTasksContent extends ConsumerWidget {
|
||||
resourceDownloads.isNotEmpty ||
|
||||
subtitleDownloading)
|
||||
const SizedBox(height: 2),
|
||||
_BackgroundRemovalTaskCard(
|
||||
key: ValueKey(entry.task.id),
|
||||
_ObservedRemovalTask(
|
||||
key: ValueKey((entry.owner.session, entry.task.id)),
|
||||
entry: entry,
|
||||
registry: registry,
|
||||
session: session,
|
||||
),
|
||||
],
|
||||
for (final (index, entry)
|
||||
@@ -130,9 +172,14 @@ class BackgroundTasksContent extends ConsumerWidget {
|
||||
removalEntries.isNotEmpty ||
|
||||
subtitleDownloading)
|
||||
const SizedBox(height: 2),
|
||||
_SubtitleTaskCard(
|
||||
key: ValueKey(entry.job.recognition.id),
|
||||
_ObservedSubtitleTask(
|
||||
key: ValueKey((
|
||||
entry.owner.session,
|
||||
entry.job.recognition.id,
|
||||
)),
|
||||
entry: entry,
|
||||
registry: registry,
|
||||
session: session,
|
||||
),
|
||||
],
|
||||
],
|
||||
@@ -144,6 +191,70 @@ class BackgroundTasksContent extends ConsumerWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _ObservedSubtitleTask extends ConsumerWidget {
|
||||
const _ObservedSubtitleTask({
|
||||
super.key,
|
||||
required this.entry,
|
||||
this.registry,
|
||||
this.session,
|
||||
});
|
||||
final SubtitleTaskEntry entry;
|
||||
final BackgroundTaskRegistry? registry;
|
||||
final EditorTimelineSession? session;
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final current = ref.watch(
|
||||
backgroundTasksProvider(registry: registry, session: session).select(
|
||||
(snapshot) => snapshot.subtitles
|
||||
.where(
|
||||
(item) =>
|
||||
identical(item.owner.session, entry.owner.session) &&
|
||||
item.job.id == entry.job.id,
|
||||
)
|
||||
.firstOrNull,
|
||||
),
|
||||
);
|
||||
return current == null
|
||||
? const SizedBox.shrink()
|
||||
: _SubtitleTaskCard(
|
||||
key: ValueKey((current.owner.session, current.job.id)),
|
||||
entry: current,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ObservedRemovalTask extends ConsumerWidget {
|
||||
const _ObservedRemovalTask({
|
||||
super.key,
|
||||
required this.entry,
|
||||
this.registry,
|
||||
this.session,
|
||||
});
|
||||
final RemovalTaskEntry entry;
|
||||
final BackgroundTaskRegistry? registry;
|
||||
final EditorTimelineSession? session;
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final current = ref.watch(
|
||||
backgroundTasksProvider(registry: registry, session: session).select(
|
||||
(snapshot) => snapshot.removals
|
||||
.where(
|
||||
(item) =>
|
||||
identical(item.owner.session, entry.owner.session) &&
|
||||
item.task.id == entry.task.id,
|
||||
)
|
||||
.firstOrNull,
|
||||
),
|
||||
);
|
||||
return current == null
|
||||
? const SizedBox.shrink()
|
||||
: _BackgroundRemovalTaskCard(
|
||||
key: ValueKey((current.owner.session, current.task.id)),
|
||||
entry: current,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
String _ownerName(BackgroundTaskSession owner) => owner.projectName.isEmpty
|
||||
? owner.timelineName
|
||||
: '${owner.projectName} · ${owner.timelineName}';
|
||||
@@ -387,7 +498,31 @@ class _ResourceDownloadCard extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final snapshot = ref.watch(processingResourcesProvider(repository));
|
||||
final snapshot = ref.watch(
|
||||
processingResourcesProvider(repository).select((snapshot) {
|
||||
final capability = this.install?.package.capability;
|
||||
return snapshot.copyWith(
|
||||
installs: snapshot.installs
|
||||
.where((install) => install.package.capability == capability)
|
||||
.toList(),
|
||||
paused: capability == null
|
||||
? const {}
|
||||
: snapshot.paused.where((item) => item == capability).toSet(),
|
||||
rates: capability == null
|
||||
? const {}
|
||||
: {capability: snapshot.rates[capability] ?? 0},
|
||||
subtitleDownloading: subtitleBundle && snapshot.subtitleDownloading,
|
||||
subtitlePaused: subtitleBundle && snapshot.subtitlePaused,
|
||||
subtitleDownloadedBytes: subtitleBundle
|
||||
? snapshot.subtitleDownloadedBytes
|
||||
: 0,
|
||||
subtitleTotalBytes: subtitleBundle ? snapshot.subtitleTotalBytes : 0,
|
||||
subtitleBytesPerSecond: subtitleBundle
|
||||
? snapshot.subtitleBytesPerSecond
|
||||
: 0,
|
||||
);
|
||||
}),
|
||||
);
|
||||
final install = this.install == null
|
||||
? null
|
||||
: snapshot.installs
|
||||
|
||||
Reference in new issue
Block a user