Commit Graph

1876 Commits

Author SHA1 Message Date
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 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
Martin Kleusberg 0d7ca9b5be Support pasting single value into multiple cells
This adds support for pasting a single value into all selected cells in
the Browse Data tab in order to mimic the behaviour of standard
spreadsheet application more closely.
2017-11-23 17:03:57 +01:00
mgrojo 67c5ed963e Compact and indent on JSON cell editor
New setting for enabling the following feature:
when JSON data is loaded in the JSON cell editor, the text is
indented. Before JSON data written back into the cell, the text
is compacted.

See issue #1173

Minor adjustment in preference label: removed ":" for consistency.
2017-11-23 00:39:17 +01:00
SourceTrigger 0a995423fa Source trigger patch file drop (#1236)
* Add Signal if File dropped

* Check if Index is valid

Send Signal and return if Index is invalid and File was dropped

* Connect Dropsignal to fileopen
2017-11-20 21:05:47 +01:00
Justin Clift 09e170f75d Fix typo in German translation. Thanks @weldwatcher :) 2017-11-20 15:58:25 +00:00
SourceTrigger de2131daea Improve 4k/5k resolution rendering speed on macOS/OSX (#1233)
Initialize OpenGL rendering on macOS by add a hidden QOpenGLWidget.
2017-11-20 14:44:37 +00:00
mgrojo b26948da14 Fix white over grey at invalid JSON in current line
The default style for invalid JSON or unclosed strings uses red
background and white foreground, but the current line has
precedence, so it is by default white over grey. We change the
default to something more readable for the current line at
invalid JSON. See issue #1173.
2017-11-19 21:20:33 +01:00
mgrojo 24a573dc68 Minor icon changes
New icons in resources from our icon set: Silk from
famfamfam.com

Icon for close. Applied to the find bar (see issue #191).

New icon for special copy. Applied to the "Copy with
Headers" option.

Removed the execution permission from some icon files.
2017-11-19 14:59:55 +01:00
mgrojo a457d29fe2 Fix one case for the error visual hint in the SQL results pane 2017-11-19 01:11:20 +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
mgrojo e60e9ffc75 Clipboard improvements: HTML and avoid pasting image from LibreCalc
Both "Copy" and "Copy with Headers" write in HTML and text format to the
system clipboard, when the selection includes more than one cell. This lets
the pasting application choose the most appropriate format.

Images have now no precedence over text when requesting the clipboard
content, so pasting from applications like LibreCalc, that set both formats
in the clipboard, works as expected, instead of pasting an image of the
copied text.

Copying and pasting inside the DB4S should not be affected, since the
application requests the text format and uses the internal buffer when
necessary (binary data included).

Related issue: #1058
2017-11-18 21:39:54 +01:00
Martin Kleusberg 28d53ef990 Fix qmake build
See issue #1231.
2017-11-18 18:24:21 +01:00
mgrojo 934ee7808a Added files to fix the build for JSON editor mode 2017-11-18 16:47:31 +01:00
mgrojo 3c910a9e59 JSON mode for cell editor
Support for JSON in the Database Cell editor using the QScintilla library.

The lexJSON lexer has been added to the compilation, including the
necessary files from the QScintilla source package.

See issue #1173
2017-11-18 16:28:38 +01:00
mgrojo ae55de4aee Merge branch 'json_cell_edit' 2017-11-18 15:00:15 +01:00
mgrojo c832d8a58c JSON mode for cell editor
Support for JSON in the Database Cell editor using the QScintilla library.

The lexJSON has been added to the compilation.

See issue #1173
2017-11-18 14:57:36 +01:00
Martin Kleusberg 73946400c3 Work around a bug in Qt which causes high pings for Wifi connections
See issue #1209.
2017-11-18 11:47:56 +01:00
Martin Kleusberg 514d5b703b Add "Date as dd/mm/yyyy" display format
Also reorganise the format functions to match the order of the dropbox
items.

See issue #1213.
2017-11-18 11:34:49 +01:00
Martin Kleusberg 2b68afb664 Rename function
Rename the DBBrowserDB::renameColumn() function to alterTable() because
it can do a lot more than just renaming a column.
2017-11-18 11:24:05 +01:00
Martin Kleusberg c502c2e819 Set default tab back to Database Structure
This was changed by accident (I think) in commit
9ce4b232ba.
2017-11-17 23:56:38 +01:00
Martin Kleusberg 5fbf5ca1b2 Change label of "Delete record" button to reflect number of records
Change the label of the "Delete record" button in the Browse Data tab to
"Delete records" when multiple records are selected.

See issue #856.
2017-11-17 23:46:13 +01:00
mgr ccc332c1bb Merge branch 'master' of https://github.com/sqlitebrowser/sqlitebrowser 2017-11-17 22:57:54 +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
Martin Kleusberg 3b511f83c3 Fix crash when exporting SQL files
Exporting SQL files crashed because of the multi-threaded loading of
data which also affects the SQL export. Because the table models were
destructed relatively quickly during the export's progress estimation,
their threads were still running and trying to access invalid data
structures.

See issue #1228.
2017-11-17 13:36:44 +01:00
Martin Kleusberg ccb1fd4ca8 Fix loading settings in Export SQL dialog
Due to a copy-paste error we weren't loading the values of the
checkboxes in the Export SQL dialog correctly.
2017-11-17 13:35:40 +01:00
Martin Kleusberg dd85634f81 Also emit loading finished signal when fetching an empty table set
When fetching data from an empty table or from an SQL query which
doesn't return any rows, we didn't emit the finishedFetch() signal which
is used to indicate that the fetching is completed. This is fixed by
this commit, so that the signal is always emitted no matter the number
of rows returned.

This fixes (probably besides other things) the current row numbers at
the bottom of the Browse Data tab when changing from a non-empty table
to an empty one.
2017-11-17 13:25:04 +01:00
Martin Kleusberg d0771cb4bd Fix possible crashes when using context menu in Browse Data tab
Deactivate all menu actions in the context menu in the Browse Data tab
if no database file is opened. Without a database the read-only actions
were still enabled and would lead to a crash.

See issue #1228.
2017-11-17 13:20:08 +01:00