Commit Graph

2531 Commits

Author SHA1 Message Date
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
8b94eabd9d Printing support #1525: shortcuts for the hex and text editors
Print shortcuts are added in the context of the text and hex editors of
the Edit Database Cell dock.
2018-09-30 01:01:56 +02:00
mgr
79983e25cf Printing support #1525: plot printing using preview dialog
Add shortcut and entry in context menu for printing a plot.
2018-09-29 23:54:51 +02:00
Karim ElDeeb
e771662e6c Add the missing printing plugin dll
See #760.
2018-09-29 21:18:51 +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
749e7ed78c Add "Hex dump files" as an export option when data source is hex editor
When the data source is the hex editor we are able to save whatever
data type as shown in the widget, so additionally to set the filters
according to the data type a "Hex dump files (*.txt)" filter option is
added.

If the user selects this option for saving, the hexadecimal dump of the
widget content is saved to the file. Note that the check must be performed
using the selected filter by the user and not the file ending, which would
be the same for text data exported as plain text.

The Null case is disregarded as it is useless for exporting.

See issues #1438 and #1485
2018-09-29 18:54:09 +02:00
mgr
f42b614084 A bit of polishing of the main window user-interface
Reorder the context menu of the table header and use separators for
coherent grouping: column actions, misc and encoding.

Set buttons invisible in the DB Structure toolbar when the object is
different to the supported ones. Disabling wasn't enough because the logic
for changing icon and text wasn't working well for fields and other items.

Separate Print from object actions in that same toolbar.

New icon for Project Save so it uses the same metaphor (floppy disk) as
other save actions.

Improved the look in the clear filters icon by editing it in gimp. It had
a glitch in the funnel base.
2018-09-29 17:28:12 +02:00
mgr
071f963fcc Better messages for a table edition when foreign-key check detect problems
The message when there are problems and the user has made changes and
accepted them must be different to the case when the user has cancelled
and any possible changes have been already reverted by the dialog.

In the first case the fault may be ours and we actually revert changes.
In the second case, we know for sure the problems were there before
editing the table. We warn user about it, since we already know.

The last error from the DB is inappropriate for both cases because it
hasn't been updated by the foreign-key check.

Also fixed the typo in a function identifier.

Room for improvement: maybe the check should be done before opening the
dialog, so we don't let the user edit the table until the issues have
been solved.

See issue #1547
2018-09-29 16:22:03 +02:00
Karim ElDeeb
f2fe2c921d Enable logging during installation for Windows
Sometimes the installation log is required to debug failed installs. This commit will make sure the MSI will automatically create a logging file every time it is used to install, repair, or remove the application.

See #1545.
2018-09-29 11:48:14 +02:00
Karim ElDeeb
b6d436db63 Merge branch 'master' of https://github.com/sqlitebrowser/sqlitebrowser 2018-09-28 23:26:43 +02:00
Karim ElDeeb
f683b344af Set Windows Installer to run elevated
See #1545.
2018-09-28 23:23:06 +02:00
Martin Kleusberg
c927d62eda Update translation sources 2018-09-28 23:13:44 +02:00
Martin Kleusberg
2dd1dce09f Use nullptr some more 2018-09-28 18:58:22 +02:00
Martin Kleusberg
072ae15af0 Never quote cells when copying them to clipboard in text mode
This commit make sure that we never quote cells or change their contents
when copying to the text clipboard. This way the data can't be parsed
anymore without being ambigious but for these purposes we have the
internal buffer and the HTML clipboard. This makes sure that for simple
text copies (mainly that should be single cells) the data is never
changed.

This commit also uses the normal copy code for single cells unless they
are image cells. This makes sure that copying a single cell also uses
the internal buffer which in turn avoids problems when copying and
pasting single cells with line breaks in them.

See issue #1244.
2018-09-28 18:53:03 +02:00
Martin Kleusberg
f4867e5c6d Remove unused code
Since we replaced the project file format by a pure XML representation
we don't need this function anymore.
2018-09-28 18:42:34 +02:00
Martin Kleusberg
549f44d108 Fix copying of single cless in Browse Data tab
This was broken in 4b34eb76b5.
2018-09-28 17:50:30 +02:00
Martin Kleusberg
3f8fc34394 tests: Remove broken test
SQLite doesn't even allow the statement we're checking for, so let's
remove it.
2018-09-28 17:25:39 +02:00
Martin Kleusberg
b4b933c158 Use edit role when querying values for completer in Browse Data tab
This makes sure the cell contents are not modified for display purposes
(e.g. by truncating them to a maximum display length).
2018-09-28 16:39:42 +02:00
mgrojo
88d1cbc29d Pop-up completion with distinct values
A QSortFilterProxyModel is used for filtering the values in the column so
only distinct values are accepted for the completion. With this change
the less intrusive pop-up completion can be used, displaying only unique
values in the completion menu.
2018-09-28 16:19:17 +02:00
mgrojo
04f27ccf4b Threshold in row count for disabling value completion
A setting is added for disabling the value completion when the row count
of the table is greater than the threshold.
2018-09-28 16:19:17 +02:00
mgrojo
e1101ae690 Completion of values based on previous entered values in the same column
Using the QCompleter class associated to the QLineEdit, an implementation
of a completion of values in the Extended Table Widget is straightforward.
2018-09-28 16:19:16 +02:00
Martin Kleusberg
517743ff3f grammar: Add window functions to parser
We don't do anything with the extended parser yet but I'm not even sure
the window functions can be used in CREATE TABLE or CREATE INDEX
statements anyway.
2018-09-28 16:11:11 +02:00
mgr
903e66485c Simplify the URL for a feature request
As suggested by @karim at #1497, the template in GitHub can be reused if
set as parameter. Then we can discard the long body parameter and have
a single definition of the Feature Request template text.
2018-09-27 23:43:30 +02:00
Martin Kleusberg
7e23214e61 Add auto completion for window function keywords and functions 2018-09-27 23:22:03 +02:00
Martin Kleusberg
78ae2c3e09 Fix ROWID keyword in auto completion
For some reason instead of using the ROWID keyword for auto completion
we we're only completing it to ROW.
2018-09-27 23:10:43 +02:00
Martin Kleusberg
320c71eed8 Save and load attached databases to/from the project file
We were already saving information on tables, etc. of attached
databases, so it only makes sense to save the path and name of the
databases as well.

See issue #1532.
2018-09-27 22:04:28 +02:00
Martin Kleusberg
07b1d7ba00 Fix memory leak when attaching a database 2018-09-27 21:41:40 +02:00
Martin Kleusberg
717ff075b5 Avoid some possible crashes
This adds some extra sanity checks in the code to avoid possible
crashes. The most likely way to trigger them is loading an outdated
project file which references tables that no longer exist.
2018-09-27 21:36:11 +02:00
mgr
54cf4cf140 Printing support #1525: add print preview dialog
This adds a print preview step before printing in the Database Structure
tab.

This is nice to have, but it also aims to work around the problem found in
Windows, reported at issue #760.
2018-09-27 21:06:59 +02:00
mgr
ab991c5755 Preferences > SQL: Avoid different heights due to having check boxes or not
The uniform row heights property is set so the rows without check boxes is
the same as the rows with them (the difference might only be observable
with some theme engines)
2018-09-27 21:06:59 +02:00
Martin Kleusberg
f9ac3aa711 Fix a possible endless loop on some platforms
See issue #1531.
2018-09-27 11:58:00 +02:00
Martin Kleusberg
7fb570d668 Add missing braces 2018-09-27 11:57:32 +02:00
Martin Kleusberg
2cc900a98e Simplify code 2018-09-26 15:54:42 +02:00
Martin Kleusberg
918248acaa Simplify code 2018-09-26 15:54:39 +02:00
mgr
4f0d3505ed Printing support #1525: print DB structure
New action and button for printing the database structure.

The data in the Database Structure tree widget is converted to HTML and set
in a document that can then be printed, opening the dialog as done for
other components.
2018-09-25 23:00:17 +02:00
mgr
97f9a18310 Mac version references incorrect shortcut in FK navigation (ammend) #1539
According the documentation, the default value is PortableText which is
only for writing configuration. NativeText has to be used for display to
user.

This amends 87310a62e6
2018-09-25 22:20:58 +02:00
mgr
87310a62e6 Mac version references incorrect shortcut in FK navigation #1539
Using QKeySequence(Qt::CTRL).toString() should be translated according to
OS, either to Ctrl+ or Command+.

Known problem: there are other tooltips referencing control key sequences
but they are in *.ui files and this method cannot be used.

Note: QKeySequence(Qt::CTRL + Qt::Key_Shift).toString() showed weird
output under Linux.
2018-09-24 22:48:09 +02:00
mgr
afd3026b69 Fix logic issues in name composition for drag & drop
Some combinations of options and dropped name weren't working as expected
with f33943f4cf

See related issue #1433
2018-09-23 19:01:15 +02:00
mgr
4b34eb76b5 Printing support #1525: print tables in Browse Data and Execute SQL tabs
Added contextual menu entry and keyboard shortcut for printing the browsed
table with headers. If a region is selected, print those cells data.
Otherwise, print the entire table.

The HTML conversion used for clipboard is reused. Borders are added for
better visual output.
2018-09-23 18:26:57 +02:00
mgr
99c53a436e Fix positioning issues with multibyte characters in SQL executions
QScintilla counts characters for the index inside a line and number of
bytes for the global positions. When we use index we have to use text
lengths (number of characters) and when we use global position, we have to
convert previously to byte arrays. Otherwise offsets are produced in
executions containing non US-ASCII characters (accented letters, most
symbols, etc).

The bug could lead to final statements not executed by the execute-all
action, more than one line executed by the execute line action and
incorrect line references in the log.
2018-09-22 17:49:45 +02:00
mgr
a5d6b5018b Fixes and improvement of NULL value handling in Edit DB Cell dock
Fix: NULL data are correctly indicated in the Cell Info footer when loading
data from the database. Previously, the automatic trigger of
editModeChanged when setting the text in the widget was causing the change
to Text data type. Now the modified flag of the widget is taken into
account.

Fix: NULL values could not be overwritten with empty strings, since the
old vs. new check was incorrectly returning false as the conversion to
string was discarding the NULL information.

Improvement: NULL values are visually indicated using the placeholder as
already done in the Add Record dialog. The italic style is applied to both
cases now for better indication and coherence to the browse data widget.

Known problem: when the cell is changed from a JSON cell to a NULL cell
and the automatic switch is on, the NULL information and visual indication
are still lost.
2018-09-21 23:19:48 +02:00
mgr
dd3417e1c4 Automatic switching of the editor mode according to data type #1537
A new checkable button and associated setting is added for automatically
switching the editor mode in the Edit Database Cell dock in accordance to
the loaded data. The switch is done after loading data from cell, after
importing new data to the cell and when checking the button.

If the button is unchecked the behaviour is as formerly.

Since XML is not currently detected, the mode only changes to XML when SVG
is supplied.

Default value is true, since the new behaviour is considered more useful
for the general case.
2018-09-21 20:48:16 +02:00
mgr
18f0ef60ba Enhancement #1435: pragmas invoked from Tools menu
Pragmas integrity_check, quick_check, foreign_key_check and optimize are
integrated in the Tools menu. The actions open a confirmation dialog
(with Help button that opens the corresponding reference page in
sqlite.org) and, after confirmation, opens a new SQL editor tab and runs
there the pragma, showing the possible results.

Sender in executeQuery is null in this case, so a check is added.

Added accelerator to Tools menu entry, which lacked one.
2018-09-16 18:54:25 +02:00
mgr
9ca387886b Fix XML filter for import in Edit Database Cell dock and more.
The XML branch in the import was incorrectly programmed. Now it sets the
appropriate selected filter.

The list of filters is initialised once and the selected filter is passed
to the dialog using the specific parameter.

Chopped the last space in the image formats list for better style.

Case insensitivity applied to the suffix check as done in other parts of
the code.

See issue #1535.
2018-09-16 17:12:33 +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
mgr
9daf2657fc Issue #1534: add schema name for qualified fields dropped from DB Schema
For the "Drag & Drop Qualified Names" option, the schema name for
attached databases is also added for field names dropped from the DB
Schema dock.
2018-09-15 20:27:08 +02:00
mgr
71f26cbc83 Allow exporting the textual representation of binary data
For binary data, the file save dialog allows to select text files. When
the user saves to a text file (*.txt) the visual representation of the
hex buffer is saved to the file (addresses, hexadecimal bytes and ASCII
view). In this dump, only US-ASCII seems to be considered printable, while
in screen, Latin-1 is also considered.

This was one of the enhancement suggestions in issue #1438.
2018-09-15 14:36:13 +02:00
mgr
6779ad8e7a Issue #1535: select appropriate file filter corresponding to "Mode"
This reorders the filters in the import file dialog of the Edit Cell dock
so the first entry is always in accordance to the currently selected mode.

This will also facilitate the translation of the filters, because the
translations can be reused and written without special syntax characters
(";;").

"%1 Image" is also used instead of a concatenation, because the word
order in translations will vary.
2018-09-15 13:28:22 +02:00
mgrojo
5b4dea9b7c Add "Feature Request..." entry and body templates in both types of issue
New entry under Help menu for requesting issues with the same template
used for a New Issue inside GitHub.

The "Bug Report..." entry has also been updated for adding the
corresponding template body.

Separators added in Help menu, since there are currently several different
options.

See related issue #1497
2018-09-10 22:17:02 +02:00
mgrojo
dfa599de44 Merge branch 'qualified_completion' 2018-09-10 21:03:29 +02:00