| 1 | #pragma once |
| 2 | |
| 3 | // Qt |
| 4 | #include <QMainWindow> // Required for inheritance |
| 5 | #include <QString> |
| 6 | #include <QVector> |
| 7 | #include <QPair> |
| 8 | |
| 9 | class QVBoxLayout; |
| 10 | class QSyntaxStyle; |
| 11 | class QComboBox; |
| 12 | class QCheckBox; |
| 13 | class QSpinBox; |
| 14 | class QCompleter; |
| 15 | class QStyleSyntaxHighlighter; |
| 16 | class QCodeEditor; |
| 17 | |
| 18 | /** |
| 19 | * @brief Class, that describes demo main window. |
| 20 | */ |
| 21 | class MainWindow : public QMainWindow |
| 22 | { |
| 23 | Q_OBJECT |
| 24 | |
| 25 | public: |
| 26 | |
| 27 | /** |
| 28 | * @brief Constructor. |
| 29 | * @param parent Pointer to parent widget. |
| 30 | */ |
| 31 | explicit MainWindow(QWidget* parent=nullptr); |
| 32 | |
| 33 | private: |
| 34 | |
| 35 | void loadStyle(QString path); |
| 36 | |
| 37 | QString loadCode(QString path); |
| 38 | |
| 39 | void initData(); |
| 40 | |
| 41 | void createWidgets(); |
| 42 | |
| 43 | void setupWidgets(); |
| 44 | |
| 45 | void performConnections(); |
| 46 | |
| 47 | QVBoxLayout* m_setupLayout; |
| 48 | |
| 49 | QComboBox* m_codeSampleCombobox; |
| 50 | QComboBox* m_highlighterCombobox; |
| 51 | QComboBox* m_completerCombobox; |
| 52 | QComboBox* m_styleCombobox; |
| 53 | |
| 54 | QCheckBox* m_readOnlyCheckBox; |
| 55 | QCheckBox* m_wordWrapCheckBox; |
| 56 | QCheckBox* m_parenthesesEnabledCheckbox; |
| 57 | QCheckBox* m_tabReplaceEnabledCheckbox; |
| 58 | QSpinBox* m_tabReplaceNumberSpinbox; |
| 59 | QCheckBox* m_autoIndentationCheckbox; |
| 60 | |
| 61 | QCodeEditor* m_codeEditor; |
| 62 | |
| 63 | QVector<QPair<QString, QString>> m_codeSamples; |
| 64 | QVector<QPair<QString, QCompleter*>> m_completers; |
| 65 | QVector<QPair<QString, QStyleSyntaxHighlighter*>> m_highlighters; |
| 66 | QVector<QPair<QString, QSyntaxStyle*>> m_styles; |
| 67 | }; |
| 68 |