ORE Studio 0.0.4
Loading...
Searching...
No Matches
ChangeReasonCategoryMdiWindow.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 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_CHANGE_REASON_CATEGORY_MDI_WINDOW_HPP
21#define ORES_QT_CHANGE_REASON_CATEGORY_MDI_WINDOW_HPP
22
23#include <QAction>
24#include <QToolBar>
25#include <QTableView>
26#include <QSortFilterProxyModel>
27#include "ores.qt/EntityListMdiWindow.hpp"
28#include "ores.qt/ClientManager.hpp"
29#include "ores.qt/ClientChangeReasonCategoryModel.hpp"
30#include "ores.logging/make_logger.hpp"
31#include "ores.dq/domain/change_reason_category.hpp"
32
33namespace ores::qt {
34
42 Q_OBJECT
43
44private:
45 inline static std::string_view logger_name =
46 "ores.qt.change_reason_category_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 ~ChangeReasonCategoryMdiWindow() override = default;
60
61 QSize sizeHint() const override;
62
63public slots:
64 void reload() override;
65
66signals:
67 void statusChanged(const QString& message);
68 void errorOccurred(const QString& error_message);
69 void showCategoryDetails(const dq::domain::change_reason_category& category);
70 void addNewRequested();
71 void categoryDeleted(const QString& code);
72 void showCategoryHistory(const QString& code);
73
74public slots:
75 void addNew();
76 void editSelected();
77 void deleteSelected();
78 void viewHistorySelected();
79
80private slots:
81 void onDataLoaded();
82 void onLoadError(const QString& error_message, const QString& details = {});
83 void onSelectionChanged();
84 void onDoubleClicked(const QModelIndex& index);
85
86private slots:
87 void showHeaderContextMenu(const QPoint& pos);
88
89private:
90 void setupUi();
91 void setupToolbar();
92 void setupTable();
93 void setupColumnVisibility();
94 void setupConnections();
95 void updateActionStates();
96 void saveSettings();
97 void restoreSettings();
98
99 ClientManager* clientManager_;
100 QString username_;
101
102 QToolBar* toolbar_;
103 QTableView* tableView_;
105 QSortFilterProxyModel* proxyModel_;
106
107 // Toolbar actions
108 QAction* reloadAction_;
109 QAction* addAction_;
110 QAction* editAction_;
111 QAction* deleteAction_;
112 QAction* historyAction_;
113
114protected:
115 QString normalRefreshTooltip() const override {
116 return tr("Refresh change reason categories");
117 }
118};
119
120}
121
122#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:35
Groups change reasons into logical categories.
Definition change_reason_category.hpp:45
MDI window for displaying and managing change reason categories.
Definition ChangeReasonCategoryMdiWindow.hpp:41
QString normalRefreshTooltip() const override
Get the normal (non-stale) tooltip text for the refresh action.
Definition ChangeReasonCategoryMdiWindow.hpp:115
Model for displaying change reason categories fetched from the server.
Definition ClientChangeReasonCategoryModel.hpp:40
Manages the lifecycle of the network client and IO context.
Definition ClientManager.hpp:90
Base class for entity list MDI windows providing stale indicator support.
Definition EntityListMdiWindow.hpp:56