mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-11 22:40:44 -05:00
a0e0fc98ae
The new editor mode shares the same Scintilla widget as the JSON mode. The JsonTextEdit class has been generalised. Future modes supported by Scintilla could be added with the current pattern. As a consequence, the EditMode is not always equal to the current stacked widget. Some code in EditDialog has been refactored, so it is easier to understand and modified with so many modes. textNullSet has been replaced by the use of dataType as Null. SVG is promoted to a new recognised data type, so it can be edited in the XML mode. The XML data is formatted and validated following the pattern established by the JSON mode. New modules are needed by the XML mode: the Qt XML module and some new Scintilla files required by the HTML/XML lexer. The indent_compact was incorrectly named in Setting::getDefaultValue. See issue #1253.
41 lines
754 B
C++
41 lines
754 B
C++
#ifndef DOCKTEXTEDIT_H
|
|
#define DOCKTEXTEDIT_H
|
|
|
|
#include "ExtendedScintilla.h"
|
|
#include <Qsci/qscilexerjson.h>
|
|
#include <Qsci/qscilexerxml.h>
|
|
|
|
/**
|
|
* @brief The DockTextEdit class
|
|
* This class is based on our Extended QScintilla widget
|
|
*/
|
|
class DockTextEdit : public ExtendedScintilla
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit DockTextEdit(QWidget *parent = nullptr);
|
|
virtual ~DockTextEdit();
|
|
|
|
// Enumeration of supported languages
|
|
enum Language
|
|
{
|
|
JSON,
|
|
XML
|
|
};
|
|
|
|
void setLanguage(Language lang);
|
|
Language language() { return m_language; };
|
|
|
|
public slots:
|
|
void reloadSettings();
|
|
|
|
protected:
|
|
static QsciLexerJSON* jsonLexer;
|
|
static QsciLexerXML* xmlLexer;
|
|
private:
|
|
Language m_language;
|
|
};
|
|
|
|
#endif
|