ORE Studio 0.0.4
Loading...
Searching...
No Matches
AppVersionDetailDialog.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_APP_VERSION_DETAIL_DIALOG_HPP
21#define ORES_QT_APP_VERSION_DETAIL_DIALOG_HPP
22
23#include <QUrl>
24#include <QString>
25#include <vector>
26#include "ores.qt/ClientManager.hpp"
27#include "ores.qt/DetailDialogBase.hpp"
28#include "ores.logging/make_logger.hpp"
29#include "ores.compute.api/domain/app.hpp"
30#include "ores.compute.api/domain/app_version.hpp"
31#include "ores.compute.api/messaging/platform_protocol.hpp"
32
33namespace Ui {
34class AppVersionDetailDialog;
35}
36
37namespace ores::qt {
38
47 Q_OBJECT
48
49private:
50 inline static std::string_view logger_name =
51 "ores.qt.app_version_detail_dialog";
52
53 [[nodiscard]] static auto& lg() {
54 using namespace ores::logging;
55 static auto instance = make_logger(logger_name);
56 return instance;
57 }
58
59public:
60 explicit AppVersionDetailDialog(QWidget* parent = nullptr);
61 ~AppVersionDetailDialog() override;
62
63 void setClientManager(ClientManager* clientManager);
64 void setUsername(const std::string& username);
65 void setVersion(const compute::domain::app_version& app_version);
66 void setCreateMode(bool createMode);
67 void setReadOnly(bool readOnly);
68 void setHttpBaseUrl(const std::string& url);
69
70signals:
71 void app_versionSaved(const QString& code);
72 void app_versionDeleted(const QString& code);
73
74private slots:
75 void onSaveClicked();
76 void onDeleteClicked();
77 void onCodeChanged(const QString& text);
78 void onFieldChanged();
79 void onBrowsePackageClicked();
80 void onUploadPackageClicked();
81 void onAddPlatformClicked();
82 void onRemovePlatformClicked();
83
84protected:
85 QTabWidget* tabWidget() const override;
86 QWidget* provenanceTab() const override;
87 ProvenanceWidget* provenanceWidget() const override;
88 bool hasUnsavedChanges() const override { return hasChanges_; }
89
90private:
91 struct AppEntry {
92 std::string id; // UUID string
93 std::string name;
94 };
95
96 struct PlatformEntry {
97 std::string id; // UUID string
98 std::string code;
99 std::string display_name;
100 };
101
102 void setupUi();
103 void setupConnections();
104 void loadApps();
105 void loadPlatforms();
106 void populateAppCombo();
107 void populatePlatformsTab();
108 void updateUiFromVersion();
109 void updateVersionFromUi();
110 void updateSaveButtonState();
111 bool validateInput();
112
113 Ui::AppVersionDetailDialog* ui_;
114 ClientManager* clientManager_;
115 std::string username_;
116 QUrl httpBaseUrl_;
117 compute::domain::app_version app_version_;
118 std::vector<AppEntry> appEntries_;
119 std::vector<PlatformEntry> availablePlatforms_;
120 QString selectedPackageFilePath_;
121 bool createMode_{true};
122 bool readOnly_{false};
123 bool hasChanges_{false};
124};
125
126}
127
128#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
A versioned wrapper+engine bundle for a compute grid application.
Definition app_version.hpp:37
Detail dialog for viewing and editing app version records.
Definition AppVersionDetailDialog.hpp:46
ProvenanceWidget * provenanceWidget() const override
Returns the promoted ProvenanceWidget (named "provenanceWidget" in .ui).
Definition AppVersionDetailDialog.cpp:70
bool hasUnsavedChanges() const override
Definition AppVersionDetailDialog.hpp:88
QTabWidget * tabWidget() const override
Returns the dialog's QTabWidget (named "tabWidget" in .ui).
Definition AppVersionDetailDialog.cpp:62
QWidget * provenanceTab() const override
Returns the Provenance tab widget (named "provenanceTab" in .ui).
Definition AppVersionDetailDialog.cpp:66
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
Base class for all detail dialogs.
Definition DetailDialogBase.hpp:74
Widget displaying the 6 standard record provenance fields.
Definition ProvenanceWidget.hpp:39