Commit Graph

153 Commits

Author SHA1 Message Date
mgrojo
ed178689a4 New setting allowing to set a dark style using a style-sheet
A new setting allows to follow the system style or set a new dark style
based on a the style-sheet provided by
https://github.com/ColinDuquesnoy/QDarkStyleSheet
The style-sheet is licensed under the MIT license. Images contained in
that project are licensed under CC-BY license.

Pending issues:

- Use of stylesheets is incompatible to QPalette. Some colours for
previewing settings in the Preferences dialog are eclipsed by the style-
sheet
See https://github.com/ColinDuquesnoy/QDarkStyleSheet/issues/48

- Changing the style should select matching background and foreground
colours for the Browse Data and SQL tabs in Preferences.

See issues #1751 #1493 and #1738
2019-02-22 22:15:19 +01:00
Feyn-Man
6431998470 Italian translation (#1584)
Partial Italian translation for now.  Will be continued later as time permits.
2018-12-08 14:39:34 +11:00
Martin Kleusberg
7e0ff3061b Move code for running SQL statements into a separate class
This is only done for better readability and for easing future changes.
No major logic changes intended here.
2018-12-05 18:37:52 +01:00
Martin Kleusberg
81b39ccdaa qmake: Add new option for enabling more warnings 2018-11-15 14:08:20 +01:00
Martin Kleusberg
ed06c0289e Move query generation from SqliteTableModel into a separate class 2018-11-08 16:20:34 +01:00
Martin Kleusberg
35a5b43ce0 Move SQL object classes into a separate directory 2018-11-08 16:20:33 +01:00
Manuel
abb6f686a3 Initial implementation of "conditional formatting" (#1503)
After setting a filter, the user can select from the context menu in the
filter line a new option "Use for Conditional Format", that assigns
automatically a colour to the background of cells fulfilling that
condition.

The formatting is preserved after the user has removed the filter. Several
conditional formats can be successively added to a column using different
filters.

The conditional formats of a column can be cleared when the filter is empty
selecting "Clear All Conditional Formats" from the filter line context
menu.

The conditional formats are saved and loaded in project files as other
browse table settings.

A new class Palette has been added for reusing the automatic colour
assignment of the Plot Dock. It takes into account the theme kind of the
application (dark, light) for the colour selection.

A new class CondFormat for using the conditional formatting settings from
several classes. The conversion of a filter string from our format to an
SQL condition has been moved here for reuse in filters and conditional
formatting.

Whether the conditional format applies is resolved by SQLite, so filters
and conditional formats give the same exact results.

Code for getting a pragma value has been reused for getting the condition
result, and consequently renamed to selectSingleCell.

Possible future improvement:
- New dialog for editing the conditional formatting (at least colour and
application order of conditions, but maybe too: adding new conditions and
editing the condition itself).
2018-10-30 21:22:14 +01:00
Manuel
ce032d95e6 Issue #530: constraints on table prevents new record being added (#1477)
* Issue #530: constraints on table prevents new record being added

This adds a new dialog for adding records to a table. The current approach
is broken for several cases where foreign keys and check constraints are
impeding the insertion of an empty record. With the dialog, the user can
inspect the constraints (tooltip) and type of fields and add values
consistent with the requirements. The data is only inserted when the user
presses the Save button.

The dialog is modelled after the Edit Table or Edit Index dialog. An upper
frame allows entering the data using widgets. The lower frame previews the
SQL statement that will be used.

The old approach for adding records is still accessible pressing Tab on
the last cell of the table.

* Fix build problem introduced in previous commit on this branch

* Dialog as fallback for failure after empty row insertion and read only text

The insertion of an empty row is always tried. When it fails due to
constraints and foreign keys, the Add Record Dialog is open so the user
can enter values for the new record considering the constraints.

When the table has not constraints, or the row insertion provides valid
values, the user is still able to insert rows using the simple approach.

SQL preview in dialog is now read-only.

* Visual improvements for the Add Record dialog

QLineEdit as item delegate for the value, so it is more visible that we
are supposed to edit the value.

Remove last end-of-line in tool-tip.

* Improvements in the "Add Record" dialog

Display of NULL values using DisplayRole (no focus) or place holder text
(when focus).

Set value to NULL through a context menu and shortcut in the value line
edit.

Take text type affinity into account for quoting or not entered numbers.
New isType and affinity functions in sqlitetypes.

Clarify wording of constraints in tooltip for value. Added the same tooltip
for the type.

Escape quotes inside string values.

Removed unused parameters warnings.

Other wording or code improvements based on the pull-request review: #1477.

* User access to the Add Record dialog

The Add Record dialog is now accessible for the user. The New Record button
is converted to a QToolButton and a new pop-up menu is added to it for
invoking the in-line table insertion (New Record) or the Add Record dialog
(Insert Values...). What's This information for the button updated.
2018-08-27 21:35:09 +02:00
Marcin Mikołajczak
44920ce098 i18n: Add Polish translation (#1456)
Signed-off-by: Marcin Mikołajczak <me@m4sk.in>
2018-07-10 23:12:28 +02:00
Iulian Onofrei
3cdc65a63f Add automatic crypted databases open via dotenvs (#1404)
* Rename confusing variables

* Fix some project warnings

* Fix code style

* Add constant for the default page size

* Move KeyFormats enum to CipherSettings

* Fix code style

* Fix memory leak

* Stop relying on CipherDialog for encryption settings management

* Fix code style

* Add .env format for QSettings

* Add automatic crypted databases open via dotenvs

This adds support for `.env` files next to the crypted databases that
are to be opened that contains the needed cipher settings.

The only required one is the plain-text password as a value for the key
with the name of the database like this:

    myCryptedDatabase.sqlite = MyPassword

This way, databases with a different extension are supported too:

    myCryptedDatabase.db = MyPassword

You can also specify a custom page size adding a different line
(anywhere in the file) like this:

    myCryptedDatabase.db_pageSize = 2048

If not specified, `1024` is used.

You can also specify the format of the specified key using the
associated integer id:

    anotherCryptedDatabase.sqlite = 0xCAFEBABE
    anotherCryptedDatabase.sqlite_keyFormat = 1

where `1` means a Raw key. If not specified, `0` is used, which means a
simple text Passphrase.

Dotenv files (`.env`) are already used on other platforms and by
different tools to manage environment variables, and it's recommended
to be ignored from version control systems, so they won't leak.

* Add new files to CMakeLists

* Move DotenvFormat include to the implementation

* Fix build error

* Remove superfluous method

(related to ac51c23)

* Remove superfluous checks

* Fix memory leaks

(introduced by 94bbb46)

* Fix code style

* Make dotenv related variable and comment clearer

* Remove duplicated code

* Remove unused forward declaration

(introduced by e5a0293)
2018-07-10 20:46:17 +02:00
Julian Ospald
873d705e03 Make install paths configurable 2018-06-22 13:50:56 +02:00
Martin Kleusberg
3da520cdd1 Clean up multi threading patch, fix build and some bugs
Make strings translatable, remove some more debug code, fix tests,
reduce size of patch slightly, remove weird tooltip, don't crash when
closing database, simplify code, fix filters, don't link agains pthread
on Windows.
2018-06-08 22:46:47 +02:00
Martin Kleusberg
51dbe72e23 Multi-threading patch
This was done by Michael Krause.
https://lists.sqlitebrowser.org/pipermail/db4s-dev/2018-February/000305.html

In this commit I only fixed two compiler warnings, some whitespace
issues and removed some debug messages.
2018-06-08 22:46:47 +02:00
Martin Kleusberg
a117c11064 Simplify qmake files 2018-05-20 15:58:24 +02:00
GortiZ
e7752d7398 KUbuntu 14.04 support restored (#1298)
* - [NEW] Add new interface and functionality to manage database file extension. (Implements feature request #659)

* - [FIX] Fixed CMake file to src.pro

* - Applied changes requested by mgrojo to uniform code with sqlitebrowser standards
- Add "history" when closing editor window, but reopen before closing preferences
- Revert some changes done by QtCreator

* Refuse from previous commit

* Additional changes requested by MKleusberg:
- [CHG] Always add "All files (*)" to filters
- [FIX] Removed unused include

* merged from master

* Merge sqlitebrowser master

* [FIX] Fixed compatibility to compile on KUbuntu 14.04 with Qt 5.2.1

* [FIX] Fix Qt version for QOpenGLWidget support on previous commit

* [CHG] Uniformed QT_VERSION_CHECK style
[CHG] Reverted macOS check on Mainwindow for OpenGL context creation
2018-05-20 15:56:01 +02:00
mgrojo
7c9fe7039c Merge branch 'master' into xml_cell_edit
# Conflicts:
#	src/EditDialog.cpp
#	src/ExtendedScintilla.cpp
2018-01-27 19:01:08 +01:00
Giuseppe Zizza
a993c19853 File Extension management interface (#659)
[NEW] Add new interface and functionality to manage database file
extension. (Implements feature request #659)
2018-01-13 16:43:24 +01:00
Martin Kleusberg
5562119563 Move check for binary data into separate function
There are two places in the code where we check for binary data in
database cells. This commit takes the code and moves it into a separate
function so it's easier to improve the situation in both function
simultaneously.
2017-12-31 15:25:01 +01:00
mgrojo
a0e0fc98ae XML mode for the cell editor
The new editor mode shares the same Scintilla widget as the JSON mode.
The JsonTextEdit class has been generalised. Future modes supported by
Scintilla could be added with the current pattern. As a consequence, the
EditMode is not always equal to the current stacked widget.

Some code in EditDialog has been refactored, so it is easier to understand
and modified with so many modes. textNullSet has been replaced by the use
of dataType as Null.

SVG is promoted to a new recognised data type, so it can be edited in the
XML mode.

The XML data is formatted and validated following the pattern established
by the JSON mode.

New modules are needed by the XML mode: the Qt XML module and some new
Scintilla files required by the HTML/XML lexer.

The indent_compact was incorrectly named in Setting::getDefaultValue.

See issue #1253.
2017-12-23 22:19:17 +01:00
mgrojo
8896ecca40 Refactoring and find/replace dialog in the JSON editor.
SQL and JSON text editor classes have been refactored. A new parent class
for both editors have been added for the common logic implementable without
depending on the specific lexer.

The only visible effect of this change should be that the JSON editor
(issue #1173) now has the same find/replace dialog as the SQL editor.

This prepares for the implementation of the XML editor (issue #1253).
2017-12-16 00:09:47 +01:00
mgrojo
82665e3f09 Find/Replace dialog for SQL editors and logs
A classic Find/Replace dialog including all the options provided
by the QScintilla editor. Additionally a "Replace All" and a
Find All" button are implemented. This complements issue #191

New shortcut in main window for opening the find/replace dialog
connected to the focused widget. Standard for Replace is Ctrl+H.
Consequently the shortcut for Copy with Headers is changed to
Ctrl+Shift+C (see issue #1058).

For SQL text widgets not embedded in the main window, the standard
shortcut cannot be enabled, otherwise it conflicts with the main
window. Therefore the shortcut Ctrl+Shift+H is enabled for all the
SQL widgets as fallback. A better solution would be desirable.
2017-11-25 21:39:41 +01:00
SourceTrigger
de2131daea Improve 4k/5k resolution rendering speed on macOS/OSX (#1233)
Initialize OpenGL rendering on macOS by add a hidden QOpenGLWidget.
2017-11-20 14:44:37 +00:00
Martin Kleusberg
28d53ef990 Fix qmake build
See issue #1231.
2017-11-18 18:24:21 +01:00
Martin Kleusberg
bfa2fda1ad Attempt to implement multi-threaded loading of data
This is mostly done by trial & error. Don't expect any miracles from
it.
2017-10-11 09:21:41 +02:00
Martin Kleusberg
1c7cc24b15 dbhub: Improve push database UI
This adds a new Push Database dialog which lets you specify the database
name, the licence, a commit message, and the visibility of the database.
2017-08-12 14:58:30 +02:00
Justin Clift
0a5eef8241 Use the new Czech language, add the Czech flag 2017-07-21 17:40:22 +01:00
Justin Clift
d17b5454a1 Qmake now installs icon and metadata on *nix 2017-05-14 18:12:31 +01:00
Martin Kleusberg
f07548dfb2 build: Add make install rule to qmake project file
See issue #833.
2017-05-08 13:51:40 +02:00
Martin Kleusberg
0c8cb4ec1d Revert "Move fetching data for data browsing to a separate thread"
This reverts commit 6da71b6788.

This was causing just too many problems for one. The ones I noticed
were:
- Messing up the table view when scrolling down very large table where
the prefetching code is triggered.
- Crashing when setting an auto increment PK in the Edit Table dialog
because the sqlitetablemodel is used for a check in there.
- Probably more crashed in other places but for the same reason.
- Easy to fix but an issue nonetheless: when doing plotting a number of
empty rows would be inserted into the data browser.
- It just feels a little laggy.
2017-05-05 15:08:51 +02:00
Martin Kleusberg
6da71b6788 Move fetching data for data browsing to a separate thread
This moves the data fetching code into a separate thread for
asynchronous execution. The Browse Data and the Execute SQL tabs are
affected by this.

Note that this is a somewhat naive implementation that is meant for some
first testing.
2017-05-04 18:58:38 +02:00
Martin Kleusberg
1eece9ef06 tests: Add regex test files to qmake project file 2017-04-29 13:50:57 +02:00
Андрій Кондратьєв
dd685afef1 Ukrainian translation 2017-04-06 19:19:44 +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
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
45580865d3 Merge branch 'plotrefactoring' 2017-01-16 12:46:52 +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
Vladislav Tronko
4f7473fbed Enhanced UI for creating and editing foreign keys 2017-01-13 12:59:31 +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
b9e4433318 Drop Qt4 support
This commit removes all code and configuration that was required for
building with Qt4. Hopefully noone really needs it anymore.

See issue #603.
2016-10-18 18:07:38 +02:00
Martin Kleusberg
5dddffd7a0 travis: Fix building 2016-09-06 17:07:06 +02:00
Martin Kleusberg
affacf08bd Test adding C++11 code 2016-09-06 16:19:10 +02:00
Vladislav Tronko
3a06395f88 Divide PreferencesDialog in two classes
This forces PreferencesDialog to serve only for UI needs.
Plus, this opens the door for adding another class for shortcut
management without pain.
2016-09-03 22:30:55 +03:00
Martin Kleusberg
a1e08b37c9 Rename ExportCsvDialog to ExportData dialog
Sorry for the big change but I think it's preferable to not call it CSV
dialog when it's not just doing CSV.
2016-08-25 23:12:36 +02:00
Justin Clift
c6121c8d64 Renamed Arabic language file for now, so flag icon shows on windows
(cherry picked from commit ac0b8b9a4f)
2016-08-14 15:34:47 +01:00
M. Hasbini
2a1441a4aa Update src.pro 2016-07-11 03:12:35 +03:00
Justin Clift
cfdb48cec0 Initial qmake changes for OSX sqlcipher/sqlite switching 2016-05-24 15:15:21 +01:00
Justin Clift
3d6f318618 Adjust the application name on Windows & OSX 2016-05-17 18:35:06 +01:00
Justin Clift
159cc27e56 Move the new Win32 SQLite variable paths to the existing Win32 scope 2016-05-02 14:10:18 +01:00
Justin Clift
46536d2893 Added comment for the new SQLite paths in src.pro 2016-05-02 12:54:00 +01:00