BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
pubchemDialog.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_VIEW_DIALOGSPUBCHEMDIALOG_H
6 #define BALL_VIEW_DIALOGSPUBCHEMDIALOG_H
7 
8 #ifndef BALL_COMMON_GLOBAL_H
9 # include <BALL/COMMON/global.h>
10 #endif
11 
12 #ifndef BALL_VIEW_KERNEL_MODULARWIDGET_H
14 #endif
15 
16 #ifndef BALL_STRUCTURE_SMILESPARSER_H
18 #endif
19 
20 #include <QtGui/QDialog>
21 
22 #include <map>
23 #include <boost/unordered_map.hpp>
24 
25 class QNetworkAccessManager;
26 class QNetworkReply;
27 
28 class QTreeWidgetItem;
29 
30 namespace Ui
31 {
32  class PubChemDialogData;
33 }
34 
35 namespace BALL
36 {
37  namespace VIEW
38  {
42  : public QDialog,
43  public ModularWidget
44  {
45  Q_OBJECT
46 
47  public:
48 
50 
51 
52  PubChemDialog ( QWidget* parent = NULL, const char* name = "PubChemDialog" );
53 
55  virtual ~PubChemDialog();
56 
58  virtual void initializeWidget ( MainControl& main_control );
59 
61  virtual void checkMenu ( MainControl& main_control );
62 
64  void generateFromSMILES ( const String& SMILES );
65  public slots:
66 
68  void show();
69 
71  void generateButtonClicked();
72 
74  void queryPubChem();
75 
77  void switchView ( QTreeWidgetItem* item, int column );
78 
80  void clearEntries();
81 
83  void finished();
84 
86  void updateDownloadProgress ( qint64 done, qint64 total );
87 
89  void downloadFinished ( QNetworkReply* reply );
90 
91  protected:
92  Ui::PubChemDialogData* ui_;
93 
95 
97  {
98  QString name;
99  QString description;
101  };
102 
104  LONG, SHORT
105  };
106 
107  void insert_ ( ParsedResult_ d, QTreeWidgetItem* parent, bool plot );
108  bool handleDownloadError_ ( QNetworkReply* reply);
109  void buildInformationTemplates_();
110  QString buildHeaderTemplate_(InfoDisplayStyle style, const char* str) const;
111 
112  std::map<QTreeWidgetItem*, System*> sd_systems_;
113  std::map<QTreeWidgetItem*, System*> original_systems_;
114  std::map<QTreeWidgetItem*, ParsedResult_> descriptions_;
115 
116  QAction* action1_, *action2_;
117 
119  boost::unordered_map<String, QString> information_templates_;
120 
122  QNetworkAccessManager* network_manager_;
123  };
124 
125  }
126 }
127 #endif