nsbaci 1.0
Loading...
Searching...
No Matches
nsbaci::ui::ErrorDialogFactory Class Reference

Factory for creating error dialogs from UIError objects. More...

#include <errorDialogFactory.h>

Public Types

using DialogInvoker = std::function<QMessageBox::StandardButton()>
 Callable type that shows a dialog when invoked.

Static Public Member Functions

static DialogInvoker getDialogFromUIError (const UIError &error, QWidget *parent=nullptr)
 Creates a dialog invoker from a UIError.
static std::vector< DialogInvokergetDialogsFromUIErrors (const std::vector< UIError > &errors, QWidget *parent=nullptr)
 Creates dialog invokers for multiple UIErrors.
static DialogInvoker getSuccessDialog (const QString &title, const QString &message, QWidget *parent=nullptr)
 Creates a success message dialog invoker.
static void showErrors (const std::vector< UIError > &errors, QWidget *parent=nullptr)
 Shows all error dialogs sequentially.
static QMessageBox::StandardButton showError (const UIError &error, QWidget *parent=nullptr)
 Shows a single error dialog immediately.
static void showSuccess (const QString &title, const QString &message, QWidget *parent=nullptr)
 Shows a success message dialog immediately.

Detailed Description

Factory for creating error dialogs from UIError objects.

Provides static methods to convert UIError objects into QMessageBox dialogs. Supports two modes:

  • Deferred: Returns a DialogInvoker callable for later invocation
  • Immediate: Shows the dialog right away via convenience methods
See also
DialogInvoker

Member Typedef Documentation

◆ DialogInvoker

using nsbaci::ui::ErrorDialogFactory::DialogInvoker = std::function<QMessageBox::StandardButton()>

Callable type that shows a dialog when invoked.

A DialogInvoker is a packaged dialog that can be invoked at any time. When called, it displays the dialog (blocking) and returns which button the user clicked. Think of it as a "suspended dialog" or "dialog builder" that you can trigger when ready.

Returns
The button that was clicked (QMessageBox::StandardButton).

Member Function Documentation

◆ getDialogFromUIError()

ErrorDialogFactory::DialogInvoker nsbaci::ui::ErrorDialogFactory::getDialogFromUIError ( const UIError & error,
QWidget * parent = nullptr )
static

Creates a dialog invoker from a UIError.

Returns a callable that, when invoked, shows the error dialog and returns the button clicked by the user.

Parameters
errorThe UIError to display.
parentParent widget for the dialog.
Returns
A callable that shows the dialog when invoked.
Here is the caller graph for this function:

◆ getDialogsFromUIErrors()

std::vector< ErrorDialogFactory::DialogInvoker > nsbaci::ui::ErrorDialogFactory::getDialogsFromUIErrors ( const std::vector< UIError > & errors,
QWidget * parent = nullptr )
static

Creates dialog invokers for multiple UIErrors.

Parameters
errorsVector of UIErrors to convert.
parentParent widget for all dialogs.
Returns
Vector of callables, one per error.
Here is the call graph for this function:

◆ getSuccessDialog()

ErrorDialogFactory::DialogInvoker nsbaci::ui::ErrorDialogFactory::getSuccessDialog ( const QString & title,
const QString & message,
QWidget * parent = nullptr )
static

Creates a success message dialog invoker.

Parameters
titleDialog title.
messageSuccess message body.
parentParent widget for the dialog.
Returns
A callable that shows the success dialog when invoked.
Here is the caller graph for this function:

◆ showError()

QMessageBox::StandardButton nsbaci::ui::ErrorDialogFactory::showError ( const UIError & error,
QWidget * parent = nullptr )
static

Shows a single error dialog immediately.

Parameters
errorThe UIError to display.
parentParent widget for the dialog.
Returns
The button that was clicked.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ showErrors()

void nsbaci::ui::ErrorDialogFactory::showErrors ( const std::vector< UIError > & errors,
QWidget * parent = nullptr )
static

Shows all error dialogs sequentially.

Convenience method that creates and immediately shows dialogs for all provided UIErrors.

Parameters
errorsVector of UIErrors to display.
parentParent widget for all dialogs.
Here is the call graph for this function:

◆ showSuccess()

void nsbaci::ui::ErrorDialogFactory::showSuccess ( const QString & title,
const QString & message,
QWidget * parent = nullptr )
static

Shows a success message dialog immediately.

Parameters
titleDialog title.
messageSuccess message body.
parentParent widget for the dialog.
Here is the call graph for this function:

The documentation for this class was generated from the following files: