ORE Studio 0.0.4
Loading...
Searching...
No Matches
PartyPickerDialog.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_PARTYPICKERDIALOG_HPP
21#define ORES_QT_PARTYPICKERDIALOG_HPP
22
23#include <vector>
24#include <QDialog>
25#include <QLabel>
26#include <QLineEdit>
27#include <QComboBox>
28#include <QRadioButton>
29#include <QTimer>
30#include <QTreeWidget>
31#include <QPushButton>
32#include <boost/uuid/uuid.hpp>
33#include "ores.qt/ClientManager.hpp"
34#include "ores.qt/export.hpp"
35
36namespace ores::qt {
37
38class ImageCache;
39
48class ORES_QT_API PartyPickerDialog : public QDialog {
49 Q_OBJECT
50
51public:
52 explicit PartyPickerDialog(
53 const std::vector<PartyInfo>& parties,
54 ClientManager* clientManager,
55 ImageCache* imageCache,
56 QWidget* parent = nullptr);
57
58 boost::uuids::uuid selectedPartyId() const;
59 QString selectedPartyName() const;
60
61private slots:
62 void onOkClicked();
63
64private:
65 enum Role {
66 BusinessCentreRole = Qt::UserRole,
67 PartyNameRole,
68 PartyIdRole
69 };
70
71private:
72 void setupUi();
73 void populateCentreCombo();
74 void applyFilter();
75 void selectSystemParty();
76 void selectOperationalItem(QTreeWidgetItem* item);
77 QTreeWidgetItem* firstVisibleItem() const;
78 void refreshFlagIcons();
79
80private:
81 ClientManager* clientManager_;
82 ImageCache* imageCache_;
83 std::vector<PartyInfo> parties_;
84
85 // System-party section (hidden when no system party is available)
86 QRadioButton* systemRadio_;
87
88 // Operational-party section
89 QRadioButton* operationalRadio_;
90 QWidget* operationalContent_;
91 QLineEdit* filterEdit_;
92 QComboBox* centreCombo_;
93 QTreeWidget* listWidget_;
94
95 QPushButton* okButton_;
96 QPushButton* cancelButton_;
97 QTimer* flagRefreshTimer_;
98
99 // Tracks which party is currently selected
100 boost::uuids::uuid selectedId_;
101 QString selectedName_;
102};
103
104}
105
106#endif
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
Cache for dynamically loaded images (flags, icons) from the server.
Definition ImageCache.hpp:54
Modal dialog for selecting a party from a list of available parties.
Definition PartyPickerDialog.hpp:48