Commit Graph

24 Commits

Author SHA1 Message Date
mgrojo
2a830e5a3a Update QDarkStyleSheet to v3.0.rc and add new light style
Thanks to a new light style provided by QDarkStyleSheet in v3.0.rc
(9eea545) we can add a new light style option.

`qdarkstyle/dark/style.qrc` had to be renamed to
`qdarkstyle/dark/darkstyle.qrc` and `qdarkstyle/light/style.qrc` to
`qdarkstyle/light/lightstyle.qrc` in order to include both as resources.

See issues:
- https://github.com/ColinDuquesnoy/QDarkStyleSheet/issues/240
- https://github.com/ColinDuquesnoy/QDarkStyleSheet/issues/273
- #2558
2021-03-30 23:54:55 +02:00
Martin Kleusberg
329c07e0b2 Fix a ton of warnings from clang, clazy, cppcheck, etc. 2021-01-22 14:38:35 +01:00
mgrojo
0562f16dfa New settings for changing the selection appearance in editors
Default values follow desktop style as before.

See issue #2320.
2020-07-04 20:50:51 +02:00
mgrojo
662dbcf900 New setting for configuring brace matching background
This allows modifying this background colour and provides a better
default, which does not make the cursor invisible (in dark mode) and it
is itself visible outside of the current line (in light mode).

See issues #2203 and #2320
2020-07-04 17:08:01 +02:00
Martin Kleusberg
ba1270cedb Clean up the code and make some more minor optimisations
This also includes replacing some more Qt containers by their STL
counterparts.
2019-11-06 20:25:18 +01:00
mgrojo
bef856ef45 Fixes some problems reported by Coverity
- Unchecked dynamic_cast
- Uninitialized scalar field
- Uninitialized pointer field
- Big parameter passed by value
2019-08-02 17:19:28 +02:00
mgrojo
48a8481b85 Allow using extended regular expressions in the find dialogs
This adds support for searching "this|that" to find either "this" or "that"
or using quantifiers like "{number}". The change applies to the
Find/Replace dialog and the search bar.

See https://en.cppreference.com/w/cpp/regex/ecmascript for details of the
syntax.

This raises the requirement for an external version of QScintilla to v2.11.

See issue #1625
2019-07-26 19:47:02 +02:00
Martin Kleusberg
b803e3c49f Use more STL containers instead of Qt containers 2019-05-02 17:02:59 +02:00
Martin Kleusberg
f821fbb1a8 Silence a couple of warnings 2019-04-29 19:14:10 +02:00
mgrojo
5ca95a57bc Find dialog based on the Find/Replace dialog for the Scintilla widgets
A new find dialog, bound to Ctrl+F, has been added to all the Scintilla
editors. The dialog is basically the Find/Replace dialog, whose replace
related controls have been set to invisible.

This shortcut and the new menu contextual entry are disabled for the
Execute SQL editors, since there the shortcut is already assigned to the
search bar and it would also be redundant.

See issue #1746
2019-04-04 23:49:35 +02:00
mgrojo
29bfcc4922 Add option for word wrapping in Edit Database Cell
A new option, in the toolbar of the Edit Database Cell, is added for
setting word wrapping for the text editor modes. It is now independent of
the SQL preference. The configuration reading the editor/wrap_lines setting
is moved to the particular SQL editor class.

Added icon from the Silk icon set.

See issue #1796
2019-03-17 19:23:02 +01:00
mgrojo
45c1e2abfd Drop the QTextEdit widget in the Edit Database Cell dock
Use the QScintilla widget for all the text modes of the Edit Database Cell
dock. All the features are believed to be preserved.

- The plain text mode is materialised removing the lexer.

- Null values are indicated now in the margin instead of using a
placeholder. The same pattern is also used for the Image and BLOB data
cases when the editor is switched to a text mode. In the dark mode, the
line number margin matches now the style-sheet and instead of the
configurable editor colours.

- Read-only state in the editor is hinted by the caret not blinking, but
the text is still selectable by keyboard or mouse.

Features and fixes added by using this widget:

- Find/Replace dialog for the plain text editor. See issue #1746
- The QScintilla widget does not strip CR characters. See issue #1793
- Line numbers and visible caret line in the text mode.
2019-03-10 01:01:07 +01:00
mgrojo
cc67969d73 Update preference colours when the application style is changed
In order to have matching colours in all the preferences, the individual
colour settings in Data Browser and SQL tabs are reset to default values
matching the corresponding style setting (dark stylesheet or follow desktop,
which could be dark or light as always).

Additionally, several problems with colour settings in QScintilla have
been fixed:
- We don't use indentation guides
- both sets of lexer colour settings must be used, otherwise the result is
inconsistant and unpredictable:
    * lexer->setDefaultColor|Paper and lexer->setColor|Paper
2019-02-28 00:02:47 +01:00
Martin Kleusberg
042e925f9f Make ExtendedScintilla widget run without a lexer
When using an ExtendedScintilla widget without setting a lexer, the
application would easily crash. This is improved by this commit.
2019-02-21 14:19:47 +01:00
mgrojo
ea6cf146c7 Cmd+Backspace should delete from cursor to the beginning of line on macOS
See issue #815
2019-01-03 00:40:40 +01:00
mgrojo
fc7f2b9440 Align Mac shortcut in Scintilla to standard and Qt for Alt+Backspace
In Mac the standard shortcut for deleting word to the left is Alt+Backspace
so we set this key sequence in Scintilla editors as alternate for Mac.

Reference:

http://doc.qt.io/qt-5/qkeysequence.html
Section Standard Shortcuts:
DeleteStartOfWord	is Alt+Backspace in macOS column.

See issue #815
2019-01-02 21:37:26 +01:00
mgrojo
58f52f13cb Set the POSIX flag in Scintilla regex find
The POSIX flag is passed to QScintilla for stardardisation of the regex
implementation. This only changes the syntax for sub-expressions. Before
this change it was '\( \)'. With the POSIX flag it is simply '( )' for
sub-expressions, consequently \( and \( have to be used for matching
parenthesis.

Both the Qt implementation (used in filters and REGEXP operator) and the
C++11 standard (possibly used in the future for the editor, if QScintilla
add support) use the the new syntax for sub-expressions.

References:
https://en.cppreference.com/w/cpp/regex/syntax_option_type
>    If no grammar is chosen, ECMAScript is assumed to be selected.

https://en.cppreference.com/w/cpp/regex/ecmascript
>    The Atom ( Disjunction ) is marked subexpression

Qt also uses subexpressions in the POSIX style.
http://doc.qt.io/qt-5/qregexp.html#capturing-parentheses

See issue #1625
2018-11-25 18:43:27 +01:00
mgr
2e788d79bd Completion doesn't work until DB Structure is refreshed #1549
Apparently setLexer is needed for actually activating the QScintilla
completion after application start-up.
2018-09-30 21:13:52 +02:00
mgr
57f0175a1d Print preview dialog in all cases
Add print preview dialogs to all the cases where we have printable objects.
Remaining were table browsers and Scintilla editors.
2018-09-29 19:21:11 +02:00
mgr
60c229c1c4 Printing support: print dialog from QScintilla widgets
Add printing support for QScintilla widgets (SQL, JSON and XML). It can be
access through the contextual menu, shortcut (Ctrl+P) or (in the case of
the "Execute SQL" tab) from a button in the toolbar.

Ctrl+P was previously assigned to Plot Dock since
63c338c359 but, as it was foreseen in that
commit, it should be assign to print is ever supported. This change must
be mentioned in release notes.

First part of printing support. See issue #1525.
2018-09-16 16:06:27 +02:00
mgrojo
85dbe7b016 Setting for line wrap in Scintilla editors
A new setting is added to the 'SQL' tab of the Preferences dialog. It
enables the line wrapping in the editors with none/character/word/
whitespace boundaries.

See comments in issue #1173.
2018-03-28 22:26:07 +02:00
mgrojo
379bbb81a2 Support for dark themes in default settings and restore defaults button
All the colour configurations have been reviewed under an operating-system theme
dark theme.

Some hard-coded colours in QScintilla editors and Data Browser have been
replaced by queries of the system palette or reuse of our settings.

New settings for foreground and background colours for QScintilla editors
defaulting to system colours. This is mainly needed because if the user
saves colour settings for a dark theme and then he changes the system theme
back to a light theme, then the foreground colours are preserved while the
background would fall back to the system theme leading to an incompatible
combination. This also gives more freedom to the user in defining his own
colour combinations.

Since only the default colour settings adapt to the system theme, and once
settings are saved this can no longer happen, a 'Restore Defaults' button
is added so the default adapted colour settings can be restored. This is
also useful for restoring default behaviour when wanted.

Other fixes and improvements: waiting cursor while saving; check boxes in
SQL tab for bold, italic and underline when applicable; avoid translation
of hidden colour setting names used in code.

See related issue #1324.
2018-02-25 19:13:28 +01:00
mgrojo
a0e0fc98ae XML mode for the cell editor
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.
2017-12-23 22:19:17 +01:00
mgrojo
8896ecca40 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).
2017-12-16 00:09:47 +01:00