dockDialog.h

Go to the documentation of this file.
00001 //
00002 // -*- Mode: C++; tab-width: 2; -*-
00003 // vi: set ts=2:
00004 //
00005 
00006 #ifndef BALL_VIEW_DIALOGS_DOCKDIALOG_H
00007 #define BALL_VIEW_DIALOGS_DOCKDIALOG_H
00008 
00009 #ifndef BALL_COMMON_GLOBAL_H
00010 # include <BALL/COMMON/global.h>
00011 #endif
00012 
00013 #ifndef BALL_VIEW_KERNEL_PREFERENCESENTRY_H
00014 # include <BALL/VIEW/KERNEL/preferencesEntry.h>
00015 #endif
00016 
00017 #ifndef BALL_MOLMEC_COMMON_RADIUSRULEPROCESSOR_H
00018 # include <BALL/MOLMEC/COMMON/radiusRuleProcessor.h>
00019 #endif
00020 
00021 #ifndef BALL_MOLMEC_COMMON_CHARGERULEPROCESSOR_H
00022 # include <BALL/MOLMEC/COMMON/chargeRuleProcessor.h>
00023 #endif
00024 
00025 #ifndef BALL_STRUCTURE_DEFAULTPROCESSORS_H
00026 # include <BALL/STRUCTURE/defaultProcessors.h>
00027 #endif
00028 
00029 #ifndef BALL_DATATYPE_OPTIONS_H
00030 # include <BALL/DATATYPE/options.h>
00031 #endif
00032 
00033 #include <BALL/VIEW/UIC/ui_dockDialog.h>
00034 
00035 namespace BALL
00036 {
00037   class INIFile;
00038   class System;
00039   class Options;
00040 
00041   namespace VIEW
00042   {
00043     class DockingController;
00044     
00045   
00052     class BALL_VIEW_EXPORT DockDialog : 
00053       public QDialog,
00054       public Ui_DockDialogData,
00055       public PreferencesEntry
00056     { 
00057       Q_OBJECT
00058       
00059       public:
00060     
00064       
00075         DockDialog(QWidget* parent = 0, const char* name = "DockDialog");
00076           
00079         virtual ~DockDialog();
00081 
00085         
00088         const DockDialog& operator =(const DockDialog& dock_dialog);
00090           
00094         
00099         void setSystems(System* system1, System* system2);
00100         
00103         System* getSystem1();
00104         
00107         System* getSystem2();
00108         
00111         Options& getAlgorithmOptions();
00112         
00115         Options& getScoringOptions();
00116         
00119         void isRedock(bool is_redock);
00120           
00126         // remark: score_func isn't enum type because we then have cyclic includes of DockDialog and DockingController
00127         void addAlgorithm(const QString& name, const int algorithm, QDialog* dialog);
00128           
00134         // remark: score_func isn't enum type because we then have cyclic includes of DockDialog and DockingController
00135         void addScoringFunction(const QString& name, const int score_func, QDialog* dialog=0);
00136         
00143         virtual void initializeWidget();
00144 
00151         virtual void fetchPreferences(INIFile& file);
00152         
00158         virtual void writePreferences(INIFile& file);
00159         
00160           
00163         void reset();
00165           
00166       public slots:
00167   
00172         bool exec();
00173         
00177         void resetPressed();
00178       
00184         void okPressed();
00185         
00189         void cancelPressed();
00190         
00194         void algAdvancedPressed();
00195         
00199         void scoringAdvancedPressed();
00200         
00204         void partner1Chosen();
00205         
00209         void partner2Chosen();
00210         
00214         void scoringFuncChosen();
00215         
00219         void algorithmChosen();
00220         
00224         void browseChargesData();
00225         
00229         void browseChargesRules();
00230         
00234         void browseRadiiData();
00235         
00239         void browseRadiiRules();
00240         
00241         
00242       protected:
00243       
00247         void applyValues_();
00248         
00251         bool applyProcessors_();
00252         
00255         void selectFile_(QLineEdit& lineedit);
00256           
00260         void fillSystemComboboxes_();
00261         
00269         void fetchPreferences_(INIFile& file, const String& entry, const QString& default_value);
00270       
00275         void swapValues_();
00276         
00277         
00278       private:
00279 
00284         DockDialog(const DockDialog& dock_dialog);
00285       
00288         bool is_redock_;
00289         
00294         bool has_changed_;
00295       
00299         HashMap<int, QDialog*> algorithm_dialogs_;
00300         
00304         HashMap<int, QDialog*> scoring_dialogs_;
00305       
00309         HashMap<int, vector<int> > allowed_sf_;
00310         
00313         vector<System*> loaded_systems_;
00314 
00317         System* docking_partner1_;
00318         
00321         System* docking_partner2_;  
00322         
00325         Options algorithm_opt_, scoring_opt_;
00326     
00332         vector<QString> backup_;
00333         
00336         RadiusRuleProcessor     radius_rule_processor_;
00337         ChargeRuleProcessor     charge_rule_processor_;
00338         AssignRadiusProcessor   radius_processor_;
00339         AssignChargeProcessor   charge_processor_;
00340     };
00341       
00342   } // end of namespace View
00343 } // end of namespace BALL
00344 #endif