1 #pragma once
2 
3 #include "common/common_pch.h"
4 
5 #include "mkvtoolnix-gui/main_window/tool_base.h"
6 #include "mkvtoolnix-gui/util/files_drag_drop_handler.h"
7 
8 class QDragEnterEvent;
9 class QDropEvent;
10 class QMenu;
11 
12 namespace mtx::gui::ChapterEditor {
13 
14 namespace Ui {
15 class Tool;
16 }
17 
18 class Tab;
19 
20 class Tool : public ToolBase {
21   Q_OBJECT
22 
23 protected:
24   // UI stuff:
25   std::unique_ptr<Ui::Tool> ui;
26   QMenu *m_chapterEditorMenu;
27   mtx::gui::Util::FilesDragDropHandler m_filesDDHandler;
28 
29 public:
30   explicit Tool(QWidget *parent, QMenu *chapterEditorMenu);
31   ~Tool();
32 
33   virtual void setupUi() override;
34   virtual void setupActions() override;
35   virtual std::pair<QString, QString> nextPreviousWindowActionTexts() const override;
36   virtual QVector<Tab *> tabs();
37 
38 public Q_SLOTS:
39   virtual void retranslateUi();
40   virtual void toolShown() override;
41   virtual void tabTitleChanged();
42   virtual void enableMenuActions();
43   virtual void newFile();
44   virtual void selectFileToOpen(bool append);
45   virtual void save();
46   virtual void saveAsXml();
47   virtual void saveToMatroska();
48   virtual void saveAllTabs();
49   virtual bool closeTab(int index);
50   virtual void closeCurrentTab();
51   virtual void closeSendingTab();
52   virtual bool closeAllTabs();
53   virtual void reload();
54   virtual void openFiles(QStringList const &fileNames);
55   virtual void openFilesFromCommandLine(QStringList const &fileNames);
56 
57   virtual void removeChaptersFromExistingMatroskaFile();
58 
59 protected:
60   virtual Tab *appendTab(Tab *tab);
61   virtual Tab *currentTab();
62   virtual void forEachTab(std::function<void(Tab &)> const &worker);
63 
64   virtual void openFile(QString const &fileName, bool append);
65   virtual void showChapterEditorsWidget();
66 
67   virtual void dragEnterEvent(QDragEnterEvent *event) override;
68   virtual void dropEvent(QDropEvent *event) override;
69 
70 public:
71   static QString chapterNameTemplateToolTip();
72 };
73 
74 }
75