BALL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
pubchemDownloader.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_FORMAT_PUBCHEMDOWNLOADER_H
6 #define BALL_FORMAT_PUBCHEMDOWNLOADER_H
7 
8 #ifndef BALL_SYSTEM_SIMPLEDOWNLOADER_H
10 #endif
11 
12 #include <QDomDocument>
13 
14 namespace BALL
15 {
17  : public QObject
18  {
19  Q_OBJECT
20 
21  public:
23  virtual ~PubChemDownloader() {};
24 
25  bool downloadSDF(const String& query, const String& filename, bool blocking = true);
26 
27  public slots:
28  void downloadFinished(bool error);
29  void dataTransferProgress(qint64 done, qint64 total);
30 
31  signals:
32  void downloadProgress(qint64 done, qint64 total);
33  void downloadFinished(const QString& filename);
34 
35  protected:
36  QDomDocument pollPubChem_(const QString& request_id);
37  void buildSimpleTree_(const String& names);
38  void addTextNode_(const String& value);
39 
42 
44  QDomDocument request_;
45  QDomElement last_node_;
46  QDomElement current_node_;
47 
48  QFile outfile_;
49  QFtp ftp_;
50  };
51 }
52 
53 #endif // BALL_FORMAT_PUBCHEMDOWNLOADER_H
54