ORE Studio 0.0.4
Loading...
Searching...
No Matches
FlagSelectorDialog.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_QT_FLAG_SELECTOR_DIALOG_HPP
21#define ORES_QT_FLAG_SELECTOR_DIALOG_HPP
22
23#include <QDialog>
24#include <QListWidget>
25#include <QPushButton>
26#include <QLineEdit>
27#include <QLabel>
28#include <QString>
29#include "ores.qt/ImageCache.hpp"
30#include "ores.logging/make_logger.hpp"
31#include "ores.qt/export.hpp"
32
33namespace ores::qt {
34
40class ORES_QT_API FlagSelectorDialog final : public QDialog {
41 Q_OBJECT
42
43private:
44 inline static std::string_view logger_name = "ores.qt.flag_selector_dialog";
45
46 [[nodiscard]] static auto& lg() {
47 using namespace ores::logging;
48 static auto instance = make_logger(logger_name);
49 return instance;
50 }
51
52public:
60 explicit FlagSelectorDialog(ImageCache* imageCache,
61 const QString& currentImageId = QString(),
62 QWidget* parent = nullptr);
63
69 QString selectedImageId() const { return selectedImageId_; }
70
71private slots:
72 void onImageListLoaded();
73 void onImageLoaded(const QString& image_id);
74 void onAllImagesLoaded();
75 void onSearchTextChanged(const QString& text);
76 void onItemSelectionChanged();
77 void onClearClicked();
78 void onSelectClicked();
79
80private:
81 void setupUi();
82 void populateList();
83 void filterList(const QString& filter);
84 void loadVisibleIcons();
85
86 ImageCache* imageCache_;
87 QString selectedImageId_;
88 QString currentImageId_;
89
90 QLineEdit* searchEdit_;
91 QListWidget* listWidget_;
92 QLabel* previewLabel_;
93 QLabel* previewDescLabel_;
94 QPushButton* clearButton_;
95 QPushButton* selectButton_;
96 QPushButton* cancelButton_;
97};
98
99}
100
101#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
Dialog for selecting a flag/image to associate with a currency.
Definition FlagSelectorDialog.hpp:40
QString selectedImageId() const
Get the selected image ID.
Definition FlagSelectorDialog.hpp:69
Cache for dynamically loaded images (flags, icons) from the server.
Definition ImageCache.hpp:54