Commit Graph

38 Commits

Author SHA1 Message Date
mgrojo
05559d4727 Avoid inheriting the style sheet in child widgets
Avoid inheriting the style sheet in child widgets by naming the widget
type where it is set.

This had the effect, reported in issue #838, of setting an unwanted style
in child widgets, like the tool-tip of the "Load all data" button, the
tool-tip of the SQL results pane or the context menu of the search-bar
edit line.
2017-12-15 17:58:28 +01:00
mgrojo
c1f2306106 Remove no longer used method SqlExecutionArea::saveAsView()
It was moved to MainWindow for reuse and this copy was no longer used.
2017-11-30 22:44:16 +01:00
Martin Kleusberg
b1e42d08c6 Avoid some warnings 2017-11-29 22:22:05 +01:00
mgrojo
82665e3f09 Find/Replace dialog for SQL editors and logs
A classic Find/Replace dialog including all the options provided
by the QScintilla editor. Additionally a "Replace All" and a
Find All" button are implemented. This complements issue #191

New shortcut in main window for opening the find/replace dialog
connected to the focused widget. Standard for Replace is Ctrl+H.
Consequently the shortcut for Copy with Headers is changed to
Ctrl+Shift+C (see issue #1058).

For SQL text widgets not embedded in the main window, the standard
shortcut cannot be enabled, otherwise it conflicts with the main
window. Therefore the shortcut Ctrl+Shift+H is enabled for all the
SQL widgets as fallback. A better solution would be desirable.
2017-11-25 21:39:41 +01:00
Martin Kleusberg
8687bfa3c3 Also apply table view settings to the SQL result tables
Use the same font settings for the result table views in the Execute SQL
tabs as for the Browse Data table view.

See issue #1240.
2017-11-23 17:15:29 +01:00
mgrojo
87e1b9bc7c Usability improvements for Extended Table Widget and SQL
results pane

Copy for multi-line text data surrounds the text with the
<pre> tag in the HTML version for avoiding line white-space
adjustments in the pasted text. See #1058

Do not use binary data in the "Use as Filter" option.

Indicate the existence of an error in the background of the
SQL results frame. The error-indicators is reused for
disabling this functionality.

When nothing is shown, a placeholder text hints the
objective of the results pane.

The preference label for the font size of this pane is
modified for consistency (SQL Log is another widget).
2017-11-19 00:57:42 +01:00
mgr
e242fc84ee Search bar improvements
New button and key sequence (ESC) to close the search bar.

Clear selection (by not avoiding the search) when the text to search is
deleted, as expected by @pamtbaau at #1220.
2017-11-17 22:56:15 +01:00
mgr
23155a72d4 Fix bug in the incremental search and in find previous occurrence
Fixed the bug reported by @pamtbaau for the incremental search and the
bug noted by @MKleusberg for the find-previous, both described at #1220
2017-11-16 22:38:16 +01:00
mgr
5b6cdf231e Execute SQL tab: Add search bar for SQL code #191
The find operations in QScintilla are used for implementing a find frame
in the SQL Editor of the main window. A checkable tool button is added
in the SQL Editor toolbar for showing and hiding this frame.

There are check boxes for Whole Words, Case Sensitive and Regular
Expressions. The QScintilla facilities in the findFirst method are used
for the implementation.
2017-11-11 19:31:33 +01:00
Martin Kleusberg
3ae4267a8b Fix column widths in Execute SQL tab after multi-threading
This fixes the automatic column width adjustment in the Execute SQL tab
results view. This was broken by the introduction of multi-threaded
loading of the table data.
2017-10-15 11:39:55 +02:00
Martin Kleusberg
e9d4b3912a Move button for saving Execute SQL results to the toolbar
In the Execute SQL tab, move the button for saving the results of a
query as either a CSV file or a view from the bottom of the results view
to the toolbar at the top.

See issue #1122.
2017-09-10 15:00:31 +02:00
Martin Kleusberg
532fcd3f6b Add initial support for multiple database schemata
This adds initial basic support for handling different database schemata
at once to the backend code. This is still far from working properly but
shouldn't break much either - mostly because it's not really used yet in
the user interface code.
2017-09-03 13:22:21 +02:00
Martin Kleusberg
f1194d845e Rename all the settings accessor functions
Rename the settings accessor functions from Settings::getSettingsValue()
(and similar) to Settings::getValue() (and similar). The 'Settings' bit
seems a bit redundant and costs a lot of screen space.
2017-03-20 23:16:52 +01:00
Martin Kleusberg
f67817ee68 Simplify code for reloading settings
This simplifies the code for reloading the settings in the Execute SQL
area.

It might also fix a bug where setting a new font for the success/error
message at the bottom of each Execute SQL tab would be overwritten to
Monospace immediately after setting it.
2017-03-16 16:59:23 +01:00
Martin Kleusberg
e43dbddbd3 Remove unnecessary includes
Hopefully this reduces the compile time a little bit.
2017-01-20 22:37:59 +01:00
Martin Kleusberg
e5a79ec0fa Code refactoring
This changes the class structure in the sqlb namespace as well as the
DBBrowserObject class. The rest of the commit are changes that are
required by the modifications in sqlb and DBBrowserObject.

The idea behind this refactoring is this: we currently have the
DBBrowserObject class which holds some basic information about the
database object (name, type, SQL string, etc.). It also contains a
sqlb::Table and a sqlb::Index object. Those are used if the type of
the object is table or index and they contain a whole lot more
information on the object than the DBBrowserObject class, including the
name, the type, the SQL string, etc.

So we have a duplication here. There are two class structures for
storing the same information. This has historic reasons but other than
that there is no point in keeping it this way. With this commit I start
the work of consolidating the sqlb classes in order to get rid of the
DBBrowserObject class entirely.

This commit only starts this task, it doesn't finish it. This is why it
is a little messy here and there, but then again the old structure was a
little messy, too. We will need at least a very basic trigger and view
parser before finishing this is even possible. When this is done, I hope
the ode will be much easier to read and understand. But even in the
current state there already is some progress: we save a little bit of
memory, don't copy big objects all the time anymore, and replace a lot
of unnecessary string comparisons with integer comparisons.
2017-01-20 17:42:15 +01:00
Martin Kleusberg
d868f4c85d Make last database error message private
It's not supposed to be edited by anyone else.
2017-01-16 15:52:37 +01:00
Vladislav Tronko
210916cfeb Use references instead of pointers where it's possible
In our case DDBrowserDB shares lifetime scope with MainWindow, so
there's no need to pass pointers back and forth.
2016-12-29 20:38:24 +02:00
Martin Kleusberg
8f77634a0a Fix escaping of Execute SQL results
Fix the HTML escaping of the success/error messages at the bottom of the
Execute SQL tab. This also simplifies the code a bit.

See issue #823.
2016-10-13 12:39:10 +02:00
Vladislav Tronko
3a06395f88 Divide PreferencesDialog in two classes
This forces PreferencesDialog to serve only for UI needs.
Plus, this opens the door for adding another class for shortcut
management without pain.
2016-09-03 22:30:55 +03:00
Martin Kleusberg
a1e08b37c9 Rename ExportCsvDialog to ExportData dialog
Sorry for the big change but I think it's preferable to not call it CSV
dialog when it's not just doing CSV.
2016-08-25 23:12:36 +02:00
Martin Kleusberg
f91773b291 Add basic JSON export feature
This adds some basic functionality for exporting JSON files by extending
the CSV export dialog. There is still a bit of work required for
fine-tuning the JSON export feature though. But a standard export of a
table s working well already.

See issue #688.
2016-08-25 01:04:12 +02:00
Lars Immisch
1192f450fd Allow viewing via the EditDialog for executed sql statements (#570)
* Allow viewing via the EditDialog for executed sql statements

Editing is disallowed, becuase we do not know which table the freeform
query operates on

* Fix whitespace

* Don't crash when changing to 'Execute SQL' tab when no database selected

* Add double click action

* A small usability improvement and indentation changes suggested by @MKleusberg
2016-04-26 00:16:30 +02:00
Martin Kleusberg
631979c330 Improve escpaing support
When generating SQL statements properly escape all identifiers, even
those containing backticks which apparently are allowed inside
identifiers in SQLite.

See issue #387.
2015-08-17 00:17:48 +02:00
Martin Kleusberg
c235379523 Add option for horizontal tiling between code editor and result view
Add a new option to the Preferences Dialog which activates horizontal
tiling between the SQL code editor and the result view in the Execute
SQL tab, i.e. the two widgets are shown side by side instead of one over
the other.

See issue #380.
2015-07-08 21:48:14 +02:00
Martin Kleusberg
2715d75f01 Add option for setting SQL editor font
See issue #299.
2015-05-06 19:54:02 +02:00
Martin Kleusberg
cde2393539 Use QScintilla instead of own implementation of a code editor
This is a first rough implementation of QScintilla support as SQL text
editor.

It should work mostly and build fine with qmake as well as cmake. The
new code supports all the features of the old one plus adding a few
subtle improvements. The main point of this, however, is reducing the
code we have to maintain and making it easier to add new features to the
editor.
2015-04-23 19:51:54 +02:00
Martin Kleusberg
f257f9248e Move syntax highlighter objects to SqlTextEdit class
Any SqlTextEdit object has its SQL syntax highlighter anyway, so it
makes sense to move the syntax highlighter object inside the text edit
class instead of maintining somewhere else. This hopefully makes the
code a bit easier to maintain.
2014-11-09 12:20:02 +01:00
Martin Kleusberg
a0f22a1ddb SqlExecutionArea: Use log font size for execution result
Use the same configurable font size as for the SQL log pane for the
result view of the SQL execution area tabs in the main window.

See issue #131.
2014-10-15 18:46:20 +02:00
Martin Kleusberg
a3affde782 Make sure columns in the Execute SQL area don't get too big by default
When running a SQL statement the column widths of the result table view
are set to fit their contents automatically. However, for very long
values this makes the table hard to navigate. This is why this commit
introduces a maximum column width while still trying to fit each column
to its contents.

See issue #79, point 2.
2014-08-22 14:27:54 +02:00
Martin Kleusberg
35c571ba7b SqlExecutionArea: Replace UTF8 paragraph separator by newline char
When the user selects multiple lines of SQL code and hits F5 to execute
them the execution stops after the first line because we use the
selectedText() method of the QTextCursor class to get the selected text
and this method returns Unicode U+2029 paragraph separator characters
instead of newline \n characters.
(see http://qt-project.org/doc/qt-4.8/qtextcursor.html#selectedText)
Fix this by replacing these by regular newline characters to.
2014-02-10 13:56:22 +01:00
Peinthor Rene
1bac11348f include cleanup 2013-09-19 22:55:35 +02:00
Martin Kleusberg
606b5bd953 SqlExecutionArea: Show status messages in text edit instead of label 2013-05-17 14:35:20 +02:00
Martin Kleusberg
ef5f88cc70 SqlExecutionArea: Implement save as view function
Add a menu item to allow saving the results of a query a new view.
2013-05-06 18:59:46 +02:00
Martin Kleusberg
9536e7a095 SqlExecutionArea: Support exporting result to CSV file
Add a button which allows the user to save the query results to a CSV
file.

Add some basic preparations for saving the result as a view.
2013-05-06 18:44:58 +02:00
Martin Kleusberg
e548becda1 SqlExecutionArea: Use Qt Designer for layout design 2013-05-06 18:17:59 +02:00
Martin Kleusberg
16d533999d Make result table in SQL tab non-editable 2013-05-06 17:35:39 +02:00
Martin Kleusberg
23d929ec0e First version of multiple SQL scripts support in main window
Allow multiple SQL scripts in different tabs in the SQL tab of the main
window.

Auto completion support is still missing, the rest is working fine.
2013-05-02 21:15:23 +02:00