feat: initial Cutdex application
Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,203 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'app_database.g.dart';
|
||||
|
||||
class RecentProjectRecords extends Table {
|
||||
TextColumn get id => text()();
|
||||
TextColumn get name => text()();
|
||||
TextColumn get path => text()();
|
||||
IntColumn get position => integer()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
|
||||
class LastOpenedTimelines extends Table {
|
||||
TextColumn get projectId => text()();
|
||||
TextColumn get timelineId => text()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {projectId};
|
||||
}
|
||||
|
||||
class McpConfigurations extends Table {
|
||||
IntColumn get id => integer()();
|
||||
BoolColumn get enabled => boolean()();
|
||||
IntColumn get port => integer()();
|
||||
TextColumn get token => text()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
|
||||
class AppearanceConfigurations extends Table {
|
||||
IntColumn get id => integer()();
|
||||
TextColumn get themeMode => text()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
|
||||
class LanguageConfigurations extends Table {
|
||||
IntColumn get id => integer()();
|
||||
TextColumn get language => text()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
|
||||
class ConversationLocationConfigurations extends Table {
|
||||
IntColumn get id => integer()();
|
||||
TextColumn get directory => text()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
|
||||
class ProjectLocationConfigurations extends Table {
|
||||
IntColumn get id => integer()();
|
||||
TextColumn get directory => text()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
|
||||
class ResourceLocationConfigurations extends Table {
|
||||
IntColumn get id => integer()();
|
||||
TextColumn get directory => text()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
|
||||
class AgentConfigurations extends Table {
|
||||
IntColumn get id => integer()();
|
||||
BoolColumn get enabled => boolean()();
|
||||
TextColumn get selectedProviderId => text().nullable()();
|
||||
TextColumn get selectedModelId => text().nullable()();
|
||||
IntColumn get revision => integer()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
|
||||
class AgentProviders extends Table {
|
||||
BoolColumn get enabled => boolean().withDefault(const Constant(true))();
|
||||
TextColumn get id => text()();
|
||||
TextColumn get name => text()();
|
||||
TextColumn get apiType => text()();
|
||||
TextColumn get baseUrl => text()();
|
||||
TextColumn get credentialId => text().nullable()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
|
||||
class AgentModels extends Table {
|
||||
TextColumn get providerId => text()();
|
||||
TextColumn get modelId => text()();
|
||||
IntColumn get contextWindow => integer().nullable()();
|
||||
IntColumn get maxOutputTokens => integer().nullable()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {providerId, modelId};
|
||||
}
|
||||
|
||||
class WorkspaceViewConfigurations extends Table {
|
||||
TextColumn get mode => text().withDefault(const Constant('agent'))();
|
||||
IntColumn get id => integer()();
|
||||
TextColumn get activeProjectId => text().nullable()();
|
||||
BoolColumn get sidebarCollapsed => boolean()();
|
||||
RealColumn get sidebarWidth => real().nullable()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
|
||||
class ProjectViewConfigurations extends Table {
|
||||
TextColumn get projectId => text()();
|
||||
BoolColumn get propertiesOpen => boolean()();
|
||||
RealColumn get timelineHeight => real().nullable()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {projectId};
|
||||
}
|
||||
|
||||
class TimelineViewConfigurations extends Table {
|
||||
TextColumn get projectId => text()();
|
||||
TextColumn get timelineId => text()();
|
||||
TextColumn get sequenceId => text()();
|
||||
BoolColumn get active => boolean()();
|
||||
IntColumn get playheadTick => integer()();
|
||||
IntColumn get baseTick => integer()();
|
||||
RealColumn get fractionalTick => real()();
|
||||
RealColumn get pixelsPerTick => real()();
|
||||
RealColumn get verticalOffset => real()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {projectId, timelineId, sequenceId};
|
||||
}
|
||||
|
||||
@DriftDatabase(
|
||||
tables: [
|
||||
RecentProjectRecords,
|
||||
LastOpenedTimelines,
|
||||
McpConfigurations,
|
||||
AppearanceConfigurations,
|
||||
LanguageConfigurations,
|
||||
ConversationLocationConfigurations,
|
||||
ProjectLocationConfigurations,
|
||||
ResourceLocationConfigurations,
|
||||
AgentConfigurations,
|
||||
AgentProviders,
|
||||
AgentModels,
|
||||
WorkspaceViewConfigurations,
|
||||
ProjectViewConfigurations,
|
||||
TimelineViewConfigurations,
|
||||
],
|
||||
)
|
||||
class AppDatabase extends _$AppDatabase {
|
||||
AppDatabase(super.executor);
|
||||
|
||||
@override
|
||||
int get schemaVersion => 2;
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration => MigrationStrategy(
|
||||
onCreate: (migrator) => migrator.createAll(),
|
||||
onUpgrade: (_, from, _) async {
|
||||
throw StateError('Unsupported app database schema version: $from');
|
||||
},
|
||||
beforeOpen: (_) async {
|
||||
await customStatement('PRAGMA journal_mode = WAL');
|
||||
await customStatement('PRAGMA synchronous = FULL');
|
||||
await customStatement('PRAGMA busy_timeout = 5000');
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
AppDatabase appDatabase(Ref ref) {
|
||||
final database = AppDatabase(LazyDatabase(_openAppDatabase));
|
||||
ref.onDispose(database.close);
|
||||
return database;
|
||||
}
|
||||
|
||||
Future<QueryExecutor> _openAppDatabase() async {
|
||||
if (Platform.environment.containsKey('FLUTTER_TEST')) {
|
||||
return NativeDatabase.memory();
|
||||
}
|
||||
final support = Directory(
|
||||
p.join((await getApplicationSupportDirectory()).path, 'Cutdex'),
|
||||
);
|
||||
await support.create(recursive: true);
|
||||
return NativeDatabase.createInBackground(
|
||||
File(p.join(support.path, 'app.sqlite')),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user