Refactoring and find/replace dialog in the JSON editor.

SQL and JSON text editor classes have been refactored. A new parent class
for both editors have been added for the common logic implementable without
depending on the specific lexer.

The only visible effect of this change should be that the JSON editor
(issue #1173) now has the same find/replace dialog as the SQL editor.

This prepares for the implementation of the XML editor (issue #1253).
This commit is contained in:
mgrojo
2017-12-16 00:09:47 +01:00
parent de260d32c5
commit 8896ecca40
10 changed files with 308 additions and 405 deletions

View File

@@ -1,7 +1,7 @@
#ifndef SQLTEXTEDIT_H
#define SQLTEXTEDIT_H
#include "Qsci/qsciscintilla.h"
#include "ExtendedScintilla.h"
class FindReplaceDialog;
class SqlUiLexer;
@@ -10,7 +10,7 @@ class SqlUiLexer;
* @brief The SqlTextEdit class
* This class is based on the QScintilla widget
*/
class SqlTextEdit : public QsciScintilla
class SqlTextEdit : public ExtendedScintilla
{
Q_OBJECT
@@ -18,30 +18,11 @@ public:
explicit SqlTextEdit(QWidget *parent = nullptr);
virtual ~SqlTextEdit();
bool findText(QString text, bool regexp, bool caseSensitive, bool words, bool wrap, bool forward);
void clearSelection();
static SqlUiLexer* sqlLexer;
public slots:
void reloadKeywords();
void reloadSettings();
void clearErrorIndicators();
void setErrorIndicator(int fromRow, int fromIndex, int toRow, int toIndex);
void openFindReplaceDialog();
protected:
void dropEvent(QDropEvent* e);
private:
void setupSyntaxHighlightingFormat(const QString& settings_name, int style);
int errorIndicatorNumber;
bool showErrorIndicators;
FindReplaceDialog* findReplaceDialog;
private slots:
void updateLineNumberAreaWidth();
void showContextMenu(const QPoint &pos);
};
#endif