Sketcher: Obey non-intrusive preferences for modal pop-ups

==========================================================

This commit turns the remaining blocking pop-ups in which the user can only click "ok"
into non-intrusive notifications, depending on the user preferences in settings.
This commit is contained in:
Abdullah Tahiri
2023-05-18 06:57:50 +02:00
committed by abdullahtahiriyo
parent 2a3fe4c628
commit 60d99ca570
10 changed files with 363 additions and 242 deletions

View File

@@ -26,7 +26,6 @@
# include <boost/core/ignore_unused.hpp>
# include <QContextMenuEvent>
# include <QMenu>
# include <QMessageBox>
# include <QPainter>
# include <QPixmapCache>
# include <QRegularExpression>
@@ -44,6 +43,7 @@
#include <Gui/CommandT.h>
#include <Gui/Document.h>
#include <Gui/MainWindow.h>
#include <Gui/Notifications.h>
#include <Gui/Selection.h>
#include <Gui/SelectionObject.h>
#include <Gui/ViewProvider.h>
@@ -614,8 +614,10 @@ void ConstraintView::swapNamedOfSelectedItems()
//
// If names are empty then nothing should be done
if (escapedstr1.empty() || escapedstr2.empty()) {
QMessageBox::warning(Gui::MainWindow::getInstance(), tr("Unnamed constraint"),
tr("Only the names of named constraints can be swapped."));
Gui::TranslatedUserWarning(item1->sketch,
tr("Unnamed constraint"),
tr("Only the names of named constraints can be swapped."));
return;
}
@@ -1046,8 +1048,9 @@ void TaskSketcherConstraints::changeFilteredVisibility(bool show, ActionTarget t
catch (const Base::Exception& e) {
Gui::Command::abortCommand();
QMessageBox::critical(Gui::MainWindow::getInstance(), tr("Error"),
QString::fromLatin1("Impossible to update visibility tracking: ") + QString::fromLatin1(e.what()), QMessageBox::Ok, QMessageBox::Ok);
Gui::TranslatedUserError(sketch,
tr("Error"),
tr("Impossible to update visibility tracking"));
return;
}
@@ -1129,8 +1132,9 @@ void TaskSketcherConstraints::onListWidgetConstraintsItemChanged(QListWidgetItem
catch (const Base::Exception& e) {
Gui::Command::abortCommand();
QMessageBox::critical(Gui::MainWindow::getInstance(), tr("Error"),
QString::fromLatin1(e.what()), QMessageBox::Ok, QMessageBox::Ok);
Gui::NotifyUserError(sketch,
QT_TRANSLATE_NOOP("Notifications", "Value Error"),
e.what());
}
}
@@ -1145,8 +1149,9 @@ void TaskSketcherConstraints::onListWidgetConstraintsItemChanged(QListWidgetItem
catch (const Base::Exception& e) {
Gui::Command::abortCommand();
QMessageBox::critical(Gui::MainWindow::getInstance(), tr("Error"),
QString::fromLatin1(e.what()), QMessageBox::Ok, QMessageBox::Ok);
Gui::NotifyUserError(sketch,
QT_TRANSLATE_NOOP("Notifications", "Value Error"),
e.what());
}
inEditMode = false;
@@ -1422,8 +1427,9 @@ void TaskSketcherConstraints::change3DViewVisibilityToTrackFilter()
catch (const Base::Exception & e) {
Gui::Command::abortCommand();
QMessageBox::critical(Gui::MainWindow::getInstance(), tr("Error"),
QString::fromLatin1("Impossible to update visibility tracking: ") + QString::fromLatin1(e.what()), QMessageBox::Ok, QMessageBox::Ok);
Gui::TranslatedUserError(sketch,
tr("Error"),
tr("Impossible to update visibility tracking: "));
return false;
}