ORE Studio 0.0.4
Loading...
Searching...
No Matches
PartyController.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_PARTY_CONTROLLER_HPP
21#define ORES_QT_PARTY_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/party.hpp"
31#include "ores.qt/EntityListMdiWindow.hpp"
32
33namespace ores::qt {
34
35class BadgeCache;
36class ChangeReasonCache;
37class PartyMdiWindow;
38class DetachableMdiSubWindow;
39
46class PartyController final : public EntityController {
47 Q_OBJECT
48
49private:
50 inline static std::string_view logger_name =
51 "ores.qt.party_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
70 ~PartyController() override;
71
72 void showListWindow() override;
73 void closeAllWindows() override;
74 void reloadListWindow() override;
75
76signals:
77 void statusMessage(const QString& message);
78 void errorMessage(const QString& error);
79
80protected:
81 EntityListMdiWindow* listWindow() const override;
82
83private slots:
84 void onShowDetails(const refdata::domain::party& party);
85 void onAddNewRequested();
86 void onShowHistory(const refdata::domain::party& party);
87 void onRevertVersion(const refdata::domain::party& party);
88 void onOpenVersion(const refdata::domain::party& party,
89 int versionNumber);
90 void onNotificationReceived(const QString& eventType, const QDateTime& timestamp,
91 const QStringList& entityIds, const QString& tenantId);
92
93private:
94 void showAddWindow();
95 void showDetailWindow(const refdata::domain::party& party);
96 void showHistoryWindow(const refdata::domain::party& party);
97
98 ImageCache* imageCache_;
99 ChangeReasonCache* changeReasonCache_;
100 BadgeCache* badgeCache_;
101 PartyMdiWindow* listWindow_;
102 DetachableMdiSubWindow* listMdiSubWindow_;
103};
104
105}
106
107#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
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
Controller for managing party windows and operations.
Definition PartyController.hpp:46
void closeAllWindows() override
Closes all windows managed by this controller. Must be implemented by derived classes.
Definition PartyController.cpp:153
void reloadListWindow() override
Reloads the list window. Must be implemented by derived classes.
Definition PartyController.cpp:169
EntityListMdiWindow * listWindow() const override
Returns the list window for marking as stale on notifications.
Definition PartyController.cpp:453
void showListWindow() override
Shows the main list window for this entity. Must be implemented by derived classes.
Definition PartyController.cpp:102
MDI window for displaying and managing parties.
Definition PartyMdiWindow.hpp:44
An internal legal entity participating in financial transactions.
Definition party.hpp:37