CuteLogger
Fast and simple logging solution for Qt based applications
playlistdock.h
1 /*
2  * Copyright (c) 2012-2021 Meltytech, LLC
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef PLAYLISTDOCK_H
19 #define PLAYLISTDOCK_H
20 
21 #include <QDockWidget>
22 #include <QUndoCommand>
23 #include <QTimer>
24 #include "models/playlistmodel.h"
25 
26 namespace Ui {
27  class PlaylistDock;
28 }
29 
30 class QAbstractItemView;
31 class PlaylistIconView;
32 
33 class PlaylistDock : public QDockWidget
34 {
35  Q_OBJECT
36 
37 public:
38  explicit PlaylistDock(QWidget *parent = 0);
39  ~PlaylistDock();
40  PlaylistModel* model() {
41  return &m_model;
42  }
43  int position();
44  void replaceClipsWithHash(const QString& hash, Mlt::Producer& producer);
45 
46 signals:
47  void clipOpened(Mlt::Producer* producer, bool play = false);
48  void itemActivated(int start);
49  void showStatusMessage(QString);
50  void addAllTimeline(Mlt::Playlist*, bool skipProxy = false);
51 
52 public slots:
53  void incrementIndex();
54  void decrementIndex();
55  void setIndex(int row);
56  void moveClipUp();
57  void moveClipDown();
58  void on_actionOpen_triggered();
59  void on_actionInsertCut_triggered();
60  void on_actionAppendCut_triggered();
61  void on_actionUpdate_triggered();
62  void on_removeButton_clicked();
63  void setUpdateButtonEnabled(bool modified);
64  void onProducerOpened();
65  void onInChanged();
66  void onOutChanged();
67  void on_actionCopy_triggered();
68  void on_actionSelectAll_triggered();
69  void on_actionSelectNone_triggered();
70  void onProducerChanged(Mlt::Producer* producer);
71  void on_actionGoto_triggered();
72 
73 private slots:
74  void on_menuButton_clicked();
75 
76  void on_actionInsertBlank_triggered();
77 
78  void on_actionAppendBlank_triggered();
79 
80  void viewCustomContextMenuRequested(const QPoint &pos);
81 
82  void viewDoubleClicked(const QModelIndex &index);
83 
84  void on_actionRemoveAll_triggered();
85 
86  void on_actionSortByName_triggered();
87 
88  void on_actionSortByDate_triggered();
89 
90  void on_actionSetFileDate_triggered();
91 
92  void onPlaylistCreated();
93 
94  void onPlaylistLoaded();
95 
96  void onPlaylistModified();
97 
98  void onPlaylistCleared();
99 
100  void onPlaylistClosed();
101 
102  void onDropped(const QMimeData *data, int row);
103 
104  void onMoveClip(int from, int to);
105 
106  void onPlayerDragStarted();
107 
108  void on_addButton_clicked();
109 
110  void on_actionThumbnailsHidden_triggered(bool checked);
111 
112  void on_actionLeftAndRight_triggered(bool checked);
113 
114  void on_actionTopAndBottom_triggered(bool checked);
115 
116  void on_actionInOnlySmall_triggered(bool checked);
117 
118  void on_actionInOnlyLarge_triggered(bool checked);
119 
120  void on_actionAddToTimeline_triggered();
121 
122  void on_actionAddToSlideshow_triggered();
123 
124  void on_updateButton_clicked();
125 
126  void updateViewModeFromActions();
127 
128  void on_tilesButton_clicked();
129 
130  void on_iconsButton_clicked();
131 
132  void on_detailsButton_clicked();
133 
134  void onMovedToEnd();
135 
136  void onInTimerFired();
137 
138  void onOutTimerFired();
139 
140  void on_actionPlayAfterOpen_triggered(bool checked);
141 
142  void on_actionUpdateThumbnails_triggered();
143 
144  void onProducerModified();
145 
146  void on_addFilesButton_clicked();
147 
148 protected:
149  void keyPressEvent(QKeyEvent* event);
150  void keyReleaseEvent(QKeyEvent* event);
151 
152 private:
153  void setViewMode(PlaylistModel::ViewMode mode);
154  void resetPlaylistIndex();
155  void emitDataChanged(const QVector<int> &roles);
156  void setPlaylistIndex(Mlt::Producer* producer, int row);
157 
158  Ui::PlaylistDock *ui;
159  QAbstractItemView *m_view;
160  PlaylistIconView *m_iconsView;
161  PlaylistModel m_model;
162  int m_defaultRowHeight;
163  QTimer m_inChangedTimer;
164  QTimer m_outChangedTimer;
165 };
166 
167 #endif // PLAYLISTDOCK_H