409 } |
409 } |
410 else |
410 else |
411 { |
411 { |
412 ColorToolbarItem newentry (value, nullptr); |
412 ColorToolbarItem newentry (value, nullptr); |
413 item = getSelectedQuickColor(); |
413 item = getSelectedQuickColor(); |
414 int idx = (item) ? getItemRow (item, quickColorItems) + 1 : length(quickColorItems); |
414 int idx = (item) ? getItemRow (item, quickColorItems) + 1 : countof(quickColorItems); |
415 quickColors.insert (idx, newentry); |
415 quickColors.insert (idx, newentry); |
416 entry = &quickColors[idx]; |
416 entry = &quickColors[idx]; |
417 } |
417 } |
418 |
418 |
419 updateQuickColorList (entry); |
419 updateQuickColorList (entry); |
444 |
444 |
445 QListWidgetItem* item = ui.quickColorList->selectedItems() [0]; |
445 QListWidgetItem* item = ui.quickColorList->selectedItems() [0]; |
446 int idx = getItemRow (item, quickColorItems); |
446 int idx = getItemRow (item, quickColorItems); |
447 int dest = up ? (idx - 1) : (idx + 1); |
447 int dest = up ? (idx - 1) : (idx + 1); |
448 |
448 |
449 if (dest < 0 or dest >= length(quickColorItems)) |
449 if (dest < 0 or dest >= countof(quickColorItems)) |
450 return; // destination out of bounds |
450 return; // destination out of bounds |
451 |
451 |
452 qSwap (quickColors[dest], quickColors[idx]); |
452 qSwap (quickColors[dest], quickColors[idx]); |
453 updateQuickColorList (&quickColors[dest]); |
453 updateQuickColorList (&quickColors[dest]); |
454 } |
454 } |
458 // Add a separator to quick colors |
458 // Add a separator to quick colors |
459 // |
459 // |
460 void ConfigDialog::slot_addColorSeparator() |
460 void ConfigDialog::slot_addColorSeparator() |
461 { |
461 { |
462 quickColors << ColorToolbarItem::makeSeparator(); |
462 quickColors << ColorToolbarItem::makeSeparator(); |
463 updateQuickColorList (&quickColors[length(quickColors) - 1]); |
463 updateQuickColorList (&quickColors[countof(quickColors) - 1]); |
464 } |
464 } |
465 |
465 |
466 // |
466 // |
467 // |
467 // |
468 // Clear all quick colors |
468 // Clear all quick colors |
553 // |
553 // |
554 void ConfigDialog::slot_setShortcut() |
554 void ConfigDialog::slot_setShortcut() |
555 { |
555 { |
556 QList<ShortcutListItem*> sel = getShortcutSelection(); |
556 QList<ShortcutListItem*> sel = getShortcutSelection(); |
557 |
557 |
558 if (length(sel) < 1) |
558 if (countof(sel) < 1) |
559 return; |
559 return; |
560 |
560 |
561 ShortcutListItem* item = sel[0]; |
561 ShortcutListItem* item = sel[0]; |
562 |
562 |
563 if (KeySequenceDialog::staticDialog (item, this)) |
563 if (KeySequenceDialog::staticDialog (item, this)) |