Commit Graph

2209 Commits

Author SHA1 Message Date
mgrojo
982a88b5e2 Avoid crash performing the correct check to know if the plot has graphs
This crash was introduced in 6d3228a0e3. It
happened when no previous settings were saved for the plot.

Additionally the plot interaction are set once for the plot widget.

This was reported at issue #838.
2017-12-14 23:38:33 +01:00
mgrojo
6d3228a0e3 Visual warning when plotting if not all data has been fetched
Warn user if not all data has been fetched and hint about the button for
loading all the data. The attention to this button is attracted changing
its background to a reddish colour and showing a warning in its tool-tip,
which is automatically shown for its default duration.

Default message is simplified and the button is only enabled when it is
useful (users of non-big databases would never be distracted about the
fetching mechanism).

Since this button is also useful for resetting the zoom and axis range,
it is also enabled if the user performs one of these interactions over the
plot.

See discussion at issue #838.
2017-12-13 23:05:56 +01:00
mgrojo
e34d36085d Copy plot to clipboard
New context menu and shortcut (context restricted to widget) for copying
the current plot to the clipboard as a pixmap.
2017-12-13 00:14:27 +01:00
mgrojo
d2200de4b0 Avoid warning in setPointSize when Preferences are opened
The warning was introduced in 387449b751
because the initial value in the UI is 0.

See issue #1263.
2017-12-12 00:17:19 +01:00
mgrojo
387449b751 Preview for the Data Browser font in Preferences
The 'Displayed text' boxes preview now the Data Browser font that the user
sets in the corresponding widgets.

See issue #1263
2017-12-12 00:08:22 +01:00
mgrojo
bfb607c4b7 Crash when running query with columns selected for plot
The model was still changing when the plot was being drawn. Now the plot
waits for the fetching to be finished.

See issue #1262
2017-12-11 23:57:25 +01:00
mgrojo
7ac93e34ed Allow user to set the BLOB text. Preview for field display in Preferences
A new setting allows the user to set the text for BLOB data in the cell.

The existing line-edit for setting the NULL text and the new one for BLOB
are updated with the cell background and foreground colors, providing a
preview of the desired changes. An additional preview-only box is added for
the regular fields.

See issue #1263

Settings in Database tab are left-aligned for consistency to other tabs.
See comment in #1173.
2017-12-11 22:00:03 +01:00
mgrojo
4a9f1a2a50 Avoid two calls to dittoRecord in 'Duplicate record' called from shortcut
This was mistakenly introduced in 7ed1b1db05

The unwanted effect was two new duplicate records inserted.

Additionally the shortcut is made self-documented for the user in the
corresponding context menu.
2017-12-11 00:48:55 +01:00
mgrojo
7ed1b1db05 Do not ignore error when inserting rows in 'Duplicate record'
That avoids overwriting existing record as reported in issue #1255.

This doesn't improve the underlying situation, that is inserting empty rows
before duplicating the content. But it is safer to not ignore the error in
the initial row insertion.
2017-12-10 15:34:05 +01:00
mgrojo
5807c0be6b Allow zooming and dragging only in one orientation
By selecting the axis or the labels associated to the axis,the user can
restrict the subsequent zoom or drag operation to that orientation.

The possible user interactions are documented in the Whats's This
information.

See issue #1258
2017-12-08 20:12:07 +01:00
mgrojo
232130bc60 Indent/Compact setting moved to Cell Editor
Removed the related check box in the Preferences Dialog. A new checkable
tool-button with icon from the Silk collection. When checked, the
indent-on-loading and compact-on-saving feature is enabled. When widget
is destroyed, the setting value is saved from this button state.

Currently it is only usable in the JSON mode, but could be reused in XML
and any other future modes.

See issue #1173.

Some tooltips in the Edit Dialog have been corrected, since it is not only
used for text.
2017-12-08 17:50:15 +01:00
mgrojo
a41394ad4a Fix copy in internal buffer
There was an omission of the last_row update in
968b8d55f0

That had an effect of converting all copied selections to one column.
2017-12-07 21:13:06 +01:00
mgrojo
2e881659a5 Fix crash and blocking condition while removing hidden columns at copy
It uses QMutableListIterator for removing while iterating and it can also
be made forwards, sot it is clearer.

This fixes #1256 in my environment.
2017-12-07 18:31:54 +01:00
Martin Kleusberg
409d02f9ea plot: Remove axis labels when there is no plot
See issue #950.
2017-12-07 16:14:15 +01:00
Martin Kleusberg
968b8d55f0 Fix possible crash when copying data into the internal copy-paste buffer
This fixes a crash which happens if you copy a range which contains at
least one cell of binary data and which has a hidden column in the
middle of it.
2017-12-07 14:08:46 +01:00
Martin Kleusberg
298d8c22c0 Fix NULL check in copy-paste code
Fix a bug introduced by commit ebd96c6a03.
Thanks for @mgrojo for pointing this out.
2017-12-07 13:38:36 +01:00
mgrojo
4a0f6f790d Valid HTML clipboard content
Copied HTML now passes validation from https://validator.w3.org/check

Thunderbird accepts now our HTML version of the copied data.

Added a meta generator key. See discussion in issue #1244
<meta name="generator" content="DB Browser for SQLite">
2017-12-06 23:04:40 +01:00
mgrojo
05149150a5 Disable 'Attach Database' when appropiate. Better 'Choose...' messages
Disable 'Attach Database' when no database is opened.
Added to the function that enables and disable actions depending on
database state. See issue #1254

Display more specific 'Choose a file...' messages in two places. See issue
#331.
2017-12-06 19:26:59 +01:00
mgrojo
a4728ff5f6 Fixed inconsistencies in new toolbar buttons
Restored menu entries for 'Open Project' and 'Save Project'. They were
accidentally removed in 8fbf44bffe

Set the status-tip to all the toolbar buttons for consistency. This
displays a message in the status bar when hovering over the toolbar button,
and (depending on platform), when the menu entry is the current. Set to the
the same text than the tool-tip following previous example.

Both tips for 'Close Database' were added.
2017-12-06 18:08:37 +01:00
mgrojo
678079a77a Cell editor fixes and improvements
Valid JSON is detected as a new first-class data type. See issue #1173.

Text data length is always calculated in characters and not in bytes (UTF-8
gives different results).

Text in read-only mode is also selectable by keyboard and the caret is
visible. See issue #1123
2017-12-06 00:01:09 +01:00
mgrojo
8fbf44bffe New toolbars, new action icons and toolbar style preference
Two new application toolbars: Extra DB (attach, close database) and Project
(Open, Save). Can be disabled and moved as usual.

Icons for Close Database and Attach Database actions, which lacked ones.

Different icon for the dock configuration, so they are visually
distinguishable from the toolbar configurations.

New preference for the toolbar style, with default value: text besides icon
as before. But in order for the style to change, the value in UI must be
ToolButtonIconOnly.

Needed new icons from famfamfam.com's Silk collection.

See related issue #331
2017-12-04 22:49:48 +01:00
Martin Kleusberg
5707b3139f Fix quoting of data copied to clipboard in one more occasion 2017-12-04 13:56:57 +01:00
Martin Kleusberg
a9e04080e9 Clean up the code for pasting clipboard contents
We have two different sources when pasting data into a table view: the
system clipboard and the internal copy-paste buffer. Both work slightly
different but most code is duplicated between them. This commit cleans
up the pasting code by merging the two code paths into a single one.
This does not only reduce the amount of duplicated code but also enables
some features for both sources that were only available for one of the
sources. This includes duplicating data by copying from a single cell to
multiple cells and the message box asking for confirmation when the
source and destination ranges do not match. These features were only
available for the system clipboard before and should now work for both
sources.
2017-12-04 13:26:08 +01:00
Martin Kleusberg
ebd96c6a03 Add helper function for escaping strings which are copied into clipboard
Introduce a helper function for escaping special characters and for
adding quotes when copying data into the system clipboard.
2017-12-04 13:03:56 +01:00
Martin Kleusberg
316860a709 Make sure to properly clear the system clipboard when copying data
When copying binary data or similar using the internal copy-paste buffer
we need to clear the system clipboard first in order to avoid confusion
between the two paste sources. Just calling clear() on the clipboard
doesn't seem to work on my system, so this commit manually sets the
clipboard text to a null string.
2017-12-04 12:55:29 +01:00
Martin Kleusberg
47b07490de Share internal copy-paste buffer between different table views
Use a shared internal copy-paste buffer for all table views in the
application instead of having one buffer per view. This is not only less
confusing because it more closely resembles the behaviour of the system
clipboard but it also allows copying BLOB data from a Execute SQL result
view to a Browse Data table.
2017-12-04 12:47:37 +01:00
Martin Kleusberg
9db70e0750 Don't paste NULL value when pasting from empty clipboard
When the clipboard is empty and trying to paste from it we would set the
selected field to NULL. This is fixed by this commit, so that nothing
happens.
2017-12-04 12:44:35 +01:00
Martin Kleusberg
b3a0c574e8 Don't treat trailing line break as NULL value when pasting from clipboard
When copying cells from a spreadsheet application an extra line break is
appended to the clipboard text. This commit adds some extra code to our
parser to remove this line break. Without this we would paste a single
NULL value into an additional line.

See issue #1244.
2017-12-04 12:38:25 +01:00
Martin Kleusberg
2b1004602f Don't copy data from hidden columns to clipboard
Copying data from hidden columns is not only confusing but does also
break some common use cases. This commit makes sure that we're not
copying any data from hidden columns. That means the only way to get the
old behaviour now is to unhide all columns, including the rowid column.

See issue #1094.
2017-12-04 12:10:22 +01:00
mgrojo
cef1e9020b Improve the user interactions over plot: zooming and range dragging.
The rectangle selection is no longer possible. Control+click can be used
for selecting a range of items.

This allows more freedom for performing customisations as requested in
issue "Change axis limits #838".

The "Load all data" button tool-tip and icon have been readjusted so they
hint the additional use pattern of resetting the plot to the original
zoom and range limits.

New and more appropriate icon for the "Save Plot" button. Icon from the
Silk set from famfamfam.com.
2017-12-02 17:41:41 +01:00
mgrojo
bbe460c349 Improvements in the new "Save filter as view" functionality
The query used in sqlitetablemodel does not rename the columns, instead
it applies the display formats in the WHERE part. In this way the saved
view has the original column names.

Changes in Button "Save filter as view": more information in tooltip and it
is disabled when no database is open.

See discussion in PR #1246
2017-12-02 16:09:55 +01:00
mgrojo
cc61e47279 Prevent crash with "Save SQL file as" when no SQL tab is open
The same check performed in MainWindow::saveSqlFile() is applied here.

See issue #1248
2017-12-02 14:57:00 +01:00
mgrojo
5a8d6bbf62 Avoid crash when starting without a database and activating the find frame
See issue #1248
2017-12-02 00:16:31 +01:00
mgrojo
aa2aa137f2 Quote only data with end-of-lines, tabs or double-quotes
Headers are also quoted if they contain end-of-lines or tabs.

See #1244
2017-12-01 23:58:06 +01:00
mgrojo
882fc8d3d3 Merge pull request #1246 from sqlitebrowser/save_filter_as_view
Save current filter, sort column and display formats as a new view
2017-12-01 21:51:47 +01:00
mgrojo
5da3d14ee3 Fixed issues from @MKleusber's review
New view name validated with isNull().

Text in information box reworded.

Column names are preserved in the new view, except for the ones with
display formats, for which an underline is appended in order to fix the
reported filtering defect.
2017-12-01 19:28:57 +01:00
Martin Kleusberg
e79c5db308 Manually set the keyboard shortcut for the Find/Replace dialog to Ctrl+H
Make sure the keyboard shortcut for the Find & Replace dialog is always
set to Ctrl+H instead of using Qt's QKeySequence::Replace. At least on
KDE desktops but probably on other systems too it break the Ctrl+R
shortcut which is used for refresh and SQL execution.
2017-12-01 13:52:02 +01:00
Martin Kleusberg
16263452c8 plot: Correctly restore Y axis check states
When restoring the plot state we always checked set the use-on-y-axis
checkbox when a colour was defined for a field. This is correct most of
the times because a field doesn't have a colour as long as it's not used
in the plot. However, when you uncheck a field it keeps its colour which
starts causing issues as soon these settings are reloaded.

The solution is to not only store the colour but also the check state
independently. This changes the project files format though, so the code
needs to support loading old and new file formats.

See issue #1245.
2017-12-01 13:03:48 +01:00
mgrojo
dcc0c32c39 Avoid adding an empty row in the clipboard data
This part from 3aef8adc9a is undone, because
it adds an empty row in the clipboard data. The whole loop can be rethought
later, if necessary.
2017-11-30 22:48:45 +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
mgrojo
e5f7456863 Save current filter, sort column and display formats as a new view
A new button is added to the Browse Data tab for saving the current display
of the table (current filter, sort column and display formats) as a new
view. This allows (specially for non advanced users) the creation of simple
views. It can be seen, either as a way of storing the current
filtering or as an easy way of creating views.

This reuses the query set in sqlitetablemodel, but the column aliases when
a display format is used has been changed from col%1 to the original column
names, i.e. format(`orig`) AS `orig`.
2017-11-30 20:41:21 +01:00
Martin Kleusberg
b1e42d08c6 Avoid some warnings 2017-11-29 22:22:05 +01:00
Martin Kleusberg
3aef8adc9a Clean up copy & paste code
Also add some TODO comments in preparation for #1244.
2017-11-29 22:17:22 +01:00
mgrojo
d486a9ff64 Error indicators in JSON mode editor
Improve the feedback to the user for invalid JSON data using error
indicators like the SQL editor.

Do not select all the text in the JSON mode, in order to see the
syntax highlighting while browsing.

Fix the logic in the case of not compacting/prettifying.

Change "Indent" to "Pretty print" in preferences for coherence to
JSON Export dialog (actually it is not only indentation).

Do not underline error style font, so it does not overlap with
error indicators.

See issue #1173
2017-11-27 22:10:10 +01:00
mgrojo
42d2feb99b Actually change the shortcut for Copy with Headers to Ctrl+Shift+C
The change in commit 82665e3f09 only
affected the label in the context menu.
2017-11-26 14:21:20 +01:00
mgrojo
c9bf5f87cb Find/Replace dialog improvements
Find/Replace dialog does not block the main window.

Dialog reused, so checks changed by user are preserved.

The selection of the last occurrence in Find All and Replace All
is cleared, so all the occurrences have the same appearance.
2017-11-26 01:19:33 +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
mgrojo
ce06845b36 Folding issues related to the Scintilla JSON lexer
Applied patch from:
https://sourceforge.net/p/scintilla/code/merge-requests/19/

See this thread for info:
https://groups.google.com/forum/#!topic/scintilla-interest/w4sW3sM6Cek

This is merged into Scintilla, so it might come fixed in a future
release.

This should solve the folding issue reported in #1173
2017-11-24 19:31:47 +01:00
mgrojo
189f19695a JSON validation before applying data to cell
A warning dialog is popped-up for confirming application of
invalid JSON data. Parse error is shown in the dialog.

*.json added to import filter.

See issue #1173
2017-11-24 00:27:48 +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