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#include "ores.qt/export.hpp"
33
34namespace ores::qt {
35
43class ORES_QT_API LeiEntityPicker final : public QWidget {
44 Q_OBJECT
45
46private:
47 inline static std::string_view logger_name =
48 "ores.qt.lei_entity_picker";
49
50 [[nodiscard]] static auto& lg() {
51 using namespace ores::logging;
52 static auto instance = make_logger(logger_name);
53 return instance;
54 }
55
56public:
57 explicit LeiEntityPicker(ClientManager* clientManager,
58 QWidget* parent = nullptr);
59
64 QString selectedLei() const;
65
70 QString selectedName() const;
71
75 bool hasSelection() const;
76
80 void load();
81
82signals:
88 void entitySelected(const QString& lei, const QString& name);
89
94
99 void loadCompleted(int entityCount);
100
105 void loadFailed(const QString& errorMessage);
106
107private slots:
108 void onSearchTextChanged(const QString& text);
109 void onCountryFilterChanged(int index);
110 void onSelectionChanged();
111
112private:
113 void setupUI();
114 void applyFilters();
115 void loadEntitiesForCountry(const QString& country);
116
117 ClientManager* clientManager_;
118 QLineEdit* searchEdit_;
119 QComboBox* countryFilter_;
120 QTableView* tableView_;
121 QStandardItemModel* model_;
122 QSortFilterProxyModel* proxyModel_;
123 QLabel* statusLabel_;
124 QString selectedLei_;
125 QString selectedName_;
126 bool countriesLoaded_ = false;
127};
128
129}
130
131#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:123
Reusable widget for searching and selecting an LEI entity.
Definition LeiEntityPicker.hpp:43
void selectionCleared()
Emitted when the selection is cleared.
void loadCompleted(int entityCount)
Emitted when entities are successfully loaded from the server.
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.