BALL
1.4.1
|
00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 00005 #ifndef BALL_FORMAT_PUBCHEMDOWNLOADER_H 00006 #define BALL_FORMAT_PUBCHEMDOWNLOADER_H 00007 00008 #ifndef BALL_SYSTEM_SIMPLEDOWNLOADER_H 00009 # include <BALL/SYSTEM/simpleDownloader.h> 00010 #endif 00011 00012 #include <QDomDocument> 00013 00014 namespace BALL 00015 { 00016 class BALL_EXPORT PubChemDownloader 00017 : public QObject 00018 { 00019 Q_OBJECT 00020 00021 public: 00022 PubChemDownloader(); 00023 virtual ~PubChemDownloader() {}; 00024 00025 bool downloadSDF(const String& query, const String& filename, bool blocking = true); 00026 00027 public slots: 00028 void downloadFinished(bool error); 00029 void dataTransferProgress(qint64 done, qint64 total); 00030 00031 signals: 00032 void downloadProgress(qint64 done, qint64 total); 00033 void downloadFinished(const QString& filename); 00034 00035 protected: 00036 QDomDocument pollPubChem_(const QString& request_id); 00037 void buildSimpleTree_(const String& names); 00038 void addTextNode_(const String& value); 00039 00040 String esearch_base_url_; 00041 String pug_base_url_; 00042 00043 SimpleDownloader dl_; 00044 QDomDocument request_; 00045 QDomElement last_node_; 00046 QDomElement current_node_; 00047 00048 QFile outfile_; 00049 QFtp ftp_; 00050 }; 00051 } 00052 00053 #endif // BALL_FORMAT_PUBCHEMDOWNLOADER_H 00054