20#ifndef ORES_QT_COUNTRY_HISTORY_DIALOG_HPP
21#define ORES_QT_COUNTRY_HISTORY_DIALOG_HPP
30#include "ores.qt/ClientManager.hpp"
31#include "ores.qt/ImageCache.hpp"
32#include "ores.refdata/domain/country.hpp"
33#include "ores.logging/make_logger.hpp"
34#include "ui_CountryHistoryDialog.h"
37class CountryHistoryDialog;
49 inline static std::string_view logger_name =
50 "ores.qt.country_history_dialog";
52 [[nodiscard]]
static auto& lg() {
54 static auto instance = make_logger(logger_name);
58 const QIcon& getHistoryIcon()
const;
63 QWidget* parent =
nullptr);
73 QSize sizeHint()
const override;
86 [[nodiscard]] QString
alpha2Code()
const {
return alpha2Code_; }
91 [[nodiscard]]
const std::vector<refdata::domain::country>&
getHistory()
const {
96 void statusChanged(
const QString& message);
97 void errorOccurred(
const QString& error_message);
113 void onVersionSelected(
int index);
114 void onHistoryLoaded();
115 void onHistoryLoadError(
const QString& error);
116 void onOpenClicked();
117 void onRevertClicked();
118 void onReloadClicked();
121 void displayChangesTab(
int version_index);
122 void displayFullDetailsTab(
int version_index);
129 using DiffResult = QVector<QPair<QString, QPair<QString, QString>>>;
130 DiffResult calculateDiff(
135 void updateButtonStates();
136 int selectedVersionIndex()
const;
138 std::unique_ptr<Ui::CountryHistoryDialog> ui_;
142 std::vector<refdata::domain::country> history_;
145 QAction* reloadAction_;
146 QAction* openAction_;
147 QAction* revertAction_;
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:35
Manages the lifecycle of the network client and IO context.
Definition ClientManager.hpp:90
Widget for displaying country version history.
Definition CountryHistoryDialog.hpp:45
void markAsStale()
Mark the history data as stale and reload.
Definition CountryHistoryDialog.cpp:513
const std::vector< refdata::domain::country > & getHistory() const
Returns the loaded history vector for version navigation.
Definition CountryHistoryDialog.hpp:91
void openVersionRequested(const refdata::domain::country &country, int versionNumber)
Emitted when user requests to open a version in read-only mode.
void revertVersionRequested(const refdata::domain::country &country)
Emitted when user requests to revert to a selected version.
QString alpha2Code() const
Returns the alpha-2 code of the country.
Definition CountryHistoryDialog.hpp:86
void setImageCache(ImageCache *imageCache)
Set the image cache for displaying country flags.
Definition CountryHistoryDialog.cpp:524
Cache for dynamically loaded images (flags, icons) from the server.
Definition ImageCache.hpp:52
Represents a country using ISO 3166-1 standard codes.
Definition country.hpp:33