| 217 |
217 |
| 218 for (int i = 0; i < g_NumGrids; ++i) |
218 for (int i = 0; i < g_NumGrids; ++i) |
| 219 { |
219 { |
| 220 // Icon |
220 // Icon |
| 221 lb_gridIcons[i] = new QLabel; |
221 lb_gridIcons[i] = new QLabel; |
| 222 lb_gridIcons[i]->setPixmap (getIcon (fmt ("grid-%1", str (g_GridInfo[i].name).toLower()))); |
222 lb_gridIcons[i]->setPixmap (getIcon (fmt ("grid-%1", QString (g_GridInfo[i].name).toLower()))); |
| 223 |
223 |
| 224 // Text label |
224 // Text label |
| 225 lb_gridLabels[i] = new QLabel (fmt ("%1:", g_GridInfo[i].name)); |
225 lb_gridLabels[i] = new QLabel (fmt ("%1:", g_GridInfo[i].name)); |
| 226 |
226 |
| 227 QHBoxLayout* labellayout = new QHBoxLayout; |
227 QHBoxLayout* labellayout = new QHBoxLayout; |
| 538 } |
538 } |
| 539 |
539 |
| 540 // ============================================================================= |
540 // ============================================================================= |
| 541 // Pick a color and set the appropriate configuration option. |
541 // Pick a color and set the appropriate configuration option. |
| 542 // ----------------------------------------------------------------------------- |
542 // ----------------------------------------------------------------------------- |
| 543 void ConfigDialog::pickColor (str& conf, QPushButton* button) |
543 void ConfigDialog::pickColor (QString& conf, QPushButton* button) |
| 544 { |
544 { |
| 545 QColor col = QColorDialog::getColor (QColor (conf)); |
545 QColor col = QColorDialog::getColor (QColor (conf)); |
| 546 |
546 |
| 547 if (col.isValid()) |
547 if (col.isValid()) |
| 548 { |
548 { |
| 549 int r = col.red(), |
549 int r = col.red(), |
| 550 g = col.green(), |
550 g = col.green(), |
| 551 b = col.blue(); |
551 b = col.blue(); |
| 552 |
552 |
| 553 str colname; |
553 QString colname; |
| 554 colname.sprintf ("#%.2X%.2X%.2X", r, g, b); |
554 colname.sprintf ("#%.2X%.2X%.2X", r, g, b); |
| 555 conf = colname; |
555 conf = colname; |
| 556 setButtonBackground (button, colname); |
556 setButtonBackground (button, colname); |
| 557 } |
557 } |
| 558 } |
558 } |
| 579 } |
579 } |
| 580 |
580 |
| 581 // ============================================================================= |
581 // ============================================================================= |
| 582 // Sets background color of a given button. |
582 // Sets background color of a given button. |
| 583 // ----------------------------------------------------------------------------- |
583 // ----------------------------------------------------------------------------- |
| 584 void ConfigDialog::setButtonBackground (QPushButton* button, str value) |
584 void ConfigDialog::setButtonBackground (QPushButton* button, QString value) |
| 585 { |
585 { |
| 586 button->setIcon (getIcon ("colorselect")); |
586 button->setIcon (getIcon ("colorselect")); |
| 587 button->setAutoFillBackground (true); |
587 button->setAutoFillBackground (true); |
| 588 button->setStyleSheet (fmt ("background-color: %1", value)); |
588 button->setStyleSheet (fmt ("background-color: %1", value)); |
| 589 } |
589 } |
| 689 break; |
689 break; |
| 690 } |
690 } |
| 691 } |
691 } |
| 692 |
692 |
| 693 assert (info != null); |
693 assert (info != null); |
| 694 str fpath = QFileDialog::getOpenFileName (this, fmt ("Path to %1", info->name), *info->path, g_extProgPathFilter); |
694 QString fpath = QFileDialog::getOpenFileName (this, fmt ("Path to %1", info->name), *info->path, g_extProgPathFilter); |
| 695 |
695 |
| 696 if (fpath.isEmpty()) |
696 if (fpath.isEmpty()) |
| 697 return; |
697 return; |
| 698 |
698 |
| 699 info->input->setText (fpath); |
699 info->input->setText (fpath); |
| 702 // ============================================================================= |
702 // ============================================================================= |
| 703 // '...' button pressed for the download path |
703 // '...' button pressed for the download path |
| 704 // ----------------------------------------------------------------------------- |
704 // ----------------------------------------------------------------------------- |
| 705 void ConfigDialog::slot_findDownloadFolder() |
705 void ConfigDialog::slot_findDownloadFolder() |
| 706 { |
706 { |
| 707 str dpath = QFileDialog::getExistingDirectory(); |
707 QString dpath = QFileDialog::getExistingDirectory(); |
| 708 ui->downloadPath->setText (dpath); |
708 ui->downloadPath->setText (dpath); |
| 709 } |
709 } |
| 710 |
710 |
| 711 // ============================================================================= |
711 // ============================================================================= |
| 712 // Updates the text string for a given shortcut list item |
712 // Updates the text string for a given shortcut list item |
| 713 // ----------------------------------------------------------------------------- |
713 // ----------------------------------------------------------------------------- |
| 714 void ConfigDialog::setShortcutText (ShortcutListItem* item) |
714 void ConfigDialog::setShortcutText (ShortcutListItem* item) |
| 715 { |
715 { |
| 716 QAction* act = item->getAction(); |
716 QAction* act = item->getAction(); |
| 717 str label = act->iconText(); |
717 QString label = act->iconText(); |
| 718 str keybind = item->getKeyConfig()->getValue().toString(); |
718 QString keybind = item->getKeyConfig()->getValue().toString(); |
| 719 item->setText (fmt ("%1 (%2)", label, keybind)); |
719 item->setText (fmt ("%1 (%2)", label, keybind)); |
| 720 } |
720 } |
| 721 |
721 |
| 722 // ============================================================================= |
722 // ============================================================================= |
| 723 // Gets the configuration string of the quick color toolbar |
723 // Gets the configuration string of the quick color toolbar |
| 724 // ----------------------------------------------------------------------------- |
724 // ----------------------------------------------------------------------------- |
| 725 str ConfigDialog::quickColorString() |
725 QString ConfigDialog::quickColorString() |
| 726 { |
726 { |
| 727 str val; |
727 QString val; |
| 728 |
728 |
| 729 for (const LDQuickColor& entry : quickColors) |
729 for (const LDQuickColor& entry : quickColors) |
| 730 { |
730 { |
| 731 if (val.length() > 0) |
731 if (val.length() > 0) |
| 732 val += ':'; |
732 val += ':'; |
| 780 |
780 |
| 781 // ============================================================================= |
781 // ============================================================================= |
| 782 // ----------------------------------------------------------------------------- |
782 // ----------------------------------------------------------------------------- |
| 783 void KeySequenceDialog::updateOutput() |
783 void KeySequenceDialog::updateOutput() |
| 784 { |
784 { |
| 785 str shortcut = seq.toString(); |
785 QString shortcut = seq.toString(); |
| 786 |
786 |
| 787 if (seq == QKeySequence()) |
787 if (seq == QKeySequence()) |
| 788 shortcut = "<empty>"; |
788 shortcut = "<empty>"; |
| 789 |
789 |
| 790 str text = fmt ("<center><b>%1</b></center>", shortcut); |
790 QString text = fmt ("<center><b>%1</b></center>", shortcut); |
| 791 lb_output->setText (text); |
791 lb_output->setText (text); |
| 792 } |
792 } |
| 793 |
793 |
| 794 // ============================================================================= |
794 // ============================================================================= |
| 795 // ----------------------------------------------------------------------------- |
795 // ----------------------------------------------------------------------------- |