Commit Graph

28 Commits

Author SHA1 Message Date
mgrojo
29bfcc4922 Add option for word wrapping in Edit Database Cell
A new option, in the toolbar of the Edit Database Cell, is added for
setting word wrapping for the text editor modes. It is now independent of
the SQL preference. The configuration reading the editor/wrap_lines setting
is moved to the particular SQL editor class.

Added icon from the Silk icon set.

See issue #1796
2019-03-17 19:23:02 +01:00
mgrojo
45c1e2abfd Drop the QTextEdit widget in the Edit Database Cell dock
Use the QScintilla widget for all the text modes of the Edit Database Cell
dock. All the features are believed to be preserved.

- The plain text mode is materialised removing the lexer.

- Null values are indicated now in the margin instead of using a
placeholder. The same pattern is also used for the Image and BLOB data
cases when the editor is switched to a text mode. In the dark mode, the
line number margin matches now the style-sheet and instead of the
configurable editor colours.

- Read-only state in the editor is hinted by the caret not blinking, but
the text is still selectable by keyboard or mouse.

Features and fixes added by using this widget:

- Find/Replace dialog for the plain text editor. See issue #1746
- The QScintilla widget does not strip CR characters. See issue #1793
- Line numbers and visible caret line in the text mode.
2019-03-10 01:01:07 +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
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
mgr
a90d1b24d3 Special copy for the binary editor including addresses, hex and ASCII #1485
Added a new copy action to the binary editor context menu for copying the
selected text as seen by the user, instead of the stream of hexadecimal
digits copied by default by qhexedit.

In order to support copying from the context menu, qhexedit has been
modified for not resetting the selection when the left mouse button is
pressed. This will be converted to a pull request to qhexedit afterwards.

See related issue #1485
2018-09-30 23:51:49 +02:00
mgr
1c06066258 Printing support #1525: print images in Editor Dialog and menu in hex
Added support for printing images in the Editor Dialog. A new action added
that can be activated through the context menu or shortcut for printing.

The same approach is applied to the hex editor, which also lacked a
context menu. Consequently the specific shortcut can be deleted.
2018-09-30 23:21:49 +02:00
mgr
dd3417e1c4 Automatic switching of the editor mode according to data type #1537
A new checkable button and associated setting is added for automatically
switching the editor mode in the Edit Database Cell dock in accordance to
the loaded data. The switch is done after loading data from cell, after
importing new data to the cell and when checking the button.

If the button is unchecked the behaviour is as formerly.

Since XML is not currently detected, the mode only changes to XML when SVG
is supplied.

Default value is true, since the new behaviour is considered more useful
for the general case.
2018-09-21 20:48:16 +02:00
mgrojo
52ae85dd28 Added some "What's This" information
Added some texts to the "What's This" information of some buttons or other
widgets that lacked them. This will help the user to discover the provided
features.

Specifically, help is added for the filter fields and the remote dock.
See discussions in issues #1311 and #1312.
2018-02-02 21:27:58 +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
232130bc60 Indent/Compact setting moved to Cell Editor
Removed the related check box in the Preferences Dialog. A new checkable
tool-button with icon from the Silk collection. When checked, the
indent-on-loading and compact-on-saving feature is enabled. When widget
is destroyed, the setting value is saved from this button state.

Currently it is only usable in the JSON mode, but could be reused in XML
and any other future modes.

See issue #1173.

Some tooltips in the Edit Dialog have been corrected, since it is not only
used for text.
2017-12-08 17:50:15 +01:00
mgrojo
c832d8a58c JSON mode for cell editor
Support for JSON in the Database Cell editor using the QScintilla library.

The lexJSON has been added to the compilation.

See issue #1173
2017-11-18 14:57:36 +01:00
mgr
9ce4b232ba New shortcut for Copy with Headers and some self-documented shortcuts
Ctrl+H invokes the Copy with Headersers action in the Extended Table Widget
as suggested in #1058.

The following options in context menu display now their shortcuts:
Set to Null, Copy, Copy with Headers and Paste.

Some other shortcuts are now displayed in the corresponding tooltips.
2017-11-12 19:26:39 +01:00
Martin Kleusberg
3a70b412e8 Turn some slots into normal functions
They aren't used for signal processing at the moment and don't look like
they can be used for that easily.
2017-10-30 13:15:43 +01:00
Justin Clift
47b1224bc2 Ugly workarounds :) for various small bugs in the Edit Cell
Fixes #726, and also a few other small issues at the same time
2016-08-13 16:34:07 +01:00
Justin Clift
b835ae800b Reimplement data loading and handling for the Edit Cell
This uses a somewhat different approach to the previous
one.  It now selectively stores the data into either
the text *or* hex widget buffer, and only copies the
data between them when the edit mode is changed.

Additionally, unneeded copy operations are minimised
where possible to reduce overall slowdown.:
2016-08-09 13:04:32 +01:00
Justin Clift
89baf3464d Adjust the layout of the Edit Cell as per #673 (#679) 2016-07-27 20:41:01 +01:00
Justin Clift
94fcfc1a66 Fix typo in label name 2016-07-20 19:25:51 +01:00
Justin Clift
4467b75782 Fix simple typo in EditDialog widget name 2016-07-13 13:41:02 +01:00
Martin Kleusberg
f26df79961 Add edit cell dock to main window
Add a new option for replacing the edit data dialog by an edit data dock
widget which is added to the main window and remains visible. This might
be interesting for people who otherwise would have to open the edit
dialog many times by doing tons of double clicks.
2015-12-15 22:29:15 +01:00
Martin Kleusberg
b407704959 EditDialog: Use Monospace font in text editor 2014-06-12 18:51:23 +02:00
Martin Kleusberg
ae4d04f9b1 EditDialog: Show warning when editing binary data in text mode 2014-05-25 17:30:57 +02:00
Martin Kleusberg
41296e3ac0 EditDialog: Increase size to fit the hex editor widget entirely 2014-05-25 17:15:28 +02:00
Martin Kleusberg
7b9a120d42 EditDialog: Improve handling of binary data in text mode
Make the EditDialog a bit more user friendly when editing binary data in
text mode:

Don't change back to the hex editor after changing any character.

Show the full binary data even if it contains a NULL byte.

Also (though a bit unrelated) disable rich text input for the text widget.

This partially fixes issue #19.
2014-05-25 11:53:31 +02:00
Martin Kleusberg
66b1a62fa4 Better image file handling in EditDialog
Put the image editor into a scrollarea so the dialog doesn't screw up
when importing a large image file.

When importing a file add a filter to the file dialog to only show image
files.
2013-03-17 13:02:49 +01:00
Martin Kleusberg
b5bade6d52 Allow user to switch between text and hex editor
Allow the user to change between the text editor and the hex editor.

Allow the user to change between insert and overwrite mode in both
editors.

This makes it possible to enter any binary data into an empty cell.
2013-03-17 02:54:07 +01:00
Martin Kleusberg
b88fd9316e Use different editors in EditDialog depending on the data type
Only show the old text edit widget when there is actually a text to be
edited. If the data is a image file show the image instead of some
random garbage. If it is some other binary data show the hex editor.
2013-03-17 02:11:12 +01:00
Martin Kleusberg
ab2a4e6479 Rewrite EditDialog using Qt Designer
Create a Qt Designer form file for the edit dialog.

Clean up the edit dialog code removing some not working and not used
functionality e.g. for blob editing.
2013-01-09 16:25:45 +01:00