File indexing completed on 2024-04-28 05:48:20
0001 #pragma once 0002 0003 #include <KTextEditor/Document> 0004 #include <KTextEditor/View> 0005 #include <QPointer> 0006 0007 class CEPluginView; 0008 class AsmView; 0009 class AsmViewModel; 0010 0011 class CEWidget : public QWidget 0012 { 0013 Q_OBJECT 0014 public: 0015 explicit CEWidget(CEPluginView *pluginView, KTextEditor::MainWindow *mainWindow); 0016 ~CEWidget() override; 0017 0018 Q_INVOKABLE bool shouldClose(); 0019 0020 protected: 0021 bool eventFilter(QObject *o, QEvent *e) override; 0022 0023 private: 0024 void createTopBar(class QVBoxLayout *mainLayout); 0025 void createMainViews(class QVBoxLayout *mainLayout); 0026 void setAvailableLanguages(const QByteArray &data); 0027 void setAvailableCompilers(const QByteArray &data); 0028 void repopulateCompilersCombo(const QString &lang); 0029 void initOptionsComboBox(); 0030 bool compilationFailed(const QJsonObject &obj); 0031 void processAndShowAsm(const QByteArray &data); 0032 void doCompile(); 0033 QString currentCompiler() const; 0034 void addExtraActionstoTextEditor(); 0035 void warnIfBadArgs(const QStringList &args); 0036 void sendMessage(const QString &plainText, bool warn); 0037 0038 void removeViewAsActiveXMLGuiClient(); 0039 0040 CEPluginView *m_pluginView = nullptr; 0041 0042 /// The document that we are working with 0043 QPointer<KTextEditor::Document> doc = nullptr; 0044 0045 KTextEditor::MainWindow *const m_mainWindow = nullptr; 0046 class QPointer<KTextEditor::View> m_textEditor = nullptr; 0047 class AsmView *m_asmView = nullptr; 0048 class AsmViewModel *m_model = nullptr; 0049 class QLineEdit *m_lineEdit = nullptr; 0050 class QComboBox *m_languagesCombo = nullptr; 0051 class QComboBox *m_compilerCombo = nullptr; 0052 class QToolButton *m_optsCombo = nullptr; 0053 class QPushButton *m_compileButton = nullptr; 0054 0055 struct Compiler { 0056 QString name; 0057 QVariant id; 0058 }; 0059 using CompilerLangPair = std::pair<QString, Compiler>; 0060 std::vector<CompilerLangPair> m_langToCompiler; 0061 0062 std::vector<CompilerLangPair> compilersForLanguage(const QString &lang) const; 0063 0064 Q_SIGNALS: 0065 void lineHovered(int line); 0066 };