Commit Graph

188 Commits

Author SHA1 Message Date
mgrojo
24d4ca729b Use Ctrl+W to close a tab in SQL editor and Ctrl+F4 to close DB file
See enhancement #2025
2019-10-30 20:49:02 +01:00
Martin Kleusberg
e0304ec8e5 Remove left-over definition
This is not used anymore.
2019-10-04 17:58:21 +02:00
mgrojo
63aabb9601 Added toolbar for direct formatting of columns in Data Browser
The new toolbar is hidden by default and can be toggled using a button in
the main Data Browser toolbar. Margins and spacing have been updated to
improve appearance of the two toolbars.

These tool buttons apply the format to the columns which are contained in
the selection. This is done by updating or adding a new condition-less
format to the list of conditional formats of those columns.

New style icons from the Silk icon set. Changed existent ones for
coherence.

See issue #1976.
2019-09-29 12:33:34 +02:00
Martin Kleusberg
3f0832f449 Move form data and code for Browse Data tab into a separate widget class
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.
2019-08-21 20:47:27 +02:00
Martin Kleusberg
6f81e89ec1 Add context menu and Duplicate tab feature to Execute SQL tabs
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.
2019-08-15 16:24:35 +02:00
mgrojo
732cda89fd Button for clearing the sorting columns
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
2019-08-15 15:43:13 +02:00
mgrojo
e40271f042 Set a minimum size for the Browse Table combo-box
See issue #1965
2019-08-12 21:45:37 +02:00
mgrojo
12c6a66375 New shortcuts for menu entries: open read-only and wiki
Ctrl+Shift+O for "Open DB Read Only" (see issue #1904)
F1 for "Help > Wiki" (our online help page)
2019-08-01 21:39:17 +02:00
Martin Kleusberg
97d77d557b Fix build for Qt version < 5.6
This fixes 8a4e363483.
2019-07-26 15:34:01 +02:00
mgrojo
9e6bd05f35 Avoid ambiguity for Ctrl+F in the Execute SQL tab
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
2019-04-05 20:54:09 +02:00
Manuel
ea2aa495b3 Visual sort indicators for multi-column sorting (#1810)
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
2019-03-28 15:05:27 +11:00
mgrojo
dfb7974d27 Reduce (and unify) margins in the main tabs and in Execute SQL widgets
The margins have been set to 3 for the layouts of all the main tabs. It has
been generally reduced from the default (9), except for the DB Structure
which was set to 0 and now has been increased to 3 for uniformity with the
other tabs.

The margins of interior widgets in Execute SQL tab has also been reduced to
3 from the default.

See issues #1762 and #620.
2019-02-23 17:08:54 +01:00
Martin Kleusberg
282387ced7 Add new logging section for SQLite's error log
Add a new logging section to the SQL log panel called "Error Log".
Register a callback to receive errors and warnings from SQLite and add
them to the new error log section.

See issue #1754.
2019-02-21 14:19:47 +01:00
Martin Kleusberg
0089802177 Make Add Record button work again with a single click
In 5f4d0ee7ff the Add Record button in the
Browse Table tab was inadvertently changed to only open a popup menu
after a long click but not triggering the Add Record action after a
normal click. This restores the old behaviour.
2019-02-09 18:42:53 +01:00
Manuel
5f4d0ee7ff Improve the size policy (toolbars and improved icons) (#1684)
* Improve the size policy (and more and better icons)

These changes improve the size policy for translations having long texts
in some buttons by:

* Converting the text buttons in the Edit Database Cell to icons
* Making the "Type of data" label wrappable and expandable
* Converting the text buttons in the Browse Data tab to icons
* Allowing the Plot combo-boxes to shrunk

All this allows both the Browse Data and the docks to grow and shrink with
more freedom.

New icons for buttons are reused when appropriate in context menus.

Added icon for filter and improve icon for docks (has been mirrored so it
matches the actual dock position).

Added Print icon in Edit Database Cell using the extra free space, so the
print action there is more visible.

This continues the effort started in #1324.

* Convert the embedded buttons to actual toolbars

This provides more flexibility, like the way how toolbars are compacted
when they have not enough space.

The QToolButtons in Browse Data tab and in Edit Cell dialog are converted
to QActions and inserted in new toolbars embedded in the same place as
the old buttons. Everything else should stay the same (shortcuts, tool-tips
and what's-this information).

* Set style for all toolbars in Preferences and minor adjustments

The combo-box used for the main toolbar is replicated for all the toolbars
in application. In this way, users with high resolutions can use the styles
with both icons and text, while users with lower resolutions can leave the
default styles, which should be better for them.

Some icon texts has been abbreviated from their default values, so they fit
better in the toolbars when they are visible.

The print icon in Edit Cell has been moved to the right, where it would be
the first to be collapsed.

The original what's-this info for Set as NULL in Edit Cell toolbar has been
restored.

* Remove no longer used overloaded function

The addShortcutsTooltip function applying to QWidget was no longer used
after having converted all the buttons to actions, so it is removed.
2019-02-08 21:45:50 +01:00
mgrojo
9fc6eeb3c6 Fix ambiguous shortcut for Ctrl+/
The shortcut was ambiguous because it was active in the button and in the
SQL editor itself. In the button was only documentation and was made
ambiguous when enabling the feature and fixing the shortcut in
6425fb177e

Now its scope is reduced to widget like similar button shortcuts so it can
be unambiguous in the editor.

See issue #1614
2019-02-04 20:30:29 +01:00
mgrojo
a14939913b New action "Save All"
New action "Save All" for saving all the files currently opened by the
application: DB file, SQL files and project file. Can be activated through
shortcut (Ctrl+Shift+S) and File menu.

Icon composed from package.png and database_save.png.

See issues #871 and #1706
2019-01-18 23:35:27 +01:00
mgrojo
f5011a233b "Save Project" to remember filename and new "Save Project As" action
"Save Project" remembers used filename, at second and successive calls
the user is not asked for the filename. Ellipsis are removed, since it
only opens a dialog the first time.

A Wait Cursor is set while saving so the user does not get the impression
that pressing "Save Project" does nothing.

"Save Project As" action is added, so the user can still save to another
filename when saved for the first time. Added icon combining package.png
and textfield_rename.png from the Silk icon set.

The base filename for a new project does not include the DB suffix.

Problems saving the project file are detected and the user warned.

See issue #1706
2019-01-11 21:53:45 +01:00
mgrojo
bf5eaa7330 Replace link style from pragma labels to an embedded icon with link
Even after having removed the hard-coded style from the link texts, this
combination of hyperlink over regular window background is not giving good
results in some dark theme colours. It is uncommon to have this combination
in GUI applications.

The link in the label has been replaced by a link in an embedded icon.

In order to be still recognisable as a link (apart from the hand icon) the
link hover signal is connected to a slot showing the link in the status bar
for 5 seconds.

See issue #1493
2018-12-30 13:30:36 +01:00
mgrojo
8f59d3aed6 Make Ctrl+T shortcut to work for "Open tab" in "Execute SQL"
This shortcut was set for the following actions, making it ambiguous:
"View > DB Toolbar" and "Open tab" in "Execute SQL". Additionally it was
used by QScintilla for transposing lines.

Shortcut for "View > DB Toolbar" has been removed, since it's not
considered a frequently used action and there are other toolbars without
shortcut. The shortcut for QScintilla has been changed to "Ctrl+Shift+Up".

The now working shortcut is added to the "Open tab" action's tool-tip for
documentation purposes.

See issue #1647
2018-12-28 13:04:17 +01:00
mgrojo
ea5a32c37b Fix ambiguous shortcut for Ctrl+O
Ctrl+O for opening a database file did no longer work. It raised this
warning:

QAction::eventFilter: Ambiguous shortcut overload: Ctrl+O

The shortcut was repeated in the UI.

This bug was introduced by e11b32ed54

It was laterally reported in #459
2018-12-27 16:22:41 +01:00
mgrojo
544ed812e2 Reset Window Layout, positional shortcuts for tabs and avoid statusTip
- New action (Alt+0) in View menu for resetting window layout (main tabs,
toolbars and docks).
- Shortcuts for tabs use positional meaning: after moving the tabs, the
number always refers to the position of the tab, and not the identity.
- Avoid using statusTip for restoring the original tab label and use
accesibleName, which is believed to be either neutral, when set, or
beneficial.
- Assure the tab is open when some function switches to it: browse table
and SQLite checks.
- Avoid flickering while clearing and adding tabs.

See issue #1675
2018-12-26 19:04:09 +01:00
mgrojo
4f9c21f83f Closable main tabs and saving automatically open tabs and order
Main tabs are made closable, so they can be closed by the user. New entries
are added to the View menu for toggling their open/closed state.

Spartan users can closed all tabs but their preferred, and then the tab bar
is hidden saving some space.

The set of open tabs and their order is automatically saved in the settings
on application exit and restored on application start.

Tab labels are stored in the statusTip attribute in order to restore them,
since those labels are not stored anywhere else.

See issues #1675 and #459
2018-12-25 21:12:28 +01:00
mgrojo
195d8683e5 Enable the movable attribute for main tabs
The movable attribute for the main tabs is enabled and the code is adapted
to use widget references instead of indices.

This allows user to move tabs and set a preferred order, but the order is
still not saved.

See issue #1675
2018-12-24 00:56:44 +01:00
zvova7890
a983248931 Change UI size policy, make RU translation shorter (#1678)
The width of the UI elements is forced by the text in buttons. This is a problem in some translations,
where the text are longer than the original. This PR address this tweaking some aspects:

* change UI size policy

* make RU translation for some buttons shorter

* move Set as NULL to bottom in EditDialog
2018-12-23 12:31:06 +01:00
mgrojo
6425fb177e Use native names in the tool-tips documenting some shortcuts
There are three reasons for not hard-coding the shortcut names in tool-tips
or other texts inside the UI elements:
- Qt uses portable names for the shortcuts, that are translated to different
key combinations depending on the operating system, e.g. Ctrl is translated
to Cmd in MacOS.
- An eventual change in a shortcut is propagated to user strings affecting
translations.
- If we ever allow configuring the shortcuts in Preferences, the text
would be incoherent.

The shortcuts are added programmatically to the tool-tips and consequently
they are removed from the UI files. The translation files have been updated
semi-automatically so the translated strings aren't lost.

Shortcuts have been added to actions that lacked them (because they are
implemented through other means) so they can be used. The WidgetShortcut
scope prevents in those cases any interference with the current shortcut
logic.

In the case of Ctrl+Return for "Execute all/selected SQL", it has been
moved from code to UI file, since it no longer made sense.

See issue #721
2018-12-06 18:56:24 +01:00
Martin Kleusberg
1f9101ae2a Move SQL execution in Execute SQL tab into a separate thread 2018-12-05 18:37:52 +01:00
mgrojo
2b15029be5 Button for new Un/Comment Block feature
A new button has been added to the "Execute SQL" toolbar for invoking the
new Un/Comment Block feature.

See issue #1614
2018-11-23 18:35:52 +01:00
Martin Kleusberg
aad06b8d7c Fix spelling error 2018-10-24 13:57:13 +02:00
mgr
629b02ae85 Set a sensible maximum for the browsed table combobox
See issue  #420
2018-10-04 23:08:41 +02:00
mgr
8b656cdeaa Printing support #1525: add print button to Data Browse tab
For consistency for the other application tabs, a print button is added
to the Data Browse Tab for printing the currently browsed table or
selection of cells.
2018-10-01 23:07:17 +02:00
mgr
f42b614084 A bit of polishing of the main window user-interface
Reorder the context menu of the table header and use separators for
coherent grouping: column actions, misc and encoding.

Set buttons invisible in the DB Structure toolbar when the object is
different to the supported ones. Disabling wasn't enough because the logic
for changing icon and text wasn't working well for fields and other items.

Separate Print from object actions in that same toolbar.

New icon for Project Save so it uses the same metaphor (floppy disk) as
other save actions.

Improved the look in the clear filters icon by editing it in gimp. It had
a glitch in the funnel base.
2018-09-29 17:28:12 +02:00
mgr
4f0d3505ed Printing support #1525: print DB structure
New action and button for printing the database structure.

The data in the Database Structure tree widget is converted to HTML and set
in a document that can then be printed, opening the dialog as done for
other components.
2018-09-25 23:00:17 +02:00
mgr
18f0ef60ba Enhancement #1435: pragmas invoked from Tools menu
Pragmas integrity_check, quick_check, foreign_key_check and optimize are
integrated in the Tools menu. The actions open a confirmation dialog
(with Help button that opens the corresponding reference page in
sqlite.org) and, after confirmation, opens a new SQL editor tab and runs
there the pragma, showing the possible results.

Sender in executeQuery is null in this case, so a check is added.

Added accelerator to Tools menu entry, which lacked one.
2018-09-16 18:54:25 +02:00
mgr
60c229c1c4 Printing support: print dialog from QScintilla widgets
Add printing support for QScintilla widgets (SQL, JSON and XML). It can be
access through the contextual menu, shortcut (Ctrl+P) or (in the case of
the "Execute SQL" tab) from a button in the toolbar.

Ctrl+P was previously assigned to Plot Dock since
63c338c359 but, as it was foreseen in that
commit, it should be assign to print is ever supported. This change must
be mentioned in release notes.

First part of printing support. See issue #1525.
2018-09-16 16:06:27 +02:00
mgrojo
5b4dea9b7c Add "Feature Request..." entry and body templates in both types of issue
New entry under Help menu for requesting issues with the same template
used for a New Issue inside GitHub.

The "Bug Report..." entry has also been updated for adding the
corresponding template body.

Separators added in Help menu, since there are currently several different
options.

See related issue #1497
2018-09-10 22:17:02 +02:00
mgrojo
f33943f4cf Improvements for drag and drop of items from the DB Schema dock to editor
Two new options editable from a new context menu of the dock:
- Drag & Drop Qualified Names: add table name to fields and schema name
to other objects (except for "main" schema)
- Drag & Drop Enquoted Names: whether to surround the identifiers by the
configured quoting characters for identifiers.

Support for dragging & dropping of attached databases names.

Add "." as separator for multiple dropped objects other than fields (since
they are not usually used in SQL as a list). This allows to compose
qualified names by dropping the parent and the child items together. This
is only generally useful when the "Qualified Names" option is disabled.

See related issue #1433
2018-09-09 19:52:36 +02:00
mgrojo
60195c78ed New shortcut key for copying cell value from above
Ctrl+' is used by spreadsheets for copying formula/value from the cell
above.

Our shortcut copies the value inside the inline editor when it is text.
That mimics the behaviour of LibreOffice Calc. For binary data that cannot
be edited inline, the BLOB is just copied from the above cell to the
current one.

See discussion in PR #1516.
2018-09-02 22:05:12 +02: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
Martin Kleusberg
1a780ebddc Add menu item for our Patreon page
See issue #1425.
2018-08-12 22:25:02 +02:00
Martin Kleusberg
8a07f0e655 Change page_size PRAGMA from spin box to combo box
Change the control of the page_size PRAGMA from a spin box to a combo
box in the Edit Pragma tab. This makes sure no values are entered which
aren't a power of two. The same change was done in the Cipher dialog a
while ago for the same reasons.
2018-08-09 14:39:34 +02:00
Martin Kleusberg
8f7fc07604 Order PRAGMAs in the Edit Pragma tab alphabetically
Also add tab stops.
2018-08-09 14:16:34 +02:00
Manuel
4f1256cc5f Allow "getting" and setting case_sensitive_like pragma (#1494)
* Allow "getting" and setting case_sensitive_like pragma

In order to allow case insensitive filtering, the pragma
case_sensitive_like is added to the GUI. Given that this pragma cannot be
read, a special SELECT request is made in DBBrowserDB::getPragma for
inferring its value.

See issue #1489.

* Warning in the pragma case_sensitive_like

This pragma has some peculiarities, so it is convenient to warn the user
about it through a tool-tip in the value.
2018-08-09 14:00:21 +02:00
mgrojo
7b660338ed Standard use of title case and ellipsis in menu actions
Menu actions that take the user to a dialog, where the action is completed
with some interaction and that could be cancelled, now have ellipsis.

Actions that only open an informative window do no longer have ellipsis.

Title case used in all menu entries.

See issue #1434
2018-08-09 12:45:41 +02:00
mgrojo
732c322181 Menu bar restructured so it follows a more standard layout
- Some actions not directly related to file operations over databases or
projects have been moved from "File" to a new "Tools" top-level menu entry.
Future tools can be added here.
- Preferences moved from "View" to "Edit" (MacOS is supposed to still have
it in the application menu).

See issue #1434
2018-08-09 12:45:41 +02:00
Martin Kleusberg
9a30e6cbb0 Don't translate PRAGMAs in the UI editor
This disables translation for PRAGMA names and values in the Edit Pragma
tab. The values must not be translated when using the current
implementation because they are used as shown for reading and writing
the PRAGMA values. The names could be translated but probably should not
be because they are more fixed name than description of their function.

See issue #1489.
2018-08-09 12:35:44 +02:00
mgrojo
f977534a1b Improper use of no-translation (notr) attribute
"Preview only (N/A)" must be translated
"toolBar1" although it's a window title it will never show up, so better
not request translation.
2018-08-06 19:24:46 +02:00
Martin Kleusberg
9a8f223b88 Add support for in-memory databases
Add a new menu option for opening an in-memory database. When working on
an in-memory database some menu options are disabled because they only
make sense when the database is also written to disk. I have left the
Write Changes button enabled though because for some actions the current
transaction needs to be committed - even though it's only committed to
memory then.

See issues #335 and #1492.
2018-08-05 15:45:50 +02:00
mgrojo
d65427a8a6 Fixes and improvements in user messages
- Title for the File Extension Manager
- Independent messages for each object type. See issue #1490
- Fixed incorrect wording in "What's This" message
2018-08-03 18:49:25 +02:00
mgrojo
e11b32ed54 Issue #1432: Popup menu in "Open Database"
A popup menu has been added in the "Open Database" button. A normal click
selects the "Open Database..." action as before. A delayed click opens the
popup menu for selecting either the "Open Database..." action or the
"Open Database Read Only..." action.
2018-06-24 20:43:17 +02:00