00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_VIEW_DIALOGS_MOLECULARFILEDIALOG_H
00008 #define BALL_VIEW_DIALOGS_MOLECULARFILEDIALOG_H
00009
00010 #ifndef BALL_COMMON_GLOBAL_H
00011 # include <BALL/COMMON/global.h>
00012 #endif
00013
00014 #ifndef BALL_VIEW_KERNEL_MODULARWIDGET_H
00015 # include <BALL/VIEW/KERNEL/modularWidget.h>
00016 #endif
00017
00018 #ifndef BALL_VIEW_KERNEL_COMMON_H
00019 # include <BALL/VIEW/KERNEL/common.h>
00020 #endif
00021
00022 class QMenu;
00023
00024 namespace BALL
00025 {
00026 class System;
00027
00028 namespace VIEW
00029 {
00030
00047 class BALL_VIEW_EXPORT MolecularFileDialog
00048 : public QWidget,
00049 public ModularWidget
00050 {
00051 Q_OBJECT
00052 public:
00053 BALL_EMBEDDABLE(MolecularFileDialog, ModularWidget)
00054
00055
00058 MolecularFileDialog(QWidget* parent = 0, const char* name = "MolecularFileDialog");
00059
00061 virtual ~MolecularFileDialog();
00062
00069 virtual void initializeWidget(MainControl& main_control);
00070
00076 virtual bool canHandle(const String& fileformat) const;
00077
00082 virtual bool openFile(const String& filename);
00083
00089 virtual System* openMolecularFile(const String& file);
00090
00095 virtual System* openMolecularFile(const String& filename,
00096 const String& filetype,
00097 const String& system_name);
00098
00099
00101 System* openPDBFile();
00102
00104 System* openHINFile();
00105
00107 System* openMOLFile();
00108
00110 System* openMOL2File();
00111
00113 System* openSDFile();
00114
00116 System* openXYZFile();
00117
00120 System* readPDBFile(String filename, String system_name);
00121
00124 System* readHINFile(String filename, String system_name);
00125
00128 System* readMOLFile(String filename, String system_name);
00129
00132 System* readMOL2File(String filename, String system_name);
00133
00136 System* readSDFile(String filename, String system_name);
00137
00140 System* readXYZFile(String filename, String system_name);
00141
00144 bool writePDBFile(String filename, const System& system);
00145
00148 bool writeHINFile(String filename, const System& system);
00149
00152 bool writeMOLFile(String filename, const System& system);
00153
00156 bool writeMOL2File(String filename, const System& system);
00157
00160 bool writeSDFile(String filename, const System& system);
00161
00164 bool writeXYZFile(String filename, const System& system);
00165
00167 virtual void checkMenu(MainControl& main_control);
00168
00170 virtual String getSupportedFileFormats() const;
00171
00173 virtual String getSupportedFileFormatsList() const;
00174
00175 void setReadPDBModels(bool read) { read_all_pdb_models_ = read; }
00176
00177 public slots:
00178
00186 virtual void readFiles();
00187
00191 virtual bool writeFile();
00192
00193
00194 protected:
00195
00196 virtual void onNotify(Message *message);
00197
00198
00199 MolecularFileDialog(const MolecularFileDialog& mfd);
00200
00201
00202 virtual bool finish_(const String& filename, const String& system_name, System* system);
00203
00204 System* openFile_(String type);
00205
00206 enum FileFormats
00207 {
00208 PDB_FILE = 0,
00209 HIN_FILE,
00210 MOL_FILE,
00211 MOL2_FILE,
00212 SD_FILE,
00213 XYZ_FILE
00214 };
00215
00216 QAction* save_id_, *open_id_;
00217 String file_format_;
00218 bool read_all_pdb_models_;
00219 };
00220
00221 }
00222 }
00223
00224 #endif // BALL_VIEW_DIALOGS_MOLECULARFILEDIALOG_H