CuteLogger
Fast and simple logging solution for Qt based applications
subtitlesdock.h
1/*
2 * Copyright (c) 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 SUBTITLESDOCK_H
19#define SUBTITLESDOCK_H
20
21#include "MltPlaylist.h"
22
23#include <QDockWidget>
24
25class SubtitlesModel;
26class SubtitlesSelectionModel;
27class QComboBox;
28class QItemSelection;
29class QLabel;
30class QLineEdit;
31class QTextEdit;
32class QToolButton;
33class QTreeView;
34
35class SubtitlesDock : public QDockWidget
36{
37 Q_OBJECT
38
39public:
40 explicit SubtitlesDock(QWidget *parent = 0);
41 ~SubtitlesDock();
42 void setModel(SubtitlesModel *model, SubtitlesSelectionModel *selectionModel);
43
44signals:
45 void seekRequested(int pos);
46 void addAllTimeline(Mlt::Playlist *, bool skipProxy, bool emptyTrack);
47 void createOrEditFilterOnOutput(Mlt::Filter *, const QStringList &key_properties);
48
49private slots:
50 void onPositionChanged(int position);
51 void onStartColumnToggled(bool checked);
52 void onEndColumnToggled(bool checked);
53 void onDurationColumnToggled(bool checked);
54
55protected:
56 void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
57
58private:
59 void setupActions();
60 void onCreateOrEditRequested();
61 void onAddRequested();
62 void onRemoveRequested();
63 void onSetStartRequested();
64 void onSetEndRequested();
65 void onMoveRequested();
66 void onTextEdited();
67 void onModelReset();
68 void updateActionAvailablity();
69 void addSubtitleTrack();
70 void removeSubtitleTrack();
71 void editSubtitleTrack();
72 void refreshTracksCombo();
73 void importSubtitles();
74 void exportSubtitles();
75 void onItemDoubleClicked(const QModelIndex &index);
76 void resizeTextWidgets();
77 void updateTextWidgets();
78 void setCurrentItem(int trackIndex, int itemIndex);
79 void refreshWidgets();
80 void selectItemForTime();
81 bool trackNameExists(const QString &name);
82 void ensureTrackExists();
83 void burnInOnTimeline();
84 void generateTextOnTimeline();
85
86 SubtitlesModel *m_model;
87 SubtitlesSelectionModel *m_selectionModel;
88 QLabel *m_addToTimelineLabel;
89 QComboBox *m_trackCombo;
90 QTreeView *m_treeView;
91 QTextEdit *m_text;
92 QTextEdit *m_prev;
93 QTextEdit *m_next;
94 QLabel *m_prevLabel;
95 QLabel *m_textLabel;
96 QLabel *m_nextLabel;
97 int m_pos;
98 bool m_textEditInProgress;
99};
100
101#endif // SUBTITLESDOCK_H