Manual for OpenFLUID 2.1.11

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 THONI <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 
48 #include <openfluid/dllexport.hpp>
49 #include <openfluid/ware/TypeDefs.hpp>
50 #include <openfluid/config.hpp>
53 
54 
55 namespace Ui {
56 class WaresSrcImportDialog;
57 }
58 
59 namespace openfluid { namespace waresdev {
60 class WaresDevImportPackage;
61 class FluidHubWaresImportWorker;
62 } }
63 
64 
65 namespace openfluid { namespace ui { namespace waresdev {
66 
67 
69 {
70  Q_OBJECT
71 
72  private slots :
73 
74  bool check();
75 
76  void onSourceChanged(QAbstractButton* ClickedButton);
77 
78  void onPackagePathButtonClicked();
79 
80  void onHubConnectButtonClicked();
81 
82  void onHubLoginButtonClicked();
83 
84  void import();
85 
86  void onWaresListRefreshAsked();
87 
88 
89  private:
90 
91  Ui::WaresSrcImportDialog* ui;
92 
93  bool m_IsConnectedToHub = false;
94  bool m_IsLoggedInHub = false;
95 
96  QButtonGroup m_SourceBtGroup;
97 
98  QString m_PackagePathLabelDefault = "<i>No package selected</i>";
99 
100  QList<QWidget*> m_HubLoginWidgets;
101  QList<QWidget*> m_HubLoginWidgetsAndButton;
102  QList<QWidget*> m_HubConnectionInfoWidgets;
103 
104 
105  QString m_HubButtonConnectLabel = tr("Connect");
106  QString m_HubButtonDisconnectLabel = tr("Disconnect");
107  QString m_HubButtonLoginLabel = tr("Log in");
108  QString m_HubButtonLogoutLabel = tr("Log out");
109 
110  std::map<openfluid::ware::WareType, QListWidget*> m_ListWidgetsByWareType;
111  std::map<openfluid::ware::WareType, WaresImportFilterWidget*> m_FilterWidgetsByWareType;
112 
113  std::map<QString, openfluid::ware::WareType> m_WareTypeConverter = {
114  { QString::fromStdString(openfluid::config::SIMULATORS_PATH), openfluid::ware::WareType::SIMULATOR },
115  { QString::fromStdString(openfluid::config::OBSERVERS_PATH), openfluid::ware::WareType::OBSERVER },
116  { QString::fromStdString(openfluid::config::BUILDEREXTS_PATH), openfluid::ware::WareType::BUILDEREXT } };
117 
118  openfluid::waresdev::WaresDevImportPackage* mp_ImportFilePkg = nullptr;
119 
120  openfluid::waresdev::FluidHubWaresImportWorker* mp_FluidHubWaresImportWorker = nullptr;
121 
122  QMap<openfluid::ware::WareType, QStringList> m_AlreadySelectedHubWares;
123 
124  void updatePackageInfo();
125 
126  bool isWareDisplayed(const openfluid::ware::WareType& Type, const QString WareId, const bool WareInWorkspace,
127  const bool WareNotAuthorized);
128 
129  void updatePackageWaresList();
130 
131  void updateHubWaresList();
132 
133  QStringList getSelectedWares();
134 
135  std::map<openfluid::ware::WareType, QStringList> getSelectedWaresByType();
136 
137 
138  public:
139 
140  explicit WaresSrcImportDialog(QWidget* Parent);
141 
143 
144 };
145 
146 
147 } } } //namespaces
148 
149 
150 #endif /* __OPENFLUID_UIWARESDEV_WARESSRCIMPORTDIALOG_HPP__ */
openfluid::ui::waresdev::WaresSrcImportDialog
Definition: WaresSrcImportDialog.hpp:68
Ui
Definition: AboutDialog.hpp:50
OPENFLUID_API
#define OPENFLUID_API
Definition: dllexport.hpp:86
openfluid::ware::WareType::BUILDEREXT
@ BUILDEREXT
openfluid::ware::WareType::OBSERVER
@ OBSERVER
openfluid::ware::WareType
WareType
Definition: TypeDefs.hpp:60
openfluid::ware::WareType::SIMULATOR
@ SIMULATOR
openfluid::waresdev::WaresDevImportPackage
Definition: WaresDevPackage.hpp:153
openfluid::ui::common::MessageDialog
Definition: MessageDialog.hpp:55
openfluid
Definition: ApplicationException.hpp:47
MessageDialog.hpp
dllexport.hpp
openfluid::waresdev::FluidHubWaresImportWorker
Definition: FluidHubWaresImportWorker.hpp:56
WaresImportFilterWidget.hpp