CuteLogger
Fast and simple logging solution for Qt based applications
playlistdock.h
1/*
2 * Copyright (c) 2012-2024 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 void getSelectionRange(int *start, int *end);
49
50signals:
51 void clipOpened(Mlt::Producer *producer, bool play = false);
52 void itemActivated(int start);
53 void showStatusMessage(QString);
54 void addAllTimeline(Mlt::Playlist *, bool skipProxy = false, bool emptyTrack = false);
55 void producerOpened();
56 void selectionChanged();
57 void enableUpdate(bool);
58
59public slots:
60 void onOpenActionTriggered();
61 void onAppendCutActionTriggered();
62 void onProducerOpened();
63 void onInChanged();
64 void onOutChanged();
65 void onProducerChanged(Mlt::Producer *producer);
66 void onProducerModified();
67 void onPlayerDragStarted();
68 void onPlaylistModified();
69 void onPlaylistCreated();
70 void onPlaylistLoaded();
71 void onPlaylistCleared();
72
73private slots:
74
75 void viewCustomContextMenuRequested(const QPoint &pos);
76 void viewDoubleClicked(const QModelIndex &index);
77 void onDropped(const QMimeData *data, int row);
78 void onMoveClip(int from, int to);
79 void onMovedToEnd();
80 void onInTimerFired();
81 void onOutTimerFired();
82
83protected:
84 void keyPressEvent(QKeyEvent *event);
85 void keyReleaseEvent(QKeyEvent *event);
86
87private:
88 void setupActions();
89 void resetPlaylistIndex();
90 void emitDataChanged(const QVector<int> &roles);
91 void setPlaylistIndex(Mlt::Producer *producer, int row);
92 void updateViewMode();
93 void onAddFilesActionTriggered();
94 void onUpdateThumbnailsActionTriggered();
95 void onAddToTimelineActionTriggered();
96 void onAddToSlideshowActionTriggered();
97 void onSetFileDateActionTriggered();
98 void onRemoveAllActionTriggered();
99 void onGotoActionTriggered();
100 void onCopyActionTriggered();
101 void onSelectAllActionTriggered();
102 void onInsertCutActionTriggered();
103 void onUpdateActionTriggered();
104 void onRemoveActionTriggered();
105 void incrementIndex();
106 void decrementIndex();
107 void setIndex(int row);
108 void moveClipUp();
109 void moveClipDown();
110 void addFiles(int row, const QList<QUrl> &urls);
111
112 Ui::PlaylistDock *ui;
113 QAbstractItemView *m_view;
114 PlaylistIconView *m_iconsView;
115 PlaylistModel m_model;
116 QItemSelectionModel *m_selectionModel;
117 int m_defaultRowHeight;
118 QTimer m_inChangedTimer;
119 QTimer m_outChangedTimer;
120 QMenu *m_mainMenu;
121 bool m_blockResizeColumnsToContents;
122};
123
124#endif // PLAYLISTDOCK_H