20#ifndef ORES_QT_DETAIL_DIALOG_BASE_HPP
21#define ORES_QT_DETAIL_DIALOG_BASE_HPP
28#include "ores.qt/ChangeReasonDialog.hpp"
34class ChangeReasonCache;
35class ProvenanceWidget;
78 using QWidget::QWidget;
171 return v != T{} ? std::optional<T>(v) : std::nullopt;
190 const std::string& modified_by,
191 const std::string& performed_by,
192 std::chrono::system_clock::time_point recorded_at,
193 const std::string& change_reason_code,
194 const std::string& change_commentary);
207 std::string reason_code;
208 std::string commentary;
236 std::optional<change_reason_selection>
239 std::string_view category =
"system");
242 bool closeConfirmed_ =
false;
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Shared cache for change reasons used across all entity dialogs.
Definition ChangeReasonCache.hpp:47
OperationType
Type of operation requiring a change reason.
Definition ChangeReasonDialog.hpp:57
Base class for all detail dialogs.
Definition DetailDialogBase.hpp:74
virtual bool hasUnsavedChanges() const
Definition DetailDialogBase.hpp:82
void setProvenanceEnabled(bool enabled)
Enable or disable the Provenance tab.
Definition DetailDialogBase.cpp:34
void populateProvenance(int version, const std::string &modified_by, const std::string &performed_by, std::chrono::system_clock::time_point recorded_at, const std::string &change_reason_code, const std::string &change_commentary)
Populate the embedded ProvenanceWidget with entity data.
Definition DetailDialogBase.cpp:47
virtual ProvenanceWidget * provenanceWidget() const =0
Returns the promoted ProvenanceWidget (named "provenanceWidget" in .ui).
virtual QWidget * provenanceTab() const =0
Returns the Provenance tab widget (named "provenanceTab" in .ui).
void statusMessage(const QString &message)
Emitted to show a status message in the status bar.
virtual QTabWidget * tabWidget() const =0
Returns the dialog's QTabWidget (named "tabWidget" in .ui).
bool isCloseConfirmed() const
Returns true if the user has already confirmed closing this dialog.
Definition DetailDialogBase.hpp:91
void notifySaveSuccess(const QString &message)
Notify that a save operation completed successfully.
Definition DetailDialogBase.hpp:140
static std::optional< T > nulloptIfZero(T v)
Return std::optional(v) when v is non-zero, std::nullopt otherwise.
Definition DetailDialogBase.hpp:170
void closeRequested()
Emitted when the dialog wants to close its container window.
std::optional< change_reason_selection > promptChangeReason(ChangeReasonDialog::OperationType opType, bool isDirty, std::string_view category="system")
Show the change reason dialog and return the user's selection.
Definition DetailDialogBase.cpp:67
void clearProvenance()
Clear all fields in the embedded ProvenanceWidget.
Definition DetailDialogBase.cpp:60
void requestClose()
Request closure of the container window.
Definition DetailDialogBase.hpp:135
void onCloseClicked()
Called when the Close button is clicked.
Definition DetailDialogBase.cpp:102
void setChangeReasonCache(ChangeReasonCache *cache)
Inject the shared change reason cache.
Definition DetailDialogBase.hpp:100
void errorMessage(const QString &message)
Emitted when an error occurs that should be shown to the user.
Result of a successful change reason prompt.
Definition DetailDialogBase.hpp:206
Widget displaying the 6 standard record provenance fields.
Definition ProvenanceWidget.hpp:39