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
26namespace Ui {
27class PlaylistDock;
28}
29
30class QAbstractItemView;
31class QItemSelectionModel;
32class QMenu;
33class PlaylistIconView;
34
35class PlaylistDock : public QDockWidget
36{
37 Q_OBJECT
38
39public:
40 explicit PlaylistDock(QWidget *parent = 0);
41 ~PlaylistDock();
42 PlaylistModel *model()
43 {
44 return &m_model;
45 }
46 int position();
47 void replaceClipsWithHash(const QString &hash, Mlt::Producer &producer);
48
49signals:
50 void clipOpened(Mlt::Producer *producer, bool play = false);
51 void itemActivated(int start);
52 void showStatusMessage(QString);
53 void addAllTimeline(Mlt::Playlist *, bool skipProxy = false);
54 void producerOpened();
55 void selectionChanged();
56 void enableUpdate(bool);
57
58public slots:
59 void onOpenActionTriggered();
60 void onAppendCutActionTriggered();
61 void onProducerOpened();
62 void onInChanged();
63 void onOutChanged();
64 void onProducerChanged(Mlt::Producer *producer);
65 void onProducerModified();
66 void onPlayerDragStarted();
67 void onPlaylistModified();
68 void onPlaylistCreated();
69 void onPlaylistLoaded();
70 void onPlaylistCleared();
71
72private slots:
73
74 void viewCustomContextMenuRequested(const QPoint &pos);
75 void viewDoubleClicked(const QModelIndex &index);
76 void onDropped(const QMimeData *data, int row);
77 void onMoveClip(int from, int to);
78 void onMovedToEnd();
79 void onInTimerFired();
80 void onOutTimerFired();
81
82protected:
83 void keyPressEvent(QKeyEvent *event);
84 void keyReleaseEvent(QKeyEvent *event);
85
86private:
87 void setupActions();
88 void resetPlaylistIndex();
89 void emitDataChanged(const QVector<int> &roles);
90 void setPlaylistIndex(Mlt::Producer *producer, int row);
91 void updateViewMode();
92 void onAddFilesActionTriggered();
93 void onUpdateThumbnailsActionTriggered();
94 void onAddToTimelineActionTriggered();
95 void onAddToSlideshowActionTriggered();
96 void onSetFileDateActionTriggered();
97 void onRemoveAllActionTriggered();
98 void onGotoActionTriggered();
99 void onCopyActionTriggered();
100 void onSelectAllActionTriggered();
101 void onInsertCutActionTriggered();
102 void onUpdateActionTriggered();
103 void onRemoveActionTriggered();
104 void incrementIndex();
105 void decrementIndex();
106 void setIndex(int row);
107 void moveClipUp();
108 void moveClipDown();
109
110 Ui::PlaylistDock *ui;
111 QAbstractItemView *m_view;
112 PlaylistIconView *m_iconsView;
113 PlaylistModel m_model;
114 QItemSelectionModel *m_selectionModel;
115 int m_defaultRowHeight;
116 QTimer m_inChangedTimer;
117 QTimer m_outChangedTimer;
118 QMenu *m_mainMenu;
119 bool m_blockResizeColumnsToContents;
120};
121
122#endif // PLAYLISTDOCK_H