lib/Preferences.cpp

Go to the documentation of this file.
00001 /*
00002  *  Qtstalker stock charter
00003  *
00004  *  Copyright (C) 2001-2007 Stefan S. Stratigakos
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00019  *  USA.
00020  */
00021 
00022 #include "Preferences.h"
00023 #include "HelpWindow.h"
00024 #include "RcFile.h"
00025 
00026 #include <qlabel.h>
00027 #include <qlayout.h>
00028 
00029 
00030 Preferences::Preferences (QWidget *w) : QTabDialog (w, "Preferences", FALSE, WDestructiveClose)
00031 {
00032   helpFile = "preferences.html";
00033 
00034   setCaption(tr("Edit Prefs"));
00035 
00036   loadSettings();
00037   createGeneralPage();
00038   createColorPage();
00039   createFontPage();
00040   createMTPage(); // main tool bar
00041   createCTPage(); // chart tool bar
00042   createETPage(); // extra tool bar
00043   
00044   setApplyButton(tr("&Apply"));  
00045   connect(this, SIGNAL(applyButtonPressed()), this, SLOT(slotSave()));
00046   
00047   setCancelButton(tr("&Ok"));  
00048 //  connect(this, SIGNAL(cancelButtonPressed()), this, SLOT(exitDialog()));
00049   
00050   setOkButton(QString::null);  
00051   
00052   setHelpButton();
00053   QObject::connect(this, SIGNAL(helpButtonPressed()), this, SLOT(slotHelp()));
00054   resize(sz);
00055   
00056 }
00057 
00058 Preferences::~Preferences ()
00059 {
00060   RcFile rcfile;
00061   rcfile.saveSize(RcFile::PrefDlgWindowSize, size());
00062 }
00063 
00064 void Preferences::loadSettings ()
00065 {
00066   RcFile rcfile;
00067 
00068   rcfile.loadData(RcFile::ShowMenuBar, menubar);
00069   rcfile.loadData(RcFile::ShowExtraToolbar, extraToolbar);
00070 
00071   rcfile.loadData(RcFile::PSButton, ps1Button, 1);
00072   rcfile.loadData(RcFile::PSButton, ps2Button, 2);
00073   rcfile.loadData(RcFile::PSButton, ps3Button, 3);
00074   rcfile.loadColor(RcFile::BackgroundColor, backgroundColor);
00075   rcfile.loadColor(RcFile::BorderColor, borderColor);
00076   rcfile.loadColor(RcFile::GridColor, gridColor);
00077   rcfile.loadFont(RcFile::PlotFont, plotFont);
00078   rcfile.loadFont(RcFile::AppFont, appFont);
00079   rcfile.loadSize(RcFile::PrefDlgWindowSize, sz);
00080 }
00081 
00082 void Preferences::createGeneralPage ()
00083 {
00084   // general parms page
00085 
00086   QWidget *w = new QWidget(this);
00087   QVBoxLayout *vbox = new QVBoxLayout(w);
00088   
00089   QGridLayout *grid = new QGridLayout(vbox, 1, 3);
00090   grid->setMargin(5);
00091   grid->setSpacing(5);
00092   grid->setColStretch(1, 1); // stretch 2nd col a little
00093   grid->setColStretch(2, 2); // stretch outer right col more
00094   
00095   vbox->insertStretch(-1, 1);
00096 
00097   // menubar checkbox
00098   QLabel *label = new QLabel(tr("Main Menubar"), w);
00099   grid->addWidget(label, 0, 0);
00100   
00101   menubarCheck = new QCheckBox(w);
00102   menubarCheck->setChecked(menubar);
00103   connect(menubarCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00104   grid->addWidget(menubarCheck, 0, 1);
00105 
00106   // extraToolbar checkbox
00107   label = new QLabel(tr("Extra Toolbar"), w);
00108   grid->addWidget(label, 1, 0);
00109   
00110   extraToolbarCheck = new QCheckBox(w);
00111   extraToolbarCheck->setChecked(extraToolbar);
00112   connect(extraToolbarCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00113   grid->addWidget(extraToolbarCheck, 1, 1);
00114 
00115   // bar spacing 1
00116   label = new QLabel(tr("Bar Spacing 1"), w);
00117   grid->addWidget(label, 2, 0);
00118   
00119   bs1Spinner = new QSpinBox(2, 99, 1, w);
00120   bs1Spinner->setValue(ps1Button);
00121   connect(bs1Spinner, SIGNAL(valueChanged(int)), this, SLOT(slotModified()));
00122   grid->addWidget(bs1Spinner, 2, 1);
00123 
00124   // bar spacing 2
00125   label = new QLabel(tr("Bar Spacing 2"), w);
00126   grid->addWidget(label, 3, 0);
00127   
00128   bs2Spinner = new QSpinBox(2, 99, 1, w);
00129   bs2Spinner->setValue(ps2Button);
00130   connect(bs2Spinner, SIGNAL(valueChanged(int)), this, SLOT(slotModified()));
00131   grid->addWidget(bs2Spinner, 3, 1);
00132 
00133   // bar spacing 3
00134   label = new QLabel(tr("Bar Spacing 3"), w);
00135   grid->addWidget(label, 4, 0);
00136   
00137   bs3Spinner = new QSpinBox(2, 99, 1, w);
00138   bs3Spinner->setValue(ps3Button);
00139   connect(bs3Spinner, SIGNAL(valueChanged(int)), this, SLOT(slotModified()));
00140   grid->addWidget(bs3Spinner, 4, 1);
00141 
00142   addTab(w, tr("General"));
00143 }
00144 
00145 void Preferences::createColorPage ()
00146 {
00147   // colors parms page
00148 
00149   QWidget *w = new QWidget(this);
00150   QVBoxLayout *vbox = new QVBoxLayout(w);
00151   
00152   QGridLayout *grid = new QGridLayout(vbox, 1, 3);
00153   grid->setMargin(5);
00154   grid->setSpacing(5);
00155   grid->setColStretch(1, 1);
00156   grid->setColStretch(2, 2);
00157   
00158   vbox->insertStretch(-1, 1);
00159 
00160   // background color
00161   QLabel *label = new QLabel(tr("Chart Background"), w);
00162   grid->addWidget(label, 0, 0);
00163   
00164   backgroundColorButton = new ColorButton(w, backgroundColor);
00165   grid->addWidget(backgroundColorButton, 0, 1);
00166   backgroundColorButton->setColorButton();
00167   connect(backgroundColorButton, SIGNAL(valueChanged()), this, SLOT(slotModified()));
00168 
00169   // border color
00170   label = new QLabel(tr("Chart Border"), w);
00171   grid->addWidget(label, 1, 0);
00172   
00173   borderColorButton = new ColorButton(w, borderColor);
00174   grid->addWidget(borderColorButton, 1, 1);
00175   borderColorButton->setColorButton();
00176   connect(borderColorButton, SIGNAL(valueChanged()), this, SLOT(slotModified()));
00177 
00178   // grid color
00179   label = new QLabel(tr("Chart Grid"), w);
00180   grid->addWidget(label, 2, 0);
00181   
00182   gridColorButton = new ColorButton(w, gridColor);
00183   grid->addWidget(gridColorButton, 2, 1);
00184   gridColorButton->setColorButton();
00185   connect(gridColorButton, SIGNAL(valueChanged()), this, SLOT(slotModified()));
00186 
00187   //FIXME: add adjustment possibility for prefered CO-colors.
00188   // in this way to add a spinbox to set the amount of colors too
00189   
00190   addTab(w, tr("Colors"));
00191 }
00192 
00193 void Preferences::createFontPage ()
00194 {
00195   // font parms page
00196 
00197   QWidget *w = new QWidget(this);
00198   QVBoxLayout *vbox = new QVBoxLayout(w);
00199   
00200   QGridLayout *grid = new QGridLayout(vbox, 1, 3);
00201   grid->setMargin(5);
00202   grid->setSpacing(5);
00203   grid->setColStretch(1, 1);
00204   grid->setColStretch(2, 2);
00205   
00206   vbox->insertStretch(-1, 1);
00207 
00208   // plot font
00209   QLabel *label = new QLabel(tr("Plot Font"), w);
00210   grid->addWidget(label, 0, 0);
00211   
00212   plotFontButton = new FontButton(w, plotFont);
00213   grid->addWidget(plotFontButton, 0, 1);
00214   connect(plotFontButton, SIGNAL(valueChanged()), this, SLOT(slotModified()));
00215 
00216   // app font
00217   label = new QLabel(tr("App Font"), w);
00218   grid->addWidget(label, 1, 0);
00219   
00220   appFontButton = new FontButton(w, appFont);
00221   grid->addWidget(appFontButton, 1, 1);
00222   connect(appFontButton, SIGNAL(valueChanged()), this, SLOT(slotModified()));
00223 
00224   addTab(w, tr("Fonts"));
00225   
00226 }
00227 
00228 void  Preferences::createMTPage()
00229 {
00230   // main tool bar page
00231 
00232   QWidget *w = new QWidget(this);
00233   QVBoxLayout *vbox = new QVBoxLayout(w);
00234   
00235   QGridLayout *grid = new QGridLayout(vbox, 1, 6); // two more cols as needed
00236   grid->setMargin(5);
00237   grid->setSpacing(5);
00238   grid->setColStretch(2, 1); // middle spacing col
00239   grid->setColStretch(5, 2); // outer right col
00240   
00241   vbox->insertStretch(-1, 1);
00242   
00243   int i = 0; // count rows
00244   int j = 0; // "count" cols
00245   bool tb; // temporary
00246   RcFile rcfile;
00247   
00248   QLabel *label = new QLabel(tr("Quit"), w);
00249   grid->addWidget(label, i, j);
00250   quitBtnCheck = new QCheckBox(w);
00251   rcfile.loadData(RcFile::ShowQuitBtn, tb);
00252   quitBtnCheck->setChecked(tb);
00253   connect(quitBtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00254   grid->addWidget(quitBtnCheck, i++, j + 1);
00255 
00256   label = new QLabel(tr("Preferences"), w);
00257   grid->addWidget(label, i, j);
00258   prefBtnCheck = new QCheckBox(w);
00259   rcfile.loadData(RcFile::ShowPrefBtn, tb);
00260   prefBtnCheck->setChecked(tb);
00261   connect(prefBtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00262   grid->addWidget(prefBtnCheck, i++, j + 1);
00263 
00264   label = new QLabel(tr("Side Panel"), w);
00265   grid->addWidget(label, i, j);
00266   sidePanelBtnCheck = new QCheckBox(w);
00267   rcfile.loadData(RcFile::ShowSidePanelBtn, tb);
00268   sidePanelBtnCheck->setChecked(tb);
00269   connect(sidePanelBtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00270   grid->addWidget(sidePanelBtnCheck, i++, j + 1);
00271 
00272   label = new QLabel(tr("Grid"), w);
00273   grid->addWidget(label, i, j);
00274   gridBtnCheck = new QCheckBox(w);
00275   rcfile.loadData(RcFile::ShowGridBtn, tb);
00276   gridBtnCheck->setChecked(tb);
00277   connect(gridBtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00278   grid->addWidget(gridBtnCheck, i++, j + 1);
00279 
00280   label = new QLabel(tr("Scale to Screen"), w);
00281   grid->addWidget(label, i, j);
00282   scaleToScreenBtnCheck = new QCheckBox(w);
00283   rcfile.loadData(RcFile::ShowScaleToScreenBtn, tb);
00284   scaleToScreenBtnCheck->setChecked(tb);
00285   connect(scaleToScreenBtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00286   grid->addWidget(scaleToScreenBtnCheck, i++, j + 1);
00287 
00288   label = new QLabel(tr("CrossHair"), w);
00289   grid->addWidget(label, i, j);
00290   crosshairBtnCheck = new QCheckBox(w);
00291   rcfile.loadData(RcFile::ShowCrosshairBtn, tb);
00292   crosshairBtnCheck->setChecked(tb);
00293   connect(crosshairBtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00294   grid->addWidget(crosshairBtnCheck, i++, j + 1);
00295 
00296   // now fill a second col
00297   i = 0;
00298   j = 3;
00299   
00300   label = new QLabel(tr("PaperTrade"), w);
00301   grid->addWidget(label, i, j);
00302   paperTradeBtnCheck = new QCheckBox(w);
00303   rcfile.loadData(RcFile::ShowPaperTradeBtn, tb);  
00304   paperTradeBtnCheck->setChecked(tb);
00305   connect(paperTradeBtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00306   grid->addWidget(paperTradeBtnCheck, i++, j + 1);
00307 
00308   label = new QLabel(tr("DrawMode"), w);
00309   grid->addWidget(label, i, j);
00310   drawModeBtnCheck= new QCheckBox(w);
00311   rcfile.loadData(RcFile::ShowDrawModeBtn, tb);
00312   drawModeBtnCheck->setChecked(tb);
00313   connect(drawModeBtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00314   grid->addWidget(drawModeBtnCheck, i++, j + 1);
00315 
00316   label = new QLabel(tr("NewIndicator"), w);
00317   grid->addWidget(label, i, j);
00318   newIndicatorBtnCheck = new QCheckBox(w);
00319   rcfile.loadData(RcFile::ShowNewIndicatorBtn, tb);
00320   newIndicatorBtnCheck->setChecked(tb);
00321   connect(newIndicatorBtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00322   grid->addWidget(newIndicatorBtnCheck, i++, j + 1);
00323 
00324   label = new QLabel(tr("DataWindow"), w);
00325   grid->addWidget(label, i, j);
00326   dataWindowBtnCheck = new QCheckBox(w);
00327   rcfile.loadData(RcFile::ShowDataWindowBtn, tb);
00328   dataWindowBtnCheck->setChecked(tb);
00329   connect(dataWindowBtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00330   grid->addWidget(dataWindowBtnCheck, i++, j + 1);
00331 
00332   label = new QLabel(tr("MainQuote"), w);
00333   grid->addWidget(label, i, j);
00334   mainQuoteBtnCheck = new QCheckBox(w);
00335   rcfile.loadData(RcFile::ShowMainQuoteBtn, tb);
00336   mainQuoteBtnCheck->setChecked(tb);
00337   connect(mainQuoteBtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00338   grid->addWidget(mainQuoteBtnCheck, i++, j + 1);
00339 
00340   label = new QLabel(tr("Help"), w);
00341   grid->addWidget(label, i, j);
00342   helpButtonCheck = new QCheckBox(w);
00343   rcfile.loadData(RcFile::ShowHelpButton, tb);
00344   helpButtonCheck->setChecked(tb);
00345   connect(helpButtonCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00346   grid->addWidget(helpButtonCheck, i++, j + 1);
00347 
00348   addTab(w, tr("MainToolbar"));
00349 }
00350 
00351 void  Preferences::createCTPage() 
00352 {
00353   // chart tool bar page
00354 
00355   QWidget *w = new QWidget(this);
00356   QVBoxLayout *vbox = new QVBoxLayout(w);
00357   
00358   QGridLayout *grid = new QGridLayout(vbox, 1, 2);
00359   grid->setMargin(5);
00360   grid->setSpacing(5);
00361   grid->setColStretch(1, 1);
00362   
00363   vbox->insertStretch(-1, 1);
00364 
00365   int i = 0; // count rows
00366   int j = 0; // "count" cols
00367   bool tb; // temporary
00368   RcFile rcfile;
00369 
00370   QLabel *label = new QLabel(tr("Compression list"), w);
00371   grid->addWidget(label, i, j);
00372   cmpsComboBoxCheck = new QCheckBox(w);
00373   rcfile.loadData(RcFile::ShowCmpsComboBox, tb);
00374   cmpsComboBoxCheck->setChecked(tb);
00375   connect(cmpsComboBoxCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00376   grid->addWidget(cmpsComboBoxCheck, i++, j + 1);  
00377 
00378   label = new QLabel(tr("Compression Monthly"), w);
00379   grid->addWidget(label, i, j);
00380   cmpsMtyBtnCheck = new QCheckBox(w);
00381   rcfile.loadData(RcFile::ShowCmpsMtyBtn, tb);
00382   cmpsMtyBtnCheck->setChecked(tb);
00383   connect(cmpsMtyBtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00384   grid->addWidget(cmpsMtyBtnCheck, i++, j + 1);
00385 
00386   label = new QLabel(tr("Compression Weekly"), w);
00387   grid->addWidget(label, i, j);
00388   cmpsWkyBtnCheck = new QCheckBox(w);
00389   rcfile.loadData(RcFile::ShowCmpsWkyBtn, tb);
00390   cmpsWkyBtnCheck->setChecked(tb);
00391   connect(cmpsWkyBtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00392   grid->addWidget(cmpsWkyBtnCheck, i++, j + 1);
00393 
00394   label = new QLabel(tr("Compression Daily"), w);
00395   grid->addWidget(label, i, j);
00396   cmpsDayBtnCheck = new QCheckBox(w);
00397   rcfile.loadData(RcFile::ShowCmpsDayBtn, tb);
00398   cmpsDayBtnCheck->setChecked(tb);
00399   connect(cmpsDayBtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00400   grid->addWidget(cmpsDayBtnCheck, i++, j + 1);
00401 
00402   label = new QLabel(tr("Compression 15 Minute"), w);
00403   grid->addWidget(label, i, j);
00404   cmps15BtnCheck = new QCheckBox(w);
00405   rcfile.loadData(RcFile::ShowCmps15Btn, tb);
00406   cmps15BtnCheck->setChecked(tb);
00407   connect(cmps15BtnCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00408   grid->addWidget(cmps15BtnCheck, i++, j + 1);
00409 
00410   label = new QLabel(tr("BarSpacing spinner"), w);
00411   grid->addWidget(label, i, j);
00412   barSpSpinboxCheck = new QCheckBox(w);
00413   rcfile.loadData(RcFile::ShowBarSpSpinbox, tb);
00414   barSpSpinboxCheck->setChecked(tb);
00415   connect(barSpSpinboxCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00416   grid->addWidget(barSpSpinboxCheck, i++, j + 1);
00417 
00418   label = new QLabel(tr("BarsToLoad field"), w);
00419   grid->addWidget(label, i, j);
00420   barsToLoadFieldCheck = new QCheckBox(w);
00421   rcfile.loadData(RcFile::ShowBarsToLoadField, tb);
00422   barsToLoadFieldCheck->setChecked(tb);
00423   connect(barsToLoadFieldCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00424   grid->addWidget(barsToLoadFieldCheck, i++, j + 1);
00425 
00426   label = new QLabel(tr("Pan Chart slider"), w);
00427   grid->addWidget(label, i, j);
00428   sliderCheck = new QCheckBox(w);
00429   rcfile.loadData(RcFile::ShowSlider, tb);
00430   sliderCheck->setChecked(tb);
00431   connect(sliderCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00432   grid->addWidget(sliderCheck, i++, j + 1);
00433 
00434   addTab(w, tr("ChartToolbar"));
00435 }
00436 
00437 void  Preferences::createETPage() 
00438 {
00439   // extra tool bar page
00440 
00441   QWidget *w = new QWidget(this);
00442   QVBoxLayout *vbox = new QVBoxLayout(w);
00443   
00444   QGridLayout *grid = new QGridLayout(vbox, 1, 2);
00445   grid->setMargin(5);
00446   grid->setSpacing(5);
00447   grid->setColStretch(1, 1);
00448   
00449   vbox->insertStretch(-1, 1);
00450 
00451   int i = 0; // count rows
00452   int j = 0; // "count" cols
00453   bool tb; // temporary
00454   RcFile rcfile;
00455 
00456   QLabel *label = new QLabel(tr("Recent charts"), w);
00457   grid->addWidget(label, i, j);
00458   recentComboBoxCheck = new QCheckBox(w);
00459   rcfile.loadData(RcFile::ShowRecentCharts, tb);
00460   recentComboBoxCheck->setChecked(tb);
00461   connect(recentComboBoxCheck, SIGNAL(stateChanged(int)), this, SLOT(slotModified()));
00462   grid->addWidget(recentComboBoxCheck, i++, j + 1);  
00463 
00464   addTab(w, tr("ExtraToolbar"));
00465 }
00466 
00467 void Preferences::slotSave ()
00468 {
00469   RcFile rcfile;
00470 
00471   bool tbool = menubarCheck->isChecked();
00472   if (tbool != menubar)
00473   {
00474     rcfile.saveData(RcFile::ShowMenuBar,tbool);
00475     emit signalMenubar(tbool);
00476     menubar = tbool;
00477   }
00478 
00479   tbool = extraToolbarCheck->isChecked();
00480   if (tbool != extraToolbar)
00481   {
00482     rcfile.saveData(RcFile::ShowExtraToolbar,tbool);
00483     emit signalExtraToolbar(tbool);
00484     extraToolbar = tbool;
00485    }
00486 
00487   int tint = bs1Spinner->value();
00488   if (tint != ps1Button)
00489   {
00490     rcfile.saveData(RcFile::PSButton, tint, 1);
00491     ps1Button = tint;
00492   }
00493   
00494   tint = bs2Spinner->value();
00495   if (tint != ps2Button)
00496   {
00497     rcfile.saveData(RcFile::PSButton, tint, 2);
00498     ps2Button = tint;
00499   }
00500   
00501   tint = bs3Spinner->value();
00502   if (tint != ps3Button)
00503   {
00504     rcfile.saveData(RcFile::PSButton, tint, 3);
00505     ps3Button = tint;
00506   }
00507 
00508   bool flag = FALSE;  
00509   QColor c;
00510   backgroundColorButton->getColor(c);
00511   if (c != backgroundColor)
00512   {
00513     rcfile.saveColor(RcFile::BackgroundColor,c);
00514     emit signalBackgroundColor(c);
00515     flag = TRUE;
00516     backgroundColor = c;
00517   }
00518 
00519   borderColorButton->getColor(c);
00520   if (c != borderColor)
00521   {
00522     rcfile.saveColor(RcFile::BorderColor,c);
00523     emit signalBorderColor(c);
00524     flag = TRUE;
00525     borderColor = c;
00526   }
00527 
00528   gridColorButton->getColor(c);
00529   if (c != gridColor)
00530   {
00531     rcfile.saveColor(RcFile::GridColor,c);
00532     emit signalGridColor(c);
00533     flag = TRUE;
00534     gridColor = c;
00535   }
00536 
00537   QFont f;
00538   plotFontButton->getFont(f);
00539   if (f != plotFont)
00540   {
00541     rcfile.saveFont(RcFile::PlotFont,f);
00542     emit signalPlotFont(f);
00543     flag = TRUE;
00544     plotFont = f;
00545   }
00546 
00547   appFontButton->getFont(f);
00548   if (f != appFont)
00549   {
00550     rcfile.saveFont(RcFile::AppFont,f);
00551     emit signalAppFont(f);
00552     flag = TRUE;
00553     appFont = f;
00554   }
00555   
00556   // main tool bar settings
00557   // save all, anyway if changed or not, who cares?
00558   rcfile.saveData(RcFile::ShowQuitBtn, quitBtnCheck->isChecked());
00559   
00560   // prevent the user does things he will regret...
00561   if(menubarCheck->isChecked())
00562       rcfile.saveData(RcFile::ShowPrefBtn, prefBtnCheck->isChecked());
00563   else 
00564       rcfile.saveData(RcFile::ShowPrefBtn, TRUE);
00565       
00566   rcfile.saveData(RcFile::ShowSidePanelBtn, sidePanelBtnCheck->isChecked());
00567   rcfile.saveData(RcFile::ShowGridBtn, gridBtnCheck->isChecked());
00568   rcfile.saveData(RcFile::ShowScaleToScreenBtn, scaleToScreenBtnCheck->isChecked());
00569   rcfile.saveData(RcFile::ShowCrosshairBtn, crosshairBtnCheck->isChecked());
00570   rcfile.saveData(RcFile::ShowPaperTradeBtn, paperTradeBtnCheck->isChecked());
00571   rcfile.saveData(RcFile::ShowDrawModeBtn, drawModeBtnCheck->isChecked());
00572   rcfile.saveData(RcFile::ShowNewIndicatorBtn, newIndicatorBtnCheck->isChecked());
00573   rcfile.saveData(RcFile::ShowDataWindowBtn, dataWindowBtnCheck->isChecked());
00574   rcfile.saveData(RcFile::ShowMainQuoteBtn, mainQuoteBtnCheck->isChecked());
00575   rcfile.saveData(RcFile::ShowHelpButton, helpButtonCheck->isChecked());
00576   // chart tool bar settings
00577   rcfile.saveData(RcFile::ShowSlider, sliderCheck->isChecked());
00578   rcfile.saveData(RcFile::ShowBarsToLoadField, barsToLoadFieldCheck->isChecked());
00579   rcfile.saveData(RcFile::ShowBarSpSpinbox, barSpSpinboxCheck->isChecked());
00580   rcfile.saveData(RcFile::ShowCmps15Btn, cmps15BtnCheck->isChecked());
00581   rcfile.saveData(RcFile::ShowCmpsDayBtn, cmpsDayBtnCheck->isChecked());
00582   rcfile.saveData(RcFile::ShowCmpsWkyBtn, cmpsWkyBtnCheck->isChecked());
00583   rcfile.saveData(RcFile::ShowCmpsMtyBtn, cmpsMtyBtnCheck->isChecked());
00584   rcfile.saveData(RcFile::ShowCmpsComboBox, cmpsComboBoxCheck->isChecked());
00585 
00586   rcfile.saveData(RcFile::ShowRecentCharts, recentComboBoxCheck->isChecked());
00587   
00588   emit signalReloadToolBars();
00589   
00590   if (flag)
00591     emit signalLoadChart();
00592     
00593   setCancelButton(tr("&OK"));
00594 }
00595 
00596 void Preferences::slotHelp ()
00597 {
00598   HelpWindow *hw = new HelpWindow(this, helpFile);
00599   hw->show();
00600 }
00601 
00602 
00603 void Preferences::slotModified()
00604 {
00605   // FIXME: The goal is to change the caption of the
00606   // Cancel-button "Cancel/OK"  depending on a change
00607   // of any data by the user
00608   //qDebug("changed");
00609   setCancelButton(tr("&Cancel"));
00610 }