20#ifndef ORES_QT_COUNTRY_DETAIL_DIALOG_HPP
21#define ORES_QT_COUNTRY_DETAIL_DIALOG_HPP
28#include "ores.refdata.api/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 CountryDetailDialog final :
public DetailDialogBase {
46 inline static std::string_view logger_name =
47 "ores.qt.country_detail_dialog";
49 [[nodiscard]]
static auto& lg() {
51 static auto instance = make_logger(logger_name);
56 explicit CountryDetailDialog(QWidget* parent =
nullptr);
57 ~CountryDetailDialog()
override;
59 void setClientManager(ClientManager* clientManager);
60 void setUsername(
const std::string& username);
61 void setImageCache(ImageCache* imageCache);
81 void setReadOnly(
bool readOnly,
int versionNumber = 0);
93 void setHistory(
const std::vector<refdata::domain::country>& history,
108 [[nodiscard]] QString alpha2Code()
const;
111 QTabWidget* tabWidget()
const override;
112 QWidget* provenanceTab()
const override;
113 ProvenanceWidget* provenanceWidget()
const override;
114 bool hasUnsavedChanges()
const override {
return isDirty_; }
117 void countryUpdated(
const QString& alpha2_code);
118 void countryCreated(
const QString& alpha2_code);
119 void countryDeleted(
const QString& alpha2_code);
120 void isDirtyChanged(
bool isDirty);
129 void onSaveClicked();
130 void onResetClicked();
131 void onDeleteClicked();
132 void onRevertClicked();
133 void onFieldChanged();
134 void onSelectFlagClicked();
135 void onCountryImageSet(
const QString& alpha2_code,
bool success,
const QString& message);
138 void onFirstVersionClicked();
139 void onPrevVersionClicked();
140 void onNextVersionClicked();
141 void onLastVersionClicked();
144 void updateSaveResetButtonState();
145 void setFieldsReadOnly(
bool readOnly);
146 void updateFlagDisplay();
147 void displayCurrentVersion();
148 void updateVersionNavButtonStates();
149 void showVersionNavActions(
bool visible);
152 std::unique_ptr<Ui::CountryDetailDialog> ui_;
158 int historicalVersion_;
159 std::string username_;
161 QAction* revertAction_;
162 QPushButton* flagButton_;
164 ClientManager* clientManager_;
165 ImageCache* imageCache_;
166 QAction* alpha2FlagAction_{
nullptr};
168 QString pendingImageId_;
171 std::vector<refdata::domain::country> history_;
172 int currentHistoryIndex_;
173 QAction* firstVersionAction_;
174 QAction* prevVersionAction_;
175 QAction* nextVersionAction_;
176 QAction* lastVersionAction_;
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
Represents a country using ISO 3166-1 standard codes.
Definition country.hpp:34