20#ifndef ORES_QT_CURRENCY_DETAIL_DIALOG_HPP
21#define ORES_QT_CURRENCY_DETAIL_DIALOG_HPP
28#include "ores.refdata/domain/currency.hpp"
29#include "ores.refdata/domain/currency_version_history.hpp"
30#include "ores.qt/ClientManager.hpp"
31#include "ores.qt/DetailDialogBase.hpp"
32#include "ores.qt/ImageCache.hpp"
33#include "ores.logging/make_logger.hpp"
37class CurrencyDetailDialog;
43class ChangeReasonCache;
45class CurrencyDetailDialog final :
public DetailDialogBase {
49 inline static std::string_view logger_name =
50 "ores.qt.currency_detail_dialog";
52 [[nodiscard]]
static auto& lg() {
54 static auto instance = make_logger(logger_name);
59 explicit CurrencyDetailDialog(QWidget* parent =
nullptr);
60 ~CurrencyDetailDialog()
override;
62 void setClientManager(ClientManager* clientManager);
63 void setUsername(
const std::string& username);
64 void setImageCache(ImageCache* imageCache);
65 void setChangeReasonCache(ChangeReasonCache* changeReasonCache);
85 void setReadOnly(
bool readOnly,
int versionNumber = 0);
112 [[nodiscard]] QString isoCode()
const;
115 void currencyUpdated(
const QString& iso_code);
116 void currencyCreated(
const QString& iso_code);
117 void currencyDeleted(
const QString& iso_code);
118 void isDirtyChanged(
bool isDirty);
127 void onSaveClicked();
128 void onResetClicked();
129 void onDeleteClicked();
130 void onRevertClicked();
131 void onFieldChanged();
132 void onSelectFlagClicked();
133 void onCurrencyImageSet(
const QString& iso_code,
bool success,
const QString& message);
134 void onGenerateClicked();
137 void onFirstVersionClicked();
138 void onPrevVersionClicked();
139 void onNextVersionClicked();
140 void onLastVersionClicked();
142 void onFeatureFlagNotification(
const QString& eventType,
const QDateTime& timestamp,
143 const QStringList& entityIds);
144 void onConnectionEstablished();
147 void updateSaveResetButtonState();
148 void setFieldsReadOnly(
bool readOnly);
149 void updateFlagDisplay();
150 void displayCurrentVersion();
151 void updateVersionNavButtonStates();
152 void showVersionNavActions(
bool visible);
153 void setupGenerateAction();
154 void updateGenerateActionVisibility();
157 std::unique_ptr<Ui::CurrencyDetailDialog> ui_;
163 int historicalVersion_;
164 std::string username_;
166 QAction* saveAction_;
167 QAction* deleteAction_;
168 QAction* revertAction_;
169 QAction* generateAction_;
170 QPushButton* flagButton_;
172 ClientManager* clientManager_;
173 ImageCache* imageCache_;
174 ChangeReasonCache* changeReasonCache_;
176 QString pendingImageId_;
177 static constexpr const char* max_timestamp =
"9999-12-31 23:59:59";
181 int currentHistoryIndex_;
182 QAction* firstVersionAction_;
183 QAction* prevVersionAction_;
184 QAction* nextVersionAction_;
185 QAction* lastVersionAction_;
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:35
Represents a currency with its metadata and formatting rules.
Definition currency.hpp:33
Contains the full version history for a currency.
Definition currency_version_history.hpp:32