API Documentation
Loading...
Searching...
No Matches
LanguageEditor.h
Go to the documentation of this file.
1#pragma once
2#include <NDEVR/Translator.h>
3#include <QWidget>
4#include <QSyntaxHighlighter>
5#include <QRegularExpression>
6namespace Ui
7{
8 class LanguageEditorUI;
9}
10class QPlainTextEdit;
11namespace NDEVR
12{
13 class LanguageHighlighter : public QSyntaxHighlighter
14 {
15 Q_OBJECT
16
17 public:
18 LanguageHighlighter(QTextDocument* parent = 0);
19 void setSearchString(const QString& search_string);
20 protected:
21 void highlightBlock(const QString& text) override;
22
23 private:
24 struct HighlightingRule
25 {
26 QRegularExpression pattern;
27 QTextCharFormat format;
28 };
29 QVector<HighlightingRule> m_highlighting_rules;
30 };
31 class LanguageEditor : public QWidget
32 {
33 public:
34 LanguageEditor(QWidget* parent = nullptr);
35 virtual ~LanguageEditor();
36
37 void setEditingTranslation(const Translator& translator);
38 void setReferenceTranslation(const Translator& translator);
39#if SUPPORTS_GOOGLE_TRANSLATE
40 QString googleTranslate(const QString& keyword, const QString& from, const QString& to) const;
41#endif
42 protected:
44 void updateUI();
47 bool canSave();
48 protected:
49 bool m_has_change = false;
50 Ui::LanguageEditorUI* ui;
54 };
55}
Definition LanguageEditor.h:32
void setReferenceTranslation(const Translator &translator)
Translator m_translator
Definition LanguageEditor.h:51
void setEditingTranslation(const Translator &translator)
Translator m_reference_translator
Definition LanguageEditor.h:52
LanguageEditor(QWidget *parent=nullptr)
bool m_has_change
Definition LanguageEditor.h:49
Ui::LanguageEditorUI * ui
Definition LanguageEditor.h:50
Translator m_original_translator
Definition LanguageEditor.h:53
Definition LanguageEditor.h:14
void highlightBlock(const QString &text) override
void setSearchString(const QString &search_string)
LanguageHighlighter(QTextDocument *parent=0)
Contains logic for translating a string into a defined language.
Definition Translator.h:45
Definition ACIColor.h:37
Definition FontEditor.h:6