00001
00002
00003
00004
00005 #ifndef BALL_VIEW_DIALOGS_DOWNLOADPDBFILE_H
00006 #define BALL_VIEW_DIALOGS_DOWNLOADPDBFILE_H
00007
00008 #ifndef BALL_COMMON_GLOBAL_H
00009 # include <BALL/COMMON/global.h>
00010 #endif
00011
00012 #ifndef BALL_VIEW_KERNEL_MODULARWIDGET_H
00013 # include <BALL/VIEW/KERNEL/modularWidget.h>
00014 #endif
00015
00016 #ifndef BALL_DATATYPE_HASHSET_H
00017 # include <BALL/DATATYPE/hashSet.h>
00018 #endif
00019
00020 #include <BALL/VIEW/UIC/ui_downloadPDBFile.h>
00021
00022 #include <QtNetwork/QNetworkReply>
00023
00024 class QProgressBar;
00025 class QNetworkAccessManager;
00026
00027 namespace BALL
00028 {
00029 namespace VIEW
00030 {
00034 class BALL_VIEW_EXPORT DownloadPDBFile
00035 : public QDialog,
00036 public Ui_DownloadPDBFileData,
00037 public ModularWidget
00038 {
00039 Q_OBJECT
00040 public:
00041 BALL_EMBEDDABLE(DownloadPDBFile, ModularWidget)
00042
00043
00044 DownloadPDBFile(QWidget* parent = 0, const char* name = "DownloadPDBFileDialog",
00045 bool modal = FALSE, Qt::WFlags fl = 0 );
00046
00048 ~DownloadPDBFile();
00049
00051 virtual void initializeWidget(VIEW::MainControl& main_control);
00052
00054 virtual void fetchPreferences(INIFile& inifile);
00055
00057 virtual void writePreferences(INIFile& inifile);
00058
00062 void setPrefix(String s) { prefix_ = s;}
00063
00067 void setSuffix(String s) { suffix_ = s;}
00068
00070 void checkMenu(MainControl& mc);
00071
00072 public slots:
00073
00075 void slotDownload();
00076
00078 void idChanged();
00079
00081 virtual void abort();
00082
00084 void downloadFinished();
00085
00087 void downloadProgress(qint64 received, qint64 total);
00088
00089 protected:
00090
00091
00092 void downloadStarted_();
00093
00094
00095 void downloadEnded_();
00096
00097 bool threadedDownload_(const String& url);
00098 void removeFile_(const String& filename);
00099
00100 bool aborted_;
00101 bool error_;
00102
00103 HashMap<String, QImage> image_cache_;
00104
00105
00106 HashSet<String> unsupported_images_;
00107
00108 QAction* menu_id_;
00109 String prefix_, suffix_;
00110
00111
00112 QNetworkReply* current_reply_;
00113
00114
00115 QProgressBar* progress_bar_;
00116 QNetworkAccessManager* network_manager_;
00117 };
00118
00119 }
00120 }
00121 #endif