Line data Source code
1 : #pragma once
2 : #include <string>
3 : #include <vector>
4 :
5 : // Pure C++ (no JUCE) — manages the video file list, selection, and play state.
6 : // All methods are UI-thread-only; no synchronization needed.
7 15 : class VideoListManager {
8 : public:
9 : enum class PlayState { Stopped, Playing, Paused };
10 :
11 : struct FileEntry {
12 : std::string filename;
13 : double durationSec = 0.0;
14 : };
15 :
16 : // Replace the file list. Clears selectedIndex if it would be out of range.
17 : void setFiles(const std::vector<FileEntry>& entries);
18 :
19 : int fileCount() const;
20 : const std::string& filename(int i) const; // asserts valid index
21 : double duration(int i) const; // asserts valid index
22 :
23 : int selectedIndex() const;
24 : void setSelectedIndex(int idx); // negative → -1; ≥ count → clamped to last
25 :
26 : PlayState playState() const;
27 : void setPlayState(PlayState s);
28 :
29 : bool isPlaying() const; // true iff playState == Playing
30 :
31 : private:
32 : std::vector<FileEntry> files_;
33 15 : int selectedIndex_ = -1;
34 15 : PlayState playState_ = PlayState::Stopped;
35 : };
|