File indexing completed on 2024-06-16 04:38:26

0001 /*
0002     SPDX-FileCopyrightText: 2007-2009 Sergio Pistone <sergio_pistone@yahoo.com.ar>
0003     SPDX-FileCopyrightText: 2010-2022 Mladen Milinkovic <max@smoothware.net>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef SCRIPTSMANAGER_H
0009 #define SCRIPTSMANAGER_H
0010 
0011 #include <QObject>
0012 #include <QMap>
0013 #include <QUrl>
0014 
0015 #include "ui_scriptsmanager.h"
0016 
0017 QT_FORWARD_DECLARE_CLASS(QAction)
0018 QT_FORWARD_DECLARE_CLASS(QDialog)
0019 QT_FORWARD_DECLARE_CLASS(QMenu)
0020 QT_FORWARD_DECLARE_CLASS(QPushButton)
0021 class TreeView;
0022 
0023 namespace SubtitleComposer {
0024 class SCScript;
0025 class Subtitle;
0026 
0027 class ScriptsManager : public QObject, private Ui::ScriptsManager
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     explicit ScriptsManager(QObject *parent = 0);
0033     virtual ~ScriptsManager();
0034 
0035     bool eventFilter(QObject *object, QEvent *event) override;
0036 
0037 public slots:
0038     void setSubtitle(Subtitle *subtitle = 0);
0039 
0040     void showDialog();
0041 
0042     void createScript(const QString &scriptName = QString());
0043     void addScript(const QUrl &srcScriptUrl = QUrl());
0044     void removeScript(const QString &scriptName = QString());
0045     void editScript(const QString &scriptName = QString());
0046     void runScript(const QString &scriptName = QString());
0047     void reloadScripts();
0048 
0049 private:
0050     static const QStringList & mimeTypes();
0051     QMenu * toolsMenu();
0052     const SCScript * currentScript() const;
0053     const SCScript * findScript(const QString filename) const;
0054 
0055     static void findAllFiles(QString path, QStringList &findAllFiles);
0056 
0057 private slots:
0058     void onToolsMenuActionTriggered(QAction *action);
0059 
0060 private:
0061     QDialog *m_dialog;
0062 };
0063 }
0064 #endif