Commit Graph

49 Commits

Author SHA1 Message Date
mgrojo
63aabb9601 Added toolbar for direct formatting of columns in Data Browser
The new toolbar is hidden by default and can be toggled using a button in
the main Data Browser toolbar. Margins and spacing have been updated to
improve appearance of the two toolbars.

These tool buttons apply the format to the columns which are contained in
the selection. This is done by updating or adding a new condition-less
format to the list of conditional formats of those columns.

New style icons from the Silk icon set. Changed existent ones for
coherence.

See issue #1976.
2019-09-29 12:33:34 +02:00
Martin Kleusberg
40aff11086 Use even less Qt containers 2019-05-03 15:04:15 +02:00
Martin Kleusberg
b803e3c49f Use more STL containers instead of Qt containers 2019-05-02 17:02:59 +02:00
Martin Kleusberg
189652d350 Remove some unnecessary includes 2019-04-29 20:54:26 +02:00
mgrojo
217563fd47 Dialog and foreground configuration for conditional formats
A new dialog for editing conditional formats that can be invoked from the
filter line editor or from the data browser contextual menus. The dialog
allows adding and removing conditional formats, changing the priority order
and editing foreground colour, background colour and filter condition.

The conditional formats have been expanded to allow defining the foreground
colour. By default is the setting configured by user.

This is a continuation of the functionality introduced in PR #1503.
2019-03-23 22:14:18 +01:00
Martin Kleusberg
f3a54e4c71 Add support for sorting by multiple columns in the Browse Data tab
This allows sorting by multiple columns (as in ORDER BY Field1, Field2)
by holding the Control key while clicking on another column header in
the Browse Data tab.

See issue #1761.
2019-03-01 11:32:38 +01:00
mgrojo
e22966ec23 Fix override warning in selectAll
This change fixes a cmpile warning on Mac OS: (10.12.6) + Clang

warning: 'selectAll' overrides a member function but is not marked
'override'

Fixes #1718
2019-01-24 23:20:20 +01:00
mgr
f2ff1472a8 Load all data when select all is requested
selectAll is overridden so all data is actually selected. Warn and ask user
as this may take some time and consume lots of memory (when the table is
big).

See issue #1373
2018-12-15 18:09:13 +01:00
mgrojo
c923cc29b5 Regexp filters
This adds support for the REGEXP operator using the syntax /regexp/ in the
filter line boxes.

A new helper option for a not-containing filter is added using this new
syntax. This could be simplified using a NOT LIKE filter, but we don't
currently support that.

The "Use in Filter Expression > Containing" option escapes a possible
slash in the beginning, so it is not interpreted as a regexp filter.

See issue #1522
2018-11-08 23:00:30 +01:00
Martin Kleusberg
fb1eba1391 Remove some virtuals and add some overrides
In our case this is more a question of code style.
2018-10-09 20:28:22 +02:00
mgr
8b656cdeaa Printing support #1525: add print button to Data Browse tab
For consistency for the other application tabs, a print button is added
to the Data Browse Tab for printing the currently browsed table or
selection of cells.
2018-10-01 23:07:17 +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
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
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
mgrojo
60195c78ed New shortcut key for copying cell value from above
Ctrl+' is used by spreadsheets for copying formula/value from the cell
above.

Our shortcut copies the value inside the inline editor when it is text.
That mimics the behaviour of LibreOffice Calc. For binary data that cannot
be edited inline, the BLOB is just copied from the above cell to the
current one.

See discussion in PR #1516.
2018-09-02 22:05:12 +02:00
mgrojo
bbe2e33ea4 Issue #1463: give assistance to users in using the filters
Added contextual menus in filter line box and cells for assisting in using
filters and for discovering existing filters.

The menu in the filter line adds "What's This" option and helper options
that add the operator and a selected placeholder (?) for easy editing.
Special options for NULL and empty strings are also added. Those work
directly.

The menu in the cells works as the current "Use as Filter" but for
different operators. In this case, only the range operator is incomplete.

Currently, not all the operators make sense for strings because we take
them as LIKE filters. At least the Not Equal filter (<>) should work, but
the other would also make sense. This will be addressed in future commits.
2018-07-08 14:29:52 +02:00
Giuseppe Zizza
18be12e9e9 [CHG] Removed unnecessary duplicated functions 2018-06-08 15:26:08 +02:00
Giuseppe Zizza
4c211ed95a [NEW] Aggiunta possibilita` di copiare le righe della tabella in SQL per facilitarne l'import 2018-06-08 14:43:48 +02:00
Martin Kleusberg
4ab2bee2ac When selecting an entire row and deleting it, remove the record
When selecting an entire row or multiple entire rows in the table view
and hitting the delete key, delete the records and not just the cell
contents.

See issue #1391.
2018-05-20 13:22:13 +02:00
mgrojo
33801d5285 Synchronize PlotDock with 'Execute SQL' table. Continuation of PR #1271
Make use of signals to connect the selection in plot to the associated
table widget. Every time that the plot is updated from the Main Window
the table widget associated to the table or query is connected to the plot
and the previous widget is disconnected. This allows the selection of the
correct table widget.

Line selection methods moved to the Extended Table Widget to be used as
slots for this connection.

The destroyed signal is also connected for resetting the plot. This fixes
a crash that already existed before this PR, when closing a SQL tab while
the plot is still associated to the table results model.
2018-01-16 00:37:42 +01:00
Martin Kleusberg
a98cd8e8f9 Avoid accidental truncation of cell data
For table cells with text larger than 32768 characters, the data gets
truncated. If the user doesn't notice this somehow and hits the Escape
key the truncated data is written back to the database resulting in a
possible data loss.

This problem is fixed by this commit in two ways:
1) The maximum length of the editor widgets is increased to the maximum
value making this problem much more unlikely.
2) If the user is still hitting this value, i.e. the text is truncated
anyway, the widget is put into read only mode and no data is written
back to the database.

See issue #1281.
2017-12-31 12:47:44 +01:00
Manuel
c753e56d62 Always copy data to clipboard and to internal buffer. Embedded image support (#1257)
At the time of pasting, use the generator and date meta tags in the HTML
version for knowing whether our data in the system clipboard has been
overwritten. If not, the internal buffer has better data, so we use it.

Since the binary data is not excluded in the system clipboard, images
are also included embedded in the HTML table. Other binary data are encoded
as base64 strings.
2017-12-22 18:43:58 +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
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
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
3aef8adc9a Clean up copy & paste code
Also add some TODO comments in preparation for #1244.
2017-11-29 22:17:22 +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
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
mgr
a03a901051 Copy rows + header to clipboard
A new option in the context menu of the table widget is added for copying
to clipboard the content of the selected cells prepended with the
appropiate column names.

See issue #1058
2017-11-04 19:53:36 +01:00
Martin Kleusberg
ee32b3e4e1 Use nullptr where possible 2017-10-30 21:20:02 +01:00
mgrojo
5cef432159 New option in the context menu for using the value as filter (#1182)
* Added an option in the context menu for using the currently selected cell
as filter in this column. This allows quick filtering by selected values.

* Changes to pull request #1182 requested by @MKleusberg: get internal cell data and check for the NULL special case.
2017-10-21 22:24:43 +02:00
Martin Kleusberg
ea1659e1d0 Support schemata other than main in the Browse Data tab
Similar to commit 44eb2d4f99 this commit
makes use of the backend code improvements introduced in commit
532fcd3f6b.

It adds support for database schemata other than "main" to the Browse
Data tab. With this it's possible again to browse and edit data of
temporary tables using the Browse Data tab. This time, however, they are
separated logically from "main" tables. So handling temporary tables
should be a lot less error prone now, plus it's easier to tell for the
user what tables goes in what schema.

This commit changes the project file format. There is some code included
which allows loading of project files in the old format. However,
project files generated using versions after this commit can't be loaded
by older versions of DB4S.
2017-09-04 12:27:52 +02:00
Martin Kleusberg
2421fef219 Add context menu to all table views
Add a context menu to all table view widgets in the program (Browse Data
tab and Execute SQL tab) which opens when right clicking a table item.

Currently the menu only allows you to copy and paste the selected
item(s).

Only activate the paste action when the current view is writable.
2017-06-28 16:30:03 +02:00
Martin Kleusberg
ef0ae8d549 Implement page-wise scrolling in Browse Data tab
Don't scroll by 100 records when using the scroll buttons but scroll by
one screen page.

See issue #232.
2017-05-08 12:06:56 +02:00
Martin Kleusberg
760ef092cd Try setting a saner default row height in the data browser
Maybe this helps with issue #419.
2017-04-10 15:07:51 +02:00
Martin Kleusberg
c62d291042 Add keyboard shortcuts for switching the currently browsed table
Add two new keyboard shortcuts for switching the currently selected
table in the Browse Data tab. These work as long as the table widget is
active. For now I have set them to Ctrl+PageUp and Ctrl+PageDown.

See issue #536.
2017-02-02 22:07:49 +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
Vladislav Tronko
5cd65e8ef6 Implemented multiple BLOB cells copy/paste 2016-08-07 06:01:07 +03:00
Milos Subotic
fe4302cb22 Paste in Browse Data table 2015-12-23 12:32:46 +01:00
Martin Kleusberg
9582786237 Add dropping of URLs and text on the data browser view
See issue #441.
2015-12-19 19:02:38 +01:00
Martin Kleusberg
39a49e33c2 Allow clicking cells with foreign key in order to jump to referenced cell
Add a tooltip to the database browser when you hover a cell with a
foreign key set in order to show the referenced table and column.

When clicking on such a cell while holding the Ctrl and Shift key (only
one of them won't work because they are for multiselection and Alt
doesn't do the trick on my system because it's just for grabbing and
moving the window) try to jump to the table and row which is referenced
in the clicked cell.

See issue #192.
2015-06-21 23:59:45 +02:00
schdub
029f01643b resize multiple (selected) cols in Browse Data tab 2015-04-20 22:15:28 +02:00
Martin Kleusberg
ba75bd16fe Use common format for all include guards and avoid leading underscores
Use a common format for all include guards, make sure each header file
has one and make sure it's named after the file name.

And as a random extra in this commit: Make sure the gen_version.h file
generated by cmake ends with a line break.

Closes #59.
2014-07-31 21:32:58 +02:00
Martin Kleusberg
297bfbce0a Move filter header from window to table widget and show sort indicators
Move the FilterTableHeader object from the MainWindow to the
ExtendedTableWidget class because it actually is a part of the latter,
not the former.

Show sort order arrows in the table header of the Browse Data tab after
clicking it.
2014-05-25 14:35:56 +02:00
Martin Kleusberg
e057f97773 ExtendedTableWidget: Fix jumpy scrolling
Fix wrong scrolling behaviour that ocurred when going to the very bottom
of the table and scrolling up slowly.
2013-04-17 20:26:55 +02:00
Martin Kleusberg
49239dad1f ExtendedTableWidget: Make scrolling less awkward with lazy population
Improve the lazy population fatchData() calls when using the vertical
scrollbar to make scrolling a lot smoother. Still not perfect but
definitely a lot better than before.
2013-04-11 17:45:14 +02:00
Martin Kleusberg
5e8c14e942 Make the QTableWidget a QTableView
Rewrite some code to use a QTableView widget instead of a QTableWidget
in the browse tab of the main window, or more presicely in the new
extended table widget class. This way the widget and the data model are
separated which on the one hand means a bit more work on our side but on
the other hand also gives us a bit more flexibility. And more
importantly at the moment: This means both, the browse tab and the sql
tab, use a table view now - that's going to be helpful for the next
commit...
2013-03-16 19:10:03 +01:00
Martin Kleusberg
d9cd62ba49 Implement an extended table widget to add proper copy to clipboard support
Extend the standard table widget class to make it possible to copy
multiple cells to the clipboard.
2013-03-16 18:31:12 +01:00