src/configDialog.cc

changeset 739
152b33a6d51b
parent 662
2f1bd9112408
child 754
c37564d59ce1
equal deleted inserted replaced
738:16b63398aa1f 739:152b33a6d51b
216 216
217 for (int i = 0; i < g_NumGrids; ++i) 217 for (int i = 0; i < g_NumGrids; ++i)
218 { 218 {
219 // Icon 219 // Icon
220 lb_gridIcons[i] = new QLabel; 220 lb_gridIcons[i] = new QLabel;
221 lb_gridIcons[i]->setPixmap (getIcon (format ("grid-%1", QString (g_GridInfo[i].name).toLower()))); 221 lb_gridIcons[i]->setPixmap (getIcon (format ("grid-%1", String (g_GridInfo[i].name).toLower())));
222 222
223 // Text label 223 // Text label
224 lb_gridLabels[i] = new QLabel (format ("%1:", g_GridInfo[i].name)); 224 lb_gridLabels[i] = new QLabel (format ("%1:", g_GridInfo[i].name));
225 225
226 QHBoxLayout* labellayout = new QHBoxLayout; 226 QHBoxLayout* labellayout = new QHBoxLayout;
247 247
248 // ============================================================================= 248 // =============================================================================
249 // ============================================================================= 249 // =============================================================================
250 static struct LDExtProgInfo 250 static struct LDExtProgInfo
251 { 251 {
252 const QString name, 252 const String name,
253 iconname; 253 iconname;
254 QString* const path; 254 String* const path;
255 QLineEdit* input; 255 QLineEdit* input;
256 QPushButton* setPathButton; 256 QPushButton* setPathButton;
257 #ifndef _WIN32 257 #ifndef _WIN32
258 bool* const wine; 258 bool* const wine;
259 QCheckBox* wineBox; 259 QCheckBox* wineBox;
539 539
540 // ============================================================================= 540 // =============================================================================
541 // 541 //
542 // Pick a color and set the appropriate configuration option. 542 // Pick a color and set the appropriate configuration option.
543 // 543 //
544 void ConfigDialog::pickColor (QString& conf, QPushButton* button) 544 void ConfigDialog::pickColor (String& conf, QPushButton* button)
545 { 545 {
546 QColor col = QColorDialog::getColor (QColor (conf)); 546 QColor col = QColorDialog::getColor (QColor (conf));
547 547
548 if (col.isValid()) 548 if (col.isValid())
549 { 549 {
550 int r = col.red(), 550 int r = col.red(),
551 g = col.green(), 551 g = col.green(),
552 b = col.blue(); 552 b = col.blue();
553 553
554 QString colname; 554 String colname;
555 colname.sprintf ("#%.2X%.2X%.2X", r, g, b); 555 colname.sprintf ("#%.2X%.2X%.2X", r, g, b);
556 conf = colname; 556 conf = colname;
557 setButtonBackground (button, colname); 557 setButtonBackground (button, colname);
558 } 558 }
559 } 559 }
580 } 580 }
581 581
582 // ============================================================================= 582 // =============================================================================
583 // Sets background color of a given button. 583 // Sets background color of a given button.
584 // ============================================================================= 584 // =============================================================================
585 void ConfigDialog::setButtonBackground (QPushButton* button, QString value) 585 void ConfigDialog::setButtonBackground (QPushButton* button, String value)
586 { 586 {
587 button->setIcon (getIcon ("colorselect")); 587 button->setIcon (getIcon ("colorselect"));
588 button->setAutoFillBackground (true); 588 button->setAutoFillBackground (true);
589 button->setStyleSheet (format ("background-color: %1", value)); 589 button->setStyleSheet (format ("background-color: %1", value));
590 } 590 }
690 break; 690 break;
691 } 691 }
692 } 692 }
693 693
694 assert (info != null); 694 assert (info != null);
695 QString fpath = QFileDialog::getOpenFileName (this, format ("Path to %1", info->name), *info->path, g_extProgPathFilter); 695 String fpath = QFileDialog::getOpenFileName (this, format ("Path to %1", info->name), *info->path, g_extProgPathFilter);
696 696
697 if (fpath.isEmpty()) 697 if (fpath.isEmpty())
698 return; 698 return;
699 699
700 info->input->setText (fpath); 700 info->input->setText (fpath);
704 // 704 //
705 // '...' button pressed for the download path 705 // '...' button pressed for the download path
706 // 706 //
707 void ConfigDialog::slot_findDownloadFolder() 707 void ConfigDialog::slot_findDownloadFolder()
708 { 708 {
709 QString dpath = QFileDialog::getExistingDirectory(); 709 String dpath = QFileDialog::getExistingDirectory();
710 ui->downloadPath->setText (dpath); 710 ui->downloadPath->setText (dpath);
711 } 711 }
712 712
713 // ============================================================================= 713 // =============================================================================
714 // 714 //
715 // Updates the text string for a given shortcut list item 715 // Updates the text string for a given shortcut list item
716 // 716 //
717 void ConfigDialog::setShortcutText (ShortcutListItem* item) 717 void ConfigDialog::setShortcutText (ShortcutListItem* item)
718 { 718 {
719 QAction* act = item->action(); 719 QAction* act = item->action();
720 QString label = act->iconText(); 720 String label = act->iconText();
721 QString keybind = item->keyConfig()->getValue().toString(); 721 String keybind = item->keyConfig()->getValue().toString();
722 item->setText (format ("%1 (%2)", label, keybind)); 722 item->setText (format ("%1 (%2)", label, keybind));
723 } 723 }
724 724
725 // ============================================================================= 725 // =============================================================================
726 // Gets the configuration string of the quick color toolbar 726 // Gets the configuration string of the quick color toolbar
727 // ============================================================================= 727 // =============================================================================
728 QString ConfigDialog::quickColorString() 728 String ConfigDialog::quickColorString()
729 { 729 {
730 QString val; 730 String val;
731 731
732 for (const LDQuickColor& entry : quickColors) 732 for (const LDQuickColor& entry : quickColors)
733 { 733 {
734 if (val.length() > 0) 734 if (val.length() > 0)
735 val += ':'; 735 val += ':';
783 783
784 // ============================================================================= 784 // =============================================================================
785 // ============================================================================= 785 // =============================================================================
786 void KeySequenceDialog::updateOutput() 786 void KeySequenceDialog::updateOutput()
787 { 787 {
788 QString shortcut = seq.toString(); 788 String shortcut = seq.toString();
789 789
790 if (seq == QKeySequence()) 790 if (seq == QKeySequence())
791 shortcut = "&lt;empty&gt;"; 791 shortcut = "&lt;empty&gt;";
792 792
793 QString text = format ("<center><b>%1</b></center>", shortcut); 793 String text = format ("<center><b>%1</b></center>", shortcut);
794 lb_output->setText (text); 794 lb_output->setText (text);
795 } 795 }
796 796
797 // ============================================================================= 797 // =============================================================================
798 // ============================================================================= 798 // =============================================================================

mercurial