Commit Graph

2241 Commits

Author SHA1 Message Date
mgrojo 9fe529752b Allow to change sort order for any column in the multi-column sort list
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.
2019-07-13 17:42:50 +02:00
mgrojo 592fa91e25 New function for detecting mixed RTL-LTR texts
Qt's isRightToLeft() returns true only for all left-to-right characters
in the string. That prevents the automatic switch to LTR Text mode, when
the text contains one or more left-to-right characters.

See #1793 and #1929
2019-07-11 22:10:24 +02:00
mgrojo 5e965b1a20 Restore QTextEdit widget for RTL text in the Cell Editor
This restores the Qt text widget that was replaced by a QScintilla one in
45c1e2abfd

QScintilla does not support right-to-left scripts like Arabic, so QTextEdit
is still needed for these languages. Since the QScintilla editor has other
advantages already explained, it is preserved for general text edition.

RTL texts are detected when data is loaded and the Qt editor is
automatically selected. This is done both when loading data from the cell
and when interactively typing RTL characters in the Cell Editor.

All these changes can be undone if a new QScintilla editor supports RTL
texts.

See comments in issue #1793
2019-07-11 22:10:24 +02:00
GortiZ 786fac033a Updated Italian translation (#1931)
* [CHG] Updated italian translations
2019-07-10 21:05:27 +02:00
Martin Kleusberg 9594115ef3 Send the fetched signal in RowLoader even when no rows where fetched
Always send the fetched() signal when a RowLoader thread has finished a
fetch task. Before this the signal was only sent when some data was
actually retrieved from the task. This fixes some rare problems in the
Execute SQL tab where the query for determining the row count of a
SELECT statement changes something, so the subsequent row loading task
does not return any rows after all.

The only case I know of is when loading an extension using the
'SELECT load_extension()' function. The load_extension function is
actually called twice when SQLite for some reason reports that rows
where returned from this statement. These calls are:
SELECT COUNT(*) FROM (SELECT load_extension('...'));
SELECT load_extension('...');
After the first call is executed, the extension is loaded. So the second
call does not return any rows and we indefinitely wait for the rows we
expect. Strangely enough this only happens for some extensions.

The change here should have no side effects becaue the signal is only
connected to one slot which skips most steps when no rows where fetched.

See issue #1932.
2019-07-06 23:05:57 +02:00
Martin Kleusberg b17755c46a Only register error log callback once at start of application
Instead of registering the error log callback function every time a
database file is opened, we now register it only once when the
application is first started. This way we can avoid calling
sqlite_shutdown which can have unintended side effects.

See issue #1932.
2019-07-05 22:13:46 +02:00
Martin Kleusberg 5589bd9da4 Speed up the loading of the database structure
While testing the original database from issue #1892 which contains
hundreds of tables and fields, I noticed how long the loading of the
database structure takes. This is especially problematic since it needs
to be reloaded on various occasions, e.g. running most statements in the
Execute SQL tab, which stalls the application every time.

According to a profiler it is the QIcon constructor which requires most
of the time. By introducing this small icon cache class we can reduce
the time for loading icons to almost nothing.

While still not perfect the UI already feels much more responsive with
this patch.
2019-06-28 14:58:50 +02:00
Martin Kleusberg 237b1fd9b8 Simplify code 2019-06-28 13:25:46 +02:00
Mercury233 028242160f minor fix zh-cn translation 2019-06-17 00:24:17 +08:00
Martin Kleusberg ccae4af6d1 Fix off-by-one error 2019-06-13 16:12:47 +02:00
Scott Furry cf05e7a462 Centralize File Filter and Resolve End CSV Import Message
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.
2019-05-29 15:54:27 +02:00
mgrojo 09944739cc Log transaction and savepoints statements executed by application
These statements have implications for the user, so it is better to log
them.

See #1859 and #1901
2019-05-29 15:37:23 +02:00
mgrojo 1df647b0df Fix copy-paste-edit error in SqlExecutionArea::saveState()
The error was introduced in 59b55ac436

Indentation level also fixed.

Thanks to @scottfurry for pointing this out. See issue #1889.
2019-05-19 19:41:27 +02:00
mgrojo 512f7eeeab Save splitter sizes of the Execute SQL areas to disk under request
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.
2019-05-19 13:45:56 +02:00
mgrojo 59b55ac436 Save splitter sizes in the Execute SQL areas
Whenever the splitters between the SQL editor, the table result and the
last execution results panes are moved, the sizes are saved to memory (for
performance) so the next SQL tab to be opened restores them. When an area
is destroyed the last saved settings are saved to disk, so they are ready
for the next execution without much impact in disk utilisation.

Issue #1889
2019-05-17 23:18:00 +02:00
mgrojo 30d0b183a5 Fix crash when opening project file
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
2019-05-12 00:15:35 +02:00
Martin Kleusberg 6bbf401abd Fix build for Qt < 5.10 2019-05-11 16:28:48 +02:00
Martin Kleusberg e2f3186d19 Fix saving/restoring of settings in Import CSV dialog
Saving and restoring of quote and separator characters did not work as
expected in the Import CSV dialog since the last commits. A missing
"else" made us try to save the string "Other" as the quote character
when a custom quote character was selected. Also the translation from
and to the saved format on disk had its problems.

See issue #1860.
2019-05-11 16:10:31 +02:00
Martin Kleusberg 2d12330783 dbhub: Set window title of new Proxy dialog
Forgot that in the last commit.
2019-05-09 15:25:10 +02:00
Martin Kleusberg 38ece2ea42 dbhub: Add proxy configuration support
This adds a new dialog, accessible from the Remote tab in the Preferences
Dialog, which allows the user to configure the proxy to use for all
network connections.

The new default is to use the system-wide proxy settings.

See issue #979.
2019-05-09 15:11:44 +02:00
Martin Kleusberg 4cf6cb7c2a dbhub: Set last modified date of file during initial cloning
The dbhub.io server provides us the last modified date of the database
when cloning it. Because we send the last modified date back to the
server when trying to push a database, it makes sense to initially set
the last modified date of the local file to the date provided by the
server.

See issue https://github.com/sqlitebrowser/dbhub.io/issues/101.
2019-05-09 13:50:39 +02:00
Martin Kleusberg afee3ca79e Support more field separators and quote chars in the CSV import
This adds support for more characters as field separator and for quoting
in the CSV import. Before this we only supported ASCII characters, with
this we support all characters which when UTF-8 encoded require up to
16 bits.

See issue #1860.
2019-05-08 23:54:06 +02:00
Martin Kleusberg cec6b82561 Fix loading of last used settings in Import CSV dialog
Fix the loading of the last used import settings in the Import CSV
dialog when the "Other" option has been used in one of the dropdown
boxes.
2019-05-07 23:16:09 +02:00
mgrojo c70a1fc56f Close version range to apply workaround for QTBUG-73721
It appeared in Qt version 5.12.0 and it is supposed to be fixed in 5.12.3.

See issue #1658
2019-05-07 22:52:52 +02:00
Martin Kleusberg d1621e31b8 Fix qmake build 2019-05-07 22:17:27 +02:00
Scott Furry f877f8a10c Resolve Github Issue #1867 - Spurious Empty Filename message.
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.
2019-05-07 22:14:13 +02:00
Scott Furry d54b820fb2 Shadowed Variable Warnings (#1864)
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.
2019-05-07 22:09:21 +02:00
Scott Furry 800a8daf11 Normalize qhexedit.h include path
Include path used for QHexEdit in EditDialog.cpp is "implementation specific"
to how DB4S uses the QHexEdit library. Change is to make usage of library
more generic.
2019-05-07 21:56:06 +02:00
Martin Kleusberg c61e172afe Attempt to fix the build on some platforms - again
See issue #1879.
2019-05-07 21:53:09 +02:00
Martin Kleusberg 64a596a887 Use even less Qt containers 2019-05-06 18:50:05 +02:00
Martin Kleusberg 37aaa4c7f2 Avoid using std::regex for now
It turned out that on some platforms we still aim to support the stdlib
had not yet implemented std::regex. For this reason we want to avoid
using it for now.

In the particular use cases here it was also not the best solution. It
was faster to write using a regular expression instead of a hand coded
loop but clearly a simple loop should be more efficient here.

See issue #1873.
2019-05-05 15:35:50 +02:00
Martin Kleusberg d87f253940 Attempt to fix build error on some platforms
See issue #1873.
2019-05-03 17:59:11 +02:00
Martin Kleusberg 16768d5474 dbhub: Respect the order of the licence list and remove "Unspecified"
Respect the suggested order of the licences as provided by the dbhub.io
server instead of sorting them alphabetically by their internal key.

Also remove the hard-coded "Unspecified" licence option because the
dbhub.io server provided its own "No licence specified" option.
2019-05-03 15:28:02 +02:00
Martin Kleusberg 5e90d90ac6 Replace all typedefs by usings
This is just a matter of code style, no functional change whatsoever.
2019-05-03 15:06:48 +02:00
Martin Kleusberg 40aff11086 Use even less Qt containers 2019-05-03 15:04:15 +02:00
Martin Kleusberg b70e25c786 dbhub: Add a built-in certificate for read-only access to dbhub.io
This adds a built-in, default certificate which enables read-only access
to dbhub.io. This should make it easier to try out the remote features.
When trying to open the Push Database dialog, a message with more
details and all required links is displayed.
2019-05-03 13:27:07 +02:00
Martin Kleusberg d344f396b2 Use Niels Lohmann's JSON library everywhere
We started to use Niels Lohmann's JSON library instead of the one
included in Qt for the Export JSON dialog a while ago because Qt's
implementation showed some problems. To avoid any similar issues and
because Niels' library has a much nicer API, this commit migrates all
our code to his library.
2019-05-02 20:09:24 +02:00
Martin Kleusberg b803e3c49f Use more STL containers instead of Qt containers 2019-05-02 17:02:59 +02:00
demian2g faaa282614 Update sqlb_ru.ts
typo fix
2019-05-02 15:37:55 +03:00
Martin Kleusberg 29ca549f2f Fix updating records after changing the primary key
In the Browse Data tab updating a row after having updated its primary
key or part of it before was broken for multi-column primary keys. When
updating the value of a primary key column and then updating any part of
the row afterwards, we were still using the old value until the view was
refreshed. With this commit it is possible to immediately update the
row using the updated primary key values.

See issue #1834.
2019-05-02 14:18:16 +02:00
Martin Kleusberg 9c0b36d7b7 Speed up the loading of row data a bit
This improves the performance for loading row data with my setup by
about 10%. Incidentally, the conversion from Qt to STL containers
reduced the performance by about the same number.
2019-05-02 12:34:14 +02:00
Martin Kleusberg e16537dd9a Use emplace_back some more 2019-05-02 12:05:27 +02:00
Martin Kleusberg 59e1edc2ba Add a primitive benchmark tool for measuring the time to fetch all rows
This adds another primitive benchmark tool which in this case helps
measuring the time required to load all remaining rows from the selected
table. When activated using the LOAD_DATA_BENCHMARK define, it opens a
message box after loading of all rows using the fetch-all-data button in
the Plot Dock is clicked.
2019-05-02 11:47:35 +02:00
Scott Furry 925eed3ef8 During GCC build, series of warning messages regarding shadowed variables were
produced. Messages would take the form:

[SQLB root]/src/sql/sqlitetypes.cpp:465:79: warning: declaration of ‘fields’ shadows a member of ‘sqlb::Table’ [-Wshadow]

and reference

[SQLB root]/src/sql/sqlitetypes.h:310:17: note: shadowed declaration is here
     FieldVector fields;

All incidents isolated to [SQLDB root]/src/sql/sqlitetypes.{h,cpp}.
Change renames local variables to silence warnings.

no errors after execution w/ gcc/clang builds on Linux.
2019-05-01 22:13:55 +02:00
Martin Kleusberg a88fad2145 Do not print an error message when a PRAGMA did not return any value
When a PRAGMA query did not return any value (most notably the PRAGMA
foreign_key_check after editing a table using the Edit Table dialog), we
used to print an error message to the console. There were no further
side effects but the message could be irritating. This extra error
message is removed by this commit.

See issue #1868.
2019-05-01 22:10:06 +02:00
Martin Kleusberg a1b43bca73 Use std::tolower with unsigned char only 2019-05-01 12:15:04 +02:00
Martin Kleusberg 14f91e95db Add missing include 2019-05-01 12:12:40 +02:00
Martin Kleusberg 20eb5e078e Fix a warning 2019-05-01 12:10:34 +02:00
Martin Kleusberg 0acbcce80c Fix compilation for older versions of Qt
QRandomGenerator was introduced in Qt 5.10 only.
2019-04-29 21:39:44 +02:00
Martin Kleusberg 189652d350 Remove some unnecessary includes 2019-04-29 20:54:26 +02:00