File indexing completed on 2024-04-28 11:20:50

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2009 Alexander Rieder <alexanderrieder@gmail.com>
0004 */
0005 
0006 #ifndef _SCRIPTEDITORWIDGET_H
0007 #define _SCRIPTEDITORWIDGET_H
0008 
0009 #include <KXmlGuiWindow>
0010 
0011 class QTemporaryFile;
0012 class QGridLayout;
0013 namespace KTextEditor
0014 {
0015     class View;
0016     class Document;
0017 }
0018 
0019 
0020 class ScriptEditorWidget : public KXmlGuiWindow
0021 {
0022   Q_OBJECT
0023   public:
0024     explicit ScriptEditorWidget( const QString& filter, const QString& highlightingMode, QWidget* parent = nullptr );
0025     ~ScriptEditorWidget() override;
0026     void open(const QUrl &url);
0027 
0028   Q_SIGNALS:
0029     void runScript(const QString& filename);
0030 
0031   private Q_SLOTS:
0032     void newScript();
0033     void open();
0034     void run();
0035     void updateCaption();
0036 
0037   protected:
0038     bool queryClose() override;
0039 
0040   private:
0041     QString m_filter;
0042     KTextEditor::View* m_editor;
0043     KTextEditor::Document* m_script;
0044     QTemporaryFile* m_tmpFile;
0045 };
0046 
0047 #endif /* _SCRIPTEDITORWIDGET_H */