Changeset c8ed26ddf1 in tspsg for src/settingsdialog.cpp
- Timestamp:
- Jul 17, 2012, 8:11:11 PM (12 years ago)
- Branches:
- appveyor, imgbot, master, readme
- Children:
- 50b614b0ea
- Parents:
- 7e8e1b444d
- git-author:
- Oleksii Serdiuk <contacts@…> (07/17/12 20:11:11)
- git-committer:
- Oleksii Serdiuk <contacts@…> (07/17/12 20:24:34)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/settingsdialog.cpp
r7e8e1b444d rc8ed26ddf1 52 52 buttonAlternateColor->setIcon(GET_ICON("format-text-color")); 53 53 buttonBorderColor->setIcon(GET_ICON("format-stroke-color")); 54 buttonBgColor->setIcon(GET_ICON("format-fill-color"));54 // buttonBgColor->setIcon(GET_ICON("format-fill-color")); 55 55 buttonFont->setIcon(GET_ICON("preferences-desktop-font")); 56 56 buttonHelp->setIcon(GET_ICON("help-hint")); … … 217 217 connect(buttonFont, SIGNAL(clicked()), SLOT(buttonFontClicked())); 218 218 connect(buttonTextColor, SIGNAL(clicked()), SLOT(buttonTextColorClicked())); 219 connect(buttonSelectedColor, SIGNAL(clicked()), SLOT(buttonSelectedColorClicked())); 220 connect(buttonAlternateColor, SIGNAL(clicked()), SLOT(buttonAlternateColorClicked())); 221 connect(buttonBorderColor, SIGNAL(clicked()), SLOT(buttonBorderColorClicked())); 222 // connect(buttonBgColor, SIGNAL(clicked()), SLOT(buttonBgColorClicked())); 219 223 setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint); 220 224 #if !defined(QT_NO_STATUSTIP) && !defined(HANDHELD) … … 295 299 selColor = QColor(settings->value("Colors/Selected", DEF_SELECTED_COLOR).toString()); 296 300 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());301 borderColor = QColor(settings->value("Colors/TableBorder", DEF_TABLE_COLOR).toString()); 302 // bgColor = QColor(settings->value("Colors/Background", DEF_BACKGROUND_COLOR).toString()); 299 303 settings->endGroup(); 300 304 … … 304 308 labelFontExample->setText(font.family()); 305 309 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); 310 setBgColor(boxTextColor, textColor); 311 setBgColor(boxSelectedColor, selColor); 312 setBgColor(boxAlternateColor, altColor); 313 setBgColor(boxBorderColor, borderColor); 314 // setBgColor(boxBgColor, bgColor); 325 315 326 316 #ifdef HANDHELD … … 427 417 if (_fontChanged) 428 418 settings->setValue("Font", font); 429 if (_colorChanged) 430 settings->setValue("Colors/Text", textColor.name()); 419 if (_colorChanged) { 420 settings->beginGroup("Colors"); 421 if (textColor != DEF_TEXT_COLOR) 422 settings->setValue("Text", textColor.name()); 423 else 424 settings->remove("Text"); 425 if (selColor != QColor(DEF_SELECTED_COLOR)) 426 settings->setValue("Selected", selColor.name()); 427 else 428 settings->remove("Selected"); 429 if (altColor != DEF_ALTERNATE_COLOR) 430 settings->setValue("Alternate",altColor.name()); 431 else 432 settings->remove("Alternate"); 433 if (borderColor != DEF_TABLE_COLOR) 434 settings->setValue("TableBorder", borderColor.name()); 435 else 436 settings->remove("TableColor"); 437 // if (bgColor != DEF_BACKGROUND_COLOR) 438 // settings->setValue("Background", bgColor.name()); 439 // else 440 // settings->remove("Background"); 441 settings->endGroup(); 442 } 431 443 settings->endGroup(); 432 444 QDialog::accept(); 433 445 } 434 446 447 void SettingsDialog::pickColor(QColor &where) 448 { 449 QColor color = QColorDialog::getColor(where, this); 450 if (color.isValid() && (where != color)) { 451 where = color; 452 _colorChanged = true; 453 } 454 } 455 456 void SettingsDialog::setBgColor(QWidget *widget, const QColor &color) 457 { 458 QPalette p = widget->palette(); 459 p.setColor(QPalette::Window, color); 460 widget->setPalette(p); 461 } 462 435 463 void SettingsDialog::buttonTextColorClicked() 436 464 { 437 QColor color = QColorDialog::getColor(this->textColor,this); 438 if (color.isValid() && (this->textColor != color)) { 439 this->textColor = color; 440 _colorChanged = true; 441 } 442 } 465 pickColor(textColor); 466 setBgColor(boxTextColor, textColor); 467 } 468 469 void SettingsDialog::buttonSelectedColorClicked() 470 { 471 pickColor(selColor); 472 setBgColor(boxSelectedColor, selColor); 473 } 474 475 void SettingsDialog::buttonAlternateColorClicked() 476 { 477 pickColor(altColor); 478 setBgColor(boxAlternateColor, altColor); 479 } 480 481 void SettingsDialog::buttonBorderColorClicked() 482 { 483 pickColor(borderColor); 484 setBgColor(boxBorderColor, borderColor); 485 } 486 487 //void SettingsDialog::buttonBgColorClicked() 488 //{ 489 // pickColor(bgColor); 490 // setBgColor(boxBgColor, bgColor); 491 //} 443 492 444 493 void SettingsDialog::buttonFontClicked()
Note: See TracChangeset
for help on using the changeset viewer.