⏱️ Timeline
Wallpaper Manager Internal Flows
1. Adding a New Wallpaper
Entry Point
setWallpaperAtTimelineIndex(
type, // ContentTypes::InstalledType
absolutePath, // Wallpaper file path
previewImage, // Preview image path
file, // Main file name
title, // Display title
monitorIndex, // Vector of monitor indices
timelineIndex, // Timeline section index
identifier, // Section identifier
saveToProfiles // Whether to persist changes
)
Internal Flow
- Validation Phase
- Check path validity
- Validate timeline index and identifier
-
Verify monitor indices
-
Timeline Section Management
- Locate target timeline section
- Validate section exists and can accept wallpaper
-
Check for existing wallpapers on target monitors
-
Wallpaper State Handling
- If timeline section is active:
for (auto& activeWallpaper : activeTimeline->activeWallpaperList) { if (activeWallpaper->monitors() == wallpaperData.monitors()) { if (isSameWallpaperRuntime(activeWallpaper->type(), wallpaperData.type())) { // Replace content in existing wallpaper activeWallpaper->replace(wallpaperData); } else { // Remove and restart with new type await removeWallpaper(wallpaperData.monitors().first()); await startWallpaper(wallpaperData); } } }
-
If timeline section is inactive:
- Store wallpaper data for later activation
-
UI Updates
- Update monitor list model
- Refresh timeline visualization
-
Trigger UI updates for affected monitors
-
Persistence
- If saveToProfiles is true:
- Update profiles configuration
- Write changes to disk
- Emit save confirmation
2. Removing a Wallpaper
Entry Point
removeWallpaperAt(
timelineIndex, // Timeline section index
sectionIdentifier, // Section identifier
monitorIndex // Target monitor
)
Internal Flow
-
Section Location
-
Active Wallpaper Handling
-
If section is active:
- Stop wallpaper process
- Wait for SDK disconnection
- Clean up resources
- Update active wallpaper list
-
Data Cleanup
- Remove wallpaper data from section
- Update monitor assignments
-
Clean up any orphaned references
-
State Synchronization
- Update monitor model data
- Refresh timeline section data
- Trigger UI updates
3. Timeline Modification
Entry Point
moveTimelineAt(
index, // Timeline index
identifier, // Section identifier
relativePosition, // New position (0-1)
positionTimeString // Time string (HH:MM:SS)
)
Internal Flow
-
Time Validation
-
Timeline Updates
- Update section end time
- Update relative position
-
Adjust adjacent section times
-
Section Validation
- Ensure continuous coverage
- Verify no overlaps
-
Check time constraints
-
Active Wallpaper Management
- Check if change affects active section
- Handle wallpaper state transitions
-
Update active wallpaper timings
-
State Persistence
- Update timeline model
- Save timeline configuration
- Emit timeline update events
Important Considerations
Error Handling
- All operations should handle failures gracefully
- Maintain system state consistency
- Provide meaningful error messages
- Roll back partial changes on failure
Async Operations
- Use QCoro tasks for async operations
- Properly await completion of all async tasks
- Handle cancellation and timeouts
- Maintain state during async transitions
State Management
- Track current timeline section state
- Monitor wallpaper process health
- Handle SDK connection lifecycle
- Manage resource cleanup
Timeline Integrity
- Maintain continuous coverage (00:00:00 to 23:59:59)
- Prevent overlapping sections
- Validate all time boundaries
- Ensure proper section ordering