preferencesbase.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                       preferencesbase.cpp  -  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 
00019 
00027 
00028 
00029 
00031 
00032 // C++ header files
00033 #include <cmath>
00034 
00035 // Qt header files
00036 #include <qapplication.h>
00037 #include <qbuttongroup.h>
00038 #include <qcheckbox.h>
00039 #include <qcombobox.h>
00040 #include <qfiledialog.h>
00041 #include <qgl.h>
00042 #include <qiconview.h>
00043 #include <qlabel.h>
00044 #include <qlineedit.h>
00045 #include <qlistview.h>
00046 #include <qmessagebox.h>
00047 #include <qpoint.h>
00048 #include <qpushbutton.h>
00049 #include <qradiobutton.h>
00050 #include <qsettings.h>
00051 #include <qsize.h>
00052 #include <qslider.h>
00053 #include <qspinbox.h>
00054 #include <qstring.h>
00055 #include <qstyle.h>
00056 #include <qstylefactory.h>
00057 #include <qvalidator.h>
00058 #include <qwidgetstack.h>
00059 
00060 // QextMDI header files
00061 #if defined(USE_KMDI) || defined(USE_KMDI_DLL)
00062 #  include<kmdidefines.h>
00063 #  include <kmdimainfrm.h>
00064 #  define QextMdiMainFrm KMdiMainFrm
00065 #  define QextMdi KMdi
00066 #else
00067 #  include <qextmdidefines.h>
00068 #  include <qextmdimainfrm.h>
00069 #endif
00070 
00071 // Xbrabo header files
00072 #include "atomset.h"
00073 #include "basisset.h"
00074 #include "colorbutton.h"
00075 #include "iconsets.h"
00076 #include "latin1validator.h"
00077 #include "paths.h"
00078 #include "preferencesbase.h"
00079 #include "version.h"
00080 
00081 
00085 
00087 PreferencesBase::PreferencesBase(QWidget* parent, const char* name, bool modal, WFlags fl) : PreferencesWidget(parent,name, modal, fl)
00089 {      
00090   mainWindow = dynamic_cast<QextMdiMainFrm*>(parent); // save the pointer to Xbrabo (main window)
00091   makeConnections();
00092   init();
00093   // STOCK on Windows chokes when a path name is used for the F11= keyword (compiler related)
00094 #ifdef WIN32
00095   RadioButtonBin1->setChecked(true);
00096   RadioButtonBin2->setDisabled(true);
00097   LineEditBin->setDisabled(true);
00098   ToolButtonBin->setDisabled(true);
00099 #endif
00100 }
00101 
00103 PreferencesBase::~PreferencesBase()
00105 {
00106   saveSettings(); // needed for mainwindow geometry
00107 }
00108 
00110 unsigned int PreferencesBase::preferredBasisset() const
00112 {  
00113   return ComboBoxBasis->currentItem();
00114 }
00115 
00117 bool PreferencesBase::useBinDirectory() const
00120 {  
00121   return RadioButtonBin2->isChecked();
00122 }
00123 
00125 GLBaseParameters PreferencesBase::getGLBaseParameters() const
00127 {  
00128   GLBaseParameters result;
00129   switch(data.lightPosition)
00130   {
00131     case 0: result.lightPositionX = -1.0;
00132             result.lightPositionY =  1.0;
00133             break;
00134     case 1: result.lightPositionX =  0.0;
00135             result.lightPositionY =  1.0;
00136             break;
00137     case 2: result.lightPositionX =  1.0;
00138             result.lightPositionY =  1.0;
00139             break;
00140     case 3: result.lightPositionX = -1.0;
00141             result.lightPositionY =  0.0;
00142             break;
00143     case 4: result.lightPositionX =  0.0;
00144             result.lightPositionY =  0.0;
00145             break;
00146     case 5: result.lightPositionX =  1.0;
00147             result.lightPositionY =  0.0;
00148             break;
00149     case 6: result.lightPositionX = -1.0;
00150             result.lightPositionY = -1.0;
00151             break;
00152     case 7: result.lightPositionX =  0.0;
00153             result.lightPositionY = -1.0;
00154             break;
00155     case 8: result.lightPositionX =  1.0;
00156             result.lightPositionY = -1.0;
00157             break;            
00158   }
00159   result.lightPositionZ = 1.0;
00160   result.lightColor = data.lightColor;
00161   result.materialSpecular = data.materialSpecular;
00162   result.materialShininess = data.materialShininess;
00163   result.backgroundColor = data.colorBackgroundGL;
00164   result.antialias = data.antialias;
00165   result.smoothShading = data.smoothShading;
00166   result.depthCue = data.depthCue;
00167   result.perspectiveProjection = data.perspectiveProjection;
00168     
00169   return result;
00170 }
00171 
00173 GLMoleculeParameters PreferencesBase::getGLMoleculeParameters() const
00175 {  
00176   GLMoleculeParameters result;
00177 
00178   if(data.quality < 11)
00179     result.quality = data.quality;
00180   else
00181     result.quality = static_cast<int>(10.0 * pow(1.1, static_cast<int>(data.quality) - 10));
00182   result.sizeLines = static_cast<GLfloat>(data.sizeLines)*lineWidthGranularity;
00183   result.sizeBonds = data.sizeBonds.toFloat()/2.0; // diameter -> radius
00184   result.sizeForces = data.sizeForces.toFloat()/2.0; // diameter -> radius
00185   result.defaultMoleculeStyle = data.styleMolecule;
00186   result.defaultForcesStyle = data.styleForces;
00187   result.fastRenderLimit = data.fastRenderLimit;
00188   result.showElements = data.showElements;
00189   result.showNumbers = data.showNumbers;
00190   result.colorLabels = data.colorLabels;
00191   result.colorICs = data.colorICs;
00192   result.colorSelections = data.colorSelections;
00193   result.opacitySelections = data.opacitySelections;
00194   result.colorForces = data.colorForces;
00195   result.forcesOneColor = data.forcesOneColor;
00196   result.opacityForces = data.opacityForces;
00197 
00198   return result;
00199 }
00200 
00202 QStringList PreferencesBase::getPVMHosts() const
00204 {  
00205   return data.pvmHosts;
00206 }
00207 
00209 void PreferencesBase::setToolbarsInfo(const QString& info, const bool status)
00211 {
00212   toolbarsInfo = info;
00213   toolbarsStatus = status;
00214 }
00215 
00217 void PreferencesBase::getToolbarsInfo(bool& status, QString& info) const
00219 {
00220   info = toolbarsInfo;
00221   status = toolbarsStatus;
00222 }
00223 
00224 
00228 
00230 void PreferencesBase::loadSettings()
00234 {
00235 #ifdef Q_OS_WIN32
00236   const QString appDirBrabo  = "C:\\Program Files\\" + Version::appCompany + "\\BRABO";
00237   const QString defaultExtension = ".exe";
00238   const QString basisDir = "C:\\Basissets";
00239   const QString binDir = "C:\\Temp";
00240   const QString unixPrefix = "/";
00241 #else
00242   const QString appDirBrabo  = "/usr/local/bin/brabo";
00243   const QString defaultExtension = ".x";
00244   const QString basisDir = "/usr/local/share/" + Version::appName.lower() + "/basissets";
00245   const QString binDir = "/tmp";
00246   const QString unixPrefix = "/" + Version::appName.lower() + "/";
00247 #endif
00248       
00249   QSettings settings;
00250   settings.setPath(Version::appCompany, Version::appName.lower(), QSettings::User);
00251 
00252   QString prefix = unixPrefix + "preferences/";
00253 
00255   unsigned int settingsVersion = settings.readNumEntry(unixPrefix + "version", 0);
00256   
00258   data.path              = settings.readEntry(prefix + "path", appDirBrabo + QDir::separator());
00259   data.extension         = settings.readEntry(prefix + "extension", defaultExtension);
00260   data.executables = settings.readListEntry(prefix + "executables");
00261   if(static_cast<int>(data.executables.size()) != ListViewExecutables->childCount())
00262   {
00264     LineEditPath->setText(data.path);
00265     LineEditExtension->setText(data.extension);
00266     updateAllExecutables(); // fills ListViewExecutables with values generated from data.path and data.extension
00267     saveWidgets(); // saves these values to data.executables
00268   }                         
00269   data.binDir            = settings.readEntry(prefix + "bin_dir", binDir);
00270   data.binInCalcDir      = settings.readBoolEntry(prefix + "bin_in_calc_dir", true);
00271   data.basissetDir       = settings.readEntry(prefix + "basisset_dir", basisDir);
00272   data.basisset          = settings.readNumEntry(prefix + "basisset", Basisset::basisToNum("6-31G"));
00274   data.styleMolecule     = settings.readNumEntry(prefix + "style_molecule", 3); // Ball & Stick
00275   data.styleForces       = settings.readNumEntry(prefix + "style_forces", 2); // Tubes
00276   data.fastRenderLimit   = settings.readNumEntry(prefix + "fast_render_limit", 1000);
00277   data.showElements      = settings.readBoolEntry(prefix + "show_elements", false);
00278   data.showNumbers       = settings.readBoolEntry(prefix + "show_numbers", true);
00279   data.sizeLines         = settings.readNumEntry(prefix + "size_lines", static_cast<int>((minLineWidthGL > 1.0f ? minLineWidthGL : 1.0f)/lineWidthGranularity)); // max(1.0, minLineWidthGL) 
00280   data.sizeBonds         = settings.readEntry(prefix + "size_bonds", QString::number(AtomSet::vanderWaals(1)/2.0));
00281   data.sizeForces        = settings.readEntry(prefix + "size_forces", QString::number(AtomSet::vanderWaals(1)/2.0*1.1));
00282   data.colorLabels       = settings.readNumEntry(prefix + "color_labels", QColor(0, 255, 0).rgb()); // green
00283   data.colorICs          = settings.readNumEntry(prefix + "color_internal_coordinates", QColor(0, 255, 255).rgb()); // cyan
00284   data.colorBackgroundGL = settings.readNumEntry(prefix + "color_background_gl", 0); // black
00285   data.colorSelections   = settings.readNumEntry(prefix + "color_selections", QColor(255, 255, 0).rgb()); // yellow
00286   data.opacitySelections = settings.readNumEntry(prefix + "opacity_selections", 50);
00287   data.colorForces       = settings.readNumEntry(prefix + "color_forces", QColor(255, 255, 0).rgb()); //yellow
00288   data.forcesOneColor    = settings.readBoolEntry(prefix + "color_force_type", false); // atom color
00289   data.opacityForces     = settings.readNumEntry(prefix + "opacity_forces", 100);
00290 
00292   data.backgroundType    = settings.readNumEntry(prefix + "background_type", 0); // default
00293   data.backgroundImage   = settings.readEntry(prefix + "background_image", QString::null);
00294   data.backgroundColor   = settings.readNumEntry(prefix + "background_color", QColor(224, 224, 224).rgb()); // Light grey
00295   data.styleApplication  = settings.readNumEntry(prefix + "style", 0); // Startup style
00296   
00298   data.lightPosition     = settings.readNumEntry(prefix + "light_position", 2);
00299   data.lightColor        = settings.readNumEntry(prefix + "light_color", QColor(255,255,255).rgb());
00300   data.materialSpecular  = settings.readNumEntry(prefix + "material_specular", 80);
00301   data.materialShininess = settings.readNumEntry(prefix + "material_shininess", 100);
00302   data.antialias         = settings.readBoolEntry(prefix + "antialias", true);
00303   data.smoothShading     = settings.readBoolEntry(prefix + "smooth_shading", true);
00304   data.depthCue          = settings.readBoolEntry(prefix + "depth_cue", true);
00305   data.quality           = settings.readNumEntry(prefix + "quality", 22); // 31 slices
00306   data.perspectiveProjection = settings.readBoolEntry(prefix + "perspective_projection", true);
00308   data.pvmHosts          = settings.readListEntry(prefix + "pvm_hosts");
00309 
00310   restoreWidgets();
00311   widgetChanged = false;
00312 
00315   toolbarsInfo = settings.readEntry(unixPrefix + "toolbars/other", QString::null);
00316   toolbarsStatus = settings.readBoolEntry(unixPrefix + "toolbars/statusbar", true);
00317 
00319   if(settingsVersion == 0)
00320     saveSettings();
00321 }
00322 
00324 void PreferencesBase::saveSettings()
00333 {
00334   QSettings settings;
00335   settings.setPath(Version::appCompany, Version::appName.lower(), QSettings::User);
00336 
00337 #ifdef Q_OS_WIN32
00338   QString unixPrefix = "/";
00339 #else
00340   QString unixPrefix = "/" + Version::appName.lower() + "/";
00341 #endif
00342 
00344   settings.writeEntry(unixPrefix + "version", static_cast<int>(SettingsVersion));
00346   QString prefix = unixPrefix + "preferences/";
00348   settings.writeEntry(prefix + "path", data.path);
00349   settings.writeEntry(prefix + "extension", data.extension);
00350   settings.writeEntry(prefix + "executables", data.executables);
00351   settings.writeEntry(prefix + "bin_in_calc_dir", data.binInCalcDir);
00352   settings.writeEntry(prefix + "bin_dir", data.binDir);
00353   settings.writeEntry(prefix + "basisset_dir", data.basissetDir);
00354   settings.writeEntry(prefix + "basisset", static_cast<int>(data.basisset));
00356   settings.writeEntry(prefix + "style_molecule", static_cast<int>(data.styleMolecule)); 
00357   settings.writeEntry(prefix + "style_forces", static_cast<int>(data.styleForces)); 
00358   settings.writeEntry(prefix + "fast_render_limit", data.fastRenderLimit);
00359   settings.writeEntry(prefix + "show_elements", data.showElements);
00360   settings.writeEntry(prefix + "show_numbers", data.showNumbers);
00361   settings.writeEntry(prefix + "size_lines", data.sizeLines);
00362   settings.writeEntry(prefix + "size_bonds", data.sizeBonds);
00363   settings.writeEntry(prefix + "size_forces", data.sizeForces);
00364   settings.writeEntry(prefix + "color_labels", static_cast<int>(data.colorLabels));
00365   settings.writeEntry(prefix + "color_internal_coordinates", static_cast<int>(data.colorICs));
00366   settings.writeEntry(prefix + "color_background_gl", static_cast<int>(data.colorBackgroundGL));
00367   settings.writeEntry(prefix + "color_selections", static_cast<int>(data.colorSelections));
00368   settings.writeEntry(prefix + "opacity_selections", static_cast<int>(data.opacitySelections));
00369   settings.writeEntry(prefix + "color_forces", static_cast<int>(data.colorForces));
00370   settings.writeEntry(prefix + "color_force_type", data.forcesOneColor);
00371   settings.writeEntry(prefix + "opacity_forces", static_cast<int>(data.opacityForces));
00373   settings.writeEntry(prefix + "background_type", static_cast<int>(data.backgroundType));
00374   settings.writeEntry(prefix + "background_image", data.backgroundImage);
00375   settings.writeEntry(prefix + "background_color", static_cast<int>(data.backgroundColor));
00376   settings.writeEntry(prefix + "style", static_cast<int>(data.styleApplication));
00378   settings.writeEntry(prefix + "light_position", static_cast<int>(data.lightPosition));
00379   settings.writeEntry(prefix + "light_color", static_cast<int>(data.lightColor));
00380   settings.writeEntry(prefix + "material_specular", static_cast<int>(data.materialSpecular));
00381   settings.writeEntry(prefix + "material_shininess", static_cast<int>(data.materialShininess));
00382   settings.writeEntry(prefix + "antialias", data.antialias);
00383   settings.writeEntry(prefix + "smooth_shading", data.smoothShading);
00384   settings.writeEntry(prefix + "depth_cue", data.depthCue);
00385   settings.writeEntry(prefix + "quality", static_cast<int>(data.quality));
00386   settings.writeEntry(prefix + "perspective_projection", data.perspectiveProjection); 
00388   settings.writeEntry(prefix + "pvm_hosts", data.pvmHosts);
00389     
00391   prefix = unixPrefix + "geometry/";
00392   settings.writeEntry(prefix + "x", mainWindow->pos().x());
00393   settings.writeEntry(prefix + "y", mainWindow->pos().y());
00394   settings.writeEntry(prefix + "width", mainWindow->size().width());
00395   settings.writeEntry(prefix + "height", mainWindow->size().height());
00396   settings.writeEntry(prefix + "maximized", mainWindow->isMaximized());
00397   settings.writeEntry(unixPrefix + "mdi_mode", mainWindow->mdiMode());
00398   settings.writeEntry(unixPrefix + "toolbars/other", toolbarsInfo);
00399   settings.writeEntry(unixPrefix + "toolbars/statusbar", toolbarsStatus);
00400   //settings.writeEntry("/recent", QStringList recentFiles);
00401 }
00402 
00404 void PreferencesBase::updateVisuals()
00406 { 
00407   switch(data.backgroundType)
00408   {
00409     case 0: // default
00410             mainWindow->setBackgroundPixmap(IconSets::getPixmap(IconSets::Background));
00411             break;
00412     case 1: // image
00413             {
00414               QPixmap pm(data.backgroundImage);
00415               if(!pm.isNull())
00416                 mainWindow->setBackgroundPixmap(pm);
00417               else
00418                 mainWindow->setBackgroundPixmap(IconSets::getPixmap(IconSets::Background));
00419             }
00420             break;
00421     case 2: // single color
00422             mainWindow->setBackgroundColor(data.backgroundColor);
00423   }
00424 
00426   updateStyle();
00427 }
00428 
00429 
00433 
00435 void PreferencesBase::accept()
00439 {  
00440   if(widgetChanged)
00441   {
00442     widgetChanged = false;
00443     saveWidgets();
00444     saveSettings(); // so CrdView's can be updated without restarting Brabosphere
00445     updatePaths();
00446     // Check whether the pvm host list has changed
00447     if(pvmHostsChanged == true)
00448     {
00449       pvmHostsChanged = false;
00450       emit newPVMHosts(data.pvmHosts);
00451     }
00452     PreferencesWidget::accept();
00453   }
00454   else
00455     PreferencesWidget::reject();
00456 }
00457 
00459 void PreferencesBase::reject()
00462 {  
00463   if(widgetChanged)
00464   {
00465     widgetChanged = false;
00466     restoreWidgets();
00467   }
00468   PreferencesWidget::reject();
00469 }
00470 
00471 
00475 
00477 void PreferencesBase::changed()
00479 {  
00480   widgetChanged = true;
00481 }
00482 
00484 void PreferencesBase::selectWidget(QIconViewItem* item)
00486 {  
00487   if(item->text() == tr("BRABO"))
00488     WidgetStackCategory->raiseWidget(0);
00489   else if(item->text() == tr("Visuals"))
00490     WidgetStackCategory->raiseWidget(1);
00491   else if(item->text() == tr("OpenGL"))
00492     WidgetStackCategory->raiseWidget(2);
00493   else if(item->text() == tr("PVM"))
00494     WidgetStackCategory->raiseWidget(3);
00495   else if(item->text() == tr("Molecule"))
00496     WidgetStackCategory->raiseWidget(4);
00497 }
00498 
00500 void PreferencesBase::changeExecutable()
00503 {  
00504   QListViewItem* item = ListViewExecutables->selectedItem();
00505   if(item == 0)
00506     return;
00507 
00508   LabelProgram->setText(item->text(0));
00509   LineEditExecutable->blockSignals(true); // setting the text doesn't change the listview
00510   LineEditExecutable->setText(item->text(1));
00511   LineEditExecutable->blockSignals(false);
00512 }
00513 
00515 void PreferencesBase::updateExecutable(const QString& text)
00517 {  
00518   QListViewItem* item = ListViewExecutables->selectedItem();
00519   if(item == 0)
00520     return;
00521 
00522   item->setText(1, text);
00523 }
00524 
00526 void PreferencesBase::updateAllExecutables()
00529 {  
00530   ListViewExecutables->findItem("ABC",0)->setText(1,LineEditPath->text()+"abc"+LineEditExtension->text());
00531   ListViewExecutables->findItem("Achar",0)->setText(1,LineEditPath->text()+"achar"+LineEditExtension->text());
00532   ListViewExecutables->findItem("AtomSCF",0)->setText(1,LineEditPath->text()+"atomscf"+LineEditExtension->text());
00533   ListViewExecutables->findItem("AtomSCF_inp",0)->setText(1,LineEditPath->text()+"atomscf_inp"+LineEditExtension->text());
00534   ListViewExecutables->findItem("AtomSCF_o2d",0)->setText(1,LineEditPath->text()+"atomscf_o2d"+LineEditExtension->text());
00535   ListViewExecutables->findItem("B112gfchk",0)->setText(1,LineEditPath->text()+"b112gfchk"+LineEditExtension->text());
00536   ListViewExecutables->findItem("Bios2ped",0)->setText(1,LineEditPath->text()+"bios2ped"+LineEditExtension->text());
00537   ListViewExecutables->findItem("Brabo",0)->setText(1,LineEditPath->text()+"brabo"+LineEditExtension->text());
00538   ListViewExecutables->findItem("Buur",0)->setText(1,LineEditPath->text()+"buur"+LineEditExtension->text());
00539   ListViewExecutables->findItem("Cnvrtaff",0)->setText(1,LineEditPath->text()+"cnvrtaff"+LineEditExtension->text());
00540   ListViewExecutables->findItem("Crd2gauss",0)->setText(1,LineEditPath->text()+"crd2gauss"+LineEditExtension->text());
00541   ListViewExecutables->findItem("Crd2xyz",0)->setText(1,LineEditPath->text()+"crd2xyz"+LineEditExtension->text());
00542   ListViewExecutables->findItem("Diffcrd",0)->setText(1,LineEditPath->text()+"diffcrd"+LineEditExtension->text());
00543   ListViewExecutables->findItem("Distor",0)->setText(1,LineEditPath->text()+"distor"+LineEditExtension->text());
00544   ListViewExecutables->findItem("Forkon",0)->setText(1,LineEditPath->text()+"forkon"+LineEditExtension->text());
00545   ListViewExecutables->findItem("Frex",0)->setText(1,LineEditPath->text()+"frex"+LineEditExtension->text());
00546   ListViewExecutables->findItem("Gar2ped",0)->setText(1,LineEditPath->text()+"gar2ped"+LineEditExtension->text());
00547   ListViewExecutables->findItem("Geom",0)->setText(1,LineEditPath->text()+"geom"+LineEditExtension->text());
00548   ListViewExecutables->findItem("Gfchk2b11",0)->setText(1,LineEditPath->text()+"gfchk2b11"+LineEditExtension->text());
00549   ListViewExecutables->findItem("Gfchk2crd",0)->setText(1,LineEditPath->text()+"gfchk2crd"+LineEditExtension->text());
00550   ListViewExecutables->findItem("Gfchk2pun",0)->setText(1,LineEditPath->text()+"gfchk2pun"+LineEditExtension->text());
00551   ListViewExecutables->findItem("HKL",0)->setText(1,LineEditPath->text()+"hkl"+LineEditExtension->text());
00552   ListViewExecutables->findItem("Log2crd",0)->setText(1,LineEditPath->text()+"log2crd"+LineEditExtension->text());
00553   ListViewExecutables->findItem("Maff",0)->setText(1,LineEditPath->text()+"maff"+LineEditExtension->text());
00554   ListViewExecutables->findItem("Makeden",0)->setText(1,LineEditPath->text()+"makeden"+LineEditExtension->text());
00555   ListViewExecutables->findItem("Makexit",0)->setText(1,LineEditPath->text()+"makexit"+LineEditExtension->text());
00556   ListViewExecutables->findItem("Molsplit",0)->setText(1,LineEditPath->text()+"molsplit"+LineEditExtension->text());
00557   ListViewExecutables->findItem("Out2aff",0)->setText(1,LineEditPath->text()+"out2aff"+LineEditExtension->text());
00558   ListViewExecutables->findItem("Potdicht",0)->setText(1,LineEditPath->text()+"potdicht"+LineEditExtension->text());
00559   ListViewExecutables->findItem("Pullarc",0)->setText(1,LineEditPath->text()+"pullarc"+LineEditExtension->text());
00560   ListViewExecutables->findItem("Refine",0)->setText(1,LineEditPath->text()+"refine"+LineEditExtension->text());
00561   ListViewExecutables->findItem("Relax",0)->setText(1,LineEditPath->text()+"relax"+LineEditExtension->text());
00562   ListViewExecutables->findItem("Ring",0)->setText(1,LineEditPath->text()+"ring"+LineEditExtension->text());
00563   ListViewExecutables->findItem("Spfmap",0)->setText(1,LineEditPath->text()+"spfmap"+LineEditExtension->text());
00564   ListViewExecutables->findItem("Startvec",0)->setText(1,LineEditPath->text()+"startvec"+LineEditExtension->text());
00565   ListViewExecutables->findItem("Stock",0)->setText(1,LineEditPath->text()+"stock"+LineEditExtension->text());
00566   ListViewExecutables->findItem("Symm",0)->setText(1,LineEditPath->text()+"symm"+LineEditExtension->text());
00567   ListViewExecutables->findItem("Table",0)->setText(1,LineEditPath->text()+"table"+LineEditExtension->text());
00568   ListViewExecutables->findItem("Xyz2crd",0)->setText(1,LineEditPath->text()+"xyz2crd"+LineEditExtension->text());
00569   
00570   changeExecutable(); //update LabelProgram & LineEditExecutable
00571 }
00572 
00574 void PreferencesBase::selectBinDir()
00576 {  
00577   QString dirname = QFileDialog::getExistingDirectory(LineEditBin->text(),this, 0, tr("Choose a directory"));
00578   if(!dirname.isNull())
00579     LineEditBin->setText(QDir::convertSeparators(dirname));
00580 }
00581 
00583 void PreferencesBase::selectExecutable()
00585 {  
00586   QString filename = QFileDialog::getOpenFileName(LineEditExecutable->text(), QString::null, this, 0, tr("Choose an executable"));
00587   if(!filename.isNull())
00588     LineEditExecutable->setText(QDir::convertSeparators(filename));
00589 }
00590 
00592 void PreferencesBase::selectBasisDir()
00594 {  
00595   QString dirname = QFileDialog::getExistingDirectory(LineEditBasis->text(),this, 0, tr("Choose a directory"));
00596   if(!dirname.isNull())
00597     LineEditBasis->setText(QDir::convertSeparators(dirname));
00598 }
00599 
00601 void PreferencesBase::selectBackground()
00603 {
00604   QString filename = QFileDialog::getOpenFileName(LineEditBackground->text(), QString::null, this, 0, tr("Choose an image"));
00605   if(!filename.isNull())
00606     LineEditBackground->setText(filename);
00607 }
00608 
00610 void PreferencesBase::updateLineEditBondSizeLines()
00612 {
00613   LineEditBondSizeLines->setText(QString::number(SliderBondSizeLines->value()*lineWidthGranularity));
00614 }
00615 
00617 void PreferencesBase::updateLineEditBondSizeTubes()
00619 {  
00620   LineEditBondSizeTubes->blockSignals(true);
00621   LineEditBondSizeTubes->setText(QString::number(SliderBondSizeTubes->value()*0.01));
00622   LineEditBondSizeTubes->blockSignals(false);
00623 }
00624 
00626 void PreferencesBase::updateSliderBondSizeTubes()
00628 {  
00629   SliderBondSizeTubes->blockSignals(true);
00630   SliderBondSizeTubes->setValue(static_cast<int>(LineEditBondSizeTubes->text().toFloat()/0.01));
00631   SliderBondSizeTubes->blockSignals(false);
00632 }
00633 
00635 void PreferencesBase::updateLineEditForceSizeTubes()
00637 {  
00638   LineEditForceSizeTubes->blockSignals(true);
00639   LineEditForceSizeTubes->setText(QString::number(SliderForceSizeTubes->value()*0.01));
00640   LineEditForceSizeTubes->blockSignals(false);
00641 }
00642 
00644 void PreferencesBase::updateSliderForceSizeTubes()
00646 {  
00647   SliderForceSizeTubes->blockSignals(true);
00648   SliderForceSizeTubes->setValue(static_cast<int>(LineEditForceSizeTubes->text().toFloat()/0.01));
00649   SliderForceSizeTubes->blockSignals(false);
00650 }
00651 
00653 void PreferencesBase::updateOpacitySelection()
00655 {  
00656   if(SliderSelectionOpacity->value() == 100)
00657     TextLabelSelection->setText(QString::number(SliderSelectionOpacity->value()) + " %");
00658   else
00659     TextLabelSelection->setText(" " + QString::number(SliderSelectionOpacity->value()) + " %");
00660 }
00661 
00663 void PreferencesBase::updateOpacityForces()
00665 {  
00666   if(SliderForceOpacity->value() == 100)
00667     TextLabelForce->setText(QString::number(SliderForceOpacity->value()) + " %");
00668   else
00669     TextLabelForce->setText(" " + QString::number(SliderForceOpacity->value()) + " %");
00670 }
00671 
00673 void PreferencesBase::updateColorButtonForce()
00675 {  
00676   ColorButtonForce->setEnabled(ComboBoxForceColor->currentItem() == 1);
00677 }
00678 
00680 void PreferencesBase::changePVMHost()
00682 {  
00683   LineEditPVMHosts->blockSignals(true); // so setting the text doesn't change the listview
00684   if(ListViewPVMHosts->selectedItem() != 0)
00685   {
00686     LineEditPVMHosts->setEnabled(true);
00687     PushButtonPVMHostsDelete->setEnabled(true);
00688     LineEditPVMHosts->setText(ListViewPVMHosts->selectedItem()->text(0));
00689   }
00690   else
00691   {
00692     LineEditPVMHosts->setEnabled(false);
00693     PushButtonPVMHostsDelete->setEnabled(false);
00694     LineEditPVMHosts->setText(QString::null);
00695   }
00696   LineEditPVMHosts->blockSignals(false);
00697 }
00698 
00700 void PreferencesBase::updatePVMHost(const QString& text)
00702 {  
00703   if(ListViewPVMHosts->selectedItem() != 0)
00704   {
00705     ListViewPVMHosts->selectedItem()->setText(0, text);
00706     ListViewPVMHosts->sort();
00707   }
00708 }
00709 
00711 void PreferencesBase::newPVMHost()
00713 {  
00714   QListViewItem* item =  new QListViewItem(ListViewPVMHosts,tr("host.domain"));
00715   ListViewPVMHosts->setSelected(item, true);
00716 }
00717 
00719 void PreferencesBase::deletePVMHost()
00721 {  
00722   if(ListViewPVMHosts->selectedItem() != 0)
00723   {
00724     delete ListViewPVMHosts->selectedItem();
00725     changed();
00726     changedPVM();
00727     ListViewPVMHosts->setSelected(ListViewPVMHosts->firstChild(), true);
00728     changePVMHost();
00729   }
00730 }
00731 
00733 void PreferencesBase::changedPVM()
00735 {
00736   pvmHostsChanged = true;
00737 }
00738 
00739 
00743 
00745 void PreferencesBase::makeConnections()
00747 {  
00749   connect(IconViewCategory, SIGNAL(selectionChanged(QIconViewItem*)), this, SLOT(selectWidget(QIconViewItem*)));
00750   
00752   connect(ButtonOK, SIGNAL(clicked()), this, SLOT(accept()));
00753   connect(ButtonCancel, SIGNAL(clicked()), this, SLOT(reject()));
00754   
00757   connect(ListViewExecutables, SIGNAL(selectionChanged()), this, SLOT(changeExecutable()));
00758   connect(LineEditExecutable, SIGNAL(textChanged(const QString&)), this, SLOT(updateExecutable(const QString&)));
00759   connect(PushButtonRename, SIGNAL(clicked()), this, SLOT(updateAllExecutables()));
00760   connect(ToolButtonBin, SIGNAL(clicked()), this, SLOT(selectBinDir()));
00761   connect(ToolButtonExecutable, SIGNAL(clicked()), this, SLOT(selectExecutable()));
00762   connect(ToolButtonBasis, SIGNAL(clicked()), this, SLOT(selectBasisDir()));
00764   connect(SliderBondSizeLines, SIGNAL(valueChanged(int)), this, SLOT(updateLineEditBondSizeLines()));
00765   connect(SliderBondSizeTubes, SIGNAL(valueChanged(int)), this, SLOT(updateLineEditBondSizeTubes()));
00766   connect(LineEditBondSizeTubes, SIGNAL(textChanged(const QString&)), this, SLOT(updateSliderBondSizeTubes()));
00767   connect(SliderForceSizeTubes, SIGNAL(valueChanged(int)), this, SLOT(updateLineEditForceSizeTubes()));
00768   connect(LineEditForceSizeTubes, SIGNAL(textChanged(const QString&)), this, SLOT(updateSliderForceSizeTubes()));
00769   connect(SliderSelectionOpacity, SIGNAL(valueChanged(int)), this, SLOT(updateOpacitySelection()));
00770   connect(SliderForceOpacity, SIGNAL(valueChanged(int)), this, SLOT(updateOpacityForces()));
00771   connect(ComboBoxForceColor, SIGNAL(activated(int)), this, SLOT(updateColorButtonForce()));
00773   connect(ToolButtonBackground, SIGNAL(clicked()), this, SLOT(selectBackground()));
00775   connect(ListViewPVMHosts, SIGNAL(selectionChanged()), this, SLOT(changePVMHost()));
00776   connect(LineEditPVMHosts, SIGNAL(textChanged(const QString&)), this, SLOT(updatePVMHost(const QString&)));
00777   connect(PushButtonPVMHostsNew, SIGNAL(clicked()), this, SLOT(newPVMHost()));
00778   connect(PushButtonPVMHostsDelete, SIGNAL(clicked()), this, SLOT(deletePVMHost()));
00779   
00782   connect(LineEditExecutable, SIGNAL(textChanged(const QString&)), this, SLOT(changed())); // no appropiate signal for ListViewExecutable
00783   connect(LineEditPath, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
00784   connect(LineEditExtension, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
00785   connect(PushButtonRename, SIGNAL(clicked()), this, SLOT(changed()));
00786   connect(ButtonGroupBin, SIGNAL(clicked(int)), this, SLOT(changed()));
00787   connect(LineEditBin, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
00788   connect(LineEditBasis, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
00789   connect(ComboBoxBasis, SIGNAL(activated(int)), this, SLOT(changed()));
00791   connect(ComboBoxMolecule, SIGNAL(activated(int)), this, SLOT(changed()));
00792   connect(ComboBoxForces, SIGNAL(activated(int)), this, SLOT(changed()));
00793   connect(SpinBoxFastRender, SIGNAL(valueChanged(int)), this, SLOT(changed()));
00794   connect(CheckBoxElement, SIGNAL(clicked()), this, SLOT(changed()));
00795   connect(CheckBoxNumber, SIGNAL(clicked()), this, SLOT(changed()));
00796   connect(SliderBondSizeLines, SIGNAL(valueChanged(int)), this, SLOT(changed()));
00797   connect(SliderBondSizeTubes, SIGNAL(valueChanged(int)), this, SLOT(changed()));
00798   connect(LineEditBondSizeTubes, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
00799   connect(SliderForceSizeTubes, SIGNAL(valueChanged(int)), this, SLOT(changed()));
00800   connect(LineEditForceSizeTubes, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
00801   connect(ColorButtonLabel, SIGNAL(newColor(QColor*)), this, SLOT(changed()));
00802   connect(ColorButtonIC, SIGNAL(newColor(QColor*)), this, SLOT(changed()));
00803   connect(ColorButtonBackgroundGL, SIGNAL(newColor(QColor*)), this, SLOT(changed()));
00804   connect(ColorButtonSelection, SIGNAL(newColor(QColor*)), this, SLOT(changed()));
00805   connect(SliderSelectionOpacity, SIGNAL(valueChanged(int)), this, SLOT(changed()));
00806   connect(ColorButtonForce, SIGNAL(newColor(QColor*)), this, SLOT(changed()));
00807   connect(ComboBoxForceColor, SIGNAL(activated(int)), this, SLOT(changed()));
00808   connect(SliderForceOpacity, SIGNAL(valueChanged(int)), this, SLOT(changed()));
00810   connect(ButtonGroupBackground, SIGNAL(clicked(int)), this, SLOT(changed()));
00811   connect(LineEditBackground, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
00812   connect(ColorButtonBackground, SIGNAL(newColor(QColor*)), this, SLOT(changed()));
00813   connect(ComboBoxStyle, SIGNAL(activated(int)), this, SLOT(changed()));
00815   connect(SliderQuality, SIGNAL(valueChanged(int)), this, SLOT(changed()));
00816   connect(CheckBoxAA, SIGNAL(clicked()), this, SLOT(changed()));
00817   connect(CheckBoxSmooth, SIGNAL(clicked()), this, SLOT(changed()));
00818   connect(CheckBoxDepthCue, SIGNAL(clicked()), this, SLOT(changed()));
00819   connect(ButtonGroupLightPosition, SIGNAL(clicked(int)), this, SLOT(changed()));
00820   connect(ColorButtonLight, SIGNAL(newColor(QColor*)), this, SLOT(changed()));
00821   connect(SliderSpecular, SIGNAL(valueChanged(int)), this, SLOT(changed()));
00822   connect(SliderShininess, SIGNAL(valueChanged(int)), this, SLOT(changed()));
00823   connect(ButtonGroupProjection, SIGNAL(clicked(int)), this, SLOT(changed()));
00825   connect(LineEditPVMHosts, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
00826   connect(LineEditPVMHosts, SIGNAL(textChanged(const QString&)), this, SLOT(changedPVM()));
00827   connect(PushButtonPVMHostsNew, SIGNAL(clicked()), this, SLOT(changed()));
00828   connect(PushButtonPVMHostsNew, SIGNAL(clicked()), this, SLOT(changedPVM()));
00829 }
00830 
00832 void PreferencesBase::init()
00834 {  
00836   IconViewCategory->setSelected(IconViewCategory->firstItem(), true);  
00838   ListViewExecutables->setSelected(ListViewExecutables->firstChild(), true);
00840   ComboBoxBasis->clear();
00841   for(unsigned int i = 0; i < Basisset::maxBasissets(); i++)
00842     ComboBoxBasis->insertItem(Basisset::numToBasis(i));
00844   ComboBoxBasis->setCurrentItem(Basisset::basisToNum("6-31G"));
00846   QStringList styleList = QStyleFactory::keys();
00847   styleList.sort();
00849   ComboBoxStyle->blockSignals(true);
00850   ComboBoxStyle->clear();
00851   ComboBoxStyle->insertItem(tr("Startup style") + " (" + QApplication::style().name() + ")");
00852   for(QStringList::iterator it = styleList.begin(); it != styleList.end(); it++)
00853     ComboBoxStyle->insertItem(*it);
00854   ComboBoxStyle->blockSignals(false);
00856   startupStyleName = QApplication::style().name();
00857 
00859   initOpenGL();
00860   SliderBondSizeLines->setMinValue(static_cast<int>(minLineWidthGL/lineWidthGranularity));
00861   SliderBondSizeLines->setMaxValue(static_cast<int>(maxLineWidthGL/lineWidthGranularity));
00862   SliderBondSizeTubes->setMaxValue(static_cast<int>(AtomSet::vanderWaals(1)/0.01)); // maxsize is H-diameter
00863   SliderForceSizeTubes->setMaxValue(static_cast<int>(AtomSet::vanderWaals(1)/0.01)); 
00864   
00866   QRegExp rx("[-a-zA-Z0-9\\.]+");
00867   LineEditPVMHosts->setValidator(new QRegExpValidator(rx, this));
00869   Latin1Validator* v = new Latin1Validator(this);
00870   LineEditBin->setValidator(v);
00871   LineEditBasis->setValidator(v);
00872   v = 0;
00873 
00875   loadSettings();
00876   updateColorButtonForce();
00877 
00879   for(QIconViewItem* item = IconViewCategory->firstItem(); item; item = item->nextItem())
00880   {
00881     if(item->text() == tr("BRABO"))
00882       item->setPixmap(IconSets::getPixmap(IconSets::BRABO));
00883     else if(item->text() == tr("Molecule"))
00884       item->setPixmap(IconSets::getPixmap(IconSets::Molecule));
00885     else if(item->text() == tr("Visuals"))
00886       item->setPixmap(IconSets::getPixmap(IconSets::Visuals));
00887     else if(item->text() == tr("OpenGL"))
00888       item->setPixmap(IconSets::getPixmap(IconSets::OpenGL));
00889     else if(item->text() == tr("PVM"))
00890       item->setPixmap(IconSets::getPixmap(IconSets::PVM));
00891   }
00892   ToolButtonExecutable->setIconSet(IconSets::getIconSet(IconSets::Open));
00893   ToolButtonBin->setIconSet(IconSets::getIconSet(IconSets::Open));
00894   ToolButtonBasis->setIconSet(IconSets::getIconSet(IconSets::Open));
00895   ToolButtonBackground->setIconSet(IconSets::getIconSet(IconSets::Open));
00896 
00897   resize(1,1); 
00898   changeExecutable();
00899   updatePaths();
00900   widgetChanged = false;
00901   pvmHostsChanged = false;
00902 }
00903 
00905 void PreferencesBase::initOpenGL()
00910 {
00912   QGLWidget* testOpenGL = new QGLWidget();
00913   testOpenGL->makeCurrent();
00914 
00916   GLfloat lwrange[] = {0.0, 0.0};
00917   GLfloat lwgran[] = {0.0};
00918   glGetFloatv(GL_LINE_WIDTH_RANGE, lwrange);
00919   glGetFloatv(GL_LINE_WIDTH_GRANULARITY, lwgran);
00920   minLineWidthGL = lwrange[0];
00921   maxLineWidthGL = lwrange[1];
00922   lineWidthGranularity = lwgran[0];
00923 
00924   /*
00925   qDebug("Renderer: %s",(const char*)glGetString(GL_RENDERER));
00926   qDebug("Vendor: %s",(const char*)glGetString(GL_VENDOR));
00927   qDebug("Version: %s",(const char*)glGetString(GL_VERSION));
00928   qDebug("Extensions: %s",(const char*)glGetString(GL_EXTENSIONS));
00929   //*/   
00930 
00932   delete testOpenGL;
00933 
00934 }
00935 
00937 void PreferencesBase::saveWidgets()
00939 {
00941   data.executables.clear();
00942   QListViewItem* item = ListViewExecutables->firstChild();
00943   while(item != 0)
00944   {
00945     data.executables += item->text(1);
00946     item = item->nextSibling();
00947   }
00948   data.path = LineEditPath->text();
00949   data.extension = LineEditExtension->text();
00950   data.binInCalcDir = RadioButtonBin1->isChecked();
00951   data.binDir = LineEditBin->text();
00952   data.basissetDir = LineEditBasis->text();
00953   data.basisset = ComboBoxBasis->currentItem();
00954   
00956   data.styleMolecule = ComboBoxMolecule->currentItem();
00957   data.styleForces = ComboBoxForces->currentItem();
00958   data.fastRenderLimit = SpinBoxFastRender->value();
00959   data.showElements = CheckBoxElement->isChecked();
00960   data.showNumbers = CheckBoxNumber->isChecked();
00961   data.sizeLines = SliderBondSizeLines->value();
00962   data.sizeBonds = LineEditBondSizeTubes->text();
00963   data.sizeForces = LineEditForceSizeTubes->text();
00964   data.colorLabels = ColorButtonLabel->color().rgb();
00965   data.colorICs = ColorButtonIC->color().rgb();
00966   data.colorBackgroundGL = ColorButtonBackgroundGL->color().rgb();
00967   data.colorSelections = ColorButtonSelection->color().rgb();
00968   data.colorForces = ColorButtonForce->color().rgb();
00969   data.opacitySelections = SliderSelectionOpacity->value();
00970   data.opacityForces = SliderForceOpacity->value();
00971   data.forcesOneColor = ComboBoxForceColor->currentItem() == 1;
00972 
00974   data.backgroundType = ButtonGroupBackground->selectedId();
00975   data.backgroundImage = LineEditBackground->text();
00976   data.backgroundColor = ColorButtonBackground->color().rgb();
00977   data.styleApplication = ComboBoxStyle->currentItem();
00978 
00980   data.quality = SliderQuality->value();
00981   data.antialias = CheckBoxAA->isChecked();
00982   data.smoothShading = CheckBoxSmooth->isChecked();
00983   data.depthCue = CheckBoxDepthCue->isChecked();
00984   /*for(unsigned int i = 0; i < 9; i++)
00985   {
00986     if(ButtonGroupLightPosition->find(i)->isOn())
00987     {
00988       data.lightPosition = i;
00989       break;
00990     }
00991   }*/
00992   data.lightPosition = ButtonGroupLightPosition->selectedId();
00993   data.lightColor = ColorButtonLight->color().rgb();
00994   data.materialSpecular = SliderSpecular->value();
00995   data.materialShininess = SliderShininess->value();
00996   data.perspectiveProjection = RadioButtonPerspective->isChecked();
00997 
00999   data.pvmHosts.clear();
01000   item = ListViewPVMHosts->firstChild();
01001   while(item != 0)
01002   {
01003     data.pvmHosts += item->text(0);
01004     item = item->nextSibling();
01005   }
01006 
01007 }
01008 
01010 void PreferencesBase::restoreWidgets()
01012 {  
01014   QListViewItem* item = ListViewExecutables->firstChild();
01015   {
01016     for(QStringList::Iterator it = data.executables.begin(); it != data.executables.end(); it++)
01017     {
01018       if(item == 0)
01019         break;  // more values than ListViewItems
01020       item->setText(1,*it);
01021       item = item->nextSibling();
01022     }  
01023   }
01024   LineEditPath->setText(data.path);
01025   LineEditExtension->setText(data.extension);
01026   RadioButtonBin1->setChecked(data.binInCalcDir);
01027   RadioButtonBin2->setChecked(!data.binInCalcDir);
01028   LineEditBin->setText(data.binDir);
01029   LineEditBasis->setText(data.basissetDir);
01030   ComboBoxBasis->setCurrentItem(data.basisset);
01031   
01033   ComboBoxMolecule->setCurrentItem(data.styleMolecule);
01034   ComboBoxForces->setCurrentItem(data.styleForces);
01035   SpinBoxFastRender->setValue(data.fastRenderLimit);
01036   CheckBoxElement->setChecked(data.showElements);
01037   CheckBoxNumber->setChecked(data.showNumbers);
01038   SliderBondSizeLines->setValue(data.sizeLines);
01039     updateLineEditBondSizeLines(); // needed?
01040   LineEditBondSizeTubes->setText(data.sizeBonds);
01041     updateSliderBondSizeTubes();
01042   LineEditForceSizeTubes->setText(data.sizeForces);
01043     updateSliderForceSizeTubes();
01044   ColorButtonLabel->setColor(data.colorLabels);
01045   ColorButtonIC->setColor(data.colorICs);
01046   ColorButtonBackgroundGL->setColor(data.colorBackgroundGL);
01047   ColorButtonSelection->setColor(data.colorSelections);
01048   ColorButtonForce->setColor(data.colorForces);
01049   SliderSelectionOpacity->setValue(data.opacitySelections);
01050   SliderForceOpacity->setValue(data.opacityForces);
01051   ComboBoxForceColor->setCurrentItem(data.forcesOneColor ? 1 : 0);
01052 
01054   ButtonGroupBackground->setButton(data.backgroundType);
01055   LineEditBackground->setText(data.backgroundImage);
01056   ColorButtonBackground->setColor(data.backgroundColor);
01057   ComboBoxStyle->setCurrentItem(data.styleApplication);
01058 
01060   SliderQuality->setValue(data.quality);
01061   CheckBoxAA->setChecked(data.antialias);
01062   CheckBoxSmooth->setChecked(data.smoothShading);
01063   CheckBoxDepthCue->setChecked(data.depthCue);
01064   ButtonGroupLightPosition->setButton(data.lightPosition);
01065   ColorButtonLight->setColor(QColor(data.lightColor));
01066   SliderSpecular->setValue(data.materialSpecular);
01067   SliderShininess->setValue(data.materialShininess);
01068   ButtonGroupProjection->setButton(data.perspectiveProjection ? 0 : 1);
01069 
01071   ListViewPVMHosts->clear();
01072   { for(QStringList::Iterator it = data.pvmHosts.begin(); it != data.pvmHosts.end(); it++)
01073       new QListViewItem(ListViewPVMHosts, *it); }
01074   if(!data.pvmHosts.isEmpty())
01075     ListViewPVMHosts->setSelected(ListViewPVMHosts->firstChild(), true);  
01076   changePVMHost();
01077 }
01078 
01080 void PreferencesBase::updateStyle()
01083 {  
01084   qDebug("Calling PreferencesBase::updateStyle");
01085   qDebug("currentStyle = " + QString(QApplication::style().name()));    
01086   if(ComboBoxStyle->currentItem() == 0)
01087   {
01088     if(QString(QApplication::style().name()).lower() != startupStyleName.lower())
01089     {
01090       qDebug("About to revert to the startup style");      
01091       QApplication::setStyle(startupStyleName);
01092     }
01093   }
01094   else
01095   {
01096     qDebug("About to change the style to "+ComboBoxStyle->currentText());
01097     QApplication::setStyle(ComboBoxStyle->currentText());
01098   }
01099 }
01100 
01102 void PreferencesBase::updatePaths()
01104 {
01105   Paths::abc         = QDir::convertSeparators(ListViewExecutables->findItem("ABC", 0)->text(1));
01106   Paths::achar       = QDir::convertSeparators(ListViewExecutables->findItem("Achar",0)->text(1));
01107   Paths::atomscf     = QDir::convertSeparators(ListViewExecutables->findItem("AtomSCF",0)->text(1));
01108   Paths::atomscf_inp = QDir::convertSeparators(ListViewExecutables->findItem("AtomSCF_inp",0)->text(1));
01109   Paths::atomscf_o2d = QDir::convertSeparators(ListViewExecutables->findItem("AtomSCF_o2d",0)->text(1));
01110   Paths::b112gfchk   = QDir::convertSeparators(ListViewExecutables->findItem("B112gfchk",0)->text(1));
01111   Paths::bios2ped    = QDir::convertSeparators(ListViewExecutables->findItem("Bios2ped",0)->text(1));
01112   Paths::brabo       = QDir::convertSeparators(ListViewExecutables->findItem("Brabo",0)->text(1));
01113   Paths::buur        = QDir::convertSeparators(ListViewExecutables->findItem("Buur",0)->text(1));
01114   Paths::cnvrtaff    = QDir::convertSeparators(ListViewExecutables->findItem("Cnvrtaff",0)->text(1));
01115   Paths::crd2gauss   = QDir::convertSeparators(ListViewExecutables->findItem("Crd2gauss",0)->text(1));
01116   Paths::crd2xyz     = QDir::convertSeparators(ListViewExecutables->findItem("Crd2xyz",0)->text(1));
01117   Paths::diffcrd     = QDir::convertSeparators(ListViewExecutables->findItem("Diffcrd",0)->text(1));
01118   Paths::distor      = QDir::convertSeparators(ListViewExecutables->findItem("Distor",0)->text(1));
01119   Paths::forkon      = QDir::convertSeparators(ListViewExecutables->findItem("Forkon",0)->text(1));
01120   Paths::frex        = QDir::convertSeparators(ListViewExecutables->findItem("Frex",0)->text(1));
01121   Paths::gar2ped     = QDir::convertSeparators(ListViewExecutables->findItem("Gar2ped",0)->text(1));
01122   Paths::geom        = QDir::convertSeparators(ListViewExecutables->findItem("Geom",0)->text(1));
01123   Paths::gfchk2b11   = QDir::convertSeparators(ListViewExecutables->findItem("Gfchk2b11",0)->text(1));
01124   Paths::gfchk2crd   = QDir::convertSeparators(ListViewExecutables->findItem("Gfchk2crd",0)->text(1));
01125   Paths::gfchk2pun   = QDir::convertSeparators(ListViewExecutables->findItem("Gfchk2pun",0)->text(1));
01126   Paths::hkl         = QDir::convertSeparators(ListViewExecutables->findItem("HKL",0)->text(1));
01127   Paths::log2crd     = QDir::convertSeparators(ListViewExecutables->findItem("Log2crd",0)->text(1));
01128   Paths::maff        = QDir::convertSeparators(ListViewExecutables->findItem("Maff",0)->text(1));
01129   Paths::makeden     = QDir::convertSeparators(ListViewExecutables->findItem("Makeden",0)->text(1));
01130   Paths::makexit     = QDir::convertSeparators(ListViewExecutables->findItem("Makexit",0)->text(1));
01131   Paths::molsplit    = QDir::convertSeparators(ListViewExecutables->findItem("Molsplit",0)->text(1));
01132   Paths::out2aff     = QDir::convertSeparators(ListViewExecutables->findItem("Out2aff",0)->text(1));
01133   Paths::potdicht    = QDir::convertSeparators(ListViewExecutables->findItem("Potdicht",0)->text(1));
01134   Paths::pullarc     = QDir::convertSeparators(ListViewExecutables->findItem("Pullarc",0)->text(1));
01135   Paths::refine      = QDir::convertSeparators(ListViewExecutables->findItem("Refine",0)->text(1));
01136   Paths::relax       = QDir::convertSeparators(ListViewExecutables->findItem("Relax",0)->text(1));
01137   Paths::ring        = QDir::convertSeparators(ListViewExecutables->findItem("Ring",0)->text(1));
01138   Paths::spfmap      = QDir::convertSeparators(ListViewExecutables->findItem("Spfmap",0)->text(1));
01139   Paths::startvec    = QDir::convertSeparators(ListViewExecutables->findItem("Startvec",0)->text(1));
01140   Paths::stock       = QDir::convertSeparators(ListViewExecutables->findItem("Stock",0)->text(1));
01141   Paths::symm        = QDir::convertSeparators(ListViewExecutables->findItem("Symm",0)->text(1));
01142   Paths::table       = QDir::convertSeparators(ListViewExecutables->findItem("Table",0)->text(1));
01143   Paths::xyz2crd     = QDir::convertSeparators(ListViewExecutables->findItem("Xyz2crd",0)->text(1));
01144 
01145   if(RadioButtonBin2->isChecked())
01146     Paths::bin = LineEditBin->text();
01147   else
01148     Paths::bin = QString::null;  
01149   Paths::basisset = LineEditBasis->text();
01150 
01153   Paths::bin = QDir::convertSeparators(QDir::cleanDirPath(Paths::bin));
01154   Paths::basisset = QDir::convertSeparators(QDir::cleanDirPath(Paths::basisset));
01155 }
01156 

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