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  @brief Header of ...
35 
36  @author Aline LIBRES <aline.libres@gmail.com>
37  */
38 
39 
40 #ifndef __OPENFLUID_UIWARESDEV_WARESSRCIMPORTDIALOG_HPP__
41 #define __OPENFLUID_UIWARESDEV_WARESSRCIMPORTDIALOG_HPP__
42 
43 
44 #include <QDialog>
45 #include <QListWidget>
46 #include <QAbstractButton>
47 #include <QButtonGroup>
48 
49 #include <openfluid/dllexport.hpp>
50 #include <openfluid/ware/TypeDefs.hpp>
51 #include <openfluid/config.hpp>
52 
53 
54 namespace Ui {
55 class WaresSrcImportDialog;
56 }
57 
58 namespace openfluid { namespace waresdev {
59 class WaresDevImportPackage;
60 class WaresHubImportWorker;
61 } }
62 
63 
64 namespace openfluid { namespace ui { namespace waresdev {
65 
66 
67 class OPENFLUID_API WaresSrcImportDialog: public QDialog
68 {
69  Q_OBJECT
70 
71  private slots :
72 
73  bool check();
74 
75  void onSourceChanged(QAbstractButton* ClickedButton);
76 
77  void onPackagePathButtonClicked();
78 
79  void onWareshubConnectButtonClicked();
80 
81  void import();
82 
83 
84  private:
85 
86  Ui::WaresSrcImportDialog* ui;
87 
88  QButtonGroup m_SourceBtGroup;
89 
90  QString m_PackagePathLabelDefault = "<i>No package selected</i>";
91 
92  QList<QWidget*> m_WaresHubConnectionInfoWidgets;
93 
94  QString m_WaresHubButtonDisconnectLabel = tr("Disconnect");
95 
96  std::map<openfluid::ware::WareType, QListWidget*> m_ListWidgetsByWareType;
97 
98  std::map<QString, openfluid::ware::WareType> m_WareTypeConverter = {
99  { QString::fromStdString(openfluid::config::SIMULATORS_PATH), openfluid::ware::WareType::SIMULATOR },
100  { QString::fromStdString(openfluid::config::OBSERVERS_PATH), openfluid::ware::WareType::OBSERVER },
101  { QString::fromStdString(openfluid::config::BUILDEREXTS_PATH), openfluid::ware::WareType::BUILDEREXT } };
102 
103  openfluid::waresdev::WaresDevImportPackage* mp_ImportFilePkg = nullptr;
104 
105  openfluid::waresdev::WaresHubImportWorker* mp_WaresHubImportWorker = nullptr;
106 
107  QMap<openfluid::ware::WareType, QStringList> m_AlreadySelectedWaresHubWares;
108 
109  void setMessage(const QString& Msg = "");
110 
111  void updatePackageInfo();
112 
113  void updatePackageWaresList();
114 
115  void updateWaresHubWaresList();
116 
117  QStringList getSelectedWares();
118 
119  std::map<openfluid::ware::WareType, QStringList> getSelectedWaresByType();
120 
121 
122  public:
123 
124  WaresSrcImportDialog(QWidget* Parent);
125 
127 
128 };
129 
130 
131 } } } //namespaces
132 
133 
134 #endif /* __OPENFLUID_UIWARESDEV_WARESSRCIMPORTDIALOG_HPP__ */
Definition: AboutDialog.hpp:51
Definition: WaresDevPackage.hpp:152
Definition: WaresSrcImportDialog.hpp:67
Definition: ApplicationException.hpp:47
Definition: WaresHubImportWorker.hpp:55
#define OPENFLUID_API
Definition: dllexport.hpp:87