Changeset a09f31733a in tspsg for src
- Timestamp:
- Jul 16, 2012, 1:05:35 AM (12 years ago)
- Branches:
- appveyor, imgbot, master, readme
- Children:
- 95c1897bf1
- Parents:
- ff8d0488a0
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/defaults.h
rff8d0488a0 ra09f31733a 107 107 # define DEF_FONT_SIZE 10 108 108 #endif // Q_WS_S60 109 //! Default text color109 //! Default solution text color 110 110 #define DEF_TEXT_COLOR QPalette().color(QPalette::Text) 111 111 //! Default selected candidate color … … 114 114 #define DEF_ALTERNATE_COLOR "#A00000" 115 115 //! Default table border color 116 #define DEF_TABLE_COLOR "#EEEEEE" 116 #define DEF_TABLE_COLOR QPalette().color(QPalette::AlternateBase) 117 //! Default solution background color 118 #define DEF_BACKGROUND_COLOR QPalette().color(QPalette::Base) 117 119 118 120 #ifndef QT_NO_PRINTER -
src/settingsdialog.cpp
rff8d0488a0 ra09f31733a 31 31 */ 32 32 SettingsDialog::SettingsDialog(QWidget *parent) 33 : QDialog(parent), _ newFont(false), _newColor(false), _translucency(0)33 : QDialog(parent), _fontChanged(false), _colorChanged(false), _translucency(0) 34 34 { 35 35 setupUi(this); … … 48 48 buttonBox->button(QDialogButtonBox::Cancel)->setCursor(QCursor(Qt::PointingHandCursor)); 49 49 50 buttonColor->setIcon(GET_ICON("format-text-color")); 50 buttonTextColor->setIcon(GET_ICON("format-text-color")); 51 buttonSelectedColor->setIcon(GET_ICON("format-text-color")); 52 buttonAlternateColor->setIcon(GET_ICON("format-text-color")); 53 buttonBorderColor->setIcon(GET_ICON("format-stroke-color")); 54 buttonBgColor->setIcon(GET_ICON("format-fill-color")); 51 55 buttonFont->setIcon(GET_ICON("preferences-desktop-font")); 52 56 buttonHelp->setIcon(GET_ICON("help-hint")); … … 212 216 connect(spinRandMin, SIGNAL(valueChanged(int)), SLOT(spinRandMinValueChanged(int))); 213 217 connect(buttonFont, SIGNAL(clicked()), SLOT(buttonFontClicked())); 214 connect(button Color, SIGNAL(clicked()), SLOT(buttonColorClicked()));218 connect(buttonTextColor, SIGNAL(clicked()), SLOT(buttonTextColorClicked())); 215 219 setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint); 216 220 #if !defined(QT_NO_STATUSTIP) && !defined(HANDHELD) … … 288 292 289 293 font = qvariant_cast<QFont>(settings->value("Font", QFont(DEF_FONT_FACE, DEF_FONT_SIZE))); 290 color = QColor(settings->value("Colors/Text", DEF_TEXT_COLOR).toString()); 294 textColor = QColor(settings->value("Colors/Text", DEF_TEXT_COLOR).toString()); 295 selColor = QColor(settings->value("Colors/Selected", DEF_SELECTED_COLOR).toString()); 296 altColor = QColor(settings->value("Colors/Alternate", DEF_ALTERNATE_COLOR).toString()); 297 borderColor = QColor(settings->value("Colors/Border", DEF_TABLE_COLOR).toString()); 298 bgColor = QColor(settings->value("Colors/Background", DEF_BACKGROUND_COLOR).toString()); 291 299 settings->endGroup(); 300 301 QFont f = font; 302 f.setPointSize(labelFontExample->font().pointSize()); 303 labelFontExample->setFont(f); 304 labelFontExample->setText(font.family()); 305 306 p = boxTextColor->palette(); 307 p.setColor(QPalette::Window, textColor); 308 boxTextColor->setPalette(p); 309 310 p = boxSelectedColor->palette(); 311 p.setColor(QPalette::Window, selColor); 312 boxSelectedColor->setPalette(p); 313 314 p = boxAlternateColor->palette(); 315 p.setColor(QPalette::Window, altColor); 316 boxAlternateColor->setPalette(p); 317 318 p = boxBorderColor->palette(); 319 p.setColor(QPalette::Window, borderColor); 320 boxBorderColor->setPalette(p); 321 322 p = boxBgColor->palette(); 323 p.setColor(QPalette::Window, bgColor); 324 boxBgColor->setPalette(p); 292 325 293 326 #ifdef HANDHELD … … 304 337 bool SettingsDialog::colorChanged() const 305 338 { 306 return _ newColor;339 return _colorChanged; 307 340 } 308 341 … … 313 346 bool SettingsDialog::fontChanged() const 314 347 { 315 return _ newFont;348 return _fontChanged; 316 349 } 317 350 … … 333 366 if (QApplication::keyboardModifiers() & Qt::ShiftModifier) { 334 367 if (QMessageBox::question(this, tr("Settings Reset"), tr("Do you really want to <b>reset all application settings to their defaults</b>?"), QMessageBox::RestoreDefaults | QMessageBox::Cancel) == QMessageBox::RestoreDefaults) { 335 _ newFont= (font != QFont(DEF_FONT_FACE, DEF_FONT_SIZE));336 _ newColor = (color != DEF_TEXT_COLOR);368 _fontChanged = (font != QFont(DEF_FONT_FACE, DEF_FONT_SIZE)); 369 _colorChanged = (textColor != DEF_TEXT_COLOR); 337 370 settings->remove(""); 338 371 settings->setValue("SettingsReset", true); … … 392 425 settings->setValue("ShowMatrixLimit", spinCitiesLimit->value()); 393 426 settings->setValue("ScrollToEnd", cbScrollToEnd->isChecked()); 394 if (_ newFont)427 if (_fontChanged) 395 428 settings->setValue("Font", font); 396 if (_ newColor)397 settings->setValue("Colors/Text", color.name());429 if (_colorChanged) 430 settings->setValue("Colors/Text", textColor.name()); 398 431 settings->endGroup(); 399 432 QDialog::accept(); 400 433 } 401 434 402 void SettingsDialog::button ColorClicked()403 { 404 QColor color = QColorDialog::getColor(this-> color,this);405 if (color.isValid() && (this-> color != color)) {406 this-> color = color;407 _ newColor= true;435 void SettingsDialog::buttonTextColorClicked() 436 { 437 QColor color = QColorDialog::getColor(this->textColor,this); 438 if (color.isValid() && (this->textColor != color)) { 439 this->textColor = color; 440 _colorChanged = true; 408 441 } 409 442 } … … 412 445 { 413 446 bool ok; 414 QFont font = QFontDialog::getFont(&ok, this->font,this);447 QFont font = QFontDialog::getFont(&ok, this->font, this); 415 448 if (ok && (this->font != font)) { 416 449 this->font = font; 417 _newFont = true; 450 QFont f = font; 451 f.setPointSize(labelFontExample->font().pointSize()); 452 labelFontExample->setFont(f); 453 labelFontExample->setText(font.family()); 454 _fontChanged = true; 418 455 } 419 456 } -
src/settingsdialog.h
rff8d0488a0 ra09f31733a 47 47 48 48 private: 49 bool _ newFont;50 bool _ newColor;49 bool _fontChanged; 50 bool _colorChanged; 51 51 qint8 _translucency; 52 52 53 QColor color;53 QColor textColor, selColor, altColor, borderColor, bgColor; 54 54 QFont font; 55 55 … … 79 79 private slots: 80 80 void accept(); 81 void button ColorClicked();81 void buttonTextColorClicked(); 82 82 void buttonFontClicked(); 83 83 #ifdef Q_WS_WINCE_WM
Note: See TracChangeset
for help on using the changeset viewer.