Fixes the matching algorithm when provided a vector of existing names:
The original algorithm was equivalent to a 'startswith' algorithm, when it should
have been testing for exact and complete string equality. This also does some
refactoring to rename and clarify variables and functions, simplifies some
functions by using standard library calls when possible, and addresses various
linter complaints. It also applies our current clang-format to the files.
Co-authored-by: Ajinkya Dahale <AjinkyaDahale@users.noreply.github.com>
There has been lots of duplicated code between those two, and the recent
changed introduced even more copy/paste code. This commit consolidates
both implementations. The two "public" entry points, `CreateExternalGear`
and `CreateInternalGear` have been kept and now call a shared helper.
==========================================================================
- Migration of all constraints to the new non-intrusive notification framework.
- Removal of internal geometry command
- Command to create manually internal geometries is removed (deprecated).
========================================================================================
Functions to transparently send errors, warnings, notifications and translatednotifications, either
as intrusive messages (modal pop-up QMessageBox style) or as non-intrusive messages (notificationarea),
depending on the preferences of the user.
It is intended to substitute calls to QMessageBox with these functions in WBs, including the Sketcher WB.
Example:
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
QObject::tr("Cannot add a constraint between two external geometries."));
Can be rewritten as:
Gui::TranslatedNotification(obj,
QObject::tr("Wrong selection"),
QObject::tr("Cannot add a constraint between two external geometries."));
or
Gui::TranslatedNotification("Sketcher",
QObject::tr("Wrong selection"),
QObject::tr("Cannot add a constraint between two external geometries."));
where the first parameter (obj or "Sketcher") is the notifier string. If obj is an App::DocumentObject
(or a derived class of it), internally the function transparently calls getFullLabel() to get the notifier
string.
===========================================================================
The former system of autoclosing messageboxes is removed in favour of the Notification Area.
========================================================
- CriticalMessage old signal is reconverted to new notification system. This enables to remove the obsolete old system.
- An example of how common errors can be provided with translation support is added, so that App notifications appear
translated in the NotificationArea.
========================================
Parameter "NotificationAreaEnabled" can be used to completely disable the Notification Area.
If disabled it won't appear on the UI at all and no non-intrusive notification will be generated.
======================
A notification area consisting of one area for non-intrusive notifications, and a widget showing previous
errors, warnings, critical messages and notifications.
Notifications being marked with QT_TRANSLATION_NOOP with context "Notifications" are translated.
Messages are shown during a minimum show time, unless pop up (clicked inside). Messages stay until
a maximum show time. Between the minimum and the maximum show times left mouse button events make
the non-intrusive notification disappear.
The widget stores a configurable amount of messages after which old messages are removed to make room for
new ones.
Unread messages are shown in bold.