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
48private slots:
49 void onPositionChanged(int position);
50 void onStartColumnToggled(bool checked);
51 void onEndColumnToggled(bool checked);
52 void onDurationColumnToggled(bool checked);
53
54protected:
55 void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
56
57private:
58 void setupActions();
59 void onCreateOrEditRequested();
60 void onAddRequested();
61 void onRemoveRequested();
62 void onSetStartRequested();
63 void onSetEndRequested();
64 void onMoveRequested();
65 void onTextEdited();
66 void onModelReset();
67 void updateActionAvailablity();
68 void addSubtitleTrack();
69 void removeSubtitleTrack();
70 void editSubtitleTrack();
71 void refreshTracksCombo();
72 void importSubtitles();
73 void exportSubtitles();
74 void onItemDoubleClicked(const QModelIndex &index);
75 void resizeTextWidgets();
76 void updateTextWidgets();
77 void setCurrentItem(int trackIndex, int itemIndex);
78 void refreshWidgets();
79 void selectItemForTime();
80 bool trackNameExists(const QString &name);
81 void ensureTrackExists();
82 void generateTextOnTimeline();
83
84 SubtitlesModel *m_model;
85 SubtitlesSelectionModel *m_selectionModel;
86 QLabel *m_addToTimelineLabel;
87 QComboBox *m_trackCombo;
88 QTreeView *m_treeView;
89 QTextEdit *m_text;
90 QTextEdit *m_prev;
91 QTextEdit *m_next;
92 QLabel *m_prevLabel;
93 QLabel *m_textLabel;
94 QLabel *m_nextLabel;
95 int m_pos;
96 bool m_textEditInProgress;
97};
98
99#endif // SUBTITLESDOCK_H