| 409 item->setText ("--------"); |
409 item->setText ("--------"); |
| 410 item->setIcon (getIcon ("empty")); |
410 item->setIcon (getIcon ("empty")); |
| 411 } |
411 } |
| 412 else |
412 else |
| 413 { |
413 { |
| 414 LDColor* col = entry.getColor(); |
414 LDColor* col = entry.color(); |
| 415 |
415 |
| 416 if (col == null) |
416 if (col == null) |
| 417 { |
417 { |
| 418 item->setText ("[[unknown color]]"); |
418 item->setText ("[[unknown color]]"); |
| 419 item->setIcon (getIcon ("error")); |
419 item->setIcon (getIcon ("error")); |
| 457 |
457 |
| 458 if (entry->isSeparator() == true) |
458 if (entry->isSeparator() == true) |
| 459 return; // don't color separators |
459 return; // don't color separators |
| 460 } |
460 } |
| 461 |
461 |
| 462 int defval = entry ? entry->getColor()->index : -1; |
462 int defval = entry ? entry->color()->index : -1; |
| 463 int val; |
463 int val; |
| 464 |
464 |
| 465 if (ColorSelector::selectColor (val, defval, this) == false) |
465 if (ColorSelector::selectColor (val, defval, this) == false) |
| 466 return; |
466 return; |
| 467 |
467 |
| 517 |
517 |
| 518 updateQuickColorList (&quickColors[dest]); |
518 updateQuickColorList (&quickColors[dest]); |
| 519 } |
519 } |
| 520 |
520 |
| 521 // ============================================================================= |
521 // ============================================================================= |
| |
522 // |
| 522 // Add a separator to quick colors |
523 // Add a separator to quick colors |
| 523 // ============================================================================= |
524 // |
| 524 void ConfigDialog::slot_addColorSeparator() |
525 void ConfigDialog::slot_addColorSeparator() |
| 525 { |
526 { |
| 526 quickColors << LDQuickColor::getSeparator(); |
527 quickColors << LDQuickColor::getSeparator(); |
| 527 updateQuickColorList (&quickColors[quickColors.size() - 1]); |
528 updateQuickColorList (&quickColors[quickColors.size() - 1]); |
| 528 } |
529 } |
| 529 |
530 |
| 530 // ============================================================================= |
531 // ============================================================================= |
| |
532 // |
| 531 // Clear all quick colors |
533 // Clear all quick colors |
| 532 // ============================================================================= |
534 // |
| 533 void ConfigDialog::slot_clearColors() |
535 void ConfigDialog::slot_clearColors() |
| 534 { |
536 { |
| 535 quickColors.clear(); |
537 quickColors.clear(); |
| 536 updateQuickColorList(); |
538 updateQuickColorList(); |
| 537 } |
539 } |
| 538 |
540 |
| 539 // ============================================================================= |
541 // ============================================================================= |
| |
542 // |
| 540 // Pick a color and set the appropriate configuration option. |
543 // Pick a color and set the appropriate configuration option. |
| 541 // ============================================================================= |
544 // |
| 542 void ConfigDialog::pickColor (QString& conf, QPushButton* button) |
545 void ConfigDialog::pickColor (QString& conf, QPushButton* button) |
| 543 { |
546 { |
| 544 QColor col = QColorDialog::getColor (QColor (conf)); |
547 QColor col = QColorDialog::getColor (QColor (conf)); |
| 545 |
548 |
| 546 if (col.isValid()) |
549 if (col.isValid()) |
| 639 if (sel.size() < 1) |
642 if (sel.size() < 1) |
| 640 return; |
643 return; |
| 641 |
644 |
| 642 ShortcutListItem* item = sel[0]; |
645 ShortcutListItem* item = sel[0]; |
| 643 |
646 |
| 644 if (KeySequenceDialog::staticDialog (item->getKeyConfig(), this)) |
647 if (KeySequenceDialog::staticDialog (item->keyConfig(), this)) |
| 645 setShortcutText (item); |
648 setShortcutText (item); |
| 646 } |
649 } |
| 647 |
650 |
| 648 // ============================================================================= |
651 // ============================================================================= |
| 649 // Reset a shortcut to defaults |
652 // Reset a shortcut to defaults |
| 652 { |
655 { |
| 653 QList<ShortcutListItem*> sel = getShortcutSelection(); |
656 QList<ShortcutListItem*> sel = getShortcutSelection(); |
| 654 |
657 |
| 655 for (ShortcutListItem* item : sel) |
658 for (ShortcutListItem* item : sel) |
| 656 { |
659 { |
| 657 item->getKeyConfig()->reset(); |
660 item->keyConfig()->reset(); |
| 658 setShortcutText (item); |
661 setShortcutText (item); |
| 659 } |
662 } |
| 660 } |
663 } |
| 661 |
664 |
| 662 // ============================================================================= |
665 // ============================================================================= |
| 666 { |
669 { |
| 667 QList<ShortcutListItem*> sel = getShortcutSelection(); |
670 QList<ShortcutListItem*> sel = getShortcutSelection(); |
| 668 |
671 |
| 669 for (ShortcutListItem* item : sel) |
672 for (ShortcutListItem* item : sel) |
| 670 { |
673 { |
| 671 item->getKeyConfig()->setValue (QKeySequence()); |
674 item->keyConfig()->setValue (QKeySequence()); |
| 672 setShortcutText (item); |
675 setShortcutText (item); |
| 673 } |
676 } |
| 674 } |
677 } |
| 675 |
678 |
| 676 // ============================================================================= |
679 // ============================================================================= |
| 697 |
700 |
| 698 info->input->setText (fpath); |
701 info->input->setText (fpath); |
| 699 } |
702 } |
| 700 |
703 |
| 701 // ============================================================================= |
704 // ============================================================================= |
| |
705 // |
| 702 // '...' button pressed for the download path |
706 // '...' button pressed for the download path |
| 703 // ============================================================================= |
707 // |
| 704 void ConfigDialog::slot_findDownloadFolder() |
708 void ConfigDialog::slot_findDownloadFolder() |
| 705 { |
709 { |
| 706 QString dpath = QFileDialog::getExistingDirectory(); |
710 QString dpath = QFileDialog::getExistingDirectory(); |
| 707 ui->downloadPath->setText (dpath); |
711 ui->downloadPath->setText (dpath); |
| 708 } |
712 } |
| 709 |
713 |
| 710 // ============================================================================= |
714 // ============================================================================= |
| |
715 // |
| 711 // Updates the text string for a given shortcut list item |
716 // Updates the text string for a given shortcut list item |
| 712 // ============================================================================= |
717 // |
| 713 void ConfigDialog::setShortcutText (ShortcutListItem* item) |
718 void ConfigDialog::setShortcutText (ShortcutListItem* item) |
| 714 { |
719 { |
| 715 QAction* act = item->getAction(); |
720 QAction* act = item->action(); |
| 716 QString label = act->iconText(); |
721 QString label = act->iconText(); |
| 717 QString keybind = item->getKeyConfig()->getValue().toString(); |
722 QString keybind = item->keyConfig()->getValue().toString(); |
| 718 item->setText (fmt ("%1 (%2)", label, keybind)); |
723 item->setText (fmt ("%1 (%2)", label, keybind)); |
| 719 } |
724 } |
| 720 |
725 |
| 721 // ============================================================================= |
726 // ============================================================================= |
| 722 // Gets the configuration string of the quick color toolbar |
727 // Gets the configuration string of the quick color toolbar |