xbraboview.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                          xbraboview.h  -  description
00003                              -------------------
00004     begin                : Fri Jul 19 2002
00005     copyright            : (C) 2002-2006 by Ben Swerts
00006     email                : bswerts@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00020 
00021 #ifndef XBRABOVIEW_H
00022 #define XBRABOVIEW_H
00023 
00025 
00027 class QDomDocument;
00028 class QDomElement;
00029 class QLabel;
00030 class QLayout;
00031 //class QListBox;
00032 class QListViewItem;
00033 class QPoint;
00034 class QProcess;
00035 class QProgressBar;
00036 class QSplitter;
00037 
00039 class AtomSet;
00040 class BraboBase;
00041 class Calculation;
00042 class GLMoleculeView;
00043 class GlobalBase;
00044 class RelaxBase;
00045 class StatusText;
00046 
00048 #if defined(USE_KMDI) || defined(USE_KMDI_DLL)
00049 #  include<kmdichildview.h>
00050 #  define QextMdiChildView KMdiChildView
00051 #else
00052   #include <qextmdichildview.h>
00053 #endif
00054 
00056 class XbraboView : public QextMdiChildView
00057 {
00058   Q_OBJECT
00059 
00060   public:
00061     XbraboView(QWidget* mainWin, QWidget* parent = 0, QString title = QString::null, const char* name = 0, WFlags f = 0);         // constructor
00062     ~XbraboView();                      // destructor
00063 
00065     unsigned int calculationType() const;         // returns the type of the calculation
00066     unsigned int buurType() const;      // returns the type of crystal environment
00067     bool isModified() const;            // returns true if the calculation has been modified
00068     //bool isAnimating() const;           // returns true if the molecule is animating
00069     QString name() const;               // returns the name of the calculation
00070     QString fileName() const;           // returns the name the calculation was opened under
00071     QString directory() const;          // returns the calculation directory
00072     bool isRunning() const;             // returns true if the calculation is running
00073     bool isPaused() const;              // returns true if the calculation is paused
00074     //bool hasSelection() const;          // returns true if atoms are selected
00075     void cut();                         // implements a cut operation
00076     void copy();                        // implements a copy operation
00077     void paste();                       // implements a paste operation
00078     GLMoleculeView* moleculeView() const;         // returns a pointer to the GLMoleculeView widget
00079 
00080     bool loadCML(const QDomDocument* doc);        // loads all data from a QDomDocument
00081     QDomDocument* saveCML();            // saves all data to a QDomDocument
00082     void setFileName(const QString filename);     // sets the name the calculation should be saved under
00083 
00084   signals:
00085     void changed();                     // is emitted when the calculation has changed or when it recieves focus
00086     
00087   public slots:
00088     void setModified(bool state = true);// sets the 'modified' property of the calculation
00089     void moleculeReadCoordinates();     // reads coordinates
00090     void moleculeSaveCoordinates();     // saves coordinates
00091     void moleculeFPS();                 // calculates the FPS for the current parameters
00092     void setupGlobal();                 // sets up global options
00093     void setupBrabo();                  // sets up Brabo options
00094     void setupRelax();                  // sets up Relax options
00095     void setupFreq();                   // sets up Distor & Forkon options
00096     void setupBuur();                   // sets up Buur options
00097     void start();                       // starts the calculation
00098     void pause();                       // pauses the calculation
00099     void stop();                        // stops the calculation
00100     void writeInput();                  // writes the input files
00101     void cleanCalculation();            // cleans the calculation directory
00102     void viewOutput();                  // shows the output files
00103     void updatePVMHosts(const QStringList& hosts);// updates the PVM host list in braboSetup
00104     void showProperties();              // changes which properties are shown in the OpenGL window.
00105 
00106   protected:
00107     void keyPressEvent(QKeyEvent* e);   // event which takes place when a key is pressed
00108     void mouseReleaseEvent(QMouseEvent* e);       // event which takes place when a mouse button was release on the widget
00109        
00110   private slots:
00111     void popup();                       // shows the popupmenu 
00112     void updateIteration(unsigned int iteration, double energy);      // updates the status window for a Brabo iteration
00113     void updateCycle(unsigned int cycle);         // updates the status window for a Relax cycle
00114     void cleanupCalculation(unsigned int error);  // cleans up a stopped calculation
00115     void showOutput(QListViewItem* item, const QPoint&, int column);  // shows a certain output chosen in an OutputChooserWidget
00116 
00117   private:
00119     void loadCMLLocal(const QDomElement* root);   // load geometry
00120     void saveCMLLocal(QDomElement* root);         // save geometry
00121     void updateCaptions();              // updates the captions of the window and taskbar
00122     void updateBraboSetup();            // updates braboSetup according to globalSetup
00123     void updateRelaxSetup();            // updates relaxSetup according to globalSetup
00124     bool makeDirCurrent(const QString dir, const QString title);      // makes a directory current
00125     void initGlobalSetup();             // constructs the GlobalBase widget if it hasn't been created yet
00126     void initBraboSetup();              // constructs the BraboBase widget if it hasn't been created yet
00127     void initRelaxSetup();              // constructs the RelaxBase widget if it hasn't been created yet
00128     bool initCalculation();             // constructs the Calculation and does an initial setup
00129     void updateAtomSet();               // does some updates when the atomset has changed
00130 
00132     // Window
00133     QVBoxLayout* BigLayout;             
00134     QSplitter* Splitter;                
00135     GLMoleculeView* MoleculeView;       
00136     QVBoxLayout* StatusLayout;          
00137     QLabel* TextLabelStatus;            
00138     StatusText* TextEditStatus;         
00139     QHBoxLayout* ProgressLayout;        
00140     QLabel* TextLabelProgress;          
00141     QProgressBar* ProgressBar;          
00142     // Dialogs
00143     GlobalBase* globalSetup;            
00144     BraboBase* braboSetup;              
00145     RelaxBase* relaxSetup;              
00146     // Other pointers
00147     QWidget* mainWindow;                
00148 
00150     bool calcModified;                  
00151     QString calcDefaultName;            
00152     QString calcFileName;               
00153     QString calcDate;                   
00154     AtomSet* atoms;                     
00155 
00156     unsigned int calcBraboSteps;        
00157     unsigned int lastProgress;          
00158     Calculation* calculation;           
00159     QStringList hostListPVM;            
00160 
00161     static unsigned int calcCounter;    
00162 };
00163 
00164 #endif
00165 

Generated on Fri May 19 14:31:56 2006 for Brabosphere by  doxygen 1.4.6-NO