20#ifndef ORES_QT_COUNTRY_DETAIL_DIALOG_HPP
21#define ORES_QT_COUNTRY_DETAIL_DIALOG_HPP
28#include "ores.refdata/domain/country.hpp"
29#include "ores.qt/ClientManager.hpp"
30#include "ores.qt/DetailDialogBase.hpp"
31#include "ores.qt/ImageCache.hpp"
32#include "ores.logging/make_logger.hpp"
36class CountryDetailDialog;
42class ChangeReasonCache;
44class CountryDetailDialog final :
public DetailDialogBase {
48 inline static std::string_view logger_name =
49 "ores.qt.country_detail_dialog";
51 [[nodiscard]]
static auto& lg() {
53 static auto instance = make_logger(logger_name);
58 explicit CountryDetailDialog(QWidget* parent =
nullptr);
59 ~CountryDetailDialog()
override;
61 void setClientManager(ClientManager* clientManager);
62 void setUsername(
const std::string& username);
63 void setImageCache(ImageCache* imageCache);
64 void setChangeReasonCache(ChangeReasonCache* changeReasonCache);
84 void setReadOnly(
bool readOnly,
int versionNumber = 0);
96 void setHistory(
const std::vector<refdata::domain::country>& history,
111 [[nodiscard]] QString alpha2Code()
const;
114 void countryUpdated(
const QString& alpha2_code);
115 void countryCreated(
const QString& alpha2_code);
116 void countryDeleted(
const QString& alpha2_code);
117 void isDirtyChanged(
bool isDirty);
126 void onSaveClicked();
127 void onResetClicked();
128 void onDeleteClicked();
129 void onRevertClicked();
130 void onFieldChanged();
131 void onSelectFlagClicked();
132 void onCountryImageSet(
const QString& alpha2_code,
bool success,
const QString& message);
135 void onFirstVersionClicked();
136 void onPrevVersionClicked();
137 void onNextVersionClicked();
138 void onLastVersionClicked();
141 void updateSaveResetButtonState();
142 void setFieldsReadOnly(
bool readOnly);
143 void updateFlagDisplay();
144 void displayCurrentVersion();
145 void updateVersionNavButtonStates();
146 void showVersionNavActions(
bool visible);
149 std::unique_ptr<Ui::CountryDetailDialog> ui_;
155 int historicalVersion_;
156 std::string username_;
158 QAction* saveAction_;
159 QAction* deleteAction_;
160 QAction* revertAction_;
161 QPushButton* flagButton_;
163 ClientManager* clientManager_;
164 ImageCache* imageCache_;
165 ChangeReasonCache* changeReasonCache_;
167 QString pendingImageId_;
170 std::vector<refdata::domain::country> history_;
171 int currentHistoryIndex_;
172 QAction* firstVersionAction_;
173 QAction* prevVersionAction_;
174 QAction* nextVersionAction_;
175 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 country using ISO 3166-1 standard codes.
Definition country.hpp:33