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 
44 signals:
45  void clipOpened(Mlt::Producer* producer, bool play = false);
46  void itemActivated(int start);
47  void showStatusMessage(QString);
48  void addAllTimeline(Mlt::Playlist*);
49 
50 public slots:
51  void incrementIndex();
52  void decrementIndex();
53  void setIndex(int row);
54  void moveClipUp();
55  void moveClipDown();
56  void on_actionOpen_triggered();
57  void on_actionInsertCut_triggered();
58  void on_actionAppendCut_triggered();
59  void on_actionUpdate_triggered();
60  void on_removeButton_clicked();
61  void setUpdateButtonEnabled(bool modified);
62  void onProducerOpened();
63  void onInChanged();
64  void onOutChanged();
65  void on_actionCopy_triggered();
66  void on_actionSelectAll_triggered();
67  void on_actionSelectNone_triggered();
68  void onProducerChanged(Mlt::Producer* producer);
69 
70 private slots:
71  void on_menuButton_clicked();
72 
73  void on_actionInsertBlank_triggered();
74 
75  void on_actionAppendBlank_triggered();
76 
77  void viewCustomContextMenuRequested(const QPoint &pos);
78 
79  void viewDoubleClicked(const QModelIndex &index);
80 
81  void on_actionGoto_triggered();
82 
83  void on_actionRemoveAll_triggered();
84 
85  void on_actionSortByName_triggered();
86 
87  void on_actionSortByDate_triggered();
88 
89  void on_actionSetFileDate_triggered();
90 
91  void onPlaylistCreated();
92 
93  void onPlaylistLoaded();
94 
95  void onPlaylistModified();
96 
97  void onPlaylistCleared();
98 
99  void onPlaylistClosed();
100 
101  void onDropped(const QMimeData *data, int row);
102 
103  void onMoveClip(int from, int to);
104 
105  void onPlayerDragStarted();
106 
107  void on_addButton_clicked();
108 
109  void on_actionThumbnailsHidden_triggered(bool checked);
110 
111  void on_actionLeftAndRight_triggered(bool checked);
112 
113  void on_actionTopAndBottom_triggered(bool checked);
114 
115  void on_actionInOnlySmall_triggered(bool checked);
116 
117  void on_actionInOnlyLarge_triggered(bool checked);
118 
119  void on_actionAddToTimeline_triggered();
120 
121  void on_updateButton_clicked();
122 
123  void updateViewModeFromActions();
124 
125  void on_tilesButton_clicked();
126 
127  void on_iconsButton_clicked();
128 
129  void on_detailsButton_clicked();
130 
131  void onMovedToEnd();
132 
133  void onInTimerFired();
134 
135  void onOutTimerFired();
136 
137  void on_actionPlayAfterOpen_triggered(bool checked);
138 
139  void on_actionUpdateThumbnails_triggered();
140 
141  void onProducerModified();
142 
143 protected:
144  void keyPressEvent(QKeyEvent* event);
145  void keyReleaseEvent(QKeyEvent* event);
146 
147 private:
148  void setViewMode(PlaylistModel::ViewMode mode);
149  void resetPlaylistIndex();
150  void emitDataChanged(const QVector<int> &roles);
151 
152  Ui::PlaylistDock *ui;
153  QAbstractItemView *m_view;
154  QAbstractItemView *m_iconsView;
155  PlaylistModel m_model;
156  int m_defaultRowHeight;
157  QTimer m_inChangedTimer;
158  QTimer m_outChangedTimer;
159 };
160 
161 #endif // PLAYLISTDOCK_H