Changeset aecdf994f9 in tspsg for src/settingsdialog.cpp
- Timestamp:
- Jun 22, 2009, 1:37:12 AM (15 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- d5384ee64e
- Parents:
- 799ba1e3f2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/settingsdialog.cpp
r799ba1e3f2 raecdf994f9 25 25 #include <QStatusTipEvent> 26 26 #include <QFontDialog> 27 #include <QColorDialog> 28 #include "defines.h" 27 29 #include "settingsdialog.h" 28 30 … … 35 37 connect(spinRandMin,SIGNAL(valueChanged(int)),this,SLOT(spinRandMinValueChanged(int))); 36 38 connect(buttonFont,SIGNAL(clicked()),this,SLOT(buttonFontClicked())); 39 connect(buttonColor,SIGNAL(clicked()),this,SLOT(buttonColorClicked())); 37 40 // setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint); 38 41 setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint); … … 47 50 labelHint->setMinimumHeight(labelHint->height()); 48 51 #endif // Q_OS_WINCE 52 settings = new QSettings(INI_FILE,QSettings::IniFormat); 53 spinRandMin->setValue(settings->value("MinCost",DEF_RAND_MIN).toInt()); 54 spinRandMax->setValue(settings->value("MaxCost",DEF_RAND_MAX).toInt()); 55 #ifndef Q_OS_WINCE 56 cbSaveState->setChecked(settings->value("SavePos",false).toBool()); 57 #endif // Q_OS_WINCE 58 settings->beginGroup("Print"); 59 font = settings->value("Font",QFont(DEF_FONT_FAMILY,DEF_FONT_SIZE)).value<QFont>(); 60 color = settings->value("Color",DEF_FONT_COLOR).value<QColor>(); 61 #ifndef Q_OS_WINCE 62 spinLeftMargin->setValue(settings->value("Offset",DEF_OFFSET).toInt()); 63 #endif // Q_OS_WINCE 64 settings->endGroup(); 49 65 } 50 66 … … 69 85 void SettingsDialog::buttonFontClicked() 70 86 { 71 // TODO: Pass current font to dialog and save selected. 72 QFontDialog fd; 73 fd.exec(); 87 bool ok; 88 QFont font = QFontDialog::getFont(&ok,this->font,this); 89 if (ok) 90 this->font = font; 74 91 } 92 93 void SettingsDialog::buttonColorClicked() 94 { 95 QColorDialog cd(color,this); 96 if (cd.exec() == QDialog::Accepted) 97 color = cd.selectedColor(); 98 } 99 100 void SettingsDialog::accept() 101 { 102 #ifndef Q_OS_WINCE 103 settings->setValue("SavePos",cbSaveState->isChecked()); 104 #endif // Q_OS_WINCE 105 settings->setValue("MinCost",spinRandMin->value()); 106 settings->setValue("MaxCost",spinRandMax->value()); 107 settings->beginGroup("Print"); 108 settings->setValue("Font",font); 109 settings->setValue("Color",color); 110 #ifndef Q_OS_WINCE 111 settings->setValue("Offset",spinLeftMargin->value()); 112 #endif // Q_OS_WINCE 113 settings->endGroup(); 114 QDialog::accept(); 115 }
Note: See TracChangeset
for help on using the changeset viewer.