Commit Graph

462 Commits

Author SHA1 Message Date
Martin Kleusberg
43a5175af1 dbhub: Keep track of the cloned databases
This adds a local database to keep track of all the cloned databases.
For now we only use this information to prevent exactly the same
database being downloaded twice.
2017-03-23 19:08:26 +01:00
Martin Kleusberg
f1194d845e Rename all the settings accessor functions
Rename the settings accessor functions from Settings::getSettingsValue()
(and similar) to Settings::getValue() (and similar). The 'Settings' bit
seems a bit redundant and costs a lot of screen space.
2017-03-20 23:16:52 +01:00
Martin Kleusberg
1e9fec270b Merge automatic update check into dbhub.io code
Move the network part of the automatic version check code into the
dbhub.io parts. While semantically this doesn't make a lot of sense it
simplifies the code a bit, reduces the size of the main window class,
and avoids duplication of code e.g. when introducing proxy support.
2017-03-19 17:29:20 +01:00
Martin Kleusberg
3e4f3fc3d2 dbhub: Add remote dock with directory browsing support
This adds a new dock to the main window that contains all the remote
functionality (or is supposed to contain it all in the future).

It also adds a directory browsing feature which allows you to browse
through the folders and files on the dbhub server.

By double clicking a database you can download and open it. The Open
Remote menu action isn't needed anymore and has been removed.

This also fixes an issue with pushing databases where, after sending the
file is completed, the save dialog was opened.

Note that this is still WIP and is far from polished.
2017-03-18 20:40:59 +01:00
Martin Kleusberg
f67817ee68 Simplify code for reloading settings
This simplifies the code for reloading the settings in the Execute SQL
area.

It might also fix a bug where setting a new font for the success/error
message at the bottom of each Execute SQL tab would be overwritten to
Monospace immediately after setting it.
2017-03-16 16:59:23 +01:00
sacha schutz
8ac4c0342a Add absolutePath to the recent Menu. Fix #965 (#967) 2017-02-28 15:44:39 +01: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
4794b0d231 Try to fix all 'not an error' errors in the Execute SQL tab
See issue #478.
2017-02-01 18:59:56 +01:00
Martin Kleusberg
bf1c90a896 Fix crash when browsing views
See issue #953.
2017-01-30 21:19:36 +01:00
Martin Kleusberg
38144bbcad Finish main part of the recent refactoring effort
This finally gets rid of the DBBrowserObject class entirely and moves
all its functionality to the newer classes in the sqlb namespace.

I'm still not entirely happy with this but at least things should be a
little more consistent now.
2017-01-23 20:59:12 +01:00
Martin Kleusberg
d236f6df9f grammar: Introduce basic View class stub
Parsing views or generating a CREATE VIEW statement isn't implemented
yet.

Also unify the process by which it's possible to retrieve information on
the fields of a database object.
2017-01-23 17:06:41 +01:00
Martin Kleusberg
ebc3869627 Rename sqlb::Object::ObjectTypes enum to sqlb::Object::Types
The 'Object' parts seemed a little redundant before.
2017-01-23 13:44:36 +01:00
Martin Kleusberg
d1e3e98006 cipher: Add support for encryption using the raw key format
See issue #264.
2017-01-22 15:36:54 +01:00
Martin Kleusberg
ef399d1770 Save foreign keys settings in the project files
Save the value of the foreign keys PRAGMA in the project files and
restore it when loading a project file.

See issue #848.
2017-01-22 12:17:01 +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
Martin Kleusberg
e5a79ec0fa Code refactoring
This changes the class structure in the sqlb namespace as well as the
DBBrowserObject class. The rest of the commit are changes that are
required by the modifications in sqlb and DBBrowserObject.

The idea behind this refactoring is this: we currently have the
DBBrowserObject class which holds some basic information about the
database object (name, type, SQL string, etc.). It also contains a
sqlb::Table and a sqlb::Index object. Those are used if the type of
the object is table or index and they contain a whole lot more
information on the object than the DBBrowserObject class, including the
name, the type, the SQL string, etc.

So we have a duplication here. There are two class structures for
storing the same information. This has historic reasons but other than
that there is no point in keeping it this way. With this commit I start
the work of consolidating the sqlb classes in order to get rid of the
DBBrowserObject class entirely.

This commit only starts this task, it doesn't finish it. This is why it
is a little messy here and there, but then again the old structure was a
little messy, too. We will need at least a very basic trigger and view
parser before finishing this is even possible. When this is done, I hope
the ode will be much easier to read and understand. But even in the
current state there already is some progress: we save a little bit of
memory, don't copy big objects all the time anymore, and replace a lot
of unnecessary string comparisons with integer comparisons.
2017-01-20 17:42:15 +01:00
Martin Kleusberg
e3ef13a916 Fix bug introduced by 194979edb0 2017-01-20 16:54:27 +01:00
Martin Kleusberg
2c7f32c699 Rename Create Index dialog to Edit Index dialog
Just like the Edit Table dialog, this dialog handles both creating and
editing. For consistency's sake this dialog is therefore renamed to Edit
Index dialog.
2017-01-20 12:35:07 +01:00
Martin Kleusberg
c9ceb5da59 Add Edit Index feature
Improve the Create Index dialog so that it allows creating as well as
editing indices.

Chenge the code for the main window to allow editing existing indices.
2017-01-20 12:15:49 +01:00
Vladyslav Tronko
194979edb0 Slight optimization of loop in populateTable() method 2017-01-17 03:24:14 +02:00
Vladyslav Tronko
e7de02b18d Fix Travis build error 2017-01-16 17:17:37 +02:00
Martin Kleusberg
d868f4c85d Make last database error message private
It's not supposed to be edited by anyone else.
2017-01-16 15:52:37 +01:00
Martin Kleusberg
45580865d3 Merge branch 'plotrefactoring' 2017-01-16 12:46:52 +01:00
Martin Kleusberg
1a6c34951b Fix error handling in open database procedure
When opening a database fails a proper error message is now shown which
hopefully tells the user what the source of the problem is. Note: this
will only work for newer versions of SQLite.

This requires a bug fix which is included in this commit. The error
message wasn't taken from the correct database handle, so it had nothing
to do with the actual error source. This is fixed by this commit as
well.
2017-01-15 21:22:03 +01:00
Martin Kleusberg
50ef6cd7c3 Allow opening databases in read only mode
See issue #325.
2017-01-15 20:22:01 +01:00
Martin Kleusberg
a6f2a7d9a0 Move plot code into a separate set of files
This cleans up the main window class a bit which was getting quite large
and a bit harder to maintain than necessary.

This commit also includes two minor fixes to the plot system:
- The plot widgets are now disabled when no database file is opened.
- The progress bar shown when fetching all data is now initialised with
the correct row numbers.

Other than that this commit should in theory not change any
functionality.
2017-01-13 18:00:39 +01:00
Martin Kleusberg
72b1d8f47e Clear edit dock after closing database
See issue #469.
2017-01-06 19:18:29 +01:00
Martin Kleusberg
e3cd04618e Fix typo in comment 2017-01-04 17:15:30 +01:00
Martin Kleusberg
c782ab665f plot: Don't generate colours randomly
This adds a basic table of 12 colours which DB4S chooses from when new
plot graphs are added. This also introduces a pointer to this table of
colours which if moved forward each time a graph is added. This it's
less likely that two graphs have the same colour in one plot.

A better but more complex approach would be to find an algorithm to
generate new colours dynamicalls. See issue #816 for details.
2017-01-03 21:00:29 +01:00
Martin Kleusberg
876f25d341 Remove dead code
Please correct me if I'm wrong but I don't see how this if statement
would ever execute the else part.
2017-01-03 20:49:21 +01:00
Vladislav Tronko
210916cfeb Use references instead of pointers where it's possible
In our case DDBrowserDB shares lifetime scope with MainWindow, so
there's no need to pass pointers back and forth.
2016-12-29 20:38:24 +02:00
Vladislav Tronko
70ff691f1a Fix bugged pagination (close #912) 2016-12-23 21:01:33 +02:00
Oleg Prutz
884ed66df8 Fix identaton (replace tabs with spaces)
This commit replaces tabs which were introduced in 17369b6 with spaces
2016-12-22 02:37:43 +03:00
Martin Kleusberg
f62d78ce15 Apply changed font settings to edit dock without restart
See issue #894.
2016-12-19 19:43:28 +01:00
Martin Kleusberg
ab5f6cffa7 Reload pragma values when pressing F5/Ctrl+R
As suggested by Iulian here
da7f472864 (commitcomment-19844983)
2016-12-19 17:53:37 +01:00
Oleg Prutz
17369b66a6 Fix hanging when deleting large number of records (#856) (#870) 2016-11-25 09:44:47 +00:00
Martin Kleusberg
df5e604e6e dbhub: Add support for sending files
NOt perfect yet but a start.
2016-11-07 23:38:51 +01:00
Martin Kleusberg
eeeec5f2fc dbhub: Use certificate manager to get client cert for authentication
When trying to fetch a database don't load a hardcoded client
certificate but grab one from the certificate manager in the preferences
dialog.

Also add support for password protected private keys.

Note: Since this is all testing code on the front-end side, we just use
the first certificate in case multiple certificates are configured.
2016-11-06 14:50:27 +01:00
Martin Kleusberg
982e4c4d34 plot: Add row number as column to select for plot
See issue #820.
2016-11-04 18:48:21 +01:00
Martin Kleusberg
70a44971be plot: Fix fetch all data button for plots based on query data
The fetch all data button in the plot area would load all data as if the
Browse Data tab was active even though the plot is based on a SQL query
in the EXecute SQL tab. That would lead to non-sensical results. With
this commit the button always load the correct data.

See issue #820.
2016-11-04 18:17:26 +01:00
Martin Kleusberg
6283f97598 dbhub: Add list of CA certificates and restructure code
Change the layout of the preferences dialog a bit.

Remove the server selection combo box from the preferences dialog as it
will probably never be required. The way we do logins using certificates
kind of makes this obsolete, I think.

Restructure the whole remote code a little bit. Also add helper
functions here and there.

Show a list of our the CA certificates built into the application in the
preferences dialog. This list is read only of course but still
informative as it tells the user which sites are supported ny DB4S.
2016-11-01 19:45:42 +01:00
bss, shaoshi
e12022432f keep user_version when Set Encryption (#846)
Set user_version of the new db to current user_version.
Otherwise user_version would be set to 0.
2016-10-26 23:40:51 +02:00
Martin Kleusberg
c2a9608c80 dbhub: Add basic HTTPS support
This adds basic support for fetching databases via HTTPS using client
certificates. You can include CA certificates to verify any responses
from a server. For now, one test CA certificate is included but it's
easy to add more.

It's also possible to authentify the client using a client certificate,
a client key and a password. As of this commit all three items are
hardcoded.

It's still possible to access any remote database via HTTP but if a
request URL starts with 'https' this new mechanism will be used.

All certificates, keys, and password included in here are taken from my
node.js test server repository. They will be replaced soon-ish.
2016-10-25 20:42:31 +02:00
Martin Kleusberg
4d26624bda dbhub: Add very basic support for opening remote files
This adds some initial support for opening remote files. You can enter a
URL and DB4S will try to download the file. When successful you'll be
able to specify a place and name to save the file under, and after
saving it locally to disk it'll be opened just like any local database
file.

See the included TODO comments for missing features. Most notably
missing is the HTTPS and certificate handling code. Also any support
for storing the remote source of a database is lacking.
2016-10-24 22:49:32 +02:00
Martin Kleusberg
85934dee77 Simplify code
This simplifies some of the super long iterator declarations by using
the auto keyword from C++11.
2016-10-18 20:07:48 +02:00
Martin Kleusberg
1ced897793 Switch to using C++11 and Qt5 (#808)
* grammar: Simplify code thanks to C++11 being there

* Use lambdas instead verbose slots for duplicating record

* travis: Use Qt5
2016-10-18 17:31:20 +02:00
Martin Kleusberg
d5c6b7bb0e Remember plot settings for each table (#819)
Store and restore the plot settings for each table - just like the
filter values or the column widths. This way you can have multiple
plots, one for each table.

Also, save these settings in the project files.
2016-10-14 13:24:06 +02:00
Martin Kleusberg
1592b7d2c3 When fetching all table data show a progress dialog
Fetching all table data using the button in the plot area might take a
long time. This commit adds a progress dialog which is displayed while
loading all the data.

See issue #499.
2016-10-13 23:07:36 +02:00
Martin Kleusberg
7570a0092d plot: Allow plotting of column when there is a NULL value in it
This enables plotting even for those columns which contain NULL values.
To distinguish NULL from a numeric 0 there is nothing drawn for NULL
values, i.e. there is a gap in the graph.

See issue #822.
2016-10-13 21:55:21 +02:00
Martin Kleusberg
8f77634a0a Fix escaping of Execute SQL results
Fix the HTML escaping of the success/error messages at the bottom of the
Execute SQL tab. This also simplifies the code a bit.

See issue #823.
2016-10-13 12:39:10 +02:00