Documentation for OpenFLUID 2.2.0
WaresSrcImportDialog.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
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 
51 #include <openfluid/dllexport.hpp>
52 #include <openfluid/ware/TypeDefs.hpp>
53 #include <openfluid/config.hpp>
57 
58 
59 namespace Ui {
60 class WaresSrcImportDialog;
61 }
62 
63 
64 namespace openfluid { namespace ui { namespace waresdev {
65 
66 
67 class WaresDevImportPackage;
68 class 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 updateWareSelectionCount();
86 
87 
88  private:
89  std::map<openfluid::ware::WareType, QListWidget*> m_ListWidgetsByWareType;
90 
91  std::map<openfluid::ware::WareType, std::map<openfluid::ware::WareID_t, QListWidgetItem*>> m_MapWidgetHub;
92  std::map<openfluid::ware::WareType, std::map<openfluid::ware::WareID_t, QListWidgetItem*>> m_MapWidgetPackage;
93 
94  Ui::WaresSrcImportDialog* ui;
95 
96  QButtonGroup m_SourceBtGroup;
97 
98  QString m_PackagePathLabelDefault = "<i>No package selected</i>";
99 
100 
101  std::map<openfluid::ware::WareType, WaresImportFilterWidget*> m_FilterWidgetsByWareType;
102 
103  std::map<QString, openfluid::ware::WareType> m_WareTypeConverter = {
104  { QString::fromStdString(openfluid::config::SIMULATORS_PATH), openfluid::ware::WareType::SIMULATOR },
105  { QString::fromStdString(openfluid::config::OBSERVERS_PATH), openfluid::ware::WareType::OBSERVER },
106  { QString::fromStdString(openfluid::config::BUILDEREXTS_PATH), openfluid::ware::WareType::BUILDEREXT } };
107 
108  WaresDevImportPackage* mp_ImportFilePkg = nullptr;
109 
110  QMap<openfluid::ware::WareType, QStringList> m_AlreadySelectedHubWares;
111 
112  void updatePackageInfo();
113 
114  void updatePackageWaresList();
115 
116  void setItemChangedConnection(bool Connect);
117 
118  void toggleCheckSelectedWares(const QStringList& SelectedWares, bool Check);
119 
120  QStringList getSelectedWares();
121 
122  std::map<openfluid::ware::WareType, QStringList> getSelectedWaresByType();
123 
124  bool wareItemDisplay(const openfluid::ware::WareType Type, const QString WareId, QListWidgetItem* Item);
125 
126  bool isWareDisplayed(const openfluid::ware::WareType& Type, const QString WareId, const bool WareInWorkspace,
127  const bool WareNotAuthorized);
128 
129  protected slots:
130 
132 
134 
135 
136  protected:
137 
138  QLineEdit* hubUrlLineEdit();
139 
140  QLineEdit* usernameLineEdit();
141 
142  QLineEdit* passwordLineEdit();
143 
144  QPushButton* hubConnectButton();
145 
146  QPushButton* hubLoginButton();
147 
148  QLabel* hubUsernameLabel();
149 
151 
153 
154  void customHideWidget(QWidget* Widget);
155 
157 
158 
159  public:
160 
161  explicit WaresSrcImportDialog(QWidget* Parent);
162 
164 
165 
166 };
167 
168 
169 } } } //namespaces
170 
171 
172 #endif /* __OPENFLUID_UIWARESDEV_WARESSRCIMPORTDIALOG_HPP__ */
Definition: AbstractSrcImportDialog.hpp:68
Definition: WaresDevPackage.hpp:152
Definition: WaresSrcImportDialog.hpp:72
#define OPENFLUID_API
Definition: dllexport.hpp:86
Definition: AboutDialog.hpp:51
WareType
Definition: TypeDefs.hpp:61
Definition: ApplicationException.hpp:47