molecularFileDialog.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 
00005 #ifndef BALL_VIEW_DIALOGS_MOLECULARFILEDIALOG_H
00006 #define BALL_VIEW_DIALOGS_MOLECULARFILEDIALOG_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_VIEW_KERNEL_COMMON_H
00017 # include <BALL/VIEW/KERNEL/common.h>
00018 #endif
00019 
00020 class QMenu;
00021 
00022 namespace BALL
00023 {
00024   class System;
00025 
00026   namespace VIEW
00027   {
00028 
00045     class BALL_VIEW_EXPORT MolecularFileDialog
00046       : public QWidget,
00047         public ModularWidget
00048     {
00049       Q_OBJECT
00050       public:
00051       BALL_EMBEDDABLE(MolecularFileDialog, ModularWidget)
00052 
00053       
00056       MolecularFileDialog(QWidget* parent = 0, const char* name = "MolecularFileDialog");
00057 
00059       virtual ~MolecularFileDialog();
00060 
00067       virtual void initializeWidget(MainControl& main_control);
00068 
00074       virtual bool canHandle(const String& fileformat) const;
00075 
00080       virtual bool openFile(const String& filename);
00081 
00087       virtual System* openMolecularFile(const String& file);
00088 
00093       virtual System* openMolecularFile(const String& filename, 
00094                                         const String& filetype, 
00095                                         const String& system_name);
00096 
00097 
00099       System* openPDBFile();
00100 
00102       System* openHINFile();
00103 
00105       System* openMOLFile();
00106 
00108       System* openMOL2File();
00109 
00111       System* openSDFile();
00112 
00114       System* openXYZFile();
00115 
00118       System* readPDBFile(String filename, String system_name);
00119 
00122       System* readHINFile(String filename, String system_name);
00123 
00126       System* readMOLFile(String filename, String system_name);
00127 
00130       System* readMOL2File(String filename, String system_name);
00131 
00134       System* readSDFile(String filename, String system_name);
00135 
00138       System* readXYZFile(String filename, String system_name);
00139 
00142       bool writePDBFile(String filename, const System& system);
00143       
00146       bool writeHINFile(String filename, const System& system);
00147       
00150       bool writeMOLFile(String filename, const System& system);
00151       
00154       bool writeMOL2File(String filename, const System& system);
00155 
00158       bool writeSDFile(String filename, const System& system);
00159 
00162       bool writeXYZFile(String filename, const System& system);
00163       
00165       virtual void checkMenu(MainControl& main_control);
00166 
00168       virtual String getSupportedFileFormats() const;
00169 
00171       virtual String getSupportedFileFormatsList() const;
00172 
00173       void setReadPDBModels(bool read) { read_all_pdb_models_ = read; }
00174 
00175       public slots:
00176 
00184       virtual void readFiles();
00185 
00189       virtual bool writeFile();
00190 
00191 
00192       protected:
00193 
00194       virtual void onNotify(Message *message);
00195 
00196       // Only for Python interface
00197       MolecularFileDialog(const MolecularFileDialog& mfd);
00198 
00199 
00200       virtual bool finish_(const String& filename, const String& system_name, System* system);
00201 
00202       System* openFile_(String type);
00203 
00204       enum FileFormats
00205       {
00206         PDB_FILE = 0,
00207         HIN_FILE,
00208         MOL_FILE,
00209         MOL2_FILE,
00210         SD_FILE,
00211         XYZ_FILE
00212       };
00213 
00214       QAction* save_id_, *open_id_;
00215       String file_format_;
00216       bool read_all_pdb_models_;
00217     };
00218 
00219   } // namespace VIEW
00220 } // namespace BALL
00221 
00222 #endif // BALL_VIEW_DIALOGS_MOLECULARFILEDIALOG_H