feat(settings): separate toasts and system notifications toggles
- Split "Notifications" setting into "In-app Toasts" and "System Notifications" - In-app toasts control the toast messages within the app - System notifications control desktop notifications on track change - Both settings persist to localStorage and load on app startup - Migrates old 'qbz-notifications-enabled' key to new 'qbz-toasts-enabled' feat(library): add stop scanning button - Add library_stop_scan command in Rust backend - Add cancel flag (AtomicBool) to LibraryState - Check cancel flag during scan loop for both CUE and audio files - Add "Cancelled" status to ScanStatus enum - Add stop button in LocalLibraryView scan progress UI - Button appears red on hover for clear visibility cc
This commit is contained in:
1 parent
7c42395598
commit
b8e3bca6f8
9 files changed
+149
-27
No files matched your search
@@ -79,7 +79,7 @@
|
||||
}
|
||||
|
||||
interface ScanProgress {
|
||||
status: 'Idle' | 'Scanning' | 'Complete' | 'Error';
|
||||
status: 'Idle' | 'Scanning' | 'Complete' | 'Cancelled' | 'Error';
|
||||
total_files: number;
|
||||
processed_files: number;
|
||||
current_file?: string;
|
||||
@@ -289,7 +289,7 @@
|
||||
const pollInterval = setInterval(async () => {
|
||||
try {
|
||||
scanProgress = await invoke<ScanProgress>('library_get_scan_progress');
|
||||
if (scanProgress.status === 'Complete' || scanProgress.status === 'Error') {
|
||||
if (scanProgress.status === 'Complete' || scanProgress.status === 'Cancelled' || scanProgress.status === 'Error') {
|
||||
clearInterval(pollInterval);
|
||||
scanning = false;
|
||||
await loadLibraryData();
|
||||
@@ -310,6 +310,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function handleStopScan() {
|
||||
try {
|
||||
await invoke('library_stop_scan');
|
||||
} catch (err) {
|
||||
console.error('Failed to stop scan:', err);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleClearLibrary() {
|
||||
if (!confirm('Clear entire library? This will remove all indexed tracks. Your files will not be deleted.')) {
|
||||
return;
|
||||
@@ -981,6 +989,10 @@
|
||||
{#if scanProgress.current_file}
|
||||
<span class="current-file">{scanProgress.current_file.split('/').pop()}</span>
|
||||
{/if}
|
||||
<button class="stop-scan-btn" onclick={handleStopScan} title="Stop scanning">
|
||||
<X size={14} />
|
||||
<span>Stop</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -1614,6 +1626,26 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.stop-scan-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 4px 10px;
|
||||
background: var(--bg-tertiary);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 6px;
|
||||
color: var(--text-secondary);
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.stop-scan-btn:hover {
|
||||
background: var(--error);
|
||||
border-color: var(--error);
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Settings Panel */
|
||||
.settings-panel {
|
||||
background: var(--bg-secondary);
|
||||
|
||||
Reference in new issue
Block a user