MarketPackWidget.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 /**
34  @file MarketPackWidget.hpp
35 
36  @author Jean-Christophe FABRE <jean-christophe.fabre@supagro.inra.fr>
37  */
38 
39 
40 #ifndef __OPENFLUID_UIMARKET_MARKETPACKWIDGET_HPP__
41 #define __OPENFLUID_UIMARKET_MARKETPACKWIDGET_HPP__
42 
43 
44 #include <QLabel>
45 #include <QGroupBox>
46 #include <QBoxLayout>
47 #include <QPushButton>
48 
49 #include <openfluid/dllexport.hpp>
51 
52 
53 namespace openfluid { namespace ui { namespace market {
54 
55 // =====================================================================
56 // =====================================================================
57 
58 class OPENFLUID_API MarketPackWidget : public QGroupBox
59 {
60  Q_OBJECT
61 
62  private:
63  QLabel *mp_EmptyCartImage;
64  QLabel *mp_FullCartImage;
65 
66  QLabel m_VersionLabel;
67 
68  void setWidgetColor(QWidget *Widget);
69 
70  //bool onButtonRelease(GdkEventButton* Event);
71 
72  protected:
75 
76  QLabel m_IDLabel;
78 
79  QHBoxLayout m_MainHBox;
80 
81  QPushButton m_InstallToggle;
82 
83  QVBoxLayout m_DetailsLeftVBox;
84  QVBoxLayout m_DetailsRightVBox;
85 
86  static QString replaceByUnknownIfEmpty(const QString& Str);
87 
88  static QString replaceByNoneIfEmpty(const QString& Str);
89 
90  protected slots:
91 
92  void onInstallModified();
93 
94  signals:
95 
96  void installModified(openfluid::ware::WareID_t);
97 
98  public:
100  const openfluid::market::MetaPackageInfo& MetaPackInfo);
101 
102  ~MarketPackWidget();
103 
104  QString getID() const { return QString::fromStdString(m_MetaPackInfo.ID); };
105 
106  bool isInstall() const { return m_InstallToggle.isChecked(); };
107 
108  void setInstall(bool Install) { m_InstallToggle.setChecked(Install); };
109 
110  /**
111  @return selected format in combobox
112  */
113  virtual openfluid::market::MetaPackageInfo::SelectionType getPackageFormat() const;
114 
115  /**
116  Creates tooltip for market pack widget
117  */
118  virtual void updateDisplayedInfos();
119 
120 };
121 
122 } } } // namespaces
123 
124 
125 #endif /* __OPENFLUID_UIMARKET_MARKETPACKWIDGET_HPP__ */
openfluid::market::MetaPackageInfo m_MetaPackInfo
Definition: MarketPackWidget.hpp:74
SelectionType
Definition: MarketInfos.hpp:128
PackageType
Definition: MarketInfos.hpp:93
std::string WareID_t
Definition: TypeDefs.hpp:50
bool isInstall() const
Definition: MarketPackWidget.hpp:106
QHBoxLayout m_MainHBox
Definition: MarketPackWidget.hpp:79
QString getID() const
Definition: MarketPackWidget.hpp:104
QLabel m_LicenseLabel
Definition: MarketPackWidget.hpp:77
QLabel m_IDLabel
Definition: MarketPackWidget.hpp:76
openfluid::ware::WareID_t ID
Definition: MarketInfos.hpp:130
QVBoxLayout m_DetailsLeftVBox
Definition: MarketPackWidget.hpp:83
Definition: MarketInfos.hpp:123
Definition: MarketPackWidget.hpp:58
Definition: ApplicationException.hpp:47
#define OPENFLUID_API
Definition: dllexport.hpp:87
QPushButton m_InstallToggle
Definition: MarketPackWidget.hpp:81
void setInstall(bool Install)
Definition: MarketPackWidget.hpp:108
QVBoxLayout m_DetailsRightVBox
Definition: MarketPackWidget.hpp:84
openfluid::market::PackageInfo::PackageType m_PackageType
Definition: MarketPackWidget.hpp:73