Documentation for OpenFLUID 2.2.2
Loading...
Searching...
No Matches
WaresSrcImportDialog.hpp
Go to the documentation of this file.
1/*
2
3 This file is part of OpenFLUID software
4 Copyright(c) 2021-2026, INRAE
5
6
7 == GNU General Public License Usage ==
8
9 OpenFLUID is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 OpenFLUID is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21
22
23 == Other Usage ==
24
25 Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26 license, and requires a written agreement between You and INRA.
27 Licensees for Other Usage of OpenFLUID may use this file in accordance
28 with the terms contained in the written agreement between You and INRA.
29
30 */
31
32/**
33 @file WaresSrcImportDialog.hpp
34
35 @author Aline LIBRES <aline.libres@gmail.com>
36 @author Armel THÖNI <armel.thoni@inra.fr>
37 */
38
39
40#ifndef __OPENFLUID_UIWARESDEV_WARESSRCIMPORTDIALOG_HPP__
41#define __OPENFLUID_UIWARESDEV_WARESSRCIMPORTDIALOG_HPP__
42
43
44#include <QListWidget>
45#include <QAbstractButton>
46#include <QButtonGroup>
47#include <QLabel>
48#include <QLineEdit>
49#include <QPushButton>
50
52#include <openfluid/ware/TypeDefs.hpp>
53#include <openfluid/config.hpp>
57
58
59namespace Ui {
60class WaresSrcImportDialog;
61}
62
63
64namespace openfluid { namespace ui { namespace waresdev {
65
66
67class WaresDevImportPackage;
68class WaresImportWorker;
69
70
72{
73 Q_OBJECT
74
75 private slots :
76
77 bool check();
78
79 void onSourceChanged(QAbstractButton* ClickedButton);
80
81 void onPackagePathButtonClicked();
82
83 void onWaresListRefreshAsked();
84
85 void onSelectFromFileClicked();
86
87 void onSelectToFileClicked();
88
89 void updateWareSelectionCount();
90
91
92 private:
93 std::map<openfluid::ware::WareType, QListWidget*> m_ListWidgetsByWareType;
94
95 std::map<openfluid::ware::WareType, std::map<openfluid::ware::WareID_t, QListWidgetItem*>> m_MapWidgetHub;
96 std::map<openfluid::ware::WareType, std::map<openfluid::ware::WareID_t, QListWidgetItem*>> m_MapWidgetPackage;
97
98 Ui::WaresSrcImportDialog* ui;
99
100 QButtonGroup m_SourceBtGroup;
101
102 QString m_PackagePathLabelDefault = "<i>No package selected</i>";
103
104
105 std::map<openfluid::ware::WareType, WaresImportFilterWidget*> m_FilterWidgetsByWareType;
106
107 std::map<QString, openfluid::ware::WareType> m_WareTypeConverter = {
108 { QString::fromStdString(openfluid::config::SIMULATORS_PATH), openfluid::ware::WareType::SIMULATOR },
109 { QString::fromStdString(openfluid::config::OBSERVERS_PATH), openfluid::ware::WareType::OBSERVER },
110 { QString::fromStdString(openfluid::config::BUILDEREXTS_PATH), openfluid::ware::WareType::BUILDEREXT } };
111
112 WaresDevImportPackage* mp_ImportFilePkg = nullptr;
113
114 QMap<openfluid::ware::WareType, QStringList> m_AlreadySelectedHubWares;
115
116 BranchMap_t m_BranchByURL;
117
118 std::map<openfluid::ware::WareType, openfluid::thirdparty::json> m_WaresNotFoundByType;
119
120 void updatePackageInfo();
121
122 void updatePackageWaresList();
123
124 void setItemChangedConnection(bool Connect);
125
126 void toggleCheckSelectedWares(const QStringList& SelectedWares, bool Check);
127
128 QStringList getSelectedWares();
129
130 openfluid::utils::FluidHubAPIClient::WaresDetailsByID_t getAllAvailableWaresWithDetails(
132
133 std::map<openfluid::ware::WareType, QStringList> getSelectedWaresByType(bool AsID=false);
134
135 bool wareItemDisplay(const openfluid::ware::WareType Type, const QString WareId, QListWidgetItem* Item);
136
137 bool isWareDisplayed(const openfluid::ware::WareType& Type, const QString WareId, const bool WareInWorkspace,
138 const bool WareNotAuthorized);
139
140 protected slots:
141
143
145
146
147 protected:
148
149 QLineEdit* hubUrlLineEdit();
150
151 QLineEdit* usernameLineEdit();
152
153 QLineEdit* passwordLineEdit();
154
155 QPushButton* hubConnectButton();
156
157 QPushButton* hubLoginButton();
158
160
162
164
165 void customHideWidget(QWidget* Widget);
166
168
169
170 public:
171
172 explicit WaresSrcImportDialog(QWidget* Parent);
173
175
176
177};
178
179
180} } } //namespaces
181
182
183#endif /* __OPENFLUID_UIWARESDEV_WARESSRCIMPORTDIALOG_HPP__ */
Definition AbstractSrcImportDialog.hpp:68
Definition WaresDevPackage.hpp:152
Definition WaresSrcImportDialog.hpp:72
std::map< openfluid::ware::WareID_t, WareDetailedDescription > WaresDetailsByID_t
Definition FluidHubAPIClient.hpp:80
#define OPENFLUID_API
Definition dllexport.hpp:86
Definition AboutDialog.hpp:51
std::map< std::string, std::string > BranchMap_t
Definition GitImportWorker.hpp:56
WareType
Definition TypeDefs.hpp:61
Definition ApplicationException.hpp:47