ORE Studio 0.0.4
Loading...
Searching...
No Matches
LeiEntityPicker.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 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_LEI_ENTITY_PICKER_HPP
21#define ORES_QT_LEI_ENTITY_PICKER_HPP
22
23#include <QWidget>
24#include <QLineEdit>
25#include <QComboBox>
26#include <QTableView>
27#include <QLabel>
28#include <QStandardItemModel>
29#include <QSortFilterProxyModel>
30#include "ores.qt/ClientManager.hpp"
31#include "ores.logging/make_logger.hpp"
32
33namespace ores::qt {
34
42class LeiEntityPicker final : public QWidget {
43 Q_OBJECT
44
45private:
46 inline static std::string_view logger_name =
47 "ores.qt.lei_entity_picker";
48
49 [[nodiscard]] static auto& lg() {
50 using namespace ores::logging;
51 static auto instance = make_logger(logger_name);
52 return instance;
53 }
54
55public:
56 explicit LeiEntityPicker(ClientManager* clientManager,
57 QWidget* parent = nullptr);
58
63 QString selectedLei() const;
64
69 QString selectedName() const;
70
74 bool hasSelection() const;
75
79 void load();
80
81signals:
87 void entitySelected(const QString& lei, const QString& name);
88
93
98 void loadCompleted(int entityCount);
99
104 void loadFailed(const QString& errorMessage);
105
106private slots:
107 void onSearchTextChanged(const QString& text);
108 void onCountryFilterChanged(int index);
109 void onSelectionChanged();
110
111private:
112 void setupUI();
113 void applyFilters();
114 void loadEntitiesForCountry(const QString& country);
115
116 ClientManager* clientManager_;
117 QLineEdit* searchEdit_;
118 QComboBox* countryFilter_;
119 QTableView* tableView_;
120 QStandardItemModel* model_;
121 QSortFilterProxyModel* proxyModel_;
122 QLabel* statusLabel_;
123 QString selectedLei_;
124 QString selectedName_;
125 bool countriesLoaded_ = false;
126};
127
128}
129
130#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
Reusable widget for searching and selecting an LEI entity.
Definition LeiEntityPicker.hpp:42
bool hasSelection() const
Check whether an entity is currently selected.
Definition LeiEntityPicker.cpp:138
void selectionCleared()
Emitted when the selection is cleared.
void load()
Trigger an asynchronous load of LEI entities from the server.
Definition LeiEntityPicker.cpp:142
QString selectedName() const
Get the entity legal name of the currently selected entity.
Definition LeiEntityPicker.cpp:134
void loadCompleted(int entityCount)
Emitted when entities are successfully loaded from the server.
QString selectedLei() const
Get the LEI of the currently selected entity.
Definition LeiEntityPicker.cpp:130
void entitySelected(const QString &lei, const QString &name)
Emitted when the user selects an entity.
void loadFailed(const QString &errorMessage)
Emitted when loading entities fails.