ORE Studio 0.0.4
Loading...
Searching...
No Matches
CodingSchemeAuthorityTypeMdiWindow.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_CODING_SCHEME_AUTHORITY_TYPE_MDI_WINDOW_HPP
21#define ORES_QT_CODING_SCHEME_AUTHORITY_TYPE_MDI_WINDOW_HPP
22
23#include <QTableView>
24#include <QToolBar>
25#include <QSortFilterProxyModel>
26#include "ores.qt/EntityListMdiWindow.hpp"
27#include "ores.qt/ClientManager.hpp"
28#include "ores.qt/ClientCodingSchemeAuthorityTypeModel.hpp"
29#include "ores.logging/make_logger.hpp"
30#include "ores.dq.api/domain/coding_scheme_authority_type.hpp"
31
32namespace ores::qt {
33
34class CodingSchemeAuthorityTypeMdiWindow final : public EntityListMdiWindow {
35 Q_OBJECT
36
37private:
38 inline static std::string_view logger_name =
39 "ores.qt.coding_scheme_authority_type_mdi_window";
40
41 [[nodiscard]] static auto& lg() {
42 using namespace ores::logging;
43 static auto instance = make_logger(logger_name);
44 return instance;
45 }
46
47public:
48 explicit CodingSchemeAuthorityTypeMdiWindow(ClientManager* clientManager,
49 const QString& username,
50 QWidget* parent = nullptr);
51 ~CodingSchemeAuthorityTypeMdiWindow() override = default;
52
53public slots:
54 void doReload() override;
55
56signals:
57 void statusChanged(const QString& message);
58 void errorOccurred(const QString& error_message);
59 void showAuthorityTypeDetails(const dq::domain::coding_scheme_authority_type& authorityType);
60 void showAuthorityTypeHistory(const QString& code);
61 void addNewRequested();
62
63private slots:
64 void onDataLoaded();
65 void onLoadError(const QString& error_message, const QString& details = {});
66 void onRowDoubleClicked(const QModelIndex& index);
67 void onAddClicked();
68 void onEditClicked();
69 void onDeleteClicked();
70 void onRefreshClicked();
71 void onSelectionChanged();
72 void onHistoryClicked();
73
74protected:
75 QString normalRefreshTooltip() const override {
76 return tr("Refresh authority types");
77 }
78
79private:
80 void setupUi();
81 void setupToolbar();
82 void setupConnections();
83 void updateActionStates();
84
85 ClientManager* clientManager_;
86 QString username_;
87 ClientCodingSchemeAuthorityTypeModel* model_;
88 QSortFilterProxyModel* proxyModel_;
89 QTableView* tableView_;
90 QToolBar* toolbar_;
91
92 QAction* addAction_;
93 QAction* editAction_;
94 QAction* deleteAction_;
95 QAction* refreshAction_;
96 QAction* historyAction_;
97};
98
99}
100
101#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Classifies coding schemes by the type of authority that defines them.
Definition coding_scheme_authority_type.hpp:41