This removes a couple of checks whether the database is opened. They
are not really necessary because the respective buttons are disabled
anyway in case no database is loaded. This was inconsistent anyway since
not all functions were checking for this. It also gets rid of a string
which translators have to deal with even though it is never going to be
displayed.
This fixes a regression introduced in commit
3f0832f449 which lead to the calculation
of numbers like sum, average, and count in the status bar not being
displayed.
This adds a new widget called TableBrowser which does everything the
Browse Data tab did before. All the UI data and all the code related to
this tab is moved into the new widget class. The main window now simply
uses the new widget instead of implementing all this stuff itself.
I mainly see three benefits from this change:
1) The main window class becomes smaller and starts looking less like a
master class which manages all of the application. This should make it
easier for new developers to find their way around the code.
2) A better separation of the table browser and the remaining main
window makes it clearer which class class is responsible for what. Again
this makes it easier to maintain the code when it grows.
3) If we ever want to have split views, multiple Browse Data tabs, or
something similar this is an absolute prerequisite.
This commit obviously changes a lot of code. So be prepared for
unintended changes and consider doing some extra testing.
See issue #1972.
Make sure the updating of the database structure always happens in the
main thread so it is in sync with the GUI updates. This way we know for
sure that the list of tables has been completely updated before we try
to (re-)select a table in the Browse Data tab after the DB structure
changed.
See issue #1701.
Restoring the current table and applied filters from project was not
working due to some interference with other applied changes.
Now it is done at the end of the load project function and after having
processed events. applyBrowseTableSettings is also called, otherwise
filters are applied but not visible in their input boxes.
See issue #1573
If no DB is open, DB4S tries to open the dropped file as formerly.
Otherwise, the user is prompted for the action:
- Open Database or Project
- Attach Database...
- Import CSV file(s)...
See issue #1883
Add a new right click context menu to the tab bar of the Execute SQL tab
in the main window. This menu contains actions for renaming and closing
tabs. Especially the renaming feature was hard to find before.
Add a third, new action to the context menu for duplicating the tab.
Duplicating opens a new tan and copies the title and SQL text from the
selected tab.
See issue #1964.
A new button in the "Browse Data" toolbar for clearing the sorting columns
and returning to the default table order.
New icon created as a composition of icons from the Silk icon set.
See issue #1761
When browsing a view we were constructing a query which looked like
this because the rowid column was empty:
SELECT "",* FROM "view_name";
This worked because there isn't really any rowid column for views anyway
and SQLite was interpreting the first bit as an empty string literal.
However using double quotes for string literals triggers a warning in
the error log. This commit aims to avoid this warning.
Flickering was produced in the table header, due to the fact that the
the filter boxes were displayed first at the rightmost side while the
table is reset and then they are repainted when the rows appear, in order
to leave space to the vertical header with the row numbers.
Setting the minimum width of the vertical header to the current width
before any filtering or sorting avoids the issue. The minimum width is
set to the default when changing the current table.
See issues #1763 and #1941
When opening a file in read-only mode, remember that read-only flag when
adding it to the list of recently opened files. The next time it is
opened it will be again in read-only mode.
The way this is implemented (by adding a "[ro]" to the start of the path
to indicate when to open in read-only mode) was chosen in order to be
fully backwards compatible with the previous data format for the file
list.
See issue #1913.
Fix a crash when using the "Browse Table" action in the right click menu
in the Database Structure tab. It crashed whenever the table name or the
schema name started or ended with a space character.
A second Ctrl+Click over an already added column changes the direction of
any column.
Before this change, the effect was only applied to the last selected column
and a second Ctrl+Click on the other columns triggered a requery without
having changed anything.
This was mentioned in PR #1810. See also issue #1761.
Matter came up WRT #1880. In reviewing, several other instances
were found where same file filter as a string literal was repreated.
This commit centralizes these file filters to one location. Filters
are declared `static const` to prevent accidental modification.
Also applied is a fix to #1881. QMessage at end of Import CSV is removed.
Saving cannot be done in the class destructor, since it seems that the
sizes have already change in that moment. Now they are saved under request
of the Main Window at the same time when the Main Window state is saved.
See issue #1889.
When opening a project file the following exception is raised in
src/sqlitedb.h:208
terminate called after throwing an instance of 'std::out_of_range'
what(): map::at
This is related to 64a596a887
Problem traced to QFile::exist() producing message when passed an empty QString.
Fix is to test QString length before any QFile::exist() usage with that string.
Compile with ALL_WARNINGS using GCC 8.2.1.
Encountered approximately dozen warnings with this pattern:
[path to sqlitebrowser root]/src/[somesourcefile]:line:cursor: warning: declaration
of ‘data’ shadows a member of ‘ClassName’ [-Wshadow]
OtherDataType data = ....line of code at line given above...
^~~~
In file included from /usr/include/qt5/QtWidgets/qdialog.h:44,
from /usr/include/qt5/QtWidgets/QDialog:1,
...other sources in project
/usr/include/qt5/QtWidgets/qwidget.h:733:18: note: shadowed declaration is here
QWidgetData *data;
^~~~
It appears there is a variable named 'data' within Qt global scope. Using 'data`
as a variable name, even one limited in scope to small lamda expressions, causes
compiler some grief.
Commit resolves the warnings in affected files. No problems apparent during execution.
Requires CSV stress-testing.
Resolve warnings that occur when building w/ ALL_WARNINGS enabled. Source tree
examined to enusre prefetch size is handled as type std::size_t. Also, tree was
modified correcting handling of the chunkSize variable in sqlitetablemodel that
uses the prefetch preference setting.
Also, some minor editing of sources was taken to improve readability
as well as consistency.
The following changes set the project as modified in order to ask to save
changes in project file when closing DB or application:
The main database file and any attached database file.
* PRAGMA values
* Show Row Id option
* Encoding
* Unlock View Primary Key option
* Sort columns and sort directions
* Column widths
* Applied Filters
* Display Formats
* Hidden columns
See issue #1706
When the Ctrl+F was used in the Scintilla widgets of the SQL Log or Edit
Database Cell docks, the shortcut was ambiguous with the search find bar
action, which had window context. Now the later has widget context and a
new widget-context shortcut is explicitly connected to the action in the
editors of each new SQL tab.
See issue #1746
A new find dialog, bound to Ctrl+F, has been added to all the Scintilla
editors. The dialog is basically the Find/Replace dialog, whose replace
related controls have been set to invisible.
This shortcut and the new menu contextual entry are disabled for the
Execute SQL editors, since there the shortcut is already assigned to the
search bar and it would also be redundant.
See issue #1746
Move the code for opening and saving SQL files in the Execute SQL tab
from the main window to the SqlExecutionAtra class.
Also fix some warnings in the code for opening new SQL tabs.
In the Table class we need to store whether this is a WITHOUT ROWID
table or now. Instead of just storing a boolean flag for that we were
storing a list of the rowid column(s). This is not just more complicated
to handle than a simple flag but also more error-prone because the list
must always be kept equal to the list of primary key columns. Failing to
keep them equal would result in an invalid SQL statement.
Now number of rows and columns is always showed, independent of the number
of cells threshold. Plural forms are used in translations (Spanish and
British English updated for testing).
Min and Max have also been added to the status bar message.
When a selection is made in the Data Browser, the status bar shows:
number of rows, number of columns, sum and average of numeric values (other
data types count as 0) in the selection.
For avoiding expensive computations when the selection is very big
(selecting all cells or an entire column) the threshold setting for the
completion is reused.
This was inspired by #1791, but does not implement the proposed feature.
This add initial and mostly untested support for WITHOUT ROWID tables
with multiple primary key columns. It should now be possible to update
and to delete records in these tables.
This commit also improves the overall handling of multiple primary key
columns in preparation for better support of them in general.
Note that this makes us depend on an SQLite version with a built-in JSON
extension.
See issues #516, #1075, and #1834.
This adds visual sort indicators to the already working multi-column
sorting. Qt sort indicator is disabled, so only one indicator per column
is visible.
Unicode characters are used to indicate direction (triangles) and sort
column order (superscript numbers).
See issue #1761
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.