ORE Studio 0.0.4
Loading...
Searching...
No Matches
ReportDefinitionMdiWindow.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_MDI_WINDOW_HPP
21#define ORES_QT_REPORT_DEFINITION_MDI_WINDOW_HPP
22
23#include <vector>
24#include <QToolBar>
25#include <QTableView>
26#include <QSortFilterProxyModel>
27#include <boost/uuid/uuid.hpp>
28#include "ores.qt/EntityListMdiWindow.hpp"
29#include "ores.qt/ClientManager.hpp"
30#include "ores.qt/ClientReportDefinitionModel.hpp"
31#include "ores.qt/PaginationWidget.hpp"
32#include "ores.logging/make_logger.hpp"
33#include "ores.reporting.api/domain/report_definition.hpp"
34
35namespace ores::qt {
36
37class BadgeCache;
38
46 Q_OBJECT
47
48private:
49 inline static std::string_view logger_name =
50 "ores.qt.report_definition_mdi_window";
51
52 [[nodiscard]] static auto& lg() {
53 using namespace ores::logging;
54 static auto instance = make_logger(logger_name);
55 return instance;
56 }
57
58public:
60 ClientManager* clientManager,
61 const QString& username,
62 BadgeCache* badgeCache,
63 QWidget* parent = nullptr);
64 ~ReportDefinitionMdiWindow() override = default;
65
66public slots:
67 void doReload() override;
68
69signals:
70 void statusChanged(const QString& message);
71 void errorOccurred(const QString& error_message);
72 void showDefinitionDetails(const reporting::domain::report_definition& definition);
73 void addNewRequested();
74 void definitionDeleted(const QString& code);
75 void showDefinitionHistory(const reporting::domain::report_definition& definition);
76 void scheduleRequested(const std::vector<boost::uuids::uuid>& ids);
77 void unscheduleRequested(const std::vector<boost::uuids::uuid>& ids);
78
79public slots:
80 void addNew();
81 void editSelected();
82 void deleteSelected();
83 void viewHistorySelected();
84 void scheduleSelected();
85 void unscheduleSelected();
86
87private slots:
88 void onDataLoaded();
89 void onLoadError(const QString& error_message, const QString& details = {});
90 void onSelectionChanged();
91 void onDoubleClicked(const QModelIndex& index);
92
93protected:
94 QString normalRefreshTooltip() const override {
95 return tr("Refresh report definitions");
96 }
97
98private:
99 void setupUi();
100 void setupToolbar();
101 void setupTable();
102 void setupConnections();
103 void updateActionStates();
104
105 ClientManager* clientManager_;
106 QString username_;
107 BadgeCache* badgeCache_;
108
109 QToolBar* toolbar_;
110 QTableView* tableView_;
112 QSortFilterProxyModel* proxyModel_;
113 PaginationWidget* paginationWidget_;
114
115 // Toolbar actions
116 QAction* reloadAction_;
117 QAction* addAction_;
118 QAction* editAction_;
119 QAction* deleteAction_;
120 QAction* historyAction_;
121 QAction* scheduleAction_;
122 QAction* unscheduleAction_;
123};
124
125}
126
127#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
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
Model for displaying report definitions fetched from the server.
Definition ClientReportDefinitionModel.hpp:43
Base class for entity list MDI windows providing stale indicator support.
Definition EntityListMdiWindow.hpp:62
Widget providing pagination controls for data tables.
Definition PaginationWidget.hpp:39
MDI window for displaying and managing report definitions.
Definition ReportDefinitionMdiWindow.hpp:45
QString normalRefreshTooltip() const override
Get the normal (non-stale) tooltip text for the refresh action.
Definition ReportDefinitionMdiWindow.hpp:94
Persistent template for a scheduled report.
Definition report_definition.hpp:44