CuteLogger
Fast and simple logging solution for Qt based applications
playlistdock.h
1 /*
2  * Copyright (c) 2012-2020 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 
32 class PlaylistDock : public QDockWidget
33 {
34  Q_OBJECT
35 
36 public:
37  explicit PlaylistDock(QWidget *parent = 0);
38  ~PlaylistDock();
39  PlaylistModel* model() {
40  return &m_model;
41  }
42  int position();
43  void replaceClipsWithHash(const QString& hash, Mlt::Producer& producer);
44 
45 signals:
46  void clipOpened(Mlt::Producer* producer, bool play = false);
47  void itemActivated(int start);
48  void showStatusMessage(QString);
49  void addAllTimeline(Mlt::Playlist*, bool skipProxy = false);
50 
51 public slots:
52  void incrementIndex();
53  void decrementIndex();
54  void setIndex(int row);
55  void moveClipUp();
56  void moveClipDown();
57  void on_actionOpen_triggered();
58  void on_actionInsertCut_triggered();
59  void on_actionAppendCut_triggered();
60  void on_actionUpdate_triggered();
61  void on_removeButton_clicked();
62  void setUpdateButtonEnabled(bool modified);
63  void onProducerOpened();
64  void onInChanged();
65  void onOutChanged();
66  void on_actionCopy_triggered();
67  void on_actionSelectAll_triggered();
68  void on_actionSelectNone_triggered();
69  void onProducerChanged(Mlt::Producer* producer);
70 
71 private slots:
72  void on_menuButton_clicked();
73 
74  void on_actionInsertBlank_triggered();
75 
76  void on_actionAppendBlank_triggered();
77 
78  void viewCustomContextMenuRequested(const QPoint &pos);
79 
80  void viewDoubleClicked(const QModelIndex &index);
81 
82  void on_actionGoto_triggered();
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 protected:
147  void keyPressEvent(QKeyEvent* event);
148  void keyReleaseEvent(QKeyEvent* event);
149 
150 private:
151  void setViewMode(PlaylistModel::ViewMode mode);
152  void resetPlaylistIndex();
153  void emitDataChanged(const QVector<int> &roles);
154 
155  Ui::PlaylistDock *ui;
156  QAbstractItemView *m_view;
157  QAbstractItemView *m_iconsView;
158  PlaylistModel m_model;
159  int m_defaultRowHeight;
160  QTimer m_inChangedTimer;
161  QTimer m_outChangedTimer;
162 };
163 
164 #endif // PLAYLISTDOCK_H