ORE Studio 0.0.4
Loading...
Searching...
No Matches
RoleMdiWindow.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_ROLE_MDI_WINDOW_HPP
21#define ORES_QT_ROLE_MDI_WINDOW_HPP
22
23#include <QTableView>
24#include <QVBoxLayout>
25#include <QToolBar>
26#include <QSortFilterProxyModel>
27#include <memory>
28#include "ores.qt/EntityListMdiWindow.hpp"
29#include "ores.qt/ClientManager.hpp"
30#include "ores.logging/make_logger.hpp"
31#include "ores.qt/ClientRoleModel.hpp"
32
33namespace ores::qt {
34
42 Q_OBJECT
43
44private:
45 inline static std::string_view logger_name =
46 "ores.qt.role_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:
55 explicit RoleMdiWindow(ClientManager* clientManager,
56 const QString& username,
57 QWidget* parent = nullptr);
58 ~RoleMdiWindow() override;
59
60 ClientRoleModel* roleModel() const { return roleModel_.get(); }
61
62 QSize sizeHint() const override;
63
64signals:
65 void statusChanged(const QString& message);
66 void errorOccurred(const QString& error_message);
67 void selectionChanged(int selection_count);
68 void showRoleDetails(const iam::domain::role& role);
69
70public slots:
71 void reload() override;
72 void viewSelected();
73
74protected:
75 QString normalRefreshTooltip() const override { return tr("Refresh roles"); }
76
77private slots:
78 void onDataLoaded();
79 void onLoadError(const QString& error_message, const QString& details = {});
80 void onRowDoubleClicked(const QModelIndex& index);
81 void onSelectionChanged();
82 void onConnectionStateChanged();
83
84private:
85 void updateActionStates();
86 void setupReloadAction();
87
88private:
89 QVBoxLayout* verticalLayout_;
90 QTableView* roleTableView_;
91 QToolBar* toolBar_;
92
93 QAction* reloadAction_;
94 QAction* viewAction_;
95
96 std::unique_ptr<ClientRoleModel> roleModel_;
97 QSortFilterProxyModel* proxyModel_;
98 ClientManager* clientManager_;
99 QString username_;
100};
101
102}
103
104#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:35
Represents a named collection of permissions that can be assigned to accounts.
Definition role.hpp:39
Manages the lifecycle of the network client and IO context.
Definition ClientManager.hpp:90
Model for displaying roles fetched from the server via client.
Definition ClientRoleModel.hpp:38
Base class for entity list MDI windows providing stale indicator support.
Definition EntityListMdiWindow.hpp:56
MDI window for displaying and managing roles.
Definition RoleMdiWindow.hpp:41
QString normalRefreshTooltip() const override
Get the normal (non-stale) tooltip text for the refresh action.
Definition RoleMdiWindow.hpp:75