00001 /*************************************************************************** 00002 preferencesbase.h - description 00003 ------------------- 00004 begin : Sat Aug 10 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 PREFERENCESBASE_H 00022 #define PREFERENCESBASE_H 00023 00025 00026 // STL header files 00027 #include <vector> 00028 00029 // Qt forward class declarations 00030 class QIconViewItem; 00031 class QStyle; 00032 00033 // QextMDI forward class declarations 00034 #if defined(USE_KMDI) || defined(USE_KMDI_DLL) 00035 # define QextMdiMainFrm KMdiMainFrm 00036 #endif 00037 class QextMdiMainFrm; 00038 00039 // Xbrabo forward class declarations 00040 class ColorButton; 00041 #include "glbaseparameters.h" // structs can't be declared forward 00042 #include "glmoleculeparameters.h" 00043 00044 // Base class header file 00045 #include "preferenceswidget.h" 00046 00047 00049 class PreferencesBase : public PreferencesWidget 00050 { 00051 Q_OBJECT 00052 00053 public: 00054 PreferencesBase(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); // constructor 00055 ~PreferencesBase(); // destructor 00056 00058 unsigned int preferredBasisset() const; // returns the preferred basisset 00059 bool useBinDirectory() const; // returns true if .11 files should be written to a special directory 00060 GLBaseParameters getGLBaseParameters() const; // returns a struct with the OpenGL base parameters 00061 GLMoleculeParameters getGLMoleculeParameters() const; // returns a struct with the OpenGL molecule parameters 00062 QStringList getPVMHosts() const; // returns a list of PVM hosts 00063 void setToolbarsInfo(const QString& info, const bool status); // sets the info needed to restore the toolbars 00064 void getToolbarsInfo(bool& status, QString& info) const;// returns the toolbars info 00065 00066 signals: 00067 void newPVMHosts(const QStringList& hosts); // is emitted when the PVM host list has changed 00068 00069 public slots: 00070 void loadSettings(); // loads the program settings 00071 void saveSettings(); // saves the program settings 00072 void updateVisuals(); // updates the look of the entire program 00073 00074 protected slots: 00075 void accept(); // is called when the changes are accepted (OK clicked) 00076 void reject(); // is called when the changes are rejected (Cancel or X clicked) 00077 00078 private slots: 00080 void changed(); // sets the 'changed' status of the widget 00081 void selectWidget(QIconViewItem* item); // shows a widget from the widgetstack depending on the iconview item 00083 void changeExecutable(); // updates LineEditExecutable with the selected item in ListViewExecutable 00084 void updateExecutable(const QString& text); // keeps ListViewExecutables in sync with LineEditExecutable 00085 void updateAllExecutables(); // renames all items in the ListView according to a pattern 00086 void selectBinDir(); // selects a directory to store the .11 00087 void selectExecutable(); // selects an executable 00088 void selectBasisDir(); // selects a directory to read the basissets from 00090 void selectBackground(); // selects a background image 00091 void updateLineEditBondSizeLines(); // updates LineEditBondSizeLines according to SliderBondSizeLines 00092 void updateLineEditBondSizeTubes(); // updates LineEditBondSizeTubes according to SliderBondSizeTubes 00093 void updateSliderBondSizeTubes(); // updates SliderBondSizeTubes according to LineEditBondSizeTubes 00094 void updateLineEditForceSizeTubes();// updates LineEditForceSizeTubes according to SliderForceSizeTubes 00095 void updateSliderForceSizeTubes(); // updates SliderForceSizeTubes according to LineEditForceSizeTubes 00096 void updateOpacitySelection(); // updates TextLabelSelection according to SliderSelectionOpacity 00097 void updateOpacityForces(); // updates TextLabelForces according to SliderForcesOpacity 00098 void updateColorButtonForce(); // enables/disables ColorButtonForce according to the selected color type 00100 void changePVMHost(); // updates LineEditPVMHost with the selected item in ListViewPVMHosts 00101 void updatePVMHost(const QString& text); // keeps ListViewPVMHosts in sync with LineEditPVMHost 00102 void newPVMHost(); // adds a PVM host 00103 void deletePVMHost(); // deletes a PVM host 00104 void changedPVM(); // the PVM host list was changed 00105 00106 private: 00108 enum{SettingsVersion = 100}; //< The current version for the settings file 00109 00111 void makeConnections(); // sets up all permanent connections 00112 void init(); // initializes the dialog 00113 void initOpenGL(); // determines the capabilities of OpenGL 00114 void saveWidgets(); // saves the status of the widgets 00115 void restoreWidgets(); // restores the status of the widgets 00116 void updateStyle(); // Changes the style of the application 00117 void updatePaths(); // updates the data of the Paths class 00118 00120 struct WidgetData 00122 { 00124 QStringList executables; 00125 QString path; 00126 QString extension; 00127 bool binInCalcDir; 00128 QString binDir; 00129 QString basissetDir; 00130 unsigned int basisset; 00131 00133 unsigned int styleMolecule; 00134 unsigned int styleForces; 00135 int fastRenderLimit; 00136 bool showElements; 00137 bool showNumbers; 00138 int sizeLines; 00139 QString sizeBonds; 00140 QString sizeForces; 00141 unsigned int colorLabels; 00142 unsigned int colorICs; 00143 unsigned int colorBackgroundGL; 00144 unsigned int colorSelections; 00145 unsigned int colorForces; 00146 unsigned int opacitySelections; 00147 unsigned int opacityForces; 00148 bool forcesOneColor; 00149 00151 unsigned int backgroundType; 00152 QString backgroundImage; 00153 unsigned int backgroundColor; 00154 unsigned int styleApplication; 00155 00157 unsigned int lightPosition; 00158 unsigned int lightColor; 00159 unsigned int materialSpecular; 00160 unsigned int materialShininess; 00161 bool antialias; 00162 bool smoothShading; 00163 bool depthCue; 00164 unsigned int quality; 00165 bool perspectiveProjection; 00166 00168 QStringList pvmHosts; 00169 }; 00170 00172 // widgets 00173 QString startupStyleName; 00174 QextMdiMainFrm* mainWindow; 00175 // other 00176 WidgetData data; 00177 bool widgetChanged; 00178 bool pvmHostsChanged; 00179 QString tempBondSizeBS; 00180 QString tempBondSizeL; 00181 float minLineWidthGL; 00182 float maxLineWidthGL; 00183 float lineWidthGranularity; 00184 QString toolbarsInfo; 00185 bool toolbarsStatus; 00186 00187 }; 00188 00189 #endif 00190