tauri-app: allow editing record-daemon settings
All checks were successful
record-daemon / Build, check and test (push) Successful in 2m28s
All checks were successful
record-daemon / Build, check and test (push) Successful in 2m28s
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
import { ref } from "vue";
|
||||
import GameHistory from "./components/GameHistory.vue";
|
||||
import GameReview from "./components/GameReview.vue";
|
||||
import Settings from "./components/Settings.vue";
|
||||
import type { GameHistoryItem } from "./types/timeline";
|
||||
|
||||
// Current view state
|
||||
const currentView = ref<"history" | "review">("history");
|
||||
const currentView = ref<"history" | "review" | "settings">("history");
|
||||
const selectedGame = ref<GameHistoryItem | null>(null);
|
||||
|
||||
// Navigate to review view
|
||||
@@ -19,12 +20,50 @@ function closeReview() {
|
||||
currentView.value = "history";
|
||||
selectedGame.value = null;
|
||||
}
|
||||
|
||||
// Navigate to settings
|
||||
function openSettings() {
|
||||
currentView.value = "settings";
|
||||
}
|
||||
|
||||
// Navigate back from settings
|
||||
function closeSettings() {
|
||||
currentView.value = "history";
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="app">
|
||||
<GameHistory
|
||||
v-if="currentView === 'history'"
|
||||
<!-- Navigation bar -->
|
||||
<nav v-if="currentView !== 'review'" class="app-nav">
|
||||
<div class="nav-left">
|
||||
<button
|
||||
:class="['nav-tab', { active: currentView === 'history' }]"
|
||||
@click="currentView = 'history'"
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<rect x="3" y="3" width="7" height="7" rx="1" />
|
||||
<rect x="14" y="3" width="7" height="7" rx="1" />
|
||||
<rect x="3" y="14" width="7" height="7" rx="1" />
|
||||
<rect x="14" y="14" width="7" height="7" rx="1" />
|
||||
</svg>
|
||||
Game History
|
||||
</button>
|
||||
<button
|
||||
:class="['nav-tab', { active: currentView === 'settings' }]"
|
||||
@click="openSettings"
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="12" cy="12" r="3" />
|
||||
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
|
||||
</svg>
|
||||
Settings
|
||||
</button>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<GameHistory
|
||||
v-if="currentView === 'history'"
|
||||
@open-review="openReview"
|
||||
/>
|
||||
<GameReview
|
||||
@@ -32,6 +71,10 @@ function closeReview() {
|
||||
:game="selectedGame"
|
||||
@back="closeReview"
|
||||
/>
|
||||
<Settings
|
||||
v-else-if="currentView === 'settings'"
|
||||
@back="closeSettings"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -72,4 +115,44 @@ body {
|
||||
min-height: 100vh;
|
||||
background: #0a0a13;
|
||||
}
|
||||
|
||||
/* Navigation bar */
|
||||
.app-nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 24px;
|
||||
height: 48px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
.nav-left {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.nav-tab {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 8px 14px;
|
||||
background: none;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
color: #94a3b8;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
.nav-tab:hover {
|
||||
color: #e2e8f0;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.nav-tab.active {
|
||||
color: #f1f5f9;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -104,10 +104,6 @@ async function loadGameHistory() {
|
||||
}
|
||||
}
|
||||
|
||||
function selectGame(game: GameHistoryItem) {
|
||||
selectedGame.value = game;
|
||||
}
|
||||
|
||||
function closeDetail() {
|
||||
selectedGame.value = null;
|
||||
}
|
||||
|
||||
1239
tauri-app/src/components/Settings.vue
Normal file
1239
tauri-app/src/components/Settings.vue
Normal file
File diff suppressed because it is too large
Load Diff
148
tauri-app/src/types/daemon.ts
Normal file
148
tauri-app/src/types/daemon.ts
Normal file
@@ -0,0 +1,148 @@
|
||||
/**
|
||||
* TypeScript types for daemon settings and status.
|
||||
* Mirrors the Rust types from record-daemon/src/config/ and record-daemon/src/ipc/protocol.rs.
|
||||
*/
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Encoder presets
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface NvencPreset {
|
||||
type: "nvenc";
|
||||
bitrate: number;
|
||||
cq_level: number;
|
||||
two_pass: boolean;
|
||||
}
|
||||
|
||||
export interface AmfPreset {
|
||||
type: "amf";
|
||||
bitrate: number;
|
||||
quality: "speed" | "balanced" | "quality";
|
||||
}
|
||||
|
||||
export interface X264Preset {
|
||||
type: "x264";
|
||||
preset: string;
|
||||
bitrate: number;
|
||||
crf: number | null;
|
||||
}
|
||||
|
||||
export type EncoderPreset = NvencPreset | AmfPreset | X264Preset;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Quality level
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export type QualityLevel = "low" | "medium" | "high" | "ultra";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Settings structures
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface VideoSettings {
|
||||
encoder_preset: EncoderPreset;
|
||||
quality: QualityLevel;
|
||||
frame_rate: number;
|
||||
hardware_acceleration: boolean;
|
||||
}
|
||||
|
||||
export interface OutputSettings {
|
||||
path: string;
|
||||
naming_pattern: string;
|
||||
container: string;
|
||||
split_size_mb: number;
|
||||
split_time_minutes: number;
|
||||
}
|
||||
|
||||
export interface AudioSettings {
|
||||
enabled: boolean;
|
||||
bitrate: number;
|
||||
sample_rate: number;
|
||||
channels: number;
|
||||
capture_game: boolean;
|
||||
capture_mic: boolean;
|
||||
mic_device: string | null;
|
||||
}
|
||||
|
||||
export interface DaemonSettings {
|
||||
auto_record: boolean;
|
||||
monitor_client: boolean;
|
||||
poll_interval_ms: number;
|
||||
socket_path: string | null;
|
||||
log_level: string;
|
||||
save_timeline: boolean;
|
||||
}
|
||||
|
||||
export interface Settings {
|
||||
video: VideoSettings;
|
||||
output: OutputSettings;
|
||||
audio: AudioSettings;
|
||||
daemon: DaemonSettings;
|
||||
}
|
||||
|
||||
/** Response wrapper from daemon_get_settings (daemon wraps in { settings: {...} }). */
|
||||
export interface GetSettingsResponse {
|
||||
settings: Settings;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Daemon status
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export type DaemonStatus = "idle" | "monitoring" | "recording" | "error" | "shutting_down";
|
||||
|
||||
export interface DaemonStatusResponse {
|
||||
status: DaemonStatus;
|
||||
is_recording: boolean;
|
||||
current_game_id: number | null;
|
||||
client_connected: boolean;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Encoder info
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface EncoderInfo {
|
||||
id: string;
|
||||
name: string;
|
||||
is_hardware: boolean;
|
||||
available: boolean;
|
||||
}
|
||||
|
||||
export interface EncodersResponse {
|
||||
available: EncoderInfo[];
|
||||
current: string;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Quality level metadata
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export const QUALITY_LEVELS: { value: QualityLevel; label: string; description: string }[] = [
|
||||
{ value: "low", label: "Low", description: "720p @ 30fps" },
|
||||
{ value: "medium", label: "Medium", description: "1080p @ 30fps" },
|
||||
{ value: "high", label: "High", description: "1080p @ 60fps" },
|
||||
{ value: "ultra", label: "Ultra", description: "1440p @ 60fps" },
|
||||
];
|
||||
|
||||
export const CONTAINER_FORMATS = ["mp4", "mkv", "mov", "flv"] as const;
|
||||
|
||||
export const LOG_LEVELS = ["trace", "debug", "info", "warn", "error"] as const;
|
||||
|
||||
export const X264_PRESETS = [
|
||||
"ultrafast",
|
||||
"superfast",
|
||||
"veryfast",
|
||||
"faster",
|
||||
"fast",
|
||||
"medium",
|
||||
"slow",
|
||||
"slower",
|
||||
"veryslow",
|
||||
] as const;
|
||||
|
||||
export const AMF_QUALITIES: { value: "speed" | "balanced" | "quality"; label: string }[] = [
|
||||
{ value: "speed", label: "Speed" },
|
||||
{ value: "balanced", label: "Balanced" },
|
||||
{ value: "quality", label: "Quality" },
|
||||
];
|
||||
Reference in New Issue
Block a user