Elaztek Developer Hub
Blamite Game Engine - Keystone  00402.09.29.23.0627.blamite
A library that enables the use of Qt in Blamite's editing tools.
CodeEditorDialog.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <QDialog>
4 #include "ui_CodeEditorDialog.h"
5 
6 #include <Strings/components/classes/map/map.h>
7 #include <HEKGuerilla/components/tags/fields/fields.h>
8 
10 
16 class CodeEditorDialog : public QDialog
17 {
18  Q_OBJECT
19 private:
20  Ui::CodeEditorDialog ui;
21 
22  bool cancelled = true;
23  std::string text = "";
24  QSourceHighlite::QSourceHighliter* highlighter = nullptr;
25 
29  BlamDatarefValueHintType current_value_hint = BlamDatarefValueHintType::NONE;
30 
36  BlamMap<std::string, QSourceHighlite::QSourceHighliter::Language> language_map =
37  BlamMap<std::string, QSourceHighlite::QSourceHighliter::Language>();
38 
46  BlamMap<BlamDatarefValueHintType, QSourceHighlite::QSourceHighliter::Language> value_hint_language_map =
47  BlamMap<BlamDatarefValueHintType, QSourceHighlite::QSourceHighliter::Language>();
48 
49 public:
56  CodeEditorDialog(std::string contents = "", QWidget* parent = Q_NULLPTR);
58 
65 
72  void SetLanguage(std::string language_name);
73 
81  std::string GetText();
82 
88  bool IsCancelled();
89 
90  BlamDatarefValueHintType GetDatarefValueHintType();
91 
92 private slots:
93 
97  void CancelButtonClicked();
98 
102  void SaveButtonClicked();
103 
109  void LanguageDropdownChanged(int index);
110 };
CodeEditorDialog.h
QSourceHighlite::QSourceHighliter
Definition: qsourcehighliter.h:35
CodeEditorDialog::SetLanguage
void SetLanguage(QSourceHighlite::QSourceHighliter::Language language)
Sets the language used for syntax highlighting.
Definition: CodeEditorDialog.cpp:82
QSourceHighlite::QSourceHighliter::Language
Language
When adding a language make sure that its value is a multiple of 2 This is because we use the next nu...
Definition: qsourcehighliter.h:56
CodeEditorDialog::GetDatarefValueHintType
BlamDatarefValueHintType GetDatarefValueHintType()
Definition: CodeEditorDialog.cpp:107
qsourcehighliter.h
CodeEditorDialog::~CodeEditorDialog
~CodeEditorDialog()
Definition: CodeEditorDialog.cpp:77
QSourceHighlite::QSourceHighliter::setCurrentLanguage
void setCurrentLanguage(Language language)
Definition: qsourcehighliter.cpp:86
CodeEditorDialog
A dialog used for general-purpose text and code editing.
Definition: CodeEditorDialog.h:16
CodeEditorDialog::IsCancelled
bool IsCancelled()
Checks if the dialog was cancelled.
Definition: CodeEditorDialog.cpp:102
CodeEditorDialog::GetText
std::string GetText()
Retrieves the updated text.
Definition: CodeEditorDialog.cpp:97
CodeEditorDialog::CodeEditorDialog
CodeEditorDialog(std::string contents="", QWidget *parent=Q_NULLPTR)
Initializes a new code editor dialog.
Definition: CodeEditorDialog.cpp:7