Documentation for OpenFLUID 2.2.0
HubManager.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 HubManager.hpp
34 
35  @author Armel THÖNI <armel.thoni@inra.fr>
36  */
37 
38 #ifndef __OPENFLUID_UIWARESDEV_HUBMANAGER_HPP__
39 #define __OPENFLUID_UIWARESDEV_HUBMANAGER_HPP__
40 
41 
42 #include <QObject>
43 #include <QApplication>
44 
47 
48 
49 namespace openfluid { namespace ui { namespace waresdev {
50 
51 
52 class OPENFLUID_API HubManager: public QObject
53 {
54  Q_OBJECT
55 
56  private:
57 
58  class HubConnectWorker;
59 
60  typedef std::map<openfluid::ware::WareType, openfluid::utils::FluidHubAPIClient::WaresDetailsByID_t>
61  WaresDetailsByIDByType_t;
62 
64 
65  std::string m_HubUrl = "";
66 
67  std::string m_Username = "";
68  std::string m_Password = "";
69 
70  bool m_IsLoggedIn;
71 
72  WaresDetailsByIDByType_t m_AvailableWaresDetailsByIDByType;
73 
75 
76 
77  signals:
78 
79  void info(const QString& Message);
80 
81  void error(const QString& Message);
82 
83  void finished(bool Ok, const QString& Message);
84 
85  void progressed(int Value);
86 
87 
88  public slots :
89 
91 
93 
94  bool login(const std::string& UserID, const std::string& Password);
95 
96  void logout();
97 
98 
99  public:
100 
101  void setUrl(std::string Url);
102 
103  bool isConnected() const;
104 
105  bool isLoggedIn() const;
106 
107  bool isV0ofAPI() const; // V0 is for Wareshub API, V1 is for Fluidhub API
108 
109  std::string getUsername() const;
110 
111  std::string getPassword() const;
112 
113  bool connectToHub();
114 
116  openfluid::ware::WareType Type) const;
117 
119 
121 
122  HubManager(std::string WareshubUrl);
123 
125 
126 
127 };
128 
129 
130 // =====================================================================
131 // =====================================================================
132 
133 
134 class HubManager::HubConnectWorker : public QObject
135 {
136  Q_OBJECT
137 
138  private:
139 
140  HubManager* mp_Parent;
141 
142 
143  signals:
144 
145  void finished(bool Ok, const QString& Message);
146 
147 
148  public slots :
149 
150  bool run();
151 
152 
153  public:
154 
156 
157 };
158 
159 } } } //namespaces
160 
161 #endif /* __OPENFLUID_UIWARESDEV_HUBMANAGER_HPP__ */
void finished(bool Ok, const QString &Message)
Definition: HubManager.hpp:53
void finished(bool Ok, const QString &Message)
HubManager(std::string WareshubUrl)
openfluid::utils::FluidHubAPIClient::WaresDetailsByID_t getAvailableFragmentsWithDetails() const
openfluid::utils::FluidHubAPIClient::WaresDetailsByID_t getAvailableWaresWithDetails(openfluid::ware::WareType Type) const
bool login(const std::string &UserID, const std::string &Password)
void info(const QString &Message)
void error(const QString &Message)
Definition: FluidHubAPIClient.hpp:58
std::map< openfluid::ware::WareID_t, WareDetailedDescription > WaresDetailsByID_t
Definition: FluidHubAPIClient.hpp:80
#define OPENFLUID_API
Definition: dllexport.hpp:86
WareType
Definition: TypeDefs.hpp:61
Definition: ApplicationException.hpp:47