File indexing completed on 2022-11-22 14:07:13

0001 /*
0002     SPDX-FileCopyrightText: 2020 Jean-Baptiste Mardelle
0003     SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 
0006 #pragma once
0007 
0008 #include "ui_editsub_ui.h"
0009 
0010 #include "definitions.h"
0011 
0012 
0013 class SubtitleModel;
0014 class TimecodeDisplay;
0015 
0016 class ShiftEnterFilter : public QObject
0017 {
0018     Q_OBJECT
0019 public:
0020     ShiftEnterFilter(QObject *parent = nullptr);
0021 protected:
0022     bool eventFilter(QObject *obj, QEvent *event) override;
0023 signals:
0024     void triggerUpdate();
0025 };  
0026 
0027 
0028 /**
0029  * @class SubtitleEdit: Subtitle edit widget
0030  * @brief A dialog for editing markers and guides.
0031  * @author Jean-Baptiste Mardelle
0032  */
0033 class SubtitleEdit : public QWidget, public Ui::SubEdit_UI
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038     explicit SubtitleEdit(QWidget *parent = nullptr);
0039     void setModel(std::shared_ptr<SubtitleModel> model);
0040 
0041 public slots:
0042     void setActiveSubtitle(int id);
0043 
0044 private slots:
0045     void updateSubtitle();
0046     void goToPrevious();
0047     void goToNext();
0048     void updateStyle();
0049     void loadStyle(const QString &style);
0050 
0051 private:
0052     std::shared_ptr<SubtitleModel> m_model;
0053     int m_activeSub{-1};
0054     GenTime m_startPos;
0055     GenTime m_endPos;
0056 
0057 signals:
0058     void addSubtitle(const QString &);
0059     void cutSubtitle(int id, int cursorPos);
0060 };