CuteLogger
Fast and simple logging solution for Qt based applications
playlistdock.h
1 /*
2  * Copyright (c) 2012-2019 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 
69 private slots:
70  void on_menuButton_clicked();
71 
72  void on_actionInsertBlank_triggered();
73 
74  void on_actionAppendBlank_triggered();
75 
76  void viewCustomContextMenuRequested(const QPoint &pos);
77 
78  void viewDoubleClicked(const QModelIndex &index);
79 
80  void on_actionGoto_triggered();
81 
82  void on_actionRemoveAll_triggered();
83 
84  void on_actionSortByName_triggered();
85 
86  void on_actionSortByDate_triggered();
87 
88  void on_actionSetFileDate_triggered();
89 
90  void onPlaylistCreated();
91 
92  void onPlaylistLoaded();
93 
94  void onPlaylistModified();
95 
96  void onPlaylistCleared();
97 
98  void onPlaylistClosed();
99 
100  void onDropped(const QMimeData *data, int row);
101 
102  void onMoveClip(int from, int to);
103 
104  void onPlayerDragStarted();
105 
106  void on_addButton_clicked();
107 
108  void on_actionThumbnailsHidden_triggered(bool checked);
109 
110  void on_actionLeftAndRight_triggered(bool checked);
111 
112  void on_actionTopAndBottom_triggered(bool checked);
113 
114  void on_actionInOnlySmall_triggered(bool checked);
115 
116  void on_actionInOnlyLarge_triggered(bool checked);
117 
118  void on_actionAddToTimeline_triggered();
119 
120  void on_updateButton_clicked();
121 
122  void updateViewModeFromActions();
123 
124  void on_tilesButton_clicked();
125 
126  void on_iconsButton_clicked();
127 
128  void on_detailsButton_clicked();
129 
130  void onMovedToEnd();
131 
132  void onInTimerFired();
133 
134  void onOutTimerFired();
135 
136  void on_actionPlayAfterOpen_triggered(bool checked);
137 
138 protected:
139  void keyPressEvent(QKeyEvent* event);
140  void keyReleaseEvent(QKeyEvent* event);
141 
142 private:
143  void setViewMode(PlaylistModel::ViewMode mode);
144 
145  Ui::PlaylistDock *ui;
146  QAbstractItemView *m_view;
147  QAbstractItemView *m_iconsView;
148  PlaylistModel m_model;
149  int m_defaultRowHeight;
150  QTimer m_inChangedTimer;
151  QTimer m_outChangedTimer;
152 };
153 
154 #endif // PLAYLISTDOCK_H