Commit Graph

3080 Commits

Author SHA1 Message Date
Martin Kleusberg
ba1270cedb Clean up the code and make some more minor optimisations
This also includes replacing some more Qt containers by their STL
counterparts.
2019-11-06 20:25:18 +01:00
mgrojo
b3b1ac6946 Disable entire toolbars and frames in Table Browser
The Show/Hide Style Toolbar button and the find bar buttons were not
being disabled when the database was closed. The Find Next button even made
the application crashed in that state.

This change ensures we don't forget to disable new buttons in the toolbars
and frames of the Table Browser.

The layout where the navigation buttons are inserted does not, apparently,
disable the children widget, so cannot be used in the same way.

See related issues #1976 and #1608.
2019-11-03 20:22:27 +01:00
mgrojo
74befa368b Do not prompt for saving project file on close when it is just open
The project loading code modifies the isProjectModified flag due to the
changes performed. The flag has to set after all the loading is done, so
a close of the just opened project does not prompt for saving.
2019-11-03 18:37:12 +01:00
mgrojo
b30ddf98d0 Add project file name to window title
The DB file will include the full path only when it is different to the
project file path.

currentProjectFilename is cleared and set correctly in every case.

See issue #2027
2019-11-03 18:31:15 +01:00
mgrojo
f63bcbfef8 After closing an SQL tab, set focus to the new currently selected tab
Suggested in issue #2025
2019-11-03 14:36:58 +01:00
mgrojo
3577c71193 Allow closing the last tab by opening a new clean one
This allows clearing all the SQL tabs and at the same time, avoids leaving
an empty SQL tab widget.

Related to issue #2025
2019-10-31 20:44:22 +01:00
mgrojo
e2081db019 Fix problem to close the first tab using shortcut
This was introduced with implementation of #2025 and reported there.
2019-10-31 20:39:43 +01:00
mgrojo
24d4ca729b Use Ctrl+W to close a tab in SQL editor and Ctrl+F4 to close DB file
See enhancement #2025
2019-10-30 20:49:02 +01:00
mgrojo
ebb5e3b111 Fix for Qt versions older than 5.6.
constFirst() and constLast() were added to QList in Qt v5.6.

This entered in previous commit: 01378367a6
2019-10-28 21:15:51 +01:00
mgrojo
01378367a6 Easy way of selecting columns (and rows)
Add shortcuts for selection of entire columns ("Ctrl+Space") or rows
("Shift+Space") from the current cell selection.

A new menu entry in the column header is also added, including the shortcut
legend for selecting the column.

This addresses #1717 and complements #1976 for quick formatting of entire
columns or rows.
2019-10-27 23:35:48 +01:00
mgrojo
5aeca230fc Formats conditioned to row-id values to allow free cell formatting
The conditional formatting is extended to cover free single-cell
formatting. The row-id formats have precedence over regular conditional
formats.

In the styling toolbar, when single cells are selected, row-id formats are
created or updated. When entire columns are selected, regular conditional
formats are instead. Clearing formats for entire columns, remove both. For
single cells, only corresponding row-id formats.

New row-id formats are also saved to project files and loaded.

See issue #1976
2019-10-27 01:25:04 +02:00
Justin Clift
bf62a6e441 Initial attempt to get our Win64 builds working with Qt 5.12.5 2019-10-10 23:56:18 +11:00
Justin Clift
6bd176aab6 Update our nightly builds to use Qt 5.12.5
More a test to see if things are better with this Qt version than
5.11.3.
2019-10-09 21:17:27 +11:00
mgrojo
6ec1258a46 Revert last attempt to avoid a problem with font combo box
The font combo box overlaps the next column in some Qt versions. This is
another attempt at fixing it.

See comments in issue #1976
2019-10-08 23:14:06 +02:00
Martin Kleusberg
252484b486 Remove unneeded includes 2019-10-07 18:24:02 +02:00
Martin Kleusberg
4e8eff7af0 Some more minor performance improvements in often called functions 2019-10-07 18:23:43 +02:00
Martin Kleusberg
5f21c23d43 Remove some unnecessary semicolons 2019-10-07 18:18:46 +02:00
Martin Kleusberg
fad8a847ae Some more optimisations in SqliteTableModel
This improves the performance of a couple of often called functions in
SqliteTableModel some more.
2019-10-07 18:18:45 +02:00
Martin Kleusberg
6f7fb74809 Fix editing in tables with custom display formats
This enables editing for all columns which do not have a custom display
format set. It seems like this was broken for some time now, so the
entire table was effectively set to read only mode even when only a
single custom display format was configured.
2019-10-07 18:18:45 +02:00
mgrojo
50367b080e Bug fixing in the Conditional Format Manager dialog
This fixes the following issues, which might be Qt bugs or not:
- When moving an item to the top, the inserted widgets of the other items
are misplaced.
- When columns are resized to contents, the font combo box does not resize
with the column, overlapping the cells to its right.
- When adding a new item, the text just input in one filter line edit could
be lost.

See issue #1976 and comments in PR #2013.
2019-10-06 18:11:36 +02:00
mgrojo
2794957a89 Use a Filter Line Edit as editor for conditions in Conditional Formats
The Filter Line Edit is ideal for this dialog because it has already a
contextual menu for helping user with the syntax and a What's This button.

Moreover, the Line Edit looks better than the integrated persistent editor.

See issue #1976 and comments in PR #2013
2019-10-05 17:21:00 +02:00
Martin Kleusberg
a0b8b6f16a Make the cache access more efficient in SqliteTableModel::data()
This somewhat simplifies the cache access in SqliteTableModel::data()
function. Especially for not yet loaded cells this should speed up the
code too. It also reduces the function size which again should lead to a
little performance gain for every use case.
2019-10-04 19:06:58 +02:00
Martin Kleusberg
66f9e69620 Simplify control flow of SqliteTableModel::data()
This simplification of the control flow in SqliteTableModel::data()
makes the function a (very) little faster, at least on my system.

But more than everything else, this makes the code a bit easier to read.
2019-10-04 18:49:55 +02:00
Martin Kleusberg
a43e6a93e4 Store settings in SqliteTableModel
Store the relevant settings in SqliteTableModel and only update them
when they have changed. This avoids a lot of querying and converting of
variables in the data() function which is called very often and
therefore is somewhat critical for the overall performance.
2019-10-04 18:40:22 +02:00
Martin Kleusberg
be06bf2ac9 More consistent use of size_t for indexing table columns
Especially when we can remove the code for loading the binary bits of
the old project file format, this should allow us to get rid of a ton of
static_casts.
2019-10-04 17:58:42 +02:00
Martin Kleusberg
e0304ec8e5 Remove left-over definition
This is not used anymore.
2019-10-04 17:58:21 +02:00
Martin Kleusberg
6252124a69 Simplify some names
This is only changing internal function and variable names. Since we
have a separate class for the code from the Browse Data tab now, there
is no point to have the function names contain some sort of string like
"browseData" or similar.
2019-10-03 21:14:11 +02:00
mgrojo
009ac2ab1b Formatting is copied to the HTML version of the clipboard
Formatting applied to the data browser is copied to the HTML version of
the clipboard as CSS style. This is used also for printing.

Tested with:
- Thunderbird OK
- LibreOffice Writer OK
- LibreOffice Calc: the format is not pasted, but seems standard behaviour
in Calc

See issue #1976
2019-10-03 00:08:27 +02:00
Martin Kleusberg
7350817cc6 Add missing include
See issue #2014.
2019-10-02 12:05:32 +02:00
Martin Kleusberg
50fd6079c4 qmake: Fix build warnings
This fixes a warning about a missing macextras package when building on
non-macOS systems.
2019-10-02 12:00:24 +02:00
Martin Kleusberg
9d9e92e5ee Convert some QRegExp usages to QRegularExpression 2019-10-02 12:00:20 +02:00
mgrojo
7ca90e0f7e Fix problem with cursor navigation in table browser
This was causing that cursor navigation in table browser did not move the
scroll or that find bar required an additional scrollTo call.

Problem was introduced in 63aabb9601

See comments in PR #2013
2019-09-30 23:41:58 +02:00
mgrojo
b7f6bef398 Fix compilation error with Qt version used by Travis
This is another way to solve the overload.
2019-09-29 22:36:15 +02:00
mgrojo
9b1561afd0 Merge branch 'browser_formats' 2019-09-29 20:12:03 +02:00
mgrojo
fbf1de1e4b Merge branch 'master' into browser_formats
Necessary changes:

- Added function `ExtendedTableWidget::colsInSelection` to emulate former
behaviour of `ExtendedTableWidget::selectedCols`, which is needed by the
format toolbar.

- Added call to `ui->dataTable->scrollTo(match);` in TableBrowser::find,
otherwise the scroll was not advancing to the current index.

# Conflicts:
#	src/TableBrowser.cpp
#	src/TableBrowser.ui
#	src/icons/icons.qrc
#	src/sqlitetablemodel.cpp
2019-09-29 19:39:11 +02:00
mgrojo
6affb875cf Improvements for text alignment
The requested text alignment is always combined with AlignVCenter, which is
the value used before conditional formatting was implemented and gives
better display result.

When creating a new conditional formatting while applying a format from the
toolbar to a column which does not already have one, the alignment flag
of the format is taken from the current cell. In this way, the default text
alignment for numbers is preserved.

See issue #1976 and PR #2013
2019-09-29 13:54:18 +02:00
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
b4c8ec9706 Fix editing of collation in new fiews in the Edit Table dialog
Setting a collation in a newly added field in the Edit Table dialog did
not work when the field name was edited just before. This is fixed now.

See issue #2011.
2019-09-26 16:48:21 +02:00
Martin Kleusberg
671cc6d6c6 Add a find tool bar to the Browse Data tab
This adds a find tool bar to the Browse Data tab which allows the user
to search for values in the current table view. It only looks in
non-filtered rows and in non-hidden columns. It respected display
formats and sort order, too. The idea is to provide an additional level
of searching: the first one is done by using the filters and actually
reduces the number of rows in the view; the second level is done by
using the new find tool bar and allows you to look for values in the
remaining rows (or all rows if there is no filter).

See issue #1608.
2019-09-26 16:07:18 +02:00
Martin Kleusberg
091273869d tests: Simplify code 2019-09-26 15:30:37 +02:00
mgrojo
7541a82050 Highlight column headers to emulate spreadsheet behaviour
The column headers contained in a selection are highlighted for
consistency to the row headers and to emulated spreadsheet behaviour.
2019-09-22 23:16:04 +02:00
Martin Kleusberg
845875ae19 Fix retrieving list of selected columns for Browse Data tab
When retrieving the list of selected columns of a table in the Browse
Data tab only take into account columns which are selected entirely, not
columns which have at least a single selected field. Before selecting a
row would implicity select all columns.

This fixes issues with resizing and with hiding a column.

See issue #1999.
2019-09-22 22:36:04 +02:00
Martin Kleusberg
a69c62790f Fix foreign key editor not working correctly in Edit Table dialog
When creating a new foreign key constraint in the Edit Table dialog, a
list of tables to reference is displayed. This list is updated whenever
the name of the edited table changes because this is the only table the
name of which can change while the Edit Table dialog is opened. However,
this meant that when the name of the table changes to some existing
table name, the field list of that existing table is replaced by the
field list of the current table. If the name of the current table is
changed once again, it is deleted entirely from the list. This commit
fixes this behaviour by separating the static part of the table and
field list from the one table which can change.

See issue #1991.
2019-09-22 22:06:04 +02:00
Martin Kleusberg
91e036dd74 Add move field to top/bottom buttons to Edit Table dialog
See issue #1988.
2019-09-22 21:57:38 +02:00
Martin Kleusberg
2d4c5ce0ba Support inline preview of image data in cells
This adds a new option in the Preferences dialog to enable a preview of
images in BLOB cells directly in the grid view of the Browse Data tab.

See issue #2000.
2019-09-22 21:57:38 +02:00
mgrojo
4081debd71 Attach Database didn't escape filepath of selected file
See issue #2002
2019-09-22 21:22:34 +02:00
mgrojo
5b73cd1481 Fixes when adding new conditional format
Font point size preference is taken into account when creating a new
default conditional format.

New conditional formats in dialog are resized to contents.

See issues #1976 and #1815.
2019-09-21 23:30:28 +02:00
mgrojo
c27002c301 Added text alignment to conditional formats
Combo box for selecting the desired text alignment for a conditional
format.

The default alignment in the browser has been adjusted for numbers, which
are now aligned to the right as in spreadsheets.

Project file format updated.

See issues #1976 and #1815.
2019-09-21 23:28:35 +02:00
mgrojo
1ec502ae9b Added font and point size selection to conditional formats
Added font combo box and spin box for selecting font and font point size
of a conditional format. The default for a new conditional format is the
corresponding setting.

Minor dialog adjustments for better display.

See issues #1976 and #1815.
2019-09-21 18:17:16 +02:00
mgrojo
412c239366 More conditional formats: font style
The conditional format manager allows now to set the font style: bold,
italic and underline.

The project format has been updated. This is also the base for setting
other font formats without further changing the project schema.

New icons form the Silk icon set.

See issue #1976 and #1815.
2019-09-21 12:33:16 +02:00