ORE Studio 0.0.4
Loading...
Searching...
No Matches
BadgeSeverityMdiWindow.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_BADGE_SEVERITY_MDI_WINDOW_HPP
21#define ORES_QT_BADGE_SEVERITY_MDI_WINDOW_HPP
22
23#include <QToolBar>
24#include <QTableView>
25#include <QSortFilterProxyModel>
26#include "ores.qt/EntityListMdiWindow.hpp"
27#include "ores.qt/ClientManager.hpp"
28#include "ores.qt/ClientBadgeSeverityModel.hpp"
29#include "ores.qt/PaginationWidget.hpp"
30#include "ores.logging/make_logger.hpp"
31#include "ores.dq/domain/badge_severity.hpp"
32
33namespace ores::qt {
34
42 Q_OBJECT
43
44private:
45 inline static std::string_view logger_name =
46 "ores.qt.badge_severity_mdi_window";
47
48 [[nodiscard]] static auto& lg() {
49 using namespace ores::logging;
50 static auto instance = make_logger(logger_name);
51 return instance;
52 }
53
54public:
56 ClientManager* clientManager,
57 const QString& username,
58 QWidget* parent = nullptr);
59 ~BadgeSeverityMdiWindow() override = default;
60
61signals:
62 void statusChanged(const QString& message);
63 void errorOccurred(const QString& error_message);
64 void showSeverityDetails(const dq::domain::badge_severity& severity);
65 void addNewRequested();
66 void severityDeleted(const QString& code);
67 void showSeverityHistory(const dq::domain::badge_severity& severity);
68
69public slots:
70 void addNew();
71 void editSelected();
72 void deleteSelected();
73 void viewHistorySelected();
74
75private slots:
76 void onDataLoaded();
77 void onLoadError(const QString& error_message, const QString& details = {});
78 void onSelectionChanged();
79 void onDoubleClicked(const QModelIndex& index);
80
81protected:
82 void doReload() override;
83
84 QString normalRefreshTooltip() const override {
85 return tr("Refresh badge severities");
86 }
87
88private:
89 void setupUi();
90 void setupToolbar();
91 void setupTable();
92 void setupConnections();
93 void updateActionStates();
94
95 ClientManager* clientManager_;
96 QString username_;
97
98 QToolBar* toolbar_;
99 QTableView* tableView_;
101 QSortFilterProxyModel* proxyModel_;
102 PaginationWidget* paginationWidget_;
103
104 // Toolbar actions
105 QAction* reloadAction_;
106 QAction* addAction_;
107 QAction* editAction_;
108 QAction* deleteAction_;
109 QAction* historyAction_;
110};
111
112}
113
114#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Severity levels for badge visual classification.
Definition badge_severity.hpp:38
MDI window for displaying and managing badge severities.
Definition BadgeSeverityMdiWindow.hpp:41
void doReload() override
Subclass implementation of the reload operation.
Definition BadgeSeverityMdiWindow.cpp:179
QString normalRefreshTooltip() const override
Get the normal (non-stale) tooltip text for the refresh action.
Definition BadgeSeverityMdiWindow.hpp:84
Model for displaying badge severities fetched from the server.
Definition ClientBadgeSeverityModel.hpp:40
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
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