BALL  1.4.1
downloadElectronDensity.h
Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 
00004 #ifndef BALL_VIEW_DIALOGS_DOWNLOADELECTRONDENSITY_H
00005 #define BALL_VIEW_DIALOGS_DOWNLOADELECTRONDENSITY_H
00006 
00007 #include <BALL/VIEW/UIC/ui_downloadElectronDensity.h>
00008 
00009 #ifndef BALL_VIEW_KERNEL_MODULARWIDGET_H
00010 # include <BALL/VIEW/KERNEL/modularWidget.h>
00011 #endif
00012 
00013 #ifndef BALL_DATATYPE_HASHSET_H
00014 # include <BALL/DATATYPE/hashSet.h>
00015 #endif
00016 
00017 #include <BALL/VIEW/UIC/ui_downloadElectronDensity.h>
00018 
00019 #include <QtNetwork/QNetworkReply>
00020 
00021 class QProgressBar;
00022 class QNetworkAccessManager;
00023 
00024 namespace BALL
00025 {
00026   class TCPTransfer;
00027 
00028   namespace VIEW
00029   {
00030 
00035     class BALL_VIEW_EXPORT DownloadElectronDensity 
00036       : public QDialog,
00037         public Ui_DownloadElectronDensityData,
00038         public ModularWidget
00039     { 
00040         Q_OBJECT
00041       public:
00042         BALL_EMBEDDABLE(DownloadElectronDensity, ModularWidget)
00043         
00044         
00045         DownloadElectronDensity(QWidget* parent = 0, const char* name = "DownloadElectronDensityDialog", 
00046                         bool modal = FALSE, Qt::WFlags fl = 0 );
00047 
00049         ~DownloadElectronDensity();
00050 
00052         virtual void initializeWidget(VIEW::MainControl& main_control);
00053 
00055         virtual void fetchPreferences(INIFile& inifile);
00056 
00058         virtual void writePreferences(INIFile& inifile);
00059         
00063         void setEDSPrefix(String s) { eds_prefix_ = s;}
00064 
00068         void setEDSSuffix(String s) { eds_suffix_ = s;}
00069 
00073         void setEMDBPrefix(String s) { emdb_prefix_ = s;}
00074 
00078         void setEMDBSuffix(String s) { emdb_suffix_ = s;}
00079         
00081         void checkMenu(MainControl& mc);
00082       
00083       public slots:
00084 
00086         void slotDownload();
00087 
00089         void idChanged();
00090 
00092         void serverChanged();
00093 
00095         void typeChanged();
00096 
00098         void pdbDownloadChecked();
00099 
00101         virtual void abort();
00102 
00104         void downloadFinished();
00105 
00107         void downloadProgress(qint64 received, qint64 total);
00108 
00109       protected:
00110 
00111         //_
00112         void downloadStarted_();
00113 
00114         //_  
00115         void downloadEnded_();
00116 
00117         bool threadedDownload_(const String& url);
00118         void removeFile_(const String& filename);
00119 
00120         
00121         bool                    aborted_;
00122         bool                    error_;
00123 
00124         HashMap<String, QImage> image_cache_;
00125 
00126         // e.g. gif images if not supported
00127         HashSet<String>         unsupported_images_;
00128 
00129         QAction* menu_id_;
00130         String   eds_prefix_, eds_infix_, eds_suffix_; 
00131         String emdb_prefix_, emdb_infix_, emdb_suffix_;
00132         
00133         // the current network reply
00134         QNetworkReply* current_reply_;
00135 
00136         // the current progress bar
00137         QProgressBar*  progress_bar_;
00138         QNetworkAccessManager* network_manager_;
00139     };
00140 
00141   } 
00142 } //namespaces
00143 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines