Commit Graph

448 Commits

Author SHA1 Message Date
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
Martin Kleusberg
da7f472864 Make shortcut for 'reload' dependent on currently active tab
Make the reload shortcut (at the moment F5 and Ctrl+R) dependent on the
currently active tab. This way it always performs some meaningful task,
depending on the current context.

See issue #759.
2016-10-13 12:22:54 +02:00
Martin Kleusberg
e76e5b3241 Improve error handling when saving
Report any errors that might occur while saving changes to the database
to the user. Also warn the user that this means the database wasn't
saved entirely.

See issue #770.
2016-10-13 00:08:48 +02:00
Iulian Onofrei
175a162d1a Clear Browse Data paging label on database close
Before this, only the start index was being reset to 0, now it resets
all the indexes to 0 after closing a database.

This fixes #809
2016-10-09 03:21:52 +03:00
Iulian Onofrei
531eddbd6c Fix executing current SQL running incorrect line
Previously, it was running the query at the current cursor position, but that
proved to be confusing. Now, it runs the SQL that contains the start of the
current line. So having:

SELECT * FROM table1;
SELECT * FROM table2;

and the cursor either before the first semicolon, either after it, the first
SQL will be run, and not the second one as before.
2016-10-01 21:43:22 +03:00
Iulian Onofrei
f2956164c3 Fix Execute SQL trying to run spaces SQLs 2016-10-01 02:19:36 +03:00
Iulian Onofrei
45affc9bd5 Fix executing current SQL line not working always
If the last character was a semicolon and the cursor was placed after
it, the Execute current line action didn't execute anything. It now
execute the last SQL found
2016-09-30 20:39:46 +03:00
Martin Kleusberg
8be2c54f51 Don't simplify table/index/... names when using them internally
See issue #773.
2016-09-29 20:10:23 +02:00
Justin Clift
f537a009a0 Add placeholder File → Remote submenu + basic Preferences options 2016-09-28 13:59:41 +01:00
Iulian Onofrei
18dccd162e Add escape for Qt4 and leave toHtmlEscaped for Qt5
This would ease out Qt5 only migration by searching for `QT_VERSION < 0x050000` and removing those lines.
2016-09-27 17:42:35 +03:00
Justin Clift
482502f4f4 Replace QString::toHtmlEscaped() with Qt::escape(), for Qt4 compatibility 2016-09-27 15:25:03 +01:00
Vladislav Tronko
45e17c9b49 Remove maleficent return in previous commit 2016-09-26 14:27:53 +03:00
Vladislav Tronko
11558a86b4 Implement switching tabs using Alt modifier + number 2016-09-26 14:11:59 +03:00
Vladislav Tronko
b9dd11df53 Escape HTML entities in Execute SQL output(fixes #777) 2016-09-25 21:01:55 +03:00
Iulian Onofrei
d825af8c69 Update MainWindow.cpp
Fix Travis build error introduced by the last merged PR
2016-09-23 15:23:21 +03:00