ORE Studio 0.0.4
Loading...
Searching...
No Matches
CounterpartyController.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_COUNTERPARTY_CONTROLLER_HPP
21#define ORES_QT_COUNTERPARTY_CONTROLLER_HPP
22
23#include <QDateTime>
24#include <QMdiArea>
25#include <QMainWindow>
26#include "ores.qt/EntityController.hpp"
27#include "ores.qt/ClientManager.hpp"
28#include "ores.qt/ImageCache.hpp"
29#include "ores.logging/make_logger.hpp"
30#include "ores.refdata.api/domain/counterparty.hpp"
31#include "ores.qt/EntityListMdiWindow.hpp"
32
33namespace ores::qt {
34
35class BadgeCache;
36class ChangeReasonCache;
37class CounterpartyMdiWindow;
38class DetachableMdiSubWindow;
39
47 Q_OBJECT
48
49private:
50 inline static std::string_view logger_name =
51 "ores.qt.counterparty_controller";
52
53 [[nodiscard]] static auto& lg() {
54 using namespace ores::logging;
55 static auto instance = make_logger(logger_name);
56 return instance;
57 }
58
59public:
61 QMainWindow* mainWindow,
62 QMdiArea* mdiArea,
63 ClientManager* clientManager,
64 ImageCache* imageCache,
65 ChangeReasonCache* changeReasonCache,
66 BadgeCache* badgeCache,
67 const QString& username,
68 QObject* parent = nullptr);
69 ~CounterpartyController() override;
70
71 void showListWindow() override;
72 void closeAllWindows() override;
73 void reloadListWindow() override;
74
75signals:
76 void statusMessage(const QString& message);
77 void errorMessage(const QString& error);
78
79protected:
80 EntityListMdiWindow* listWindow() const override;
81
82private slots:
83 void onShowDetails(const refdata::domain::counterparty& counterparty);
84 void onAddNewRequested();
85 void onShowHistory(const refdata::domain::counterparty& counterparty);
86 void onRevertVersion(const refdata::domain::counterparty& counterparty);
87 void onOpenVersion(const refdata::domain::counterparty& counterparty,
88 int versionNumber);
89 void onNotificationReceived(const QString& eventType, const QDateTime& timestamp,
90 const QStringList& entityIds, const QString& tenantId);
91
92private:
93 void showAddWindow();
94 void showDetailWindow(const refdata::domain::counterparty& counterparty);
95 void showHistoryWindow(const refdata::domain::counterparty& counterparty);
96
97 ImageCache* imageCache_;
98 ChangeReasonCache* changeReasonCache_;
99 BadgeCache* badgeCache_;
100 CounterpartyMdiWindow* listWindow_;
101 DetachableMdiSubWindow* listMdiSubWindow_;
102};
103
104}
105
106#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Client-side cache of badge definitions and mappings.
Definition BadgeCache.hpp:46
Shared cache for change reasons used across all entity dialogs.
Definition ChangeReasonCache.hpp:47
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
Controller for managing counterparty windows and operations.
Definition CounterpartyController.hpp:46
void closeAllWindows() override
Closes all windows managed by this controller. Must be implemented by derived classes.
Definition CounterpartyController.cpp:153
void reloadListWindow() override
Reloads the list window. Must be implemented by derived classes.
Definition CounterpartyController.cpp:169
EntityListMdiWindow * listWindow() const override
Returns the list window for marking as stale on notifications.
Definition CounterpartyController.cpp:453
void showListWindow() override
Shows the main list window for this entity. Must be implemented by derived classes.
Definition CounterpartyController.cpp:102
MDI window for displaying and managing counterparties.
Definition CounterpartyMdiWindow.hpp:44
QMdiSubWindow that can be detached to become a floating window.
Definition DetachableMdiSubWindow.hpp:39
Abstract base class for entity controllers.
Definition EntityController.hpp:50
Base class for entity list MDI windows providing stale indicator support.
Definition EntityListMdiWindow.hpp:62
Cache for dynamically loaded images (flags, icons) from the server.
Definition ImageCache.hpp:53
An external trading partner participating in financial transactions.
Definition counterparty.hpp:37