File indexing completed on 2024-05-05 04:35:59
0001 /* 0002 SPDX-FileCopyrightText: 2013 Sven Brauch <svenbrauch@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #ifndef DOCFILEWIZARD_H 0008 #define DOCFILEWIZARD_H 0009 0010 #include <QWidget> 0011 #include <QDialog> 0012 #include <QLineEdit> 0013 #include <QTextEdit> 0014 #include <QFile> 0015 #include <KProcess> 0016 0017 class DocfileWizard : public QDialog 0018 { 0019 Q_OBJECT 0020 public: 0021 DocfileWizard(const QString& workingDirectory, QWidget* parent = nullptr); 0022 QString fileNameForModule(QString moduleName) const; 0023 void setModuleName(const QString& moduleName); 0024 // Returns the path the file was saved as when exiting the dialog, 0025 // or an empty string if the file was not saved. 0026 const QString wasSavedAs() const; 0027 0028 private: 0029 QLineEdit* interpreterField; 0030 QLineEdit* moduleField; 0031 QLineEdit* outputFilenameField; 0032 QTextEdit* statusField; 0033 QTextEdit* resultField; 0034 // used for deciding whether to auto-update the output filename text field 0035 QString previousModuleName; 0036 QProcess* worker; 0037 QFile outputFile; 0038 QString savedAs; 0039 const QString workingDirectory; 0040 0041 QPushButton* runButton; 0042 QPushButton* saveButton; 0043 0044 public slots: 0045 // Calls python to actually generate the docfile 0046 bool run(); 0047 void updateOutputFilename(const QString& newModuleName); 0048 void processScriptOutput(); 0049 void processFinished(int, QProcess::ExitStatus); 0050 void saveAndClose(); 0051 }; 0052 0053 #endif // DOCFILEWIZARD_H