ORE Studio 0.0.4
Loading...
Searching...
No Matches
ConnectionDetailPanel.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_CONNECTION_DETAIL_PANEL_HPP
21#define ORES_QT_CONNECTION_DETAIL_PANEL_HPP
22
23#include <QWidget>
24#include <QStackedWidget>
25#include <QLabel>
26#include <QVBoxLayout>
27#include <QFormLayout>
28#include <boost/uuid/uuid.hpp>
29#include "ores.connections/domain/folder.hpp"
30#include "ores.connections/domain/environment.hpp"
31#include "ores.connections/domain/connection.hpp"
32#include "ores.logging/make_logger.hpp"
33
34namespace ores::connections::service {
35class connection_manager;
36}
37
38namespace ores::qt {
39
49class ConnectionDetailPanel : public QWidget {
50 Q_OBJECT
51
52private:
53 inline static std::string_view logger_name =
54 "ores.qt.connection_detail_panel";
55
56 [[nodiscard]] static auto& lg() {
57 using namespace ores::logging;
58 static auto instance = make_logger(logger_name);
59 return instance;
60 }
61
62public:
63 explicit ConnectionDetailPanel(
65 QWidget* parent = nullptr);
66 ~ConnectionDetailPanel() override;
67
68 void showEmptyState();
69 void showFolder(const connections::domain::folder& folder, int itemCount);
70 void showEnvironment(const connections::domain::environment& env);
71 void showConnection(const connections::domain::connection& conn);
72
73private:
74 void setupEmptyPage();
75 void setupFolderPage();
76 void setupEnvironmentPage();
77 void setupConnectionPage();
78 void updateEnvironmentTagBadges(const boost::uuids::uuid& envId);
79 void updateConnectionTagBadges(const boost::uuids::uuid& connId,
80 const std::optional<boost::uuids::uuid>& envId);
81
83
84 QStackedWidget* stackedWidget_;
85
86 // Empty state page
87 QWidget* emptyPage_;
88
89 // Folder page
90 QWidget* folderPage_;
91 QLabel* folderNameLabel_;
92 QLabel* folderItemCountLabel_;
93 QLabel* folderDescriptionLabel_;
94
95 // Environment page (pure host+port, no credentials)
96 QWidget* environmentPage_;
97 QLabel* envNameLabel_;
98 QLabel* envHostLabel_;
99 QLabel* envPortLabel_;
100 QLabel* envHttpPortLabel_;
101 QLabel* envNamespaceLabel_;
102 QLabel* envDescriptionLabel_;
103 QWidget* envTagsContainer_;
104
105 // Connection page (credentials, optionally linked to environment)
106 QWidget* connectionPage_;
107 QLabel* connNameLabel_;
108 QLabel* connHostLabel_;
109 QLabel* connPortLabel_;
110 QLabel* connNamespaceLabel_;
111 QLabel* connUsernameLabel_;
112 QLabel* connDescriptionLabel_;
113 QWidget* connTagsContainer_;
114};
115
116}
117
118#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Represents a saved connection with credentials.
Definition connection.hpp:40
Represents a pure server environment (host + port only, no credentials).
Definition environment.hpp:39
Represents a folder for organizing server connections hierarchically.
Definition folder.hpp:35
High-level service for managing server connections and environments.
Definition connection_manager.hpp:53
Utilities for reading environment variables.
Definition environment.hpp:31
Detail panel showing read-only information about selected item.
Definition ConnectionDetailPanel.hpp:49