ORE Studio 0.0.4
Loading...
Searching...
No Matches
ClientDatasetDependencyModel.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_CLIENT_DATASET_DEPENDENCY_MODEL_HPP
21#define ORES_QT_CLIENT_DATASET_DEPENDENCY_MODEL_HPP
22
23#include <QAbstractTableModel>
24#include <vector>
25#include "ores.dq/domain/dataset_dependency.hpp"
26#include "ores.qt/ClientManager.hpp"
27#include "ores.logging/make_logger.hpp"
28
29namespace ores::qt {
30
37class ClientDatasetDependencyModel : public QAbstractTableModel {
38 Q_OBJECT
39
40private:
41 inline static std::string_view logger_name =
42 "ores.qt.client_dataset_dependency_model";
43
44 [[nodiscard]] static auto& lg() {
45 using namespace ores::logging;
46 static auto instance = make_logger(logger_name);
47 return instance;
48 }
49
50public:
51 enum Column {
52 DatasetCode = 0,
53 DependencyCode,
54 Role,
55 RecordedBy,
56 RecordedAt,
57 ColumnCount
58 };
59
60 explicit ClientDatasetDependencyModel(ClientManager* clientManager,
61 QObject* parent = nullptr);
62
63 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
64 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
65 QVariant data(const QModelIndex& index,
66 int role = Qt::DisplayRole) const override;
67 QVariant headerData(int section, Qt::Orientation orientation,
68 int role = Qt::DisplayRole) const override;
69
70 void loadData();
71 void loadDataByDataset(const std::string& dataset_code);
72
73 const std::vector<dq::domain::dataset_dependency>& dependencies() const;
74
81 std::vector<dq::domain::dataset_dependency>
82 dependenciesForDataset(const std::string& dataset_code) const;
83
84signals:
85 void loadStarted();
86 void loadFinished();
87 void errorOccurred(const QString& message, const QString& details = {});
88
89private:
90 ClientManager* clientManager_;
91 std::vector<dq::domain::dataset_dependency> dependencies_;
92};
93
94}
95
96#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:35
Table model for displaying dataset dependencies.
Definition ClientDatasetDependencyModel.hpp:37
std::vector< dq::domain::dataset_dependency > dependenciesForDataset(const std::string &dataset_code) const
Gets dependencies for a specific dataset from the loaded data.
Definition ClientDatasetDependencyModel.cpp:311
Manages the lifecycle of the network client and IO context.
Definition ClientManager.hpp:90