ACMX 2.136.0
Dual-Backend Real-Time GPU Video Synthesis
Loading...
Searching...
No Matches
ACMX2/interface/playlist.hpp
Go to the documentation of this file.
1#ifndef __PLAYLIST_HPP__
2#define __PLAYLIST_HPP__
3
4/**
5 * @file playlist.hpp
6 * @brief Dialog for building nested shader playlists.
7 */
8
9#include <QCheckBox>
10#include <QComboBox>
11#include <QDialog>
12#include <QGroupBox>
13#include <QHBoxLayout>
14#include <QLabel>
15#include <QLineEdit>
16#include <QPushButton>
17#include <QSortFilterProxyModel>
18#include <QSpinBox>
19#include <QStandardItemModel>
20#include <QStringList>
21#include <QTreeWidget>
22#include <QVBoxLayout>
23
24/**
25 * @brief Playlist editor dialog with tree nodes and ordered shader entries.
26 */
27class PlaylistDialog : public QDialog {
28 Q_OBJECT
29 public:
30 explicit PlaylistDialog(const QStringList &shaderNames, QWidget *parent = nullptr);
31
32 /// @brief Return whether playlist mode is enabled.
33 bool isPlaylistEnabled() const;
34 /// @brief Return flattened selection of shaders in current playlist.
35 QStringList getSelectedShaderNames() const;
36 /// @brief Return tree representation as node-name and shader-list pairs.
37 QList<QPair<QString, QStringList>> getPlaylistTree() const;
38 /// @brief Return current playlist file path.
39 QString getPlaylistFile() const;
40 /// @brief Return frames-per-shader threshold for autopilot mode (minimum 4).
41 int getAutopilotFrames() const;
42 /// @brief Return true when random autopilot timeout mode is enabled.
43 bool isAutopilotRandom() const;
44
45 void setEnabled(bool enabled);
46 void setSelectedShaderNames(const QStringList &names);
47 void setPlaylistTree(const QList<QPair<QString, QStringList>> &tree);
48 void setPlaylistFile(const QString &path);
49 /// @brief Set frames-per-shader threshold for autopilot mode.
50 void setAutopilotFrames(int frames);
51 /// @brief Enable or disable random autopilot timeout mode.
52 void setAutopilotRandom(bool enabled);
53 void updateShaderList(const QStringList &shaderNames);
54
55 public slots:
56 void addNode();
57 void renameNode();
58 void removeNode();
59 void addShader();
60 void removeShader();
61 void moveUp();
62 void moveDown();
63 void clearAll();
64 void shufflePlaylist();
65 void concatPlaylist();
66 void filterSearchChanged(const QString &text);
67 void savePlaylist();
68 void loadPlaylist();
69
70 private:
71 void setupUI();
72 void loadShaders(const QStringList &shaderNames);
73 QTreeWidgetItem *currentNodeItem() const;
74
75 QCheckBox *enableCheckBox;
76 QComboBox *shaderComboBox;
77 QLineEdit *searchLineEdit;
78 QTreeWidget *playlistTree;
79 QPushButton *addNodeButton;
80 QPushButton *renameNodeButton;
81 QPushButton *removeNodeButton;
82 QPushButton *addButton;
83 QPushButton *removeButton;
84 QPushButton *upButton;
85 QPushButton *downButton;
86 QPushButton *clearButton;
87 QPushButton *shuffleButton;
88 QPushButton *concatButton;
89 QPushButton *saveButton;
90 QPushButton *loadButton;
91 QPushButton *okButton;
92 QPushButton *cancelButton;
93
94 QSpinBox *autopilotFramesSpinBox = nullptr;
95 QCheckBox *autopilotRandomCheckBox = nullptr;
96
97 QStandardItemModel *shaderModel;
98 QSortFilterProxyModel *proxyModel;
99
100 QMap<QString, int> shaderNameToIndex;
101 QStringList shaderNamesList;
103};
104
105#endif
void loadShaders(const QStringList &shaderNames)
int getAutopilotFrames() const
Return frames-per-shader threshold for autopilot mode (minimum 4).
void setPlaylistTree(const QList< QPair< QString, QStringList > > &tree)
PlaylistDialog(const QStringList &shaderNames, QWidget *parent=nullptr)
QStringList getSelectedShaderNames() const
Return flattened selection of shaders in current playlist.
void setEnabled(bool enabled)
bool isPlaylistEnabled() const
Return whether playlist mode is enabled.
void setPlaylistFile(const QString &path)
QSortFilterProxyModel * proxyModel
void setSelectedShaderNames(const QStringList &names)
QString getPlaylistFile() const
Return current playlist file path.
void setAutopilotRandom(bool enabled)
Enable or disable random autopilot timeout mode.
QTreeWidgetItem * currentNodeItem() const
void updateShaderList(const QStringList &shaderNames)
bool isAutopilotRandom() const
Return true when random autopilot timeout mode is enabled.
QList< QPair< QString, QStringList > > getPlaylistTree() const
Return tree representation as node-name and shader-list pairs.
void filterSearchChanged(const QString &text)
void setAutopilotFrames(int frames)
Set frames-per-shader threshold for autopilot mode.
QMap< QString, int > shaderNameToIndex
QStandardItemModel * shaderModel