ORE Studio 0.0.4
Loading...
Searching...
No Matches
ReportDefinitionController.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_REPORT_DEFINITION_CONTROLLER_HPP
21#define ORES_QT_REPORT_DEFINITION_CONTROLLER_HPP
22
23#include <vector>
24#include <QMdiArea>
25#include <QMainWindow>
26#include <boost/uuid/uuid.hpp>
27#include "ores.qt/EntityController.hpp"
28#include "ores.qt/ClientManager.hpp"
29#include "ores.logging/make_logger.hpp"
30#include "ores.reporting.api/domain/report_definition.hpp"
31#include "ores.qt/EntityListMdiWindow.hpp"
32
33namespace ores::qt {
34
35class BadgeCache;
36class ReportDefinitionMdiWindow;
37class DetachableMdiSubWindow;
38class ChangeReasonCache;
39
47 Q_OBJECT
48
49private:
50 inline static std::string_view logger_name =
51 "ores.qt.report_definition_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 ChangeReasonCache* changeReasonCache,
65 BadgeCache* badgeCache,
66 const QString& username,
67 QObject* parent = nullptr);
68
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 onNotificationReceived(const QString& eventType, const QDateTime& timestamp,
84 const QStringList& entityIds, const QString& tenantId);
85 void onShowDetails(const reporting::domain::report_definition& definition);
86 void onAddNewRequested();
87 void onShowHistory(const reporting::domain::report_definition& definition);
88 void onRevertVersion(const reporting::domain::report_definition& definition);
89 void onOpenVersion(const reporting::domain::report_definition& definition,
90 int versionNumber);
91 void onScheduleRequested(const std::vector<boost::uuids::uuid>& ids);
92 void onUnscheduleRequested(const std::vector<boost::uuids::uuid>& ids);
93
94private:
95 void showAddWindow();
96 void showDetailWindow(const reporting::domain::report_definition& definition);
97 void showHistoryWindow(const reporting::domain::report_definition& definition);
98
99 ChangeReasonCache* changeReasonCache_;
100 BadgeCache* badgeCache_;
101 ReportDefinitionMdiWindow* 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
Controller for managing report definition windows and operations.
Definition ReportDefinitionController.hpp:46
void closeAllWindows() override
Closes all windows managed by this controller. Must be implemented by derived classes.
Definition ReportDefinitionController.cpp:147
void reloadListWindow() override
Reloads the list window. Must be implemented by derived classes.
Definition ReportDefinitionController.cpp:163
EntityListMdiWindow * listWindow() const override
Returns the list window for marking as stale on notifications.
Definition ReportDefinitionController.cpp:433
void showListWindow() override
Shows the main list window for this entity. Must be implemented by derived classes.
Definition ReportDefinitionController.cpp:92
MDI window for displaying and managing report definitions.
Definition ReportDefinitionMdiWindow.hpp:45
Persistent template for a scheduled report.
Definition report_definition.hpp:44