diff --git a/krita/CMakeLists.txt b/krita/CMakeLists.txt --- a/krita/CMakeLists.txt +++ b/krita/CMakeLists.txt @@ -198,7 +198,7 @@ install(TARGETS krita ${INSTALL_TARGETS_DEFAULT_ARGS}) install(PROGRAMS krita.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) install(FILES krita.rc DESTINATION ${DATA_INSTALL_DIR}/krita) -install(FILES krita.action DESTINATION ${DATA_INSTALL_DIR}/krita/actions) +install(FILES krita.action kritamenu.action DESTINATION ${DATA_INSTALL_DIR}/krita/actions) install(FILES krita.appdata.xml DESTINATION ${SHARE_INSTALL_PREFIX}/appdata/ ) if (NOT APPLE AND HAVE_OPENGL AND Qt5Quick_FOUND) diff --git a/krita/action_i18n.pl b/krita/action_i18n.pl --- a/krita/action_i18n.pl +++ b/krita/action_i18n.pl @@ -74,7 +74,9 @@ "label" => [30, []], }, "action" => { - "action" => [20, ["name"]], + "ActionCollection" => [10, ["name"]], + "Actions" => [20, ["category"]], + "Action" => [30, ["name"]], } }; diff --git a/krita/data/actions/ArtisticTextTool.action b/krita/data/actions/ArtisticTextTool.action --- a/krita/data/actions/ArtisticTextTool.action +++ b/krita/data/actions/ArtisticTextTool.action @@ -1,113 +1,116 @@ - - - Subscript - - Subscript - format-text-subscript - - - false - Subscript - - - - Detach Path - - Detach Path - artistictext-detach-path - - - false - Detach Path - - - - Italic text - - Italic text - format-text-italic - - - false - Italic text - - - - Anchor at Middle - - Anchor at Middle - format-justify-center - - - false - Anchor at Middle - - - - Anchor at End - - Anchor at End - format-justify-right - - - false - Anchor at End - - - - Convert to Path - - Convert to Path - pathshape - - - false - Convert to Path - - - - Anchor at Start - - Anchor at Start - format-justify-left - - - false - Anchor at Start - - - - Bold text - - Bold text - format-text-bold - - - false - Bold text - - - - Deselect - Ctrl+Shift+A - Deselect - - - - false - Dese&lect - Ctrl+Shift+A - - - Superscript - - Superscript - format-text-superscript - - - false - Superscript - - - + + + Artistic Text Tool + + Subscript + + Subscript + format-text-subscript + + + false + Subscript + + + + Detach Path + + Detach Path + artistictext-detach-path + + + false + Detach Path + + + + Italic text + + Italic text + format-text-italic + + + false + Italic text + + + + Anchor at Middle + + Anchor at Middle + format-justify-center + + + false + Anchor at Middle + + + + Anchor at End + + Anchor at End + format-justify-right + + + false + Anchor at End + + + + Convert to Path + + Convert to Path + pathshape + + + false + Convert to Path + + + + Anchor at Start + + Anchor at Start + format-justify-left + + + false + Anchor at Start + + + + Bold text + + Bold text + format-text-bold + + + false + Bold text + + + + Deselect + Ctrl+Shift+A + Deselect + + + + false + Dese&lect + Ctrl+Shift+A + + + Superscript + + Superscript + format-text-superscript + + + false + Superscript + + + + diff --git a/krita/data/actions/CMakeLists.txt b/krita/data/actions/CMakeLists.txt --- a/krita/data/actions/CMakeLists.txt +++ b/krita/data/actions/CMakeLists.txt @@ -3,4 +3,6 @@ InteractionTool.action PathTool.action TextTool.action + ConnectionTool.action + ReferencesTool.action DESTINATION ${DATA_INSTALL_DIR}/krita/actions) diff --git a/krita/data/actions/ConnectionTool.action b/krita/data/actions/ConnectionTool.action new file mode 100644 --- /dev/null +++ b/krita/data/actions/ConnectionTool.action @@ -0,0 +1,171 @@ + + + + Connection Tool + + Edit connection points + + Edit connection points + path-break-segment + + + true + Edit connection points + + + + % + + % + path-break-segment + + + true + % + + + + Align to left edge + + Align to left edge + align-horizontal-left + + + true + Align to left edge + + + + Align to horizontal center + + Align to horizontal center + align-horizontal-center + + + true + Align to horizontal center + + + + Align to right edge + + Align to right edge + align-horizontal-right + + + true + Align to right edge + + + + Align to top edge + + Align to top edge + align-vertical-top + + + true + Align to top edge + + + + Align to vertical center + + Align to vertical center + align-vertical-center + + + true + Align to vertical center + + + + Align to bottom edge + + Align to bottom edge + align-vertical-bottom + + + true + Align to bottom edge + + + + Escape in all directions + + Escape in all directions + escape-direction-all + + + true + Escape in all directions + + + + Escape in horizontal directions + + Escape in horizontal directions + escape-direction-horizontal + + + true + Escape in horizontal directions + + + + Escape in vertical directions + + Escape in vertical directions + escape-direction-vertical + + + true + Escape in vertical directions + + + + Escape in left direction + + Escape in left direction + escape-direction-left + + + true + Escape in left direction + + + + Escape in right direction + + Escape in right direction + escape-direction-right + + + true + Escape in right direction + + + + Escape in up direction + + Escape in up direction + escape-direction-up + + + true + Escape in up direction + + + + Escape in down direction + + Escape in down direction + escape-direction-down + + + true + Escape in down direction + + + + diff --git a/krita/data/actions/InteractionTool.action b/krita/data/actions/InteractionTool.action --- a/krita/data/actions/InteractionTool.action +++ b/krita/data/actions/InteractionTool.action @@ -1,135 +1,138 @@ - - - Raise - Ctrl+] - Raise - object-order-raise-calligra - - - false - &Raise - Ctrl+] - - - Align Right - - Align Right - object-align-horizontal-right-calligra - - - false - Align Right - - - - Ungroup - - Ungroup - object-ungroup-calligra - - - false - Ungroup - - - - Send to Back - Ctrl+Shift+[ - Send to Back - object-order-back-calligra - - - false - Send to &Back - Ctrl+Shift+[ - - - Bring to Front - Ctrl+Shift+] - Bring to Front - object-order-front-calligra - - - false - Bring to &Front - Ctrl+Shift+] - - - Vertically Center - - Vertically Center - object-align-vertical-center-calligra - - - false - Vertically Center - - - - Group - - Group - object-group-calligra - - - false - Group - - - - Align Left - - Align Left - object-align-horizontal-left-calligra - - - false - Align Left - - - - Align Top - - Align Top - object-align-vertical-top-calligra - - - false - Align Top - - - - Horizontally Center - - Horizontally Center - object-align-horizontal-center-calligra - - - false - Horizontally Center - - - - Lower - Ctrl+[ - Lower - object-order-lower-calligra - - - false - &Lower - Ctrl+[ - - - Align Bottom - - Align Bottom - object-align-vertical-bottom-calligra - - - false - Align Bottom - - - + + + Interaction Tool + + Raise + Ctrl+] + Raise + object-order-raise-calligra + + + false + &Raise + Ctrl+] + + + Align Right + + Align Right + object-align-horizontal-right-calligra + + + false + Align Right + + + + Ungroup + + Ungroup + object-ungroup-calligra + + + false + Ungroup + + + + Send to Back + Ctrl+Shift+[ + Send to Back + object-order-back-calligra + + + false + Send to &Back + Ctrl+Shift+[ + + + Bring to Front + Ctrl+Shift+] + Bring to Front + object-order-front-calligra + + + false + Bring to &Front + Ctrl+Shift+] + + + Vertically Center + + Vertically Center + object-align-vertical-center-calligra + + + false + Vertically Center + + + + Group + + Group + object-group-calligra + + + false + Group + + + + Align Left + + Align Left + object-align-horizontal-left-calligra + + + false + Align Left + + + + Align Top + + Align Top + object-align-vertical-top-calligra + + + false + Align Top + + + + Horizontally Center + + Horizontally Center + object-align-horizontal-center-calligra + + + false + Horizontally Center + + + + Lower + Ctrl+[ + Lower + object-order-lower-calligra + + + false + &Lower + Ctrl+[ + + + Align Bottom + + Align Bottom + object-align-vertical-bottom-calligra + + + false + Align Bottom + + + + diff --git a/krita/data/actions/PathTool.action b/krita/data/actions/PathTool.action --- a/krita/data/actions/PathTool.action +++ b/krita/data/actions/PathTool.action @@ -1,157 +1,160 @@ - - - To Path - P - To Path - convert-to-path - - - false - To Path - P - - - Remove point - Backspace - Remove point - pathpoint-remove - - - false - Remove point - Backspace - - - Break at segment - - Break at segment - path-break-segment - - - false - Break at segment - - - - Segment to Line - F - Segment to Line - pathsegment-line - - - false - Segment to Line - F - - - Break at point - - Break at point - path-break-point - - - false - Break at point - - - - Make line point - - Make line point - pathpoint-line - - - false - Make line point - - - - Symmetric Point - - Symmetric Point - pathpoint-symmetric - - - false - Symmetric Point - - - - Make curve point - - Make curve point - pathpoint-curve - - - false - Make curve point - - - - Segment to Curve - C - Segment to Curve - pathsegment-curve - - - false - Segment to Curve - C - - - Insert point - Ins - Insert point - pathpoint-insert - - - false - Insert point - Ins - - - Corner point - - Corner point - pathpoint-corner - - - false - Corner point - - - - Merge points - - Merge points - pathpoint-merge - - - false - Merge points - - - - Join with segment - J - Join with segment - pathpoint-join - - - false - Join with segment - J - - - Smooth point - - Smooth point - pathpoint-smooth - - - false - Smooth point - - - + + + Path Tool + + To Path + P + To Path + convert-to-path + + + false + To Path + P + + + Remove point + Backspace + Remove point + pathpoint-remove + + + false + Remove point + Backspace + + + Break at segment + + Break at segment + path-break-segment + + + false + Break at segment + + + + Segment to Line + F + Segment to Line + pathsegment-line + + + false + Segment to Line + F + + + Break at point + + Break at point + path-break-point + + + false + Break at point + + + + Make line point + + Make line point + pathpoint-line + + + false + Make line point + + + + Symmetric Point + + Symmetric Point + pathpoint-symmetric + + + false + Symmetric Point + + + + Make curve point + + Make curve point + pathpoint-curve + + + false + Make curve point + + + + Segment to Curve + C + Segment to Curve + pathsegment-curve + + + false + Segment to Curve + C + + + Insert point + Ins + Insert point + pathpoint-insert + + + false + Insert point + Ins + + + Corner point + + Corner point + pathpoint-corner + + + false + Corner point + + + + Merge points + + Merge points + pathpoint-merge + + + false + Merge points + + + + Join with segment + J + Join with segment + pathpoint-join + + + false + Join with segment + J + + + Smooth point + + Smooth point + pathpoint-smooth + + + false + Smooth point + + + + diff --git a/krita/data/actions/ReferencesTool.action b/krita/data/actions/ReferencesTool.action new file mode 100644 --- /dev/null +++ b/krita/data/actions/ReferencesTool.action @@ -0,0 +1,655 @@ + + + + References Tool + + + Insert footnote with auto number + + Insert footnote with auto number + Insert footnote with auto number + + + false + + + + configure + Insert Custom... + + Insert a custom Table of Contents into the document. + Insert Custom + + + false + + + + + Insert Labeled Footnote + + Insert Labeled Footnote + Insert Labeled Footnote + + + false + + + + + + + + + + + false + + + + configure + Settings... + + Settings + Settings + + + false + + + + + Change text direction + + Change writing direction + Change text direction + Ctrl+Shift+D + Ctrl+Shift+D + false + + + + + Insert Paragraph between sections + + Insert Paragraph between sections + Insert Paragraph between sections + + + false + + + + + Repaint + + Repaint + Repaint + + + false + + + + + Insert Link + + Insert a weblink or link to a bookmark. + Insert Link + + + false + + + + + Manage Bookmarks + + Manage your Bookmarks. Check where are they pointing to, Delete or Rename. + Manage Bookmarks + + + false + + + + + Style Manager... + <p>Change font and paragraph attributes of styles.</p><p>Multiple styles can be changed using the dialog box.</p> + Change attributes of styles + Style Manager + Ctrl+Alt+S + Ctrl+Alt+S + false + + + + + Font... + Change the attributes of the currently selected characters. + Change character size, font, boldface, italics etc. + Font + Ctrl+Alt+F + Ctrl+Alt+F + false + + + + + Font Size + + Font Size + Font Size + + + false + + + + + + + + + + + false + + + + + Align Block + + Align Block + Align Block + Ctrl+Alt+R + Ctrl+Alt+R + false + + + + + Insert Bibliography + + Insert a bibliography into the document. + Insert Bibliography + + + false + + + + + Insert endnote with auto number + + Insert endnote with auto number + Insert endnote with auto number + + + false + + + + configure + Settings... + + Settings + Settings + + + false + + + + + Bookmarks + + Display a pop up that hosts the options to add new Bookmark or handle existing Bookmarks + Bookmarks + + + false + + + + + Numbered list + + Numbered list + Numbered list + + + false + + + + + Subscript + + Subscript + Subscript + Ctrl+Shift+B + Ctrl+Shift+B + false + + + + + Decrease Font Size + + Decrease Font Size + Decrease Font Size + Ctrl+< + Ctrl+< + false + + + + + Insert Citation + + Insert a citation into the document. + Insert Citation + + + false + + + + + Configure current section + + Configure current section + Configure current section + + + false + + + + + Insert Index + + Insert Index + Insert Index + Ctrl+T + Ctrl+T + false + + + + + Italic + + Italic + Italic + Ctrl+I + Ctrl+I + false + + + + + Strikethrough + + Strikethrough + Strikethrough + + + false + + + + + Insert Custom Bibliography + + Insert a custom Bibliography into the document. + Insert Custom Bibliography + + + false + + + + + Styles Debug + + Styles Debug + Styles Debug + Ctrl+Alt+Shift+S + Ctrl+Alt+Shift+S + false + + + + + Bullet list + + Bullet list + Bullet list + + + false + + + + + Underline + + Underline + Underline + Ctrl+U + Ctrl+U + false + + + + + Align Center + + Align Center + Align Center + Ctrl+Alt+C + Ctrl+Alt+C + false + + + + + Shrink To Fit + + Shrink To Fit + Shrink To Fit + + + false + + + + + Select &All + + Select All + Select All + Ctrl+A + Ctrl+A + false + + + + + Increase Indent + + Increase Indent + Increase Indent + + + false + + + + + Insert + + Insert a Table of Contents into the document. + Insert + + + false + + + + + Paragraph Debug + + Paragraph Debug + Paragraph Debug + Ctrl+Alt+Shift+P + Ctrl+Alt+Shift+P + false + + + + + Insert Labeled Endnote + + Insert Labeled Endnote + Insert Labeled Endnote + + + false + + + + + Paragraph... + <p>Change paragraph margins, text flow, borders, bullets, numbering etc.</p><p>Select text in multiple paragraphs to change the formatting of all selected paragraphs.</p><p>If no text is selected, the paragraph where the cursor is located will be changed.</p> + Change paragraph margins, text flow, borders, bullets, numbering etc. + Paragraph + Ctrl+Alt+P + Ctrl+Alt+P + false + + + + + Insert Non-Breaking Space + + Insert Non-Breaking Space + Insert Non-Breaking Space + Ctrl+Space + Ctrl+Space + false + + + + + Insert Soft Hyphen + + Insert Soft Hyphen + Insert Soft Hyphen + + + false + + + + + Align Right + + Align Right + Align Right + Ctrl+Alt+R + Ctrl+Alt+R + false + + + + + Insert Non-Breaking Hyphen + + Insert Non-Breaking Hyphen + Insert Non-Breaking Hyphen + Ctrl+Shift+- + Ctrl+Shift+- + false + + + + + Configure... + + Configure the Table of Contents + Configure + + + false + + + + + Special Character... + Insert one or more symbols or characters not found on the keyboard. + Insert one or more symbols or characters not found on the keyboard + Special Character + Alt+Shift+C + Alt+Shift+C + false + + + + + Bold + + Bold + Bold + Ctrl+B + Ctrl+B + false + + + + + Superscript + + Superscript + Superscript + Ctrl+Shift+P + Ctrl+Shift+P + false + + + + + Configure + + Configure the bibliography + Configure + + + false + + + + + Insert new section + + Insert new section + Insert new section + + + false + + + + + Decrease Indent + + Decrease Indent + Decrease Indent + + + false + + + + + Increase Font Size + + Increase Font Size + Increase Font Size + Ctrl+> + Ctrl+> + false + + + + + Grow To Fit Height + + Grow To Fit Height + Grow To Fit Height + + + false + + + + + Align Left + + Align Left + Align Left + + + false + + + + + Add Bookmark + + Insert a Bookmark. This is useful to create links that point to areas within the document + Add Bookmark + + + false + + + + + Variable + + Variable + Variable + + + false + + + + + Grow To Fit Width + + Grow To Fit Width + Grow To Fit Width + + + false + + + + + Font Family + + Font Family + Font Family + + + false + + + + + Insert Comment + + Insert Comment + Insert Comment + Ctrl+Shift+C + Ctrl+Shift+C + false + + + + + + + + + + + false + + + + diff --git a/krita/data/actions/TextTool.action b/krita/data/actions/TextTool.action --- a/krita/data/actions/TextTool.action +++ b/krita/data/actions/TextTool.action @@ -1,443 +1,457 @@ - - - Align Right - Ctrl+Alt+R - Align Right - format-justify-right - - - false - Align Right - Ctrl+Alt+R - - - Decrease Indent - - Decrease Indent - - - - false - Decrease Indent - - - - Paragraph - Ctrl+Alt+P - Change paragraph margins, text flow, borders, bullets, numbering etc. - - <p>Change paragraph margins, text flow, borders, bullets, numbering etc.</p><p>Select text in multiple paragraphs to change the formatting of all selected paragraphs.</p><p>If no text is selected, the paragraph where the cursor is located will be changed.</p> - - false - Paragraph... - Ctrl+Alt+P - - - Text Color - - Text Color... - format-text-color - - - false - Text Color - - - - Special Character - Alt+Shift+C - Insert one or more symbols or characters not found on the keyboard - character-set - Insert one or more symbols or characters not found on the keyboard. - - false - Special Character... - Alt+Shift+C - - - Shrink To Fit - - Shrink To Fit - zoom-fit-best - - - false - Shrink To Fit - - - - Styles Debug - Ctrl+Alt+Shift+S - Styles Debug - - - - false - Styles Debug - Ctrl+Alt+Shift+S - - - Increase Indent - - Increase Indent - - - - false - Increase Indent - - - - Underline - Ctrl+U - Underline - format-text-underline - - - false - Underline - Ctrl+U - - - Grow To Fit Width - - Grow To Fit Width - zoom-fit-best - - - false - Grow To Fit Width - - - - Subscript - Ctrl+Shift+B - Subscript - format-text-subscript - - - false - Subscript - Ctrl+Shift+B - - - Insert Non-Breaking Hyphen - Ctrl+Shift+- - Insert Non-Breaking Hyphen - - - - false - Insert Non-Breaking Hyphen - Ctrl+Shift+- - - - Align Left - - Align Left - format-justify-left - - - false - Align Left - - - - Insert Comment - Ctrl+Shift+C - Insert Comment - - - - false - Insert Comment - Ctrl+Shift+C - - - Strikethrough - - Strikethrough - format-text-strikethrough - - - false - Strikethrough - - - - Configure current section - - Configure current section - configure - - - false - Configure current section - - - - Change text direction - Ctrl+Shift+D - Change writing direction - format-text-direction-rtl - - - false - Change text direction - Ctrl+Shift+D - - - Insert Non-Breaking Space - Ctrl+Space - Insert Non-Breaking Space - - - - false - Insert Non-Breaking Space - Ctrl+Space - - - Insert Soft Hyphen - - Insert Soft Hyphen - - - - false - Insert Soft Hyphen - - - - Variable - - Variable - - - - false - Variable - - - - Bullet list - - Bullet list - format-list-unordered - - - false - Bullet list - - - - Insert Index - Ctrl+T - Insert Index - - - - false - Insert Index - Ctrl+T - - - Align Center - Ctrl+Alt+C - Align Center - format-justify-center - - - false - Align Center - Ctrl+Alt+C - - - Background - - Background Color... - format-fill-color - - - false - Background - - - - Decrease Font Size - Ctrl+< - Decrease Font Size - - - - false - Decrease Font Size - Ctrl+< - - - Insert new section - - Insert new section - insert-text - - - false - Insert new section - - - - Font Size - - Font Size - - - - false - Font Size - - - - Italic - Ctrl+I - Italic - format-text-italic - - - false - Italic - Ctrl+I - - - Bold - Ctrl+B - Bold - format-text-bold - - - false - Bold - Ctrl+B - - - Increase Font Size - Ctrl+> - Increase Font Size - - - - false - Increase Font Size - Ctrl+> - - - Superscript - Ctrl+Shift+P - Superscript - format-text-superscript - - - false - Superscript - Ctrl+Shift+P - - - Select All - Ctrl+A - Select All - edit-select-all - - - false - Select &All - Ctrl+A - - - Numbered list - - Numbered list - format-list-ordered - - - false - Numbered list - - - - Style Manager - Ctrl+Alt+S - Change attributes of styles - - <p>Change font and paragraph attributes of styles.</p><p>Multiple styles can be changed using the dialog box.</p> - - false - Style Manager... - Ctrl+Alt+S - - - Align Block - Ctrl+Alt+R - Align Block - format-justify-fill - - - false - Align Block - Ctrl+Alt+R - - - Grow To Fit Height - - Grow To Fit Height - zoom-fit-best - - - false - Grow To Fit Height - - - - Paragraph Debug - Ctrl+Alt+Shift+P - Paragraph Debug - - - - false - Paragraph Debug - Ctrl+Alt+Shift+P - - - Font Family - - Font Family - - - - false - Font Family - - - - Font - Ctrl+Alt+F - Change character size, font, boldface, italics etc. - - Change the attributes of the currently selected characters. - - false - Font... - Ctrl+Alt+F - - - Repaint - - Repaint - view-refresh - - - false - Repaint - - - + + + Text Tool + + Align Right + Ctrl+Alt+R + Align Right + format-justify-right + + + false + Align Right + Ctrl+Alt+R + + + Decrease Indent + + Decrease Indent + + + + false + Decrease Indent + + + + Paragraph + Ctrl+Alt+P + Change paragraph margins, text flow, borders, bullets, numbering etc. + + <p>Change paragraph margins, text flow, borders, bullets, numbering etc.</p><p>Select text in multiple paragraphs to change the formatting of all selected paragraphs.</p><p>If no text is selected, the paragraph where the cursor is located will be changed.</p> + + false + Paragraph... + Ctrl+Alt+P + + + Text Color + + Text Color... + format-text-color + + + false + Text Color + + + + Special Character + Alt+Shift+C + Insert one or more symbols or characters not found on the keyboard + character-set + Insert one or more symbols or characters not found on the keyboard. + + false + Special Character... + Alt+Shift+C + + + Shrink To Fit + + Shrink To Fit + zoom-fit-best + + + false + Shrink To Fit + + + + Styles Debug + Ctrl+Alt+Shift+S + Styles Debug + + + + false + Styles Debug + Ctrl+Alt+Shift+S + + + Increase Indent + + Increase Indent + + + + false + Increase Indent + + + + Underline + Ctrl+U + Underline + format-text-underline + + + false + Underline + Ctrl+U + + + Grow To Fit Width + + Grow To Fit Width + zoom-fit-best + + + false + Grow To Fit Width + + + + Subscript + Ctrl+Shift+B + Subscript + format-text-subscript + + + false + Subscript + Ctrl+Shift+B + + + Insert Non-Breaking Hyphen + Ctrl+Shift+- + Insert Non-Breaking Hyphen + + + + false + Insert Non-Breaking Hyphen + Ctrl+Shift+- + + + Align Left + + Align Left + format-justify-left + + + false + Align Left + + + + Insert Comment + Ctrl+Shift+C + Insert Comment + + + + false + Insert Comment + Ctrl+Shift+C + + + Strikethrough + + Strikethrough + format-text-strikethrough + + + false + Strikethrough + + + + Configure current section + + Configure current section + configure + + + false + Configure current section + + + + Change text direction + Ctrl+Shift+D + Change writing direction + format-text-direction-rtl + + + false + Change text direction + Ctrl+Shift+D + + + Insert Non-Breaking Space + Ctrl+Space + Insert Non-Breaking Space + + + + false + Insert Non-Breaking Space + Ctrl+Space + + + Insert Soft Hyphen + + Insert Soft Hyphen + + + + false + Insert Soft Hyphen + + + + Variable + + Variable + + + + false + Variable + + + + Bullet list + + Bullet list + format-list-unordered + + + false + Bullet list + + + + Insert Index + Ctrl+T + Insert Index + + + + false + Insert Index + Ctrl+T + + + Align Center + Ctrl+Alt+C + Align Center + format-justify-center + + + false + Align Center + Ctrl+Alt+C + + + Background + + Background Color... + format-fill-color + + + false + Background + + + + Decrease Font Size + Ctrl+< + Decrease Font Size + + + + false + Decrease Font Size + Ctrl+< + + + Insert new section + + Insert new section + insert-text + + + false + Insert new section + + + + Insert Paragraph between sections + + Insert Paragraph between sections + split + + + + + + + + Font Size + + Font Size + + + + false + Font Size + + + + Italic + Ctrl+I + Italic + format-text-italic + + + false + Italic + Ctrl+I + + + Bold + Ctrl+B + Bold + format-text-bold + + + false + Bold + Ctrl+B + + + Increase Font Size + Ctrl+> + Increase Font Size + + + + false + Increase Font Size + Ctrl+> + + + Superscript + Ctrl+Shift+P + Superscript + format-text-superscript + + + false + Superscript + Ctrl+Shift+P + + + Select All + Ctrl+A + Select All + edit-select-all + + + false + Select &All + Ctrl+A + + + Numbered list + + Numbered list + format-list-ordered + + + false + Numbered list + + + + Style Manager + Ctrl+Alt+S + Change attributes of styles + + <p>Change font and paragraph attributes of styles.</p><p>Multiple styles can be changed using the dialog box.</p> + + false + Style Manager... + Ctrl+Alt+S + + + Align Block + Ctrl+Alt+R + Align Block + format-justify-fill + + + false + Align Block + Ctrl+Alt+R + + + Grow To Fit Height + + Grow To Fit Height + zoom-fit-best + + + false + Grow To Fit Height + + + + Paragraph Debug + Ctrl+Alt+Shift+P + Paragraph Debug + + + + false + Paragraph Debug + Ctrl+Alt+Shift+P + + + Font Family + + Font Family + + + + false + Font Family + + + + Font + Ctrl+Alt+F + Change character size, font, boldface, italics etc. + + Change the attributes of the currently selected characters. + + false + Font... + Ctrl+Alt+F + + + Repaint + + Repaint + view-refresh + + + false + Repaint + + + + diff --git a/krita/krita.action b/krita/krita.action --- a/krita/krita.action +++ b/krita/krita.action @@ -1,3766 +1,2540 @@ - - - - Save Incremental &Version - - Save Incremental Version - Save Incremental Version - Ctrl+Alt+S - Ctrl+Alt+S - false - - - - - Save Incremental Backup - - Save Incremental Backup - Save Incremental Backup - F4 - F4 - false - - - - - Toggle Tablet Debugger - - Toggle Tablet Debugger - Toggle Tablet Debugger - Ctrl+Shift+T - Ctrl+Shift+T - false - - - - - &Create Template From Image... - - Create Template From Image - Create Template From Image - - - false - - - - - Open Resources Folder - Opens a file browser at the location Krita saves resources such as brushes to. - Opens a file browser at the location Krita saves resources such as brushes to. - Open Resources Folder - - - false - - - - - Rotate Canvas Right - - Rotate Canvas Right - Rotate Canvas Right - Ctrl+] - Ctrl+] - false - - - - - Rotate Canvas Left - - Rotate Canvas Left - Rotate Canvas Left - Ctrl+[ - Ctrl+[ - false - - - - - Wrap Around Mode - - Wrap Around Mode - Wrap Around Mode - W - W - false - - - - - Fast Preview Mode (LOD) - - Fast Preview Mode (LOD) - Fast Preview Mode (LOD) - Shift+L - Shift+L - true - - - - - Hide Status Bar - - Shows or hides the status bar - Hide Status Bar - - - true - - - - - Show Canvas Only - - Shows just the canvas or the whole window - Show Canvas Only - Tab - Tab - false - - - - - Cleanup removed files... - - Cleanup removed files - Cleanup removed files - - - false - - - - - Apply Filter Again - - Apply Filter Again - Apply Filter Again - - - false - - - - - Colors - - Colors - Colors - - Ctrl+F - false - - - - - &Color to Alpha... - - Color to Alpha - Color to Alpha - - - false - - - - - Edge Detection - - Edge Detection - Edge Detection - - - false - - - - - Top Edge Detection - - Top Edge Detection - Top Edge Detection - - - false - - - - - Artistic - - Artistic - Artistic - - - false - - - - - &Index Colors... - - Index Colors - Index Colors - - - false - - - - - Emboss - - Emboss - Emboss - - - false - - - - - Emboss Horizontal Only - - Emboss Horizontal Only - Emboss Horizontal Only - - - false - - - - - Adjust - - Adjust - Adjust - - - false - - - - - Dodge - - Dodge - Dodge - - - false - - - - - Enhance - - Enhance - Enhance - - - false - - - - - &Sharpen - - Sharpen - Sharpen - - - false - - - - - Burn - - Burn - Burn - - - false - - - - - &Mean Removal - - Mean Removal - Mean Removal - - - false - - - - - Blur - - Blur - Blur - - - false - - - - - &Gaussian Blur... - - Gaussian Blur - Gaussian Blur - - - false - - - - - Emboss in All Directions - - Emboss in All Directions - Emboss in All Directions - - - false - - - - - Map - - Map - Map - - - false - - - - - &Small Tiles... - - Small Tiles - Small Tiles - - - false - - - - - &Levels... - - Levels - Levels - Ctrl+L - Ctrl+L - false - - - - - &Sobel... - - Sobel - Sobel - - - false - - - - - Other - - Other - Other - - - false - - - - - &Wave... - - Wave - Wave - - - false - - - - - &Motion Blur... - - Motion Blur - Motion Blur - - - false - - - - - &Color Adjustment curves... - - Color Adjustment curves - Color Adjustment curves - Ctrl+M - Ctrl+M - false - - - - - &Pixelize... - - Pixelize - Pixelize - - - false - - - - - Emboss (Laplacian) - - Emboss (Laplacian) - Emboss (Laplacian) - - - false - - - - - Left Edge Detection - - Left Edge Detection - Left Edge Detection - - - false - - - - - &Blur... - - Blur - Blur - - - false - - - - - &Raindrops... - - Raindrops - Raindrops - - - false - - - - - Bottom Edge Detection - - Bottom Edge Detection - Bottom Edge Detection - - - false - - - - - &Random Noise... - - Random Noise - Random Noise - - - false - - - - - &Brightness/Contrast curve... - - Brightness/Contrast curve - Brightness/Contrast curve - - - false - - - - - &Color Balance.. - - Color Balance.. - Color Balance.. - Ctrl+B - Ctrl+B - false - - - - - &PhongBumpmap... - - PhongBumpmap - PhongBumpmap - - - false - - - - - &Desaturate - - Desaturate - Desaturate - Ctrl+Shift+U - Ctrl+Shift+U - false - - - - - &Color Transfer... - - Color Transfer - Color Transfer - - - false - - - - - Emboss Vertical Only - - Emboss Vertical Only - Emboss Vertical Only - - - false - - - - - &Lens Blur... - - Lens Blur - Lens Blur - - - false - - - - - M&inimize Channel - - Minimize Channel - Minimize Channel - - - false - - - - - M&aximize Channel - - Maximize Channel - Maximize Channel - - - false - - - - - &Oilpaint... - - Oilpaint - Oilpaint - - - false - - - - - Right Edge Detection - - Right Edge Detection - Right Edge Detection - - - false - - - - - &Invert - - Invert - Invert - Ctrl+I - Ctrl+I - false - - - - - &Auto Contrast - - Auto Contrast - Auto Contrast - - - false - - - - - &Round Corners... - - Round Corners - Round Corners - - - false - - - - - &Unsharp Mask... - - Unsharp Mask - Unsharp Mask - - - false - - - - - &Emboss with Variable Depth... - - Emboss with Variable Depth - Emboss with Variable Depth - - - false - - - - - Emboss Horizontal && Vertical - - Emboss Horizontal & Vertical - Emboss Horizontal & Vertical - - - false - - - - - &Random Pick... - - Random Pick - Random Pick - - - false - - - - - &Gaussian Noise Reduction... - - Gaussian Noise Reduction - Gaussian Noise Reduction - - - false - - - - - &Posterize... - - Posterize - Posterize - - - false - - - - - &Wavelet Noise Reducer... - - Wavelet Noise Reducer - Wavelet Noise Reducer - - - false - - - - - &HSV Adjustment... - - HSV Adjustment - HSV Adjustment - Ctrl+U - Ctrl+U - false - - - - edit-cut - Cu&t - - Cut selection to clipboard - Cut - Ctrl+X; Shift+Del - Ctrl+X; Shift+Del - false - - - - edit-copy - &Copy - - Copy selection to clipboard - Copy - Ctrl+C; Ctrl+Ins - Ctrl+C; Ctrl+Ins - false - - - - edit-paste - &Paste - - Paste clipboard content - Paste - Ctrl+V; Shift+Ins - Ctrl+V; Shift+Ins - false - - - - - Paste into &New Image - - Paste into New Image - Paste into New Image - Ctrl+Shift+N - Ctrl+Shift+N - false - - - - - Paste at cursor - - Paste at cursor - Paste at cursor - - - false - - - - - Copy merged - - Copy merged - Copy merged - Ctrl+Shift+C - Ctrl+Shift+C - false - - - - edit-select-all - Select &All - - Select All - Select All - Ctrl+A - Ctrl+A - false - - - - edit-select-all - Deselect - - Deselect - Deselect - Ctrl+Shift+A - Ctrl+Shift+A - false - - - - edit-clear - Clear - - Clear - Clear - Del - Del - false - - - - - &Reselect - - Reselect - Reselect - Ctrl+Shift+D - Ctrl+Shift+D - false - - - - - &Invert Selection - - foo - Invert Selection - Ctrl+Shift+I - Ctrl+Shift+I - false - - - - - Copy Selection to New Layer - - Copy Selection to New Layer - Copy Selection to New Layer - Ctrl+Alt+J - Ctrl+Alt+J - false - - - - - Cut Selection to New Layer - - Cut Selection to New Layer - Cut Selection to New Layer - Ctrl+Shift+J - Ctrl+Shift+J - false - - - - - Fill with Foreground Color - - Fill with Foreground Color - Fill with Foreground Color - Shift+Backspace - Shift+Backspace - false - - - - - Fill with Background Color - - Fill with Background Color - Fill with Background Color - Backspace - Backspace - false - - - - - Fill with Pattern - - Fill with Pattern - Fill with Pattern - - - false - - - - - Fill with Foreground Color (Opacity) - - Fill with Foreground Color (Opacity) - Fill with Foreground Color (Opacity) - Ctrl+Shift+Backspace - Ctrl+Shift+Backspace - false - - - - - Fill with Background Color (Opacity) - - Fill with Background Color (Opacity) - Fill with Background Color (Opacity) - Ctrl+Backspace - Ctrl+Backspace - false - - - - - Fill with Pattern (Opacity) - - Fill with Pattern (Opacity) - Fill with Pattern (Opacity) - - - false - - - - - Stro&ke selected shapes - - Stroke selected shapes - Stroke selected shapes - - - false - - - - - Display Selection - - Display Selection - Display Selection - Ctrl+H - Ctrl+H - true - - - - - Size Canvas to Size of Selection - - Size Canvas to Size of Selection - Size Canvas to Size of Selection - - - false - - - - - &Convert to Vector Selection - - Convert to Vector Selection - Convert to Vector Selection - - - false - - - - - Convert &Shapes to Vector Selection - - Convert Shapes to Vector Selection - Convert Shapes to Vector Selection - - - false - - - - - &Toggle Selection Display Mode - - Toggle Selection Display Mode - Toggle Selection Display Mode - - - false - - - - - &Merge Selected Layers - - Merge Selected Layers - Merge Selected Layers - Ctrl+Alt+E - Ctrl+Alt+E - false - - - - - &Flatten image - - Flatten image - Flatten image - Ctrl+Shift+E - Ctrl+Shift+E - false - - - - - &Merge with Layer Below - - Merge with Layer Below - Merge with Layer Below - Ctrl+E - Ctrl+E - false - - - - - &Flatten Layer - - Flatten Layer - Flatten Layer - - - false - - - - - Rename current layer - - Rename current layer - Rename current layer - F2 - F2 - false - - - - - Rasterize Layer - - Rasterize Layer - Rasterize Layer - - - false - - - - document-save - Save Group Layers... - - Save Group Layers - Save Group Layers - - - false - - - - - Size Canvas to Size of Current Layer - - Size Canvas to Size of Current Layer - Size Canvas to Size of Current Layer - - - false - - - - light_trim-to-image - Trim to Image Size - - Trim to Image Size - Trim to Image Size - - - false - - - - light_symmetry-horizontal - Mirror Layer Horizontally - - Mirror Layer Horizontally - Mirror Layer Horizontally - - - false - - - - light_symmetry-vertical - Mirror Layer Vertically - - Mirror Layer Vertically - Mirror Layer Vertically - - - false - - - - - Activate next layer - - Activate next layer - Activate next layer - PgUp - PgUp - false - - - - - Activate previous layer - - Activate previous layer - Activate previous layer - PgDown - PgDown - false - - - - document-save - Save Layer/Mask... - - Save Layer/Mask - Save Layer/Mask - - - false - - - - edit-copy - &Duplicate Layer or Mask - - Duplicate Layer or Mask - Duplicate Layer or Mask - Ctrl+J - Ctrl+J - false - - - - light_document-new - &Paint Layer - - Paint Layer - Paint Layer - Ins - Ins - false - - - - folder-new - &Group Layer - - Group Layer - Group Layer - Ctrl+G - Ctrl+G - false - - - - edit-copy - &Clone Layer - - Clone Layer - Clone Layer - - - false - - - - bookmark-new - &Vector Layer - - Vector Layer - Vector Layer - - - false - - - - view-filter - &Filter Layer... - - Filter Layer - Filter Layer - - - false - - - - krita_tool_color_fill - &Fill Layer... - - Fill Layer - Fill Layer - - - false - - - - document-open - &File Layer... - - File Layer - File Layer - - - false - - - - edit-copy - &Transparency Mask - - Transparency Mask - Transparency Mask - - - false - - - - bookmarks - &Filter Mask... - - Filter Mask - Filter Mask - - - false - - - - bookmarks - &Transform Mask... - - Transform Mask - Transform Mask - - - false - - - - edit-paste - &Local Selection - - Local Selection - Local Selection - - - false - - - - document-new - to &Paint Layer - - to Paint Layer - to Paint Layer - - - false - - - - edit-paste - to &Selection Mask - - to Selection Mask - to Selection Mask - - - false - - - - bookmarks - to &Filter Mask... - - to Filter Mask - to Filter Mask - - - false - - - - edit-copy - to &Transparency Mask - - to Transparency Mask - to Transparency Mask - - - false - - - - view-filter - &Isolate Layer - - Isolate Layer - Isolate Layer - - - false - - - - edit-copy - Alpha into Mask - - Alpha into Mask - Alpha into Mask - - - false - - - - transparency-enabled - Write as Alpha - - Write as Alpha - Write as Alpha - - - false - - - - document-save - Save Merged... - - Save Merged - Save Merged - - - false - - - - - I&mport Layer... - - Import Layer - Import Layer - - - false - - - - document-properties - Properties... - - Properties - Properties - - - false - - - - document-new - as Paint Layer... - - as Paint Layer - as Paint Layer - - - false - - - - edit-copy - as Transparency Mask... - - as Transparency Mask - as Transparency Mask - - - false - - - - bookmarks - as Filter Mask... - - as Filter Mask - as Filter Mask - - - false - - - - edit-paste - as Selection Mask... - - as Selection Mask - as Selection Mask - - - false - - - - format-stroke-color - Image Background Color and Transparency... - - Change the background color of the image - Image Background Color and Transparency - - - false - - - - view-grid - Show Grid - - Show Grid - Show Grid - Ctrl+Shift+' - Ctrl+Shift+' - false - - - - - Snap To Grid - - Snap To Grid - Snap To Grid - Ctrl+Shift+; - Ctrl+Shift+; - false - - - - - Show Perspective Grid - - Show Perspective Grid - Show Perspective Grid - - - true - - - - - Clear Perspective Grid - - Clear Perspective Grid - Clear Perspective Grid - - - false - - - - - Hide Painting Assistants - - Hide Painting Assistants - Hide Painting Assistants - - - true - - - - - Show Assistant Previews - - Show Assistant Previews - Show Assistant Previews - - - true - - - - - Make brush color lighter - - Make brush color lighter - Make brush color lighter - L - L - false - - - - - Make brush color darker - - Make brush color darker - Make brush color darker - H - K - false - - - - - Increase opacity - - Increase opacity - Increase opacity - O - O - false - - - - - Decrease opacity - - Decrease opacity - Decrease opacity - I - I - false - - - - - Mirror View - - Mirror View - Mirror View - M - M - false - - - - - &Patterns - - Patterns - Patterns - - - false - - - - - &Gradients - - Gradients - Gradients - - - false - - - - - &Color - - Color - Color - - - false - - - - eraser-toggle - Set eraser mode - - Set eraser mode - Set eraser mode - E - E - false - - - - reload_preset - Reload Original Preset - - Reload Original Preset - Reload Original Preset - - - false - - - - transparency-unlocked - Preserve Alpha - - Preserve Alpha - Preserve Alpha - - - false - - - - light_symmetry-horizontal - Set horizontal mirror mode - - Set horizontal mirror mode - Set horizontal mirror mode - - - false - - - - light_symmetry-vertical - Set vertical mirror mode - - Set vertical mirror mode - Set vertical mirror mode - - - false - - - - - Next Blending Mode - - Next Blending Mode - Next Blending Mode - Alt+Shift++ - Alt+Shift++ - false - - - - - Previous Blending Mode - - Previous Blending Mode - Previous Blending Mode - Alt+Shift+- - Alt+Shift+- - false - - - - - Select Normal Blending Mode - - Select Normal Blending Mode - Select Normal Blending Mode - Alt+Shift+N - Alt+Shift+N - false - - - - - Select Dissolve Blending Mode - - Select Dissolve Blending Mode - Select Dissolve Blending Mode - Alt+Shift+I - Alt+Shift+I - false - - - - - Select Behind Blending Mode - - Select Behind Blending Mode - Select Behind Blending Mode - Alt+Shift+Q - Alt+Shift+Q - false - - - - - Select Clear Blending Mode - - Select Clear Blending Mode - Select Clear Blending Mode - Alt+Shift+R - Alt+Shift+R - false - - - - - Select Darken Blending Mode - - Select Darken Blending Mode - Select Darken Blending Mode - Alt+Shift+K - Alt+Shift+K - false - - - - - Select Multiply Blending Mode - - Select Multiply Blending Mode - Select Multiply Blending Mode - Alt+Shift+M - Alt+Shift+M - false - - - - - Select Color Burn Blending Mode - - Select Color Burn Blending Mode - Select Color Burn Blending Mode - Alt+Shift+B - Alt+Shift+B - false - - - - - Select Linear Burn Blending Mode - - Select Linear Burn Blending Mode - Select Linear Burn Blending Mode - Alt+Shift+A - Alt+Shift+A - false - - - - - Select Lighten Blending Mode - - Select Lighten Blending Mode - Select Lighten Blending Mode - Alt+Shift+G - Alt+Shift+G - false - - - - - Select Screen Blending Mode - - Select Screen Blending Mode - Select Screen Blending Mode - Alt+Shift+S - Alt+Shift+S - false - - - - - Select Color Dodge Blending Mode - - Select Color Dodge Blending Mode - Select Color Dodge Blending Mode - Alt+Shift+D - Alt+Shift+D - false - - - - - Select Linear Dodge Blending Mode - - Select Linear Dodge Blending Mode - Select Linear Dodge Blending Mode - Alt+Shift+W - Alt+Shift+W - false - - - - - Select Overlay Blending Mode - - Select Overlay Blending Mode - Select Overlay Blending Mode - Alt+Shift+O - Alt+Shift+O - false - - - - - Select Soft Light Blending Mode - - Select Soft Light Blending Mode - Select Soft Light Blending Mode - Alt+Shift+F - Alt+Shift+F - false - - - - - Select Hard Light Blending Mode - - Select Hard Light Blending Mode - Select Hard Light Blending Mode - Alt+Shift+H - Alt+Shift+H - false - - - - - Select Vivid Light Blending Mode - - Select Vivid Light Blending Mode - Select Vivid Light Blending Mode - Alt+Shift+V - Alt+Shift+V - false - - - - - Select Linear Light Blending Mode - - Select Linear Light Blending Mode - Select Linear Light Blending Mode - Alt+Shift+J - Alt+Shift+J - false - - - - - Select Pin Light Blending Mode - - Select Pin Light Blending Mode - Select Pin Light Blending Mode - Alt+Shift+Z - Alt+Shift+Z - false - - - - - Select Hard Mix Blending Mode - - Select Hard Mix Blending Mode - Select Hard Mix Blending Mode - Alt+Shift+L - Alt+Shift+L - false - - - - - Select Difference Blending Mode - - Select Difference Blending Mode - Select Difference Blending Mode - Alt+Shift+E - Alt+Shift+E - false - - - - - Select Exclusion Blending Mode - - Select Exclusion Blending Mode - Select Exclusion Blending Mode - Alt+Shift+X - Alt+Shift+X - false - - - - - Select Hue Blending Mode - - Select Hue Blending Mode - Select Hue Blending Mode - Alt+Shift+U - Alt+Shift+U - false - - - - - Select Saturation Blending Mode - - Select Saturation Blending Mode - Select Saturation Blending Mode - Alt+Shift+T - Alt+Shift+T - false - - - - - Select Color Blending Mode - - Select Color Blending Mode - Select Color Blending Mode - Alt+Shift+C - Alt+Shift+C - false - - - - - Select Luminosity Blending Mode - - Select Luminosity Blending Mode - Select Luminosity Blending Mode - Alt+Shift+Y - Alt+Shift+Y - false - - - - - Brush composite - - Brush composite - Brush composite - - - false - - - - - Brush option slider 1 - - Brush option slider 1 - Brush option slider 1 - - - false - - - - - Brush option slider 2 - - Brush option slider 2 - Brush option slider 2 - - - false - - - - - Brush option slider 3 - - Brush option slider 3 - Brush option slider 3 - - - false - - - - - Next Favourite Preset - - Next Favourite Preset - Next Favourite Preset - , - , - false - - - - - Previous Favourite Preset - - Previous Favourite Preset - Previous Favourite Preset - . - . - false - - - - - Switch to Previous Preset - - Switch to Previous Preset - Switch to Previous Preset - / - / - false - - - - - Mirror - - Mirror - Mirror - - - false - - - - - Workspaces - - Workspaces - Workspaces - - - false - - - - - &Painter's Tools - - Painter's Tools - Painter's Tools - - - false - - - - light_document-new - &New - - Create new document - New - Ctrl+N - Ctrl+N - false - - - - document-open - &Open... - - Open an existing document - Open - Ctrl+O - Ctrl+O - false - - - - document-open-recent - Open &Recent - - Open a document which was recently opened - Open Recent - - - false - - - - document-save - &Save - - Save - Save - Ctrl+S - Ctrl+S - false - - - - document-save-as - Save &As... - - Save document under a new name - Save As - Ctrl+Shift+S - Ctrl+Shift+S - false - - - - document-print - &Print... - - Print document - Print - Ctrl+P - Ctrl+P - false - - - - document-print-preview - Print Previe&w - - Show a print preview of document - Print Preview - - - false - - - - light_edit-undo - Undo - - Undo last action - Undo - Ctrl+Z - Ctrl+Z - false - - - - light_edit-redo - Redo - - Redo last undone action - Redo - Ctrl+Shift+Z - Ctrl+Shift+Z - false - - - - application-pdf - Export as PDF... - - Export as PDF - Export as PDF - - - false - - - - application-exit - &Quit - - Quit application - Quit - Ctrl+Q - Ctrl+Q - false - - - - - Close All - - Close All - Close All - Ctrl+Shift+W - Ctrl+Shift+W - false - - - - - Reload - - Reload - Reload - - - false - - - - document-import - Open ex&isting Document as Untitled Document... - - Open existing Document as Untitled Document - Open existing Document as Untitled Document - - - false - - - - document-export - E&xport... - - Export - Export - - - false - - - - document-properties - Document Information - - Document Information - Document Information - - - false - - - - configure-shortcuts - Configure S&hortcuts... - - Configure Shortcuts - Configure Shortcuts - - - false - - - - light_configure - Configure Tool&bars... - - Configure Toolbars - Configure Toolbars - - - false - - - - - &Themes - - Themes - Themes - - - false - - - - view-fullscreen - F&ull Screen Mode - - Display the window in full screen - Full Screen Mode - Ctrl+Shift+F - Ctrl+Shift+F - false - - - - - Show Dockers - - Show Dockers - Show Dockers - - - true - - - - - Show Docker Titlebars - - Show Docker Titlebars - Show Docker Titlebars - - - true - - - - - Dockers - - Dockers - Dockers - - - false - - - - - &Window - - Window - Window - - - false - - - - - Cascade - - Cascade - Cascade - - - false - - - - - Tile - - Tile - Tile - - - false - - - - - Next - - Next - Next - - - false - - - - - Previous - - Previous - Previous - - - false - - - - light_window-new - &New Window - - New Window - New Window - - - false - - - - - Close - - Close - Close - - - false - - - - configure - &Configure Krita... - - Configure Krita - Configure Krita - - - false - - - - - Clones &Array... - - Clones Array - Clones Array - - - false - - - - - Select from Color Range... - - Select from Color Range - Select from Color Range - - - false - - - - - Select Opaque - - Select Opaque - Select Opaque - - - false - - - - - &Convert Image Color Space... - - Convert Image Color Space - Convert Image Color Space - - - false - - - - - &Convert Layer Color Space... - - Convert Layer Color Space - Convert Layer Color Space - - - false - - - - - Apply G'Mic Action... - - Apply G'Mic Action - Apply G'Mic Action - - - false - - - - - &Histogram... - - Histogram - Histogram - - - false - - - - - Scale To New Size... - - Scale To New Size - Scale To New Size - Ctrl+Alt+I - Ctrl+Alt+I - false - - - - - Size Canvas... - - Size Canvas - Size Canvas - Ctrl+Alt+C - Ctrl+Alt+C - false - - - - - Scale &Layer... - - Scale Layer - Scale Layer - - - false - - - - - &Scale... - - Scale - Scale - - - false - - - - - Image Split - - Image Split - Image Split - - - false - - - - - Split Layer... - - Split Layer - Split Layer - - - false - - - - - Grow Selection... - - Grow Selection - Grow Selection - - - false - - - - - Shrink Selection... - - Shrink Selection - Shrink Selection - - - false - - - - - Border Selection... - - Border Selection - Border Selection - - - false - - - - - Feather Selection... - - Feather Selection - Feather Selection - Shift+F6 - Shift+F6 - false - - - - - Smooth - - Smooth - Smooth - - - false - - - - - &Offset Image... - - Offset Image - Offset Image - - - false - - - - - &Offset Layer... - - Offset Layer - Offset Layer - - - false - - - - - Move into previous group - - Move into previous group - Move into previous group - - - false - - - - - Move into next group - - Move into next group - Move into next group - - - false - - - - - Import Resources or Bundles... - - Import Resources or Bundles - Import Resources or Bundles - - - false - - - - - Create Resource Bundle... - - Create Resource Bundle - Create Resource Bundle - - - false - - - - - Manage Resource Bundles... - - Manage Resource Bundles - Manage Resource Bundles - - - false - - - - - &Rotate Image... - - Rotate Image - Rotate Image - - - false - - - - object-rotate-right - Rotate Image 90° to the Right - - Rotate Image 90° to the Right - Rotate Image 90° to the Right - - - false - - - - - Rotate Image 180° - - Rotate Image 180° - Rotate Image 180° - - - false - - - - object-rotate-left - Rotate Image 90° to the Left - - Rotate Image 90° to the Left - Rotate Image 90° to the Left - - - false - - - - light_symmetry-horizontal - Mirror Image Horizontally - - Mirror Image Horizontally - Mirror Image Horizontally - - - false - - - - light_symmetry-vertical - Mirror Image Vertically - - Mirror Image Vertically - Mirror Image Vertically - - - false - - - - - &Rotate Layer... - - Rotate Layer - Rotate Layer - - - false - - - - - Rotate Layer 180° - - Rotate Layer 180° - Rotate Layer 180° - - - false - - - - object-rotate-right - Rotate Layer 90° to the Right - - Rotate Layer 90° to the Right - Rotate Layer 90° to the Right - - - false - - - - object-rotate-left - Rotate Layer 90° to the Left - - Rotate Layer 90° to the Left - Rotate Layer 90° to the Left - - - false - - - - - Separate Image... - - Separate Image - Separate Image - - - false - - - - - &Shear Image... - - Shear Image - Shear Image - - - false - - - - - &Shear Layer... - - Shear Layer - Shear Layer - - - false - - - - media-playback-start - Open and play... - - Open and play - Open and play - - - false - - - - document-edit - Open and edit... - - Open and edit - Open and edit - - - false - - - - media-record - Start recording macro - - Start recording macro - Start recording macro - - - false - - - - media-playback-stop - Stop recording actions - - Stop recording actions - Stop recording actions - - - false - - - - - &Edit metadata... - - Edit metadata - Edit metadata - - - false - - - - help-contents - Krita &Handbook - - Krita Handbook - Krita Handbook - F1 - F1 - false - - - - tools-report-bug - &Report Bug... - - Report Bug - Report Bug - - - false - - - - preferences-desktop-locale - Switch Application &Language... - - Switch Application Language - Switch Application Language - - - false - - - - calligrakrita - &About Krita - - About Krita - About Krita - - - false - - - - kde - About &KDE - - About KDE - About KDE - - - false - - - - - Show File Toolbar - - Show File Toolbar - Show File Toolbar - - - false - - - - - Hide Brushes and Stuff Toolbar - - Hide Brushes and Stuff Toolbar - Hide Brushes and Stuff Toolbar - - - true - - - - zoom-in - Zoom &In - - Zoom In - Zoom In - Ctrl++; Ctrl+= - Ctrl++; Ctrl+= - false - - - - zoom-out - Zoom &Out - - Zoom Out - Zoom Out - Ctrl+- - Ctrl+- - false - - - - - Dynamic Brush Tool - - Dynamic Brush Tool - Dynamic Brush Tool - - - false - - - - - Crop the image to an area - - Crop the image to an area - Crop the image to an area - C - C - false - - - - - Edit the perspective grid - - Edit the perspective grid - Edit the perspective grid - - - false - - - - - Polygon Tool. Shift-mouseclick ends the polygon. - - Polygon Tool. Shift-mouseclick ends the polygon. - Polygon Tool. Shift-mouseclick ends the polygon. - - - false - - - - - References - - References - References - - - false - - - - - Rectangle Tool - - Rectangle Tool - Rectangle Tool - - - false - - - - - Multibrush Tool - - Multibrush Tool - Multibrush Tool - Q - Q - false - - - - - Shape handling - - Shape handling - Shape handling - - - false - - - - - Select a color from the image or current layer - - Select a color from the image or current layer - Select a color from the image or current layer - P - P - false - - - - - Text editing - - Text editing - Text editing - - - false - - - - - Outline Selection Tool - - Outline Selection Tool - Outline Selection Tool - - - false - - - - - Artistic text editing - - Artistic text editing - Artistic text editing - - - false - - - - - Bezier Curve Selection Tool - - Bezier Curve Selection Tool - Bezier Curve Selection Tool - - - false - - - - - Similar Color Selection Tool - - Similar Color Selection Tool - Similar Color Selection Tool - - - false - - - - - Fill Tool - - Fill a contiguous area of color with a color, or fill a selection. - Fill a contiguous area of color with a color, or fill a selection. - F - F - false - - - - - Line Tool - - Line Tool - Line Tool - - - false - - - - - Freehand Path Tool - - Freehand Path Tool - Freehand Path Tool - - - false - - - - - Bezier Curve Tool. Shift-mouseclick ends the curve. - - Bezier Curve Tool. Shift-mouseclick ends the curve. - Bezier Curve Tool. Shift-mouseclick ends the curve. - - - false - - - - - Ellipse Tool - - Ellipse Tool - Ellipse Tool - - - false - - - - - Freehand Brush Tool - - Freehand Brush Tool - Freehand Brush Tool - B - B - false - - - - - Create object - - Create object - Create object - - - false - - - - - Elliptical Selection Tool - - Elliptical Selection Tool - Elliptical Selection Tool - J - J - false - - - - - Contiguous Selection Tool - - Contiguous Selection Tool - Contiguous Selection Tool - - - false - - - - - Pattern editing - - Pattern editing - Pattern editing - - - false - - - - - Review - - Review - Review - - - false - - - - - Draw a gradient. - - Draw a gradient. - Draw a gradient. - G - G - false - - - - - Edit the grid - - Edit the grid - Edit the grid - - - false - - - - - Polygonal Selection Tool - - Polygonal Selection Tool - Polygonal Selection Tool - - - false - - - - - Measure the distance between two points - - Measure the distance between two points - Measure the distance between two points - - - false - - - - - Rectangular Selection Tool - - Rectangular Selection Tool - Rectangular Selection Tool - Ctrl+R - Ctrl+R - false - - - - - Move a layer - - Move a layer - Move a layer - T - T - false - - - - - Vector Image (EMF/WMF/SVM/SVG) tool - - Vector Image (EMF/WMF/SVM/SVG) tool - Vector Image (EMF/WMF/SVM/SVG) tool - - - false - - - - - Calligraphy - - Calligraphy - Calligraphy - - - false - - - - - Path editing - - Path editing - Path editing - - - false - - - - - Polyline Tool. Shift-mouseclick ends the polyline. - - Polyline Tool. Shift-mouseclick ends the polyline. - Polyline Tool. Shift-mouseclick ends the polyline. - - - false - - - - - Transform a layer or a selection - - Transform a layer or a selection - Transform a layer or a selection - Ctrl+T - Ctrl+T - false - - - - - Ruler assistant editor tool - - Ruler assistant editor tool - Ruler assistant editor tool - - - false - - - - - Text tool - - Text tool - Text tool - - - false - - - - - Gradient editing - - Gradient editing - Gradient editing - - - false - - - - - Brush Selection Tool - - Brush Selection Tool - Brush Selection Tool - - - false - - - - - Reset Foreground and Background Color - - Reset Foreground and Background Color - Reset Foreground and Background Color - D - D - false - - - - - Swap Foreground and Background Color - - Swap Foreground and Background Color - Swap Foreground and Background Color - X - X - false - - - - - Brush Smoothing: Weighted - - Brush Smoothing: Weighted - Brush Smoothing: Weighted - - - false - - - - - Brush Smoothing: Disabled - - Brush Smoothing: Disabled - Brush Smoothing: Disabled - - - false - - - - - Brush Smoothing: Stabilizer - - Brush Smoothing: Stabilizer - Brush Smoothing: Stabilizer - - - false - - - - - Decrease Brush Size - - Decrease Brush Size - Decrease Brush Size - [ - [ - false - - - - - Brush Smoothing: Basic - - Brush Smoothing: Basic - Brush Smoothing: Basic - - - false - - - - - Increase Brush Size - - Increase Brush Size - Increase Brush Size - ] - ] - false - - - - - Show color selector - - Show color selector - Show color selector - Shift+I - Shift+I - false - - - - - Show MyPaint shade selector - - Show MyPaint shade selector - Show MyPaint shade selector - Shift+M - Shift+M - false - - - - - Show minimal shade selector - - Show minimal shade selector - Show minimal shade selector - Shift+N - Shift+N - false - - - - - Show color history - - Show color history - Show color history - H - H - false - - - - - Show common colors - - Show common colors - Show common colors - U - U - false - - - - - Toggle Assistant - - Toggle Assistant - ToggleAssistant - Ctrl+Shift+L - Ctrl+Shift+L - true - - - - - Undo Polygon Selection Points - - Undo Polygon Selection Points - Undo Polygon Selection Points - Shift+Z - Shift+Z - false - - - - - Previous frame - - Move to previous frame - - - - false - - - - - Next frame - - Move to next frame - - - - false - - - - - Play / pause animation - - Play / pause animation - - - - false - - - - - Add blank frame - - Add blank frame - - - - false - - - - - Add duplicate frame - - Add duplicate frame - - - - false - - - - - Delete keyframe - - - Delete keyframe - - - false - - - - - Toggle onion skin - - - - - - false - - - - - Previous Keyframe - - - - - - false - - - - - Next Keyframe - - - - - - false - - - - - First Frame - - - - - - false - - - - - Last Frame - - - - - - false - - - - - Auto Frame Mode - - - - - - true - - - - show_tool_options - Show Tool Options - - Show Tool Options - Show Tool Options - - - false - - - - show_tool_options - Show Brush Editor - - Show Brush Editor - Show Brush Editor - i - - false - - - - show_tool_options - Show Brush Presets - - Show Brush Presets - Show Brush Presets - - - false - - - + + + Krita + + + Open Resources Folder + Opens a file browser at the location Krita saves resources such as brushes to. + Opens a file browser at the location Krita saves resources such as brushes to. + Open Resources Folder + 0 + 0 + + + false + + + + + Cleanup removed files... + + Cleanup removed files + Cleanup removed files + 0 + 0 + + + false + + + + + Paste at cursor + + Paste at cursor + Paste at cursor + 0 + 0 + + + false + + + + + &Invert Selection + + foo + Invert Selection + 10000000000 + 100 + Ctrl+Shift+I + Ctrl+Shift+I + false + + + + + Fill with Foreground Color (Opacity) + + Fill with Foreground Color (Opacity) + Fill with Foreground Color (Opacity) + 10000 + 1 + Ctrl+Shift+Backspace + Ctrl+Shift+Backspace + false + + + + + Fill with Background Color (Opacity) + + Fill with Background Color (Opacity) + Fill with Background Color (Opacity) + 10000 + 1 + Ctrl+Backspace + Ctrl+Backspace + false + + + + + Fill with Pattern (Opacity) + + Fill with Pattern (Opacity) + Fill with Pattern (Opacity) + 10000 + 1 + + + false + + + + + &Toggle Selection Display Mode + + Toggle Selection Display Mode + Toggle Selection Display Mode + 0 + 0 + + + false + + + + + Rename current layer + + Rename current layer + Rename current layer + 100000 + 0 + F2 + F2 + false + + + + + Activate next layer + + Activate next layer + Activate next layer + 100000 + 0 + PgUp + PgUp + false + + + + + Activate previous layer + + Activate previous layer + Activate previous layer + 100000 + 0 + PgDown + PgDown + false + + + + folder-new + &Group Layer + + Group Layer + Group Layer + 1000 + 0 + + + false + + + + edit-copy + &Clone Layer + + Clone Layer + Clone Layer + 1000 + 0 + + + false + + + + bookmark-new + &Vector Layer + + Vector Layer + Vector Layer + 1000 + 0 + + + false + + + + view-filter + &Filter Layer... + + Filter Layer + Filter Layer + 1000 + 0 + + + false + + + + krita_tool_color_fill + &Fill Layer... + + Fill Layer + Fill Layer + 1000 + 0 + + + false + + + + document-open + &File Layer... + + File Layer + File Layer + 1000 + 0 + + + false + + + + edit-copy + &Transparency Mask + + Transparency Mask + Transparency Mask + 100000 + 0 + + + false + + + + bookmarks + &Filter Mask... + + Filter Mask + Filter Mask + 100000 + 0 + + + false + + + + bookmarks + &Transform Mask... + + Transform Mask + Transform Mask + 100000 + 0 + + + false + + + + edit-paste + &Local Selection + + Local Selection + Local Selection + 100000 + 0 + + + false + + + + view-filter + &Isolate Layer + + Isolate Layer + Isolate Layer + 1000 + 0 + + + false + + + + + Make brush color lighter + + Make brush color lighter + Make brush color lighter + 0 + 0 + L + L + false + + + + + Make brush color darker + + Make brush color darker + Make brush color darker + 0 + 0 + K + K + false + + + + + Increase opacity + + Increase opacity + Increase opacity + 0 + 0 + O + O + false + + + + + Decrease opacity + + Decrease opacity + Decrease opacity + 0 + 0 + I + I + false + + + + eraser-toggle + Save Incremental &Version + + Save Incremental Version + Save Incremental Version + 1 + 0 + Ctrl+Alt+S + Ctrl+Alt+S + false + + + + reload_preset + Reload Original Preset + + Reload Original Preset + Reload Original Preset + + + false + + + + transparency-unlocked + Preserve Alpha + + Preserve Alpha + Preserve Alpha + + + false + + + + light_symmetry-horizontal + Set horizontal mirror mode + + Set horizontal mirror mode + Set horizontal mirror mode + + + false + + + + light_symmetry-vertical + Set vertical mirror mode + + Set vertical mirror mode + Set vertical mirror mode + + + false + + + + + Brush option slider 3 + + Brush option slider 3 + Brush option slider 3 + + + false + + + + + Next Favourite Preset + + Next Favourite Preset + Next Favourite Preset + , + , + false + + + + + Previous Favourite Preset + + Previous Favourite Preset + Previous Favourite Preset + . + . + false + + + + + Switch to Previous Preset + + Switch to Previous Preset + Switch to Previous Preset + / + / + false + + + + + C&ascade + + Cascade + Cascade + 10 + 0 + + + false + + + + + &Tile + + Tile + Tile + 10 + 0 + + + false + + + + + N&ext + + Next + Next + 10 + 0 + + + false + + + + + Previous + + Previous + Previous + + + false + + + + light_window-new + &New Window + + New Window + New Window + 0 + 0 + + + false + + + + + Move into previous group + + Move into previous group + Move into previous group + 0 + 0 + + + false + + + + + Move into next group + + Move into next group + Move into next group + 0 + 0 + + + false + + + + + Import Resources or Bundles... + + Import Resources or Bundles + Import Resources or Bundles + 0 + 0 + + + false + + + + + Create Resource Bundle... + + Create Resource Bundle + Create Resource Bundle + 0 + 0 + + + false + + + + + Show File Toolbar + + Show File Toolbar + Show File Toolbar + + + false + + + + + Hide Brushes and Stuff Toolbar + + Hide Brushes and Stuff Toolbar + Hide Brushes and Stuff Toolbar + + + true + + + + zoom-in + Zoom &In + + Zoom In + Zoom In + Ctrl++; Ctrl+= + Ctrl++; Ctrl+= + false + + + + zoom-out + Zoom &Out + + Zoom Out + Zoom Out + Ctrl+- + Ctrl+- + false + + + + + Reset Foreground and Background Color + + Reset Foreground and Background Color + Reset Foreground and Background Color + D + D + false + + + + + Swap Foreground and Background Color + + Swap Foreground and Background Color + Swap Foreground and Background Color + X + X + false + + + + + Brush Smoothing: Weighted + + Brush Smoothing: Weighted + Brush Smoothing: Weighted + + + false + + + + + Brush Smoothing: Disabled + + Brush Smoothing: Disabled + Brush Smoothing: Disabled + + + false + + + + + Brush Smoothing: Stabilizer + + Brush Smoothing: Stabilizer + Brush Smoothing: Stabilizer + + + false + + + + + Decrease Brush Size + + Decrease Brush Size + Decrease Brush Size + 0 + 0 + + + false + + + + + Brush Smoothing: Basic + + Brush Smoothing: Basic + Brush Smoothing: Basic + + + false + + + + + Increase Brush Size + + Increase Brush Size + Increase Brush Size + 0 + 0 + + + false + + + + + Show color selector + + Show color selector + Show color selector + Shift+I + Shift+I + false + + + + + Show MyPaint shade selector + + Show MyPaint shade selector + Show MyPaint shade selector + Shift+M + Shift+M + false + + + + + Show minimal shade selector + + Show minimal shade selector + Show minimal shade selector + Shift+N + Shift+N + false + + + + + Show color history + + Show color history + Show color history + H + H + false + + + + + Show common colors + + Show common colors + Show common colors + U + U + false + + + + + Toggle Assistant + + Toggle Assistant + ToggleAssistant + Ctrl+Shift+L + Ctrl+Shift+L + true + + + + + Undo Polygon Selection Points + + Undo Polygon Selection Points + Undo Polygon Selection Points + Shift+Z + Shift+Z + false + + + + + Move to previous frame + + Move to previous frame + Move to previous frame + 1 + 0 + + + false + + + + + Move to next frame + + Move to next frame + Move to next frame + 1 + 0 + + + false + + + + + Play / pause animation + + Play / pause animation + Play / pause animation + 1 + 0 + + + false + + + + + Add blank frame + + Add blank frame + Add blank frame + 100000 + 0 + + + false + + + + + Add duplicate frame + + Add duplicate frame + Add duplicate frame + 100000 + 0 + + + false + + + + show_tool_options + Show Tool Options + + Show Tool Options + Show Tool Options + + + false + + + + show_tool_options + Show Brush Editor + + Show Brush Editor + Show Brush Editor + i + + false + + + + show_tool_options + Show Brush Presets + + Show Brush Presets + Show Brush Presets + + + false + + + + + Toggle Tablet Debugger + + Toggle Tablet Debugger + Toggle Tablet Debugger + 0 + 0 + Ctrl+Shift+T + Ctrl+Shift+T + false + + + + + + Filters + + + &Color to Alpha... + + Color to Alpha + Color to Alpha + 10000 + 0 + + + false + + + + + &Top Edge Detection + + Top Edge Detection + Top Edge Detection + 10000 + 0 + + + false + + + + + &Index Colors... + + Index Colors + Index Colors + 10000 + 0 + + + false + + + + + Emboss Horizontal &Only + + Emboss Horizontal Only + Emboss Horizontal Only + 10000 + 0 + + + false + + + + + D&odge + + Dodge + Dodge + 10000 + 0 + + + false + + + + + &Sharpen + + Sharpen + Sharpen + 10000 + 0 + + + false + + + + + B&urn + + Burn + Burn + 10000 + 0 + + + false + + + + + &Mean Removal + + Mean Removal + Mean Removal + 10000 + 0 + + + false + + + + + &Gaussian Blur... + + Gaussian Blur + Gaussian Blur + 10000 + 0 + + + false + + + + + Emboss &in All Directions + + Emboss in All Directions + Emboss in All Directions + 10000 + 0 + + + false + + + + + &Small Tiles... + + Small Tiles + Small Tiles + 10000 + 0 + + + false + + + + + &Levels... + + Levels + Levels + 10000 + 0 + Ctrl+L + Ctrl+L + false + + + + + &Sobel... + + Sobel + Sobel + 10000 + 0 + + + false + + + + + &Wave... + + Wave + Wave + 10000 + 0 + + + false + + + + + &Motion Blur... + + Motion Blur + Motion Blur + 10000 + 0 + + + false + + + + + &Color Adjustment curves... + + Color Adjustment curves + Color Adjustment curves + 10000 + 0 + Ctrl+M + Ctrl+M + false + + + + + Pi&xelize... + + Pixelize + Pixelize + 10000 + 0 + + + false + + + + + Emboss (&Laplacian) + + Emboss (Laplacian) + Emboss (Laplacian) + 10000 + 0 + + + false + + + + + &Left Edge Detection + + Left Edge Detection + Left Edge Detection + 10000 + 0 + + + false + + + + + &Blur... + + Blur + Blur + 10000 + 0 + + + false + + + + + &Raindrops... + + Raindrops + Raindrops + 10000 + 0 + + + false + + + + + &Bottom Edge Detection + + Bottom Edge Detection + Bottom Edge Detection + 10000 + 0 + + + false + + + + + &Random Noise... + + Random Noise + Random Noise + 10000 + 0 + + + false + + + + + &Brightness/Contrast curve... + + Brightness/Contrast curve + Brightness/Contrast curve + 10000 + 0 + + + false + + + + + Colo&r Balance.. + + Color Balance.. + Color Balance.. + 10000 + 0 + Ctrl+B + Ctrl+B + false + + + + + &PhongBumpmap... + + PhongBumpmap + PhongBumpmap + 10000 + 0 + + + false + + + + + &Desaturate + + Desaturate + Desaturate + 10000 + 0 + Ctrl+Shift+U + Ctrl+Shift+U + false + + + + + Color &Transfer... + + Color Transfer + Color Transfer + 10000 + 0 + + + false + + + + + Emboss &Vertical Only + + Emboss Vertical Only + Emboss Vertical Only + 10000 + 0 + + + false + + + + + &Lens Blur... + + Lens Blur + Lens Blur + 10000 + 0 + + + false + + + + + M&inimize Channel + + Minimize Channel + Minimize Channel + 10000 + 0 + + + false + + + + + M&aximize Channel + + Maximize Channel + Maximize Channel + 10000 + 0 + + + false + + + + + &Oilpaint... + + Oilpaint + Oilpaint + 10000 + 0 + + + false + + + + + &Right Edge Detection + + Right Edge Detection + Right Edge Detection + 10000 + 0 + + + false + + + + + &Auto Contrast + + Auto Contrast + Auto Contrast + 10000 + 0 + + + false + + + + + &Round Corners... + + Round Corners + Round Corners + 10000 + 0 + + + false + + + + + &Unsharp Mask... + + Unsharp Mask + Unsharp Mask + 10000 + 0 + + + false + + + + + &Emboss with Variable Depth... + + Emboss with Variable Depth + Emboss with Variable Depth + 10000 + 0 + + + false + + + + + Emboss &Horizontal && Vertical + + Emboss Horizontal & Vertical + Emboss Horizontal & Vertical + 10000 + 0 + + + false + + + + + Random &Pick... + + Random Pick + Random Pick + 10000 + 0 + + + false + + + + + &Gaussian Noise Reduction... + + Gaussian Noise Reduction + Gaussian Noise Reduction + 10000 + 0 + + + false + + + + + &Posterize... + + Posterize + Posterize + 10000 + 0 + + + false + + + + + &Wavelet Noise Reducer... + + Wavelet Noise Reducer + Wavelet Noise Reducer + 10000 + 0 + + + false + + + + + &HSV Adjustment... + + HSV Adjustment + HSV Adjustment + 10000 + 0 + Ctrl+U + Ctrl+U + false + + + + + + Tool Shortcuts + + + Dynamic Brush Tool + + Dynamic Brush Tool + Dynamic Brush Tool + + + false + + + + + Crop Tool + + Crop the image to an area + Crop the image to an area + C + C + false + + + + + Perspective Grid + + Edit the perspective grid + Edit the perspective grid + + + false + + + + + Polygon Tool + + Polygon Tool. Shift-mouseclick ends the polygon. + Polygon Tool. Shift-mouseclick ends the polygon. + + + false + + + + + References + + References + References + + + false + + + + + Rectangle Tool + + Rectangle Tool + Rectangle Tool + + + false + + + + + Multibrush Tool + + Multibrush Tool + Multibrush Tool + Q + Q + false + + + + + Shape Manipulation Tool + + Shape Manipulation Tool + Shape Manipulation Tool + + + false + + + + + Color Picker + + Select a color from the image or current layer + Select a color from the image or current layer + P + P + false + + + + + Text Editing Tool + + Text editing + Text editing + + + false + + + + + Outline Selection Tool + + Outline Selection Tool + Outline Selection Tool + + + false + + + + + Artistic Text Tool + + Artistic text editing + Artistic text editing + + + false + + + + + Bezier Curve Selection Tool + + Select a + Bezier Curve Selection Tool + + + false + + + + + Similar Color Selection Tool + + Select a + Similar Color Selection Tool + + + false + + + + + Fill Tool + + Fill a contiguous area of color with a color, or fill a selection. + Fill a contiguous area of color with a color, or fill a selection. + F + F + false + + + + + Line Tool + + Line Tool + Line Tool + + + false + + + + + Freehand Path Tool + + Freehand Path Tool + Freehand Path Tool + + + false + + + + + Bezier Curve Tool. Shift-mouseclick ends the curve. + + Bezier Curve Tool. Shift-mouseclick ends the curve. + Bezier Curve Tool. Shift-mouseclick ends the curve. + + + false + + + + + Ellipse Tool + + Ellipse Tool + Ellipse Tool + + + false + + + + + Freehand Brush Tool + + Freehand Brush Tool + Freehand Brush Tool + B + B + false + + + + + Create object + + Create object + Create object + + + false + + + + + Elliptical Selection Tool + + Elliptical Selection Tool + Elliptical Selection Tool + J + J + false + + + + + Contiguous Selection Tool + + Contiguous Selection Tool + Contiguous Selection Tool + + + false + + + + + Pattern editing + + Pattern editing + Pattern editing + + + false + + + + + Review + + Review + Review + + + false + + + + + Draw a gradient. + + Draw a gradient. + Draw a gradient. + G + G + false + + + + + Edit the grid + + Edit the grid + Edit the grid + + + false + + + + + Polygonal Selection Tool + + Polygonal Selection Tool + Polygonal Selection Tool + + + false + + + + + Measure the distance between two points + + Measure the distance between two points + Measure the distance between two points + + + false + + + + + Rectangular Selection Tool + + Rectangular Selection Tool + Rectangular Selection Tool + Ctrl+R + Ctrl+R + false + + + + + Move a layer + + Move a layer + Move a layer + T + T + false + + + + + Vector Image (EMF/WMF/SVM/SVG) tool + + Vector Image (EMF/WMF/SVM/SVG) tool + Vector Image (EMF/WMF/SVM/SVG) tool + + + false + + + + + Calligraphy + + Calligraphy + Calligraphy + + + false + + + + + Path editing + + Path editing + Path editing + + + false + + + + + Polyline Tool. Shift-mouseclick ends the polyline. + + Polyline Tool. Shift-mouseclick ends the polyline. + Polyline Tool. Shift-mouseclick ends the polyline. + + + false + + + + + Transform a layer or a selection + + Transform a layer or a selection + Transform a layer or a selection + Ctrl+T + Ctrl+T + false + + + + + Ruler assistant editor tool + + Ruler assistant editor tool + Ruler assistant editor tool + + + false + + + + + Text tool + + Text tool + Text tool + + + false + + + + + Gradient editing + + Gradient editing + Gradient editing + + + false + + + + + Brush Selection Tool + + Brush Selection Tool + Brush Selection Tool + + + false + + + + + + Blending Modes + + + Next Blending Mode + + Next Blending Mode + Next Blending Mode + Alt+Shift++ + Alt+Shift++ + false + + + + + Previous Blending Mode + + Previous Blending Mode + Previous Blending Mode + Alt+Shift+- + Alt+Shift+- + false + + + + + Select Normal Blending Mode + + Select Normal Blending Mode + Select Normal Blending Mode + 0 + 0 + Alt+Shift+N + Alt+Shift+N + false + + + + + Select Dissolve Blending Mode + + Select Dissolve Blending Mode + Select Dissolve Blending Mode + 0 + 0 + Alt+Shift+I + Alt+Shift+I + false + + + + + Select Behind Blending Mode + + Select Behind Blending Mode + Select Behind Blending Mode + 0 + 0 + Alt+Shift+Q + Alt+Shift+Q + false + + + + + Select Clear Blending Mode + + Select Clear Blending Mode + Select Clear Blending Mode + 0 + 0 + Alt+Shift+R + Alt+Shift+R + false + + + + + Select Darken Blending Mode + + Select Darken Blending Mode + Select Darken Blending Mode + 0 + 0 + Alt+Shift+K + Alt+Shift+K + false + + + + + Select Multiply Blending Mode + + Select Multiply Blending Mode + Select Multiply Blending Mode + 0 + 0 + Alt+Shift+M + Alt+Shift+M + false + + + + + Select Color Burn Blending Mode + + Select Color Burn Blending Mode + Select Color Burn Blending Mode + 0 + 0 + Alt+Shift+B + Alt+Shift+B + false + + + + + Select Linear Burn Blending Mode + + Select Linear Burn Blending Mode + Select Linear Burn Blending Mode + 0 + 0 + Alt+Shift+A + Alt+Shift+A + false + + + + + Select Lighten Blending Mode + + Select Lighten Blending Mode + Select Lighten Blending Mode + 0 + 0 + Alt+Shift+G + Alt+Shift+G + false + + + + + Select Screen Blending Mode + + Select Screen Blending Mode + Select Screen Blending Mode + 0 + 0 + Alt+Shift+S + Alt+Shift+S + false + + + + + Select Color Dodge Blending Mode + + Select Color Dodge Blending Mode + Select Color Dodge Blending Mode + 0 + 0 + Alt+Shift+D + Alt+Shift+D + false + + + + + Select Linear Dodge Blending Mode + + Select Linear Dodge Blending Mode + Select Linear Dodge Blending Mode + 0 + 0 + Alt+Shift+W + Alt+Shift+W + false + + + + + Select Overlay Blending Mode + + Select Overlay Blending Mode + Select Overlay Blending Mode + 0 + 0 + Alt+Shift+O + Alt+Shift+O + false + + + + + Select Soft Light Blending Mode + + Select Soft Light Blending Mode + Select Soft Light Blending Mode + 0 + 0 + Alt+Shift+F + Alt+Shift+F + false + + + + + Select Hard Light Blending Mode + + Select Hard Light Blending Mode + Select Hard Light Blending Mode + 0 + 0 + Alt+Shift+H + Alt+Shift+H + false + + + + + Select Vivid Light Blending Mode + + Select Vivid Light Blending Mode + Select Vivid Light Blending Mode + 0 + 0 + Alt+Shift+V + Alt+Shift+V + false + + + + + Select Linear Light Blending Mode + + Select Linear Light Blending Mode + Select Linear Light Blending Mode + 0 + 0 + Alt+Shift+J + Alt+Shift+J + false + + + + + Select Pin Light Blending Mode + + Select Pin Light Blending Mode + Select Pin Light Blending Mode + 0 + 0 + Alt+Shift+Z + Alt+Shift+Z + false + + + + + Select Hard Mix Blending Mode + + Select Hard Mix Blending Mode + Select Hard Mix Blending Mode + 0 + 0 + Alt+Shift+L + Alt+Shift+L + false + + + + + Select Difference Blending Mode + + Select Difference Blending Mode + Select Difference Blending Mode + 0 + 0 + Alt+Shift+E + Alt+Shift+E + false + + + + + Select Exclusion Blending Mode + + Select Exclusion Blending Mode + Select Exclusion Blending Mode + 0 + 0 + Alt+Shift+X + Alt+Shift+X + false + + + + + Select Hue Blending Mode + + Select Hue Blending Mode + Select Hue Blending Mode + 0 + 0 + Alt+Shift+U + Alt+Shift+U + false + + + + + Select Saturation Blending Mode + + Select Saturation Blending Mode + Select Saturation Blending Mode + 0 + 0 + Alt+Shift+T + Alt+Shift+T + false + + + + + Select Color Blending Mode + + Select Color Blending Mode + Select Color Blending Mode + 0 + 0 + Alt+Shift+C + Alt+Shift+C + false + + + + + Select Luminosity Blending Mode + + Select Luminosity Blending Mode + Select Luminosity Blending Mode + 0 + 0 + Alt+Shift+Y + Alt+Shift+Y + false + + + + + + Animation + + + Previous frame + + Move to previous frame + Move to previous frame + 1 + 0 + + + false + + + + + Next frame + + Move to next frame + Move to next frame + 1 + 0 + + + false + + + + + Play / pause animation + + Play / pause animation + Play / pause animation + 1 + 0 + + + false + + + + + Add blank frame + + Add blank frame + Add blank frame + 100000 + 0 + + + false + + + + + Add duplicate frame + + Add duplicate frame + Add duplicate frame + 100000 + 0 + + + false + + + + + Toggle onion skin + + Toggle onion skin + Toggle onion skin + 100000 + 0 + + + false + + + + + Previous Keyframe + + + + + + false + + + + + Next Keyframe + + + + + + false + + + + + First Frame + + + + + + false + + + + + Last Frame + + + + + + false + + + + + Auto Frame Mode + + + + + + true + + + + + + Unknown + + + Rename Composition... + + Rename Composition + Rename Composition + 0 + 0 + + + false + + + + + Fill with Foreground Color (Opacity) + + Fill with Foreground Color (Opacity) + Fill with Foreground Color (Opacity) + 10000 + 1 + Ctrl+Shift+Backspace + Ctrl+Shift+Backspace + false + + + + + Fill with Background Color (Opacity) + + Fill with Background Color (Opacity) + Fill with Background Color (Opacity) + 10000 + 1 + Ctrl+Backspace + Ctrl+Backspace + false + + + + + Fill with Pattern (Opacity) + + Fill with Pattern (Opacity) + Fill with Pattern (Opacity) + 10000 + 1 + + + false + + + + + Convert &to Shape + + Convert to Shape + Convert to Shape + 10000000000 + 0 + + + false + + + + + &Remove Layer + + Remove Layer + Remove Layer + 1000 + 1 + + + false + + + + + Move Layer Left + + Move Layer Left + Move Layer Left + 1000 + 1 + + + false + + + + + Move Layer Right + + Move Layer Right + Move Layer Right + 1000 + 1 + + + false + + + + + &Properties... + + Properties + Properties + 1000 + 1 + + + false + + + + + &Select Opaque + + Select Opaque + Select Opaque + 100000 + 100 + + + false + + + + + &Show Global Selection Mask + + Shows global selection as a usual selection mask in <interface>Layers</interface> docker + Show Global Selection Mask + 0 + 0 + + + false + + + + diff --git a/krita/krita.rc b/krita/krita.rc --- a/krita/krita.rc +++ b/krita/krita.rc @@ -14,7 +14,6 @@ - @@ -45,8 +44,6 @@ - - @@ -72,13 +69,11 @@ - - - + + @@ -242,7 +237,7 @@ - + @@ -272,12 +267,12 @@ - - + + - - - + + + diff --git a/krita/kritamenu.action b/krita/kritamenu.action new file mode 100644 --- /dev/null +++ b/krita/kritamenu.action @@ -0,0 +1,2096 @@ + + + + File + + light_document-new + &New + + Create new document + New + 0 + 0 + Ctrl+N + Ctrl+N + false + + + + document-open + &Open... + + Open an existing document + Open + 0 + 0 + Ctrl+O + Ctrl+O + false + + + + document-open-recent + Save Incremental &Backup + + Save Incremental Backup + Save Incremental Backup + 1 + 0 + F4 + F4 + false + + + + document-save + + Save as .krita-6301-document_0-autosave.kra + Save + 1 + 0 + Ctrl+S + Ctrl+S + false + + + + document-save-as + Save &As... + + Save document under a new name + Save As + 1 + 0 + Ctrl+Shift+S + Ctrl+Shift+S + false + + + + + Save Incremental &Backup + + Save Incremental Backup + Save Incremental Backup + 1 + 0 + F4 + F4 + false + + + + document-import + Open ex&isting Document as Untitled Document... + + Open existing Document as Untitled Document + Open existing Document as Untitled Document + 0 + 0 + + + false + + + + document-export + E&xport... + + Export + Export + 1 + 0 + + + false + + + + application-pdf + &Export as PDF... + + Export as PDF + Export as PDF + 1 + 0 + + + false + + + + + Expor&t animation... + + Export animation + Export animation + 1 + 0 + + + false + + + + + Save Incremental &Version + + Save Incremental Version + Save Incremental Version + 1 + 0 + Ctrl+Alt+S + Ctrl+Alt+S + false + + + + + Save Incremental &Backup + + Save Incremental Backup + Save Incremental Backup + 1 + 0 + F4 + F4 + false + + + + + &Create Template From Image... + + Create Template From Image + Create Template From Image + 1 + 0 + + + false + + + + + Create Copy &From Current Image + + Create Copy From Current Image + Create Copy From Current Image + 1 + 0 + + + false + + + + document-print + &Print... + + Print document + Print + 1 + 0 + Ctrl+P + Ctrl+P + false + + + + document-print-preview + Print Previe&w + + Show a print preview of document + Print Preview + 1 + 0 + + + false + + + + document-properties + &Document Information + + Document Information + Document Information + 1 + 0 + + + false + + + + + &Close All + + Close All + Close All + 1 + 0 + Ctrl+Shift+W + Ctrl+Shift+W + false + + + + + C&lose + + Close + Close + 1 + 0 + + + false + + + + + &Quit + + Quit application + Quit + 0 + 0 + Ctrl+Q + Ctrl+Q + false + + + + + + Edit + + light_edit-undo + Undo + + Undo last action + Undo + 1 + 0 + Ctrl+Z + Ctrl+Z + false + + + + light_edit-redo + Redo + + Redo last undone action + Redo + 1 + 0 + Ctrl+Shift+Z + Ctrl+Shift+Z + false + + + + edit-cut + Cu&t + + Cut selection to clipboard + Cut + 0 + 0 + Ctrl+X + Ctrl+X + false + + + + edit-copy + &Copy + + Copy selection to clipboard + Copy + 0 + 0 + Ctrl+C + Ctrl+C + false + + + + + C&opy (sharp) + + Copy (sharp) + Copy (sharp) + 100000000 + 0 + + + false + + + + + Cut (&sharp) + + Cut (sharp) + Cut (sharp) + 100000000 + 0 + + + false + + + + + Copy &merged + + Copy merged + Copy merged + 100000000 + 0 + Ctrl+Shift+C + Ctrl+Shift+C + false + + + + edit-paste + &Paste + + Paste clipboard content + Paste + 0 + 0 + Ctrl+V + Ctrl+V + false + + + + + Paste into &New Image + + Paste into New Image + Paste into New Image + 0 + 0 + Ctrl+Shift+N + Ctrl+Shift+N + false + + + + edit-clear + C&lear + + Clear + Clear + 1 + 0 + Del + Del + false + + + + + &Fill with Foreground Color + + Fill with Foreground Color + Fill with Foreground Color + 10000 + 1 + Shift+Backspace + Shift+Backspace + false + + + + + Fill &with Background Color + + Fill with Background Color + Fill with Background Color + 10000 + 1 + Backspace + Backspace + false + + + + + F&ill with Pattern + + Fill with Pattern + Fill with Pattern + 10000 + 1 + + + false + + + + + Stro&ke selected shapes + + Stroke selected shapes + Stroke selected shapes + 1000000000 + 0 + + + false + + + + + Delete keyframe + + Delete keyframe + Delete keyframe + 100000 + 0 + + + false + + + + + + View + + + &Show Canvas Only + + Shows just the canvas or the whole window + Show Canvas Only + 0 + 0 + Tab + Tab + false + + + + view-fullscreen + F&ull Screen Mode + + Display the window in full screen + Full Screen Mode + 0 + 0 + Ctrl+Shift+F + Ctrl+Shift+F + false + + + + + &Wrap Around Mode + + Wrap Around Mode + Wrap Around Mode + 1 + 0 + W + W + false + + + + + &Fast Preview Mode (LOD) + + Fast Preview Mode (LOD) + Fast Preview Mode (LOD) + 1 + 0 + Shift+L + Shift+L + true + + + + + Mirror View + + Mirror View + Mirror View + M + M + false + + + + + &Reset zoom + + Reset zoom + Reset zoom + 1 + 0 + Ctrl+0 + Ctrl+0 + false + + + + + Zoom &In + + Zoom In + Zoom In + 0 + 0 + Ctrl++ + Ctrl++ + false + + + + + Zoom &Out + + Zoom Out + Zoom Out + 0 + 0 + Ctrl+- + Ctrl+- + false + + + + + Rotate &Canvas Right + + Rotate Canvas Right + Rotate Canvas Right + 1 + 0 + Ctrl+] + Ctrl+] + false + + + + + Rotate Canvas &Left + + Rotate Canvas Left + Rotate Canvas Left + 1 + 0 + Ctrl+[ + Ctrl+[ + false + + + + + Show &Rulers + The rulers show the horizontal and vertical positions of the mouse on the image and can be used to position your mouse at the right place on the canvas. <p>Uncheck this to hide the rulers.</p> + Show Rulers + Show Rulers + 1 + 0 + + + false + + + + + Show Guides + + Shows or hides guides + Show Guides + 1 + 0 + + + false + + + + + Show Status &Bar + + Shows or hides the status bar + Show Status Bar + 1 + 0 + + + true + + + + view-grid + Show &Grid + + Show Grid + Show Grid + 1000 + 0 + Ctrl+Shift+' + Ctrl+Shift+' + false + + + + + Snap To Grid + + Snap To Grid + Snap To Grid + Ctrl+Shift+; + Ctrl+Shift+; + false + + + + + Show Perspective Grid + + Show Perspective Grid + Show Perspective Grid + + + true + + + + + Clear Perspective Grid + + Clear Perspective Grid + Clear Perspective Grid + + + false + + + + + S&how Painting Assistants + + Show Painting Assistants + Show Painting Assistants + 1000 + 0 + + + true + + + + + Show &Assistant Previews + + Show Assistant Previews + Show Assistant Previews + 1000 + 0 + + + true + + + + + + Image + + document-properties + &Properties... + + Properties + Properties + 1000 + 0 + + + false + + + + format-stroke-color + &Image Background Color and Transparency... + + Change the background color of the image + Image Background Color and Transparency + 1000 + 0 + + + false + + + + + &Convert Image Color Space... + + Convert Image Color Space + Convert Image Color Space + 1000 + 0 + + + false + + + + light_trim-to-image + &Trim to Image Size + + Trim to Image Size + Trim to Image Size + 1 + 0 + + + false + + + + + Trim to Current &Layer + + Trim to Current Layer + Trim to Current Layer + 100000 + 0 + + + false + + + + + Trim to Selection + + Trim to Selection + Trim to Selection + 100000000 + 0 + + + false + + + + + &Rotate Image... + + Rotate Image + Rotate Image + 1000 + 0 + + + false + + + + object-rotate-right + Rotate &Image 90° to the Right + + Rotate Image 90° to the Right + Rotate Image 90° to the Right + 1000 + 0 + + + false + + + + object-rotate-left + Rotate Image &90° to the Right + + Rotate Image 90° to the Right + Rotate Image 90° to the Right + 1000 + 0 + + + false + + + + + Rotate Image &180° + + Rotate Image 180° + Rotate Image 180° + 1000 + 0 + + + false + + + + + &Shear Image... + + Shear Image + Shear Image + 1000 + 0 + + + false + + + + light_symmetry-horizontal + &Mirror Image Horizontally + + Mirror Image Horizontally + Mirror Image Horizontally + 1000 + 0 + + + false + + + + light_symmetry-vertical + Mirror Image &Vertically + + Mirror Image Vertically + Mirror Image Vertically + 1000 + 0 + + + false + + + + + Scale Image To &New Size... + + Scale Image To New Size + Scale Image To New Size + 1000 + 0 + Ctrl+Alt+I + Ctrl+Alt+I + false + + + + + &Offset Image... + + Offset Image + Offset Image + 1000 + 0 + + + false + + + + + R&esize Canvas... + + Resize Canvas + Resize Canvas + 1000 + 0 + Ctrl+Alt+C + Ctrl+Alt+C + false + + + + + Im&age Split + + Image Split + Image Split + 1000 + 0 + + + false + + + + + Separate Ima&ge... + + Separate Image + Separate Image + 1000 + 0 + + + false + + + + + + Layer + + light_document-new + &Paint Layer + + Paint Layer + Paint Layer + 1000 + 0 + + + false + + + + edit-copy + &Duplicate Layer or Mask + + Duplicate Layer or Mask + Duplicate Layer or Mask + 1000 + 0 + Ctrl+J + Ctrl+J + false + + + + + &Cut Selection to New Layer + + Cut Selection to New Layer + Cut Selection to New Layer + 100000000 + 1 + Ctrl+Shift+J + Ctrl+Shift+J + false + + + + + Copy &Selection to New Layer + + Copy Selection to New Layer + Copy Selection to New Layer + 100000000 + 0 + Ctrl+Alt+J + Ctrl+Alt+J + false + + + + document-save + &Save Layer/Mask... + + Save Layer/Mask + Save Layer/Mask + 1000 + 0 + + + false + + + + document-save + Save &Group Layers... + + Save Group Layers + Save Group Layers + 100000 + 0 + + + false + + + + + I&mport Layer... + + Import Layer + Import Layer + 100000 + 0 + + + false + + + + document-new + &as Paint Layer... + + as Paint Layer + as Paint Layer + 1000 + 0 + + + false + + + + edit-copy + as &Transparency Mask... + + as Transparency Mask + as Transparency Mask + 1000 + 0 + + + false + + + + bookmarks + as &Filter Mask... + + as Filter Mask + as Filter Mask + 1000 + 0 + + + false + + + + edit-paste + as &Selection Mask... + + as Selection Mask + as Selection Mask + 1000 + 0 + + + false + + + + document-new + to &Paint Layer + + to Paint Layer + to Paint Layer + 1000 + 0 + + + false + + + + edit-copy + to &Transparency Mask + + to Transparency Mask + to Transparency Mask + 1000 + 0 + + + false + + + + bookmarks + to &Filter Mask... + + to Filter Mask + to Filter Mask + 1000 + 0 + + + false + + + + edit-paste + to &Selection Mask + + to Selection Mask + to Selection Mask + 1000 + 0 + + + false + + + + edit-copy + &Alpha into Mask + + Alpha into Mask + Alpha into Mask + 100000 + 10 + + + false + + + + transparency-enabled + &Write as Alpha + + Write as Alpha + Write as Alpha + 1000000 + 1 + + + false + + + + document-save + &Save Merged... + + Save Merged + Save Merged + 1000000 + 0 + + + false + + + + + Split Layer... + + Split Layer + Split Layer + 1000 + 0 + + + false + + + + light_symmetry-horizontal + Mirror Layer Hori&zontally + + Mirror Layer Horizontally + Mirror Layer Horizontally + 1000 + 1 + + + false + + + + light_symmetry-vertical + Mirror Layer &Vertically + + Mirror Layer Vertically + Mirror Layer Vertically + 1000 + 1 + + + false + + + + + &Rotate Layer... + + Rotate Layer + Rotate Layer + 100000 + 1 + + + false + + + + object-rotate-right + Rotate &Layer 90° to the Right + + Rotate Layer 90° to the Right + Rotate Layer 90° to the Right + 100000 + 1 + + + false + + + + object-rotate-left + Rotate Layer &90° to the Left + + Rotate Layer 90° to the Left + Rotate Layer 90° to the Left + 100000 + 1 + + + false + + + + + Rotate Layer &180° + + Rotate Layer 180° + Rotate Layer 180° + 100000 + 1 + + + false + + + + + Scale &Layer to new Size... + + Scale Layer to new Size + Scale Layer to new Size + 100000 + 1 + + + false + + + + + &Shear Layer... + + Shear Layer + Shear Layer + 100000 + 1 + + + false + + + + + &Offset Layer... + + Offset Layer + Offset Layer + 100000 + 1 + + + false + + + + + Clones &Array... + + Clones Array + Clones Array + 100000 + 0 + + + false + + + + + &Edit metadata... + + Edit metadata + Edit metadata + 100000 + 1 + + + false + + + + + &Histogram... + + Histogram + Histogram + 100000 + 0 + + + false + + + + + &Convert Layer Color Space... + + Convert Layer Color Space + Convert Layer Color Space + 100000 + 1 + + + false + + + + + &Merge with Layer Below + + Merge with Layer Below + Merge with Layer Below + 100000 + 0 + Ctrl+E + Ctrl+E + false + + + + + &Flatten Layer + + Flatten Layer + Flatten Layer + 100000 + 0 + + + false + + + + + Ras&terize Layer + + Rasterize Layer + Rasterize Layer + 10000000 + 1 + + + false + + + + + Flatten ima&ge + + Flatten image + Flatten image + 100000 + 0 + Ctrl+Shift+E + Ctrl+Shift+E + false + + + + + &Merge Selected Layers + + Merge Selected Layers + Merge Selected Layers + Ctrl+Alt+E + Ctrl+Alt+E + false + + + + + La&yer Style... + + Layer Style + Layer Style + 100000 + 1 + + + false + + + + + + Select + + edit-select-all + Select &All + + Select All + Select All + 0 + 0 + Ctrl+A + Ctrl+A + false + + + + edit-select-all + &Deselect + + Deselect + Deselect + 1100000000 + 0 + Ctrl+Shift+A + Ctrl+Shift+A + false + + + + + &Reselect + + Reselect + Reselect + 0 + 0 + Ctrl+Shift+D + Ctrl+Shift+D + false + + + + + &Invert + + Invert + Invert + 10000 + 0 + Ctrl+I + Ctrl+I + false + + + + + &Convert to Vector Selection + + Convert to Vector Selection + Convert to Vector Selection + 10000000000 + 0 + + + false + + + + + Convert Shapes to &Vector Selection + + Convert Shapes to Vector Selection + Convert Shapes to Vector Selection + 1000000000 + 0 + + + false + + + + + &Feather Selection... + + Feather Selection + Feather Selection + 10000000000 + 100 + Shift+F6 + Shift+F6 + false + + + + + Dis&play Selection + + Display Selection + Display Selection + 1000 + 0 + Ctrl+H + Ctrl+H + true + + + + + Sca&le... + + Scale + Scale + 100000000 + 100 + + + false + + + + + S&elect from Color Range... + + Select from Color Range + Select from Color Range + 10000 + 100 + + + false + + + + + Select &Opaque + + Select Opaque + Select Opaque + 10000 + 100 + + + false + + + + + &Grow Selection... + + Grow Selection + Grow Selection + 10000000000 + 100 + + + false + + + + + S&hrink Selection... + + Shrink Selection + Shrink Selection + 10000000000 + 100 + + + false + + + + + &Border Selection... + + Border Selection + Border Selection + 10000000000 + 100 + + + false + + + + + S&mooth + + Smooth + Smooth + 10000000000 + 100 + + + false + + + + + + Filter + + + &Apply Filter Again + + Apply Filter Again + Apply Filter Again + 0 + 0 + Ctrl+F + Ctrl+F + false + + + + + Adjust + + Adjust + Adjust + + + false + + + + + Artistic + + Artistic + Artistic + + + false + + + + + Blur + + Blur + Blur + + + false + + + + + Colors + + Colors + Colors + + Ctrl+F + false + + + + + Edge Detection + + Edge Detection + Edge Detection + + + false + + + + + Enhance + + Enhance + Enhance + + + false + + + + + Emboss + + Emboss + Emboss + + + false + + + + + Map + + Map + Map + + + false + + + + + Other + + Other + Other + + + false + + + + + Apply G'Mic Action... + + Apply G'Mic Action + Apply G'Mic Action + + + false + + + + + + Tools + + media-record + &Start recording macro + + Start recording macro + Start recording macro + 1000 + 0 + + + false + + + + media-playback-stop + Stop &recording actions + + Stop recording actions + Stop recording actions + 1000 + 0 + + + false + + + + media-playback-start + &Open and play... + + Open and play + Open and play + 0 + 0 + + + false + + + + document-edit + Open &and edit... + + Open and edit + Open and edit + 0 + 0 + + + false + + + + light_configure + Configure Tool&bars... + + Configure Toolbars + Configure Toolbars + 0 + 0 + + + false + + + + + &Show Dockers + + Show Dockers + Show Dockers + 0 + 0 + + + true + + + + + Sho&w Docker Titlebars + + Show Docker Titlebars + Show Docker Titlebars + 0 + 0 + + + true + + + + + Dockers + + Dockers + Dockers + + + false + + + + + &Themes + + Themes + Themes + + + false + + + + configure-shortcuts + Configure S&hortcuts... + + Configure Shortcuts + Configure Shortcuts + 0 + 0 + + + false + + + + configure + &Configure Krita... + + Configure Krita + Configure Krita + 0 + 0 + + + false + + + + + &Manage Resources... + + Manage Resources + Manage Resources + 0 + 0 + + + false + + + + preferences-desktop-locale + Switch Application &Language... + + Switch Application Language + Switch Application Language + + + false + + + + + &Window + + Window + Window + + + false + + + + + + Help + + help-contents + Krita &Handbook + + Krita Handbook + Krita Handbook + F1 + F1 + false + + + + tools-report-bug + &Report Bug... + + Report Bug + Report Bug + + + false + + + + calligrakrita + &About Krita + + About Krita + About Krita + + + false + + + + kde + About &KDE + + About KDE + About KDE + + + false + + + + + + Brushes and Stuff + + + &Gradients + + Gradients + Gradients + + + false + + + + + &Patterns + + Patterns + Patterns + + + false + + + + + &Color + + Color + Color + + + false + + + + + &Painter's Tools + + Painter's Tools + Painter's Tools + + + false + + + + + Brush composite + + Brush composite + Brush composite + + + false + + + + + Brush option slider 1 + + Brush option slider 1 + Brush option slider 1 + + + false + + + + + Brush option slider 2 + + Brush option slider 2 + Brush option slider 2 + + + false + + + + + Mirror + + Mirror + Mirror + + + false + + + + + Workspaces + + Workspaces + Workspaces + + + false + + + + diff --git a/krita/plugins/assistants/RulerAssistant/KisRulerAssistantTool.action b/krita/plugins/assistants/RulerAssistant/KisRulerAssistantTool.action --- a/krita/plugins/assistants/RulerAssistant/KisRulerAssistantTool.action +++ b/krita/plugins/assistants/RulerAssistant/KisRulerAssistantTool.action @@ -1,25 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - + + + Ruler Assistant Tool + + diff --git a/krita/plugins/extensions/colorspaceconversion/colorspaceconversion.cc b/krita/plugins/extensions/colorspaceconversion/colorspaceconversion.cc --- a/krita/plugins/extensions/colorspaceconversion/colorspaceconversion.cc +++ b/krita/plugins/extensions/colorspaceconversion/colorspaceconversion.cc @@ -47,22 +47,21 @@ #include #include "dlg_colorspaceconversion.h" +#include "kis_action_manager.h" K_PLUGIN_FACTORY_WITH_JSON(ColorSpaceConversionFactory, "kritacolorspaceconversion.json", registerPlugin();) ColorSpaceConversion::ColorSpaceConversion(QObject *parent, const QVariantList &) : KisViewPlugin(parent) -{ - KisAction *action = new KisAction(i18n("&Convert Image Color Space..."), this); +{ + KisAction *action = m_view->actionManager()->createAction("imagecolorspaceconversion"); action->setActivationFlags(KisAction::ACTIVE_NODE); - addAction("imagecolorspaceconversion", action); connect(action, SIGNAL(triggered()), this, SLOT(slotImageColorSpaceConversion())); - action = new KisAction(i18n("&Convert Layer Color Space..."), this); + action = m_view->actionManager()->createAction("layercolorspaceconversion"); action->setActivationFlags(KisAction::ACTIVE_LAYER); action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - addAction("layercolorspaceconversion", action); connect(action, SIGNAL(triggered()), this, SLOT(slotLayerColorSpaceConversion())); } diff --git a/krita/plugins/extensions/dockers/advancedcolorselector/kis_color_selector_container.cpp b/krita/plugins/extensions/dockers/advancedcolorselector/kis_color_selector_container.cpp --- a/krita/plugins/extensions/dockers/advancedcolorselector/kis_color_selector_container.cpp +++ b/krita/plugins/extensions/dockers/advancedcolorselector/kis_color_selector_container.cpp @@ -39,15 +39,14 @@ #include "kis_node.h" #include "kis_paint_device.h" +#include "kis_action_registry.h" + KisColorSelectorContainer::KisColorSelectorContainer(QWidget *parent) : QWidget(parent), m_colorSelector(new KisColorSelector(this)), m_myPaintShadeSelector(new KisMyPaintShadeSelector(this)), m_minimalShadeSelector(new KisMinimalShadeSelector(this)), m_shadeSelector(m_myPaintShadeSelector), - m_colorSelAction(0), - m_mypaintAction(0), - m_minimalAction(0), m_canvas(0) { m_widgetLayout = new QBoxLayout(QBoxLayout::TopToBottom, this); @@ -69,19 +68,15 @@ connect(this, SIGNAL(settingsChanged()), m_minimalShadeSelector, SLOT(updateSettings())); - m_colorSelAction = new QAction("Show color selector", this); - m_colorSelAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_I)); + m_colorSelAction = KisActionRegistry::instance()->makeQAction("show_color_selector", this); connect(m_colorSelAction, SIGNAL(triggered()), m_colorSelector, SLOT(showPopup()), Qt::UniqueConnection); - m_mypaintAction = new QAction("Show MyPaint shade selector", this); - m_mypaintAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_M)); + m_mypaintAction = KisActionRegistry::instance()->makeQAction("show_mypaint_shade_selector", this); connect(m_mypaintAction, SIGNAL(triggered()), m_myPaintShadeSelector, SLOT(showPopup()), Qt::UniqueConnection); - m_minimalAction = new QAction("Show minimal shade selector", this); - m_minimalAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_N)); + m_minimalAction = KisActionRegistry::instance()->makeQAction("show_minimal_shade_selector", this); connect(m_minimalAction, SIGNAL(triggered()), m_minimalShadeSelector, SLOT(showPopup()), Qt::UniqueConnection); - } void KisColorSelectorContainer::unsetCanvas() diff --git a/krita/plugins/extensions/dockers/advancedcolorselector/kis_color_selector_ng_docker_widget.cpp b/krita/plugins/extensions/dockers/advancedcolorselector/kis_color_selector_ng_docker_widget.cpp --- a/krita/plugins/extensions/dockers/advancedcolorselector/kis_color_selector_ng_docker_widget.cpp +++ b/krita/plugins/extensions/dockers/advancedcolorselector/kis_color_selector_ng_docker_widget.cpp @@ -95,13 +95,13 @@ m_colorHistoryAction = new QAction("Show color history", this); m_colorHistoryAction->setShortcut(QKeySequence(tr("H"))); - // m_colorHistoryAction = KisActionRegistry::instance()->makeQAction("show_color_history", this, "Color Selector"); + // m_colorHistoryAction = KisActionRegistry::instance()->makeQAction("show_color_history", this); connect(m_colorHistoryAction, SIGNAL(triggered()), m_colorHistoryWidget, SLOT(showPopup()), Qt::UniqueConnection); m_commonColorsAction = new QAction("Show common colors", this); m_commonColorsAction->setShortcut(QKeySequence(tr("U"))); - // m_colorHistoryAction = KisActionRegistry::instance()->makeQAction("show_common_colors", this, "Color Selector"); + // m_colorHistoryAction = KisActionRegistry::instance()->makeQAction("show_common_colors", this); connect(m_commonColorsAction, SIGNAL(triggered()), m_commonColorsWidget, SLOT(showPopup()), Qt::UniqueConnection); } diff --git a/krita/plugins/extensions/imagesize/imagesize.cc b/krita/plugins/extensions/imagesize/imagesize.cc --- a/krita/plugins/extensions/imagesize/imagesize.cc +++ b/krita/plugins/extensions/imagesize/imagesize.cc @@ -41,34 +41,29 @@ #include "dlg_layersize.h" #include "kis_filter_strategy.h" #include "kis_action.h" +#include "kis_action_manager.h" K_PLUGIN_FACTORY_WITH_JSON(ImageSizeFactory, "kritaimagesize.json", registerPlugin();) ImageSize::ImageSize(QObject *parent, const QVariantList &) : KisViewPlugin(parent) { - KisAction *action = new KisAction(i18n("Scale Image To New Size..."), this); + KisAction *action = createAction("imagesize"); action->setActivationFlags(KisAction::ACTIVE_NODE); - addAction("imagesize", action); - action->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_I)); connect(action, SIGNAL(triggered()), this, SLOT(slotImageSize())); - action = new KisAction(i18n("Resize Canvas..."), this); + action = createAction("canvassize"); action->setActivationFlags(KisAction::ACTIVE_NODE); - addAction("canvassize", action); - action->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_C)); connect(action, SIGNAL(triggered()), this, SLOT(slotCanvasSize())); - action = new KisAction(i18n("Scale &Layer to new Size..."), this); + action = createAction("layersize"); action->setActivationFlags(KisAction::ACTIVE_LAYER); action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - addAction("layersize", action); connect(action, SIGNAL(triggered()), this, SLOT(slotLayerSize())); - action = new KisAction(i18n("&Scale..."), this); + action = createAction("selectionscale"); action->setActivationFlags(KisAction::PIXELS_SELECTED); action->setActivationConditions(KisAction::SELECTION_EDITABLE); - addAction("selectionscale", action); Q_CHECK_PTR(action); connect(action, SIGNAL(triggered()), this, SLOT(slotSelectionScale())); } diff --git a/krita/plugins/extensions/imagesplit/imagesplit.cpp b/krita/plugins/extensions/imagesplit/imagesplit.cpp --- a/krita/plugins/extensions/imagesplit/imagesplit.cpp +++ b/krita/plugins/extensions/imagesplit/imagesplit.cpp @@ -53,9 +53,8 @@ Imagesplit::Imagesplit(QObject *parent, const QVariantList &) : KisViewPlugin(parent) { - KisAction *action = new KisAction(i18n("Image Split "), this); + KisAction *action = createAction("imagesplit"); action->setActivationFlags(KisAction::ACTIVE_NODE); - addAction("imagesplit", action); connect(action, SIGNAL(triggered()), this, SLOT(slotImagesplit())); } diff --git a/krita/plugins/extensions/metadataeditor/metadataeditor.cc b/krita/plugins/extensions/metadataeditor/metadataeditor.cc --- a/krita/plugins/extensions/metadataeditor/metadataeditor.cc +++ b/krita/plugins/extensions/metadataeditor/metadataeditor.cc @@ -49,10 +49,9 @@ metadataeditorPlugin::metadataeditorPlugin(QObject *parent, const QVariantList &) : KisViewPlugin(parent) { - KisAction *action = new KisAction(i18n("&Edit metadata..."), this); + KisAction *action = createAction("EditLayerMetaData"); action->setActivationFlags(KisAction::ACTIVE_LAYER); action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - addAction("EditLayerMetaData", action); connect(action, SIGNAL(triggered()), this, SLOT(slotEditLayerMetaData())); } diff --git a/krita/plugins/extensions/modify_selection/modify_selection.cc b/krita/plugins/extensions/modify_selection/modify_selection.cc --- a/krita/plugins/extensions/modify_selection/modify_selection.cc +++ b/krita/plugins/extensions/modify_selection/modify_selection.cc @@ -38,48 +38,42 @@ ModifySelection::ModifySelection(QObject *parent, const QVariantList &) : KisViewPlugin(parent) { - KisAction* action = new KisAction(i18n("Grow Selection..."), this); + KisAction* action = createAction("growselection"); action->setActivationFlags(KisAction::PIXEL_SELECTION_WITH_PIXELS); action->setActivationConditions(KisAction::SELECTION_EDITABLE); action->setOperationID("growselection"); - addAction("growselection", action); addUIFactory(new KisOperationUIWidgetFactory("growselection")); addOperation(new GrowSelectionOperation); - action = new KisAction(i18n("Shrink Selection..."), this); + action = createAction("shrinkselection"); action->setActivationFlags(KisAction::PIXEL_SELECTION_WITH_PIXELS); action->setActivationConditions(KisAction::SELECTION_EDITABLE); action->setOperationID("shrinkselection"); - addAction("shrinkselection", action); addUIFactory(new KisOperationUIWidgetFactory("shrinkselection")); addOperation(new ShrinkSelectionOperation); - action = new KisAction(i18n("Border Selection..."), this); + action = createAction("borderselection"); action->setActivationFlags(KisAction::PIXEL_SELECTION_WITH_PIXELS); action->setActivationConditions(KisAction::SELECTION_EDITABLE); action->setOperationID("borderselection"); - addAction("borderselection", action); addUIFactory(new KisOperationUIWidgetFactory("borderselection")); addOperation(new BorderSelectionOperation); - action = new KisAction(i18n("Feather Selection..."), this); + action = createAction("featherselection"); action->setActivationFlags(KisAction::PIXEL_SELECTION_WITH_PIXELS); action->setActivationConditions(KisAction::SELECTION_EDITABLE); action->setOperationID("featherselection"); - addAction("featherselection", action); - action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F6)); addUIFactory(new KisOperationUIWidgetFactory("featherselection")); addOperation(new FeatherSelectionOperation); - action = new KisAction(i18nc("Verb for a selection modification action", "Smooth"), this); + action = createAction("smoothselection"); action->setActivationFlags(KisAction::PIXEL_SELECTION_WITH_PIXELS); action->setActivationConditions(KisAction::SELECTION_EDITABLE); action->setOperationID("smoothselection"); - addAction("smoothselection", action); addOperation(new SmoothSelectionOperation); } diff --git a/krita/plugins/extensions/offsetimage/offsetimage.cpp b/krita/plugins/extensions/offsetimage/offsetimage.cpp --- a/krita/plugins/extensions/offsetimage/offsetimage.cpp +++ b/krita/plugins/extensions/offsetimage/offsetimage.cpp @@ -44,15 +44,13 @@ OffsetImage::OffsetImage(QObject *parent, const QVariantList &) : KisViewPlugin(parent) { - KisAction *action = new KisAction(i18n("&Offset Image..."), this); + KisAction *action = createAction("offsetimage"); action->setActivationFlags(KisAction::ACTIVE_NODE); - addAction("offsetimage", action); connect(action, SIGNAL(triggered()), this, SLOT(slotOffsetImage())); - action = new KisAction(i18n("&Offset Layer..."), this); + action = createAction("offsetlayer"); action->setActivationFlags(KisAction::ACTIVE_LAYER); action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - addAction("offsetlayer", action); connect(action, SIGNAL(triggered()), this, SLOT(slotOffsetLayer())); } diff --git a/krita/plugins/tools/defaulttools/KisToolPath.action b/krita/plugins/tools/defaulttools/KisToolPath.action --- a/krita/plugins/tools/defaulttools/KisToolPath.action +++ b/krita/plugins/tools/defaulttools/KisToolPath.action @@ -1,47 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - - Decrease Brush Size - [ - Decrease Brush Size - - - - false - Decrease Brush Size - [ - - - Increase Brush Size - ] - Increase Brush Size - - - - false - Increase Brush Size - ] - - + + + Path Tool + + diff --git a/krita/plugins/tools/defaulttools/KisToolPencil.action b/krita/plugins/tools/defaulttools/KisToolPencil.action --- a/krita/plugins/tools/defaulttools/KisToolPencil.action +++ b/krita/plugins/tools/defaulttools/KisToolPencil.action @@ -1,47 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - - Decrease Brush Size - [ - Decrease Brush Size - - - - false - Decrease Brush Size - [ - - - Increase Brush Size - ] - Increase Brush Size - - - - false - Increase Brush Size - ] - - + + + Pencil Tool + + diff --git a/krita/plugins/tools/selectiontools/KisToolSelectContiguous.action b/krita/plugins/tools/selectiontools/KisToolSelectContiguous.action --- a/krita/plugins/tools/selectiontools/KisToolSelectContiguous.action +++ b/krita/plugins/tools/selectiontools/KisToolSelectContiguous.action @@ -1,25 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - + + + Contiguous Selection Tool + + diff --git a/krita/plugins/tools/selectiontools/KisToolSelectElliptical.action b/krita/plugins/tools/selectiontools/KisToolSelectElliptical.action --- a/krita/plugins/tools/selectiontools/KisToolSelectElliptical.action +++ b/krita/plugins/tools/selectiontools/KisToolSelectElliptical.action @@ -1,47 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - - Decrease Brush Size - [ - Decrease Brush Size - - - - false - Decrease Brush Size - [ - - - Increase Brush Size - ] - Increase Brush Size - - - - false - Increase Brush Size - ] - - + + + Elliptical Selection Tool + + diff --git a/krita/plugins/tools/selectiontools/KisToolSelectOutline.action b/krita/plugins/tools/selectiontools/KisToolSelectOutline.action --- a/krita/plugins/tools/selectiontools/KisToolSelectOutline.action +++ b/krita/plugins/tools/selectiontools/KisToolSelectOutline.action @@ -1,25 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - + + + Outline Selection Tool + + diff --git a/krita/plugins/tools/selectiontools/KisToolSelectPath.action b/krita/plugins/tools/selectiontools/KisToolSelectPath.action --- a/krita/plugins/tools/selectiontools/KisToolSelectPath.action +++ b/krita/plugins/tools/selectiontools/KisToolSelectPath.action @@ -1,25 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - + + + Path Selection Tool + + diff --git a/krita/plugins/tools/selectiontools/KisToolSelectPolygonal.action b/krita/plugins/tools/selectiontools/KisToolSelectPolygonal.action --- a/krita/plugins/tools/selectiontools/KisToolSelectPolygonal.action +++ b/krita/plugins/tools/selectiontools/KisToolSelectPolygonal.action @@ -1,47 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - - Decrease Brush Size - [ - Decrease Brush Size - - - - false - Decrease Brush Size - [ - - - Increase Brush Size - ] - Increase Brush Size - - - - false - Increase Brush Size - ] - - + + + Polygonal Selection Tool + + diff --git a/krita/plugins/tools/selectiontools/KisToolSelectRectangular.action b/krita/plugins/tools/selectiontools/KisToolSelectRectangular.action --- a/krita/plugins/tools/selectiontools/KisToolSelectRectangular.action +++ b/krita/plugins/tools/selectiontools/KisToolSelectRectangular.action @@ -1,47 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - - Decrease Brush Size - [ - Decrease Brush Size - - - - false - Decrease Brush Size - [ - - - Increase Brush Size - ] - Increase Brush Size - - - - false - Increase Brush Size - ] - - + + + Rectangular Selection Tool + + diff --git a/krita/plugins/tools/selectiontools/KisToolSelectSimilar.action b/krita/plugins/tools/selectiontools/KisToolSelectSimilar.action --- a/krita/plugins/tools/selectiontools/KisToolSelectSimilar.action +++ b/krita/plugins/tools/selectiontools/KisToolSelectSimilar.action @@ -1,25 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - + + + Similar Selection Tool + + diff --git a/krita/plugins/tools/tool_crop/KisToolCrop.action b/krita/plugins/tools/tool_crop/KisToolCrop.action --- a/krita/plugins/tools/tool_crop/KisToolCrop.action +++ b/krita/plugins/tools/tool_crop/KisToolCrop.action @@ -1,25 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - + + + Crop Tool + + diff --git a/krita/plugins/tools/tool_grid/KisToolGrid.action b/krita/plugins/tools/tool_grid/KisToolGrid.action --- a/krita/plugins/tools/tool_grid/KisToolGrid.action +++ b/krita/plugins/tools/tool_grid/KisToolGrid.action @@ -1,25 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - + + + Grid Tool + + diff --git a/krita/plugins/tools/tool_perspectivegrid/KisToolPerspectiveGrid.action b/krita/plugins/tools/tool_perspectivegrid/KisToolPerspectiveGrid.action --- a/krita/plugins/tools/tool_perspectivegrid/KisToolPerspectiveGrid.action +++ b/krita/plugins/tools/tool_perspectivegrid/KisToolPerspectiveGrid.action @@ -1,25 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - + + + Perspective Grid Tool + + diff --git a/krita/plugins/tools/tool_polygon/KisToolPolygon.action b/krita/plugins/tools/tool_polygon/KisToolPolygon.action --- a/krita/plugins/tools/tool_polygon/KisToolPolygon.action +++ b/krita/plugins/tools/tool_polygon/KisToolPolygon.action @@ -1,47 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - - Decrease Brush Size - [ - Decrease Brush Size - - - - false - Decrease Brush Size - [ - - - Increase Brush Size - ] - Increase Brush Size - - - - false - Increase Brush Size - ] - - + + + Polygon Tool + + diff --git a/krita/plugins/tools/tool_polyline/KisToolPolyline.action b/krita/plugins/tools/tool_polyline/KisToolPolyline.action --- a/krita/plugins/tools/tool_polyline/KisToolPolyline.action +++ b/krita/plugins/tools/tool_polyline/KisToolPolyline.action @@ -1,47 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - - Decrease Brush Size - [ - Decrease Brush Size - - - - false - Decrease Brush Size - [ - - - Increase Brush Size - ] - Increase Brush Size - - - - false - Increase Brush Size - ] - - + + + Polyline Tool + + diff --git a/krita/plugins/tools/tool_transform2/KisToolTransform.action b/krita/plugins/tools/tool_transform2/KisToolTransform.action --- a/krita/plugins/tools/tool_transform2/KisToolTransform.action +++ b/krita/plugins/tools/tool_transform2/KisToolTransform.action @@ -1,25 +1,6 @@ - - - Reset Foreground and Background Color - D - Reset Foreground and Background Color - - - - false - Reset Foreground and Background Color - D - - - Swap Foreground and Background Color - X - Swap Foreground and Background Color - - - - false - Swap Foreground and Background Color - X - - + + + Transform Tool + + diff --git a/krita/ui/KisApplication.cpp b/krita/ui/KisApplication.cpp --- a/krita/ui/KisApplication.cpp +++ b/krita/ui/KisApplication.cpp @@ -76,6 +76,7 @@ #include "kisexiv2/kis_exiv2.h" #include "KisApplicationArguments.h" #include +#include "kis_action_registry.h" #ifdef HAVE_OPENGL #include "opengl/kis_opengl.h" @@ -397,6 +398,7 @@ KisFilterRegistry::instance(); KisGeneratorRegistry::instance(); KisPaintOpRegistry::instance(); + KisActionRegistry::instance(); // Load the krita-specific tools KoPluginLoader::instance()->load(QString::fromLatin1("Krita/Tool"), diff --git a/krita/ui/KisMainWindow.cpp b/krita/ui/KisMainWindow.cpp --- a/krita/ui/KisMainWindow.cpp +++ b/krita/ui/KisMainWindow.cpp @@ -351,7 +351,10 @@ setAutoSaveSettings("krita", false); - KoPluginLoader::instance()->load("Krita/ViewPlugin", "Type == 'Service' and ([X-Krita-Version] == 28)", KoPluginLoader::PluginsConfig(), viewManager()); + KoPluginLoader::instance()->load("Krita/ViewPlugin", + "Type == 'Service' and ([X-Krita-Version] == 28)", + KoPluginLoader::PluginsConfig(), + viewManager()); subWindowActivated(); updateWindowMenu(); @@ -2080,99 +2083,79 @@ d->redo = actionManager->createStandardAction(KStandardAction::Redo, this, SLOT(redo())); d->redo->setActivationFlags(KisAction::ACTIVE_IMAGE); - d->exportPdf = new KisAction(i18nc("@action:inmenu", "Export as PDF...")); + d->exportPdf = actionManager->createAction("file_export_pdf"); d->exportPdf->setActivationFlags(KisAction::ACTIVE_IMAGE); d->exportPdf->setIcon(KisIconUtils::loadIcon("application-pdf")); - actionManager->addAction("file_export_pdf", d->exportPdf); connect(d->exportPdf, SIGNAL(triggered()), this, SLOT(exportToPdf())); - d->exportAnimation = new KisAction(i18nc("@action:inmenu", "Export animation...")); + d->exportAnimation = actionManager->createAction("file_export_animation"); d->exportAnimation->setActivationFlags(KisAction::ACTIVE_IMAGE); - actionManager->addAction("file_export_animation", d->exportAnimation); connect(d->exportAnimation, SIGNAL(triggered()), this, SLOT(exportAnimation())); - d->closeAll = new KisAction(i18nc("@action:inmenu", "Close All")); + d->closeAll = actionManager->createAction("file_close_all"); d->closeAll->setActivationFlags(KisAction::ACTIVE_IMAGE); - d->closeAll->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_W)); - actionManager->addAction("file_close_all", d->closeAll); connect(d->closeAll, SIGNAL(triggered()), this, SLOT(slotFileCloseAll())); -// d->reloadFile = new KisAction(i18nc("@action:inmenu", "Reload")); +// d->reloadFile = actionManager->createAction("file_reload_file"); // d->reloadFile->setActivationFlags(KisAction::CURRENT_IMAGE_MODIFIED); -// actionManager->addAction("file_reload_file", d->reloadFile); // connect(d->reloadFile, SIGNAL(triggered(bool)), this, SLOT(slotReloadFile())); - d->importFile = new KisAction(KisIconUtils::loadIcon("document-import"), - i18nc("@action:inmenu", "Open ex&isting Document as Untitled Document...")); - actionManager->addAction("file_import_file", d->importFile); + d->importFile = actionManager->createAction("file_import_file"); connect(d->importFile, SIGNAL(triggered(bool)), this, SLOT(slotImportFile())); - d->exportFile = new KisAction(KisIconUtils::loadIcon("document-export"), i18nc("@action:inmenu", "E&xport...")); + d->exportFile = actionManager->createAction("file_export_file"); d->exportFile->setActivationFlags(KisAction::ACTIVE_IMAGE); - actionManager->addAction("file_export_file", d->exportFile); connect(d->exportFile, SIGNAL(triggered(bool)), this, SLOT(slotExportFile())); /* The following entry opens the document information dialog. Since the action is named so it intends to show data this entry should not have a trailing ellipses (...). */ - d->showDocumentInfo = new KisAction(KisIconUtils::loadIcon("configure"), - i18nc("@action:inmenu", "Document Information")); + d->showDocumentInfo = actionManager->createAction("file_documentinfo"); d->showDocumentInfo->setActivationFlags(KisAction::ACTIVE_IMAGE); - actionManager->addAction("file_documentinfo", d->showDocumentInfo); connect(d->showDocumentInfo, SIGNAL(triggered(bool)), this, SLOT(slotDocumentInfo())); d->themeManager->setThemeMenuAction(new KActionMenu(i18nc("@action:inmenu", "&Themes"), this)); d->themeManager->registerThemeActions(actionCollection()); connect(d->themeManager, SIGNAL(signalThemeChanged()), this, SLOT(slotThemeChanged())); - d->toggleDockers = new KisAction(i18nc("@action:inmenu", "Show Dockers")); - d->toggleDockers->setCheckable(true); + d->toggleDockers = actionManager->createAction("view_toggledockers"); d->toggleDockers->setChecked(true); - actionManager->addAction("view_toggledockers", d->toggleDockers); connect(d->toggleDockers, SIGNAL(toggled(bool)), SLOT(toggleDockersVisibility(bool))); - d->toggleDockerTitleBars = new KisAction(i18nc("@action:inmenu", "Show Docker Titlebars")); - d->toggleDockerTitleBars->setCheckable(true); + d->toggleDockerTitleBars = actionManager->createAction("view_toggledockertitlebars"); { KisConfig cfg; d->toggleDockerTitleBars->setChecked(cfg.showDockerTitleBars()); } - actionManager->addAction("view_toggledockertitlebars", d->toggleDockerTitleBars); connect(d->toggleDockerTitleBars, SIGNAL(toggled(bool)), SLOT(showDockerTitleBars(bool))); actionCollection()->addAction("settings_dockers_menu", d->dockWidgetMenu); actionCollection()->addAction("window", d->windowMenu); - d->mdiCascade = new KisAction(i18nc("@action:inmenu", "Cascade")); + d->mdiCascade = actionManager->createAction("windows_cascade"); d->mdiCascade->setActivationFlags(KisAction::MULTIPLE_IMAGES); - actionManager->addAction("windows_cascade", d->mdiCascade); connect(d->mdiCascade, SIGNAL(triggered()), d->mdiArea, SLOT(cascadeSubWindows())); - d->mdiTile = new KisAction(i18nc("@action:inmenu", "Tile")); + d->mdiTile = actionManager->createAction("windows_tile"); d->mdiTile->setActivationFlags(KisAction::MULTIPLE_IMAGES); - actionManager->addAction("windows_tile", d->mdiTile); connect(d->mdiTile, SIGNAL(triggered()), d->mdiArea, SLOT(tileSubWindows())); - d->mdiNextWindow = new KisAction(i18nc("@action:inmenu", "Next")); + d->mdiNextWindow = actionManager->createAction("windows_next"); d->mdiNextWindow->setActivationFlags(KisAction::MULTIPLE_IMAGES); - actionManager->addAction("windows_next", d->mdiNextWindow); connect(d->mdiNextWindow, SIGNAL(triggered()), d->mdiArea, SLOT(activateNextSubWindow())); - d->mdiPreviousWindow = new KisAction(i18nc("@action:inmenu", "Previous")); + d->mdiPreviousWindow = actionManager->createAction("windows_previous"); d->mdiPreviousWindow->setActivationFlags(KisAction::MULTIPLE_IMAGES); - actionCollection()->addAction("windows_previous", d->mdiPreviousWindow); connect(d->mdiPreviousWindow, SIGNAL(triggered()), d->mdiArea, SLOT(activatePreviousSubWindow())); - d->newWindow = new KisAction(KisIconUtils::loadIcon("window-new"), i18nc("@action:inmenu", "&New Window")); - actionManager->addAction("view_newwindow", d->newWindow); + d->newWindow = actionManager->createAction("view_newwindow"); connect(d->newWindow, SIGNAL(triggered(bool)), this, SLOT(newWindow())); - d->close = new KisAction(i18nc("@action:inmenu", "Close")); + d->close = actionManager->createAction("file_close"); d->close->setActivationFlags(KisAction::ACTIVE_IMAGE); connect(d->close, SIGNAL(triggered()), SLOT(closeCurrentWindow())); - actionManager->addAction("file_close", d->close); actionManager->createStandardAction(KStandardAction::Preferences, this, SLOT(slotPreferences())); diff --git a/krita/ui/KisPart.cpp b/krita/ui/KisPart.cpp --- a/krita/ui/KisPart.cpp +++ b/krita/ui/KisPart.cpp @@ -73,6 +73,7 @@ #include "kis_image.h" #include "KisImportExportManager.h" #include "KisDocumentEntry.h" +#include "KoToolManager.h" #include "kis_color_manager.h" #include "kis_debug.h" @@ -115,32 +116,18 @@ void loadActions(); }; +// Basically, we are going to insert the current UI/MainWindow ActionCollection +// into the KisActionRegistry. void KisPart::Private::loadActions() { - actionCollection = new KActionCollection(part, "krita"); - KisActionRegistry * actionRegistry = KisActionRegistry::instance(); - - QStringList actionNames = actionRegistry->allActions(); - actionCollection->readSettings(); // XXX: consider relocating & managing this - - - foreach (const QString &name, actionNames) { + actionCollection = part->currentMainwindow()->viewManager()->actionCollection(); - KisAction *a = new KisAction(); - actionRegistry->propertizeAction(name, a); - - if (!actionCollection->action(name)) { - actionCollection->addAction(name, a); - } - else { - dbgAction << "duplicate action" << name << a << "from" << actionCollection; - // delete a; - } + KisActionRegistry * actionRegistry = KisActionRegistry::instance(); + foreach (auto action, actionCollection->actions()) { + auto name = action->objectName(); + actionRegistry->addAction(action->objectName(), action); } - - - }; KisPart* KisPart::instance() @@ -430,27 +417,21 @@ void KisPart::configureShortcuts() { - if (!d->actionCollection) { - d->loadActions(); - } + d->loadActions(); - // In kdelibs4 a hack was used to hide the shortcut schemes widget in the - // normal shortcut editor KShortcutsDialog from kdelibs, by setting the - // bottom buttons oneself. This does not work anymore (as the buttons are - // no longer exposed), so for now running with a plain copy of the sources - // of KShortcutsDialog, where the schemes editor is disabled directly. - // Not nice, but then soon custom Krita-specific shortcut handling is - // planned anyway. + auto actionRegistry = KisActionRegistry::instance(); + actionRegistry->configureShortcuts(d->actionCollection); - // WidgetAction + WindowAction + ApplicationAction leaves only GlobalAction excluded + // Update the non-UI actions. That includes: + // - Shortcuts called inside of tools + // - Perhaps other things? + KoToolManager::instance()->updateToolShortcuts(); - KisActionRegistry::instance()->configureShortcuts(d->actionCollection); - - - // Now update the widget tooltips in the UI. + // Now update the UI actions. foreach(KisMainWindow *mainWindow, d->mainWindows) { KActionCollection *ac = mainWindow->actionCollection(); - ac->readSettings(); + + ac->updateShortcuts(); // Loop through mainWindow->actionCollections() to modify tooltips // so that they list shortcuts at the end in parentheses diff --git a/krita/ui/KisView.cpp b/krita/ui/KisView.cpp --- a/krita/ui/KisView.cpp +++ b/krita/ui/KisView.cpp @@ -311,7 +311,7 @@ connect(canvasController(), SIGNAL(toolOptionWidgetsChanged(QList >)), d->viewManager->mainWindow(), SLOT(newOptionWidgets(QList >))); KoToolManager::instance()->addController(&d->canvasController); - KoToolManager::instance()->registerTools(d->actionCollection, &d->canvasController); + KoToolManager::instance()->registerToolActions(d->actionCollection, &d->canvasController); dynamic_cast(d->document->shapeController())->setInitialShapeForCanvas(&d->canvas); if (resourceProvider()) { diff --git a/krita/ui/KisViewManager.cpp b/krita/ui/KisViewManager.cpp --- a/krita/ui/KisViewManager.cpp +++ b/krita/ui/KisViewManager.cpp @@ -310,7 +310,7 @@ this->showHideScrollbars(); KoCanvasController *dummy = new KoDummyCanvasController(actionCollection()); - KoToolManager::instance()->registerTools(actionCollection(), dummy); + KoToolManager::instance()->registerToolActions(actionCollection(), dummy); QTimer::singleShot(0, this, SLOT(makeStatusBarVisible())); @@ -633,81 +633,57 @@ void KisViewManager::createActions() { - d->saveIncremental = new KisAction(i18n("Save Incremental &Version"), this); - d->saveIncremental->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S)); + d->saveIncremental = actionManager()->createAction("save_incremental_version"); d->saveIncremental->setActivationFlags(KisAction::ACTIVE_IMAGE); - actionManager()->addAction("save_incremental_version", d->saveIncremental); connect(d->saveIncremental, SIGNAL(triggered()), this, SLOT(slotSaveIncremental())); - d->saveIncrementalBackup = new KisAction(i18n("Save Incremental Backup"), this); - d->saveIncrementalBackup->setDefaultShortcut(Qt::Key_F4); + d->saveIncrementalBackup = actionManager()->createAction("save_incremental_backup"); d->saveIncrementalBackup->setActivationFlags(KisAction::ACTIVE_IMAGE); - actionManager()->addAction("save_incremental_backup", d->saveIncrementalBackup); connect(d->saveIncrementalBackup, SIGNAL(triggered()), this, SLOT(slotSaveIncrementalBackup())); connect(mainWindow(), SIGNAL(documentSaved()), this, SLOT(slotDocumentSaved())); d->saveIncremental->setEnabled(false); d->saveIncrementalBackup->setEnabled(false); - KisAction *tabletDebugger = new KisAction(i18n("Toggle Tablet Debugger"), this); - tabletDebugger->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_T)); - actionManager()->addAction("tablet_debugger", tabletDebugger ); + KisAction *tabletDebugger = actionManager()->createAction("tablet_debugger"); connect(tabletDebugger, SIGNAL(triggered()), this, SLOT(toggleTabletLogger())); - d->createTemplate = new KisAction( i18n( "&Create Template From Image..." ), this); + d->createTemplate = actionManager()->createAction("create_template"); d->createTemplate->setActivationFlags(KisAction::ACTIVE_IMAGE); - actionManager()->addAction("create_template", d->createTemplate); connect(d->createTemplate, SIGNAL(triggered()), this, SLOT(slotCreateTemplate())); - d->createCopy = new KisAction( i18n( "&Create Copy From Current Image" ), this); + d->createCopy = actionManager()->createAction("create_copy"); d->createCopy->setActivationFlags(KisAction::ACTIVE_IMAGE); - actionManager()->addAction("create_copy", d->createCopy); connect(d->createCopy, SIGNAL(triggered()), this, SLOT(slotCreateCopy())); - d->openResourcesDirectory = new KisAction(i18n("Open Resources Folder"), this); - d->openResourcesDirectory->setToolTip(i18n("Opens a file browser at the location Krita saves resources such as brushes to.")); - d->openResourcesDirectory->setWhatsThis(i18n("Opens a file browser at the location Krita saves resources such as brushes to.")); - actionManager()->addAction("open_resources_directory", d->openResourcesDirectory); + d->openResourcesDirectory = actionManager()->createAction("open_resources_directory"); connect(d->openResourcesDirectory, SIGNAL(triggered()), SLOT(openResourcesDirectory())); - d->rotateCanvasRight = new KisAction(i18n("Rotate Canvas Right"), this); - d->rotateCanvasRight->setDefaultShortcut(QKeySequence("Ctrl+]")); - actionManager()->addAction("rotate_canvas_right", d->rotateCanvasRight); + d->rotateCanvasRight = actionManager()->createAction("rotate_canvas_right"); d->rotateCanvasRight->setActivationFlags(KisAction::ACTIVE_IMAGE); - d->rotateCanvasLeft = new KisAction(i18n("Rotate Canvas Left"), this); - d->rotateCanvasLeft->setDefaultShortcut(QKeySequence("Ctrl+[")); - actionManager()->addAction("rotate_canvas_left", d->rotateCanvasLeft); + d->rotateCanvasLeft = actionManager()->createAction("rotate_canvas_left"); d->rotateCanvasLeft->setActivationFlags(KisAction::ACTIVE_IMAGE); - d->wrapAroundAction = new KisAction(i18n("Wrap Around Mode"), this); + d->wrapAroundAction = actionManager()->createAction("wrap_around_mode"); d->wrapAroundAction->setCheckable(true); d->wrapAroundAction->setActivationFlags(KisAction::ACTIVE_IMAGE); - d->wrapAroundAction->setDefaultShortcut(QKeySequence(Qt::Key_W)); - actionManager()->addAction("wrap_around_mode", d->wrapAroundAction); - d->levelOfDetailAction = new KisAction(i18n("Fast Preview Mode (LOD)"), this); + d->levelOfDetailAction = actionManager()->createAction("level_of_detail_mode"); d->levelOfDetailAction->setCheckable(true); d->levelOfDetailAction->setActivationFlags(KisAction::ACTIVE_IMAGE); - d->levelOfDetailAction->setDefaultShortcut(QKeySequence("Shift+L")); - actionManager()->addAction("level_of_detail_mode", d->levelOfDetailAction); - KisAction *tAction = new KisAction(i18n("Show Status Bar"), this); + KisAction *tAction = actionManager()->createAction("showStatusBar"); tAction->setCheckable(true); tAction->setChecked(true); - tAction->setToolTip(i18n("Shows or hides the status bar")); - actionManager()->addAction("showStatusBar", tAction); tAction->setActivationFlags(KisAction::ACTIVE_IMAGE); connect(tAction, SIGNAL(toggled(bool)), this, SLOT(showStatusBar(bool))); - tAction = new KisAction(i18n("Show Canvas Only"), this); + tAction = actionManager()->createAction("view_show_just_the_canvas"); tAction->setActivationFlags(KisAction::NONE); tAction->setCheckable(true); - tAction->setToolTip(i18n("Shows just the canvas or the whole window")); - tAction->setDefaultShortcut(QKeySequence(Qt::Key_Tab)); tAction->setChecked(false); - actionManager()->addAction("view_show_just_the_canvas", tAction); connect(tAction, SIGNAL(toggled(bool)), this, SLOT(showJustTheCanvas(bool))); //Workaround, by default has the same shortcut as mirrorCanvas @@ -717,31 +693,23 @@ a->setActivationConditions(KisAction::SELECTION_EDITABLE); } - a = new KisAction(i18n("Cleanup removed files..."), this); - actionManager()->addAction("edit_blacklist_cleanup", a); + a = actionManager()->createAction("edit_blacklist_cleanup"); connect(a, SIGNAL(triggered()), this, SLOT(slotBlacklistCleanup())); - d->showRulersAction = new KisAction(i18n("Show Rulers"), this); + d->showRulersAction = actionManager()->createAction("view_ruler"); d->showRulersAction->setCheckable(true); d->showRulersAction->setActivationFlags(KisAction::ACTIVE_IMAGE); - actionManager()->addAction("view_ruler", d->showRulersAction); - d->showRulersAction->setWhatsThis(i18n("The rulers show the horizontal and vertical positions of the mouse on the image " - "and can be used to position your mouse at the right place on the canvas.

Uncheck this to hide the rulers.

")); KisConfig cfg; d->showRulersAction->setChecked(cfg.showRulers()); - d->showGuidesAction = new KisAction(i18n("Show Guides"), this); + d->showGuidesAction = actionManager()->createAction("view_show_guides"); d->showGuidesAction->setCheckable(true); d->showGuidesAction->setCheckable(false); d->showGuidesAction->setActivationFlags(KisAction::ACTIVE_IMAGE); - d->showGuidesAction->setToolTip(i18n("Shows or hides guides")); - actionManager()->addAction("view_show_guides", d->showGuidesAction); - d->zoomTo100pct = new KisAction(i18n("Reset zoom"), this); + d->zoomTo100pct = actionManager()->createAction("zoom_to_100pct"); d->zoomTo100pct->setActivationFlags(KisAction::ACTIVE_IMAGE); - d->zoomTo100pct->setDefaultShortcut( QKeySequence( Qt::CTRL + Qt::Key_0 ) ); - actionManager()->addAction("zoom_to_100pct", d->zoomTo100pct); d->zoomIn = actionManager()->createStandardAction(KStandardAction::ZoomIn, 0, ""); d->zoomOut = actionManager()->createStandardAction(KStandardAction::ZoomOut, 0, ""); diff --git a/krita/ui/canvas/kis_grid_manager.cpp b/krita/ui/canvas/kis_grid_manager.cpp --- a/krita/ui/canvas/kis_grid_manager.cpp +++ b/krita/ui/canvas/kis_grid_manager.cpp @@ -48,18 +48,11 @@ void KisGridManager::setup(KisActionManager* actionManager) { - m_toggleGrid = new KisAction(KisIconUtils::loadIcon("view-grid"), i18n("Show Grid"), 0); - m_toggleGrid->setCheckable(true); + m_toggleGrid = actionManager->createAction("view_grid"); m_toggleGrid->setActivationFlags(KisAction::ACTIVE_NODE); - m_toggleGrid->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Apostrophe)); - actionManager->addAction("view_grid", m_toggleGrid); - m_toggleSnapToGrid = new KisAction(i18n("Snap To Grid"), this); - m_toggleSnapToGrid->setCheckable(true); + m_toggleSnapToGrid = actionManager->createAction("view_snap_to_grid"); m_toggleSnapToGrid->setActivationFlags(KisAction::ACTIVE_NODE); - m_toggleSnapToGrid->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Semicolon)); - // XXX: Why is this disabled? - //actionManager->addAction("view_snap_to_grid", m_toggleSnapToGrid); connect(m_toggleSnapToGrid, SIGNAL(triggered()), this, SLOT(toggleSnapToGrid())); } diff --git a/krita/ui/kis_action.h b/krita/ui/kis_action.h --- a/krita/ui/kis_action.h +++ b/krita/ui/kis_action.h @@ -78,6 +78,11 @@ KisAction(const QIcon& icon, const QString& text, QObject* parent = 0); virtual ~KisAction(); + /** + * Produces a new KisAction based on .action data files. + */ + static KisAction *makeKisAction(QString name, QObject *parent); + void setDefaultShortcut(const QKeySequence & shortcut); QKeySequence defaultShortcut() const; diff --git a/krita/ui/kis_action.cpp b/krita/ui/kis_action.cpp --- a/krita/ui/kis_action.cpp +++ b/krita/ui/kis_action.cpp @@ -19,6 +19,7 @@ #include "kis_action.h" #include "kis_action_manager.h" +#include "kis_action_registry.h" #include class Q_DECL_HIDDEN KisAction::Private { @@ -62,6 +63,17 @@ delete d; } +KisAction *makeKisAction(QString name, QObject *parent) +{ + KisAction* a = new KisAction(parent); + KisActionRegistry::instance()->propertizeAction(name, a); + KisActionRegistry::instance()->addAction(name, a); + + // TODO: Add other static data (activationFlags, etc.) using getActionXml() + + return a; +} + // Using a dynamic QObject property is done for compatibility with KAction and // XmlGui. We may merge KisAction into the XmlGui code to make this unnecessary, diff --git a/krita/ui/kis_action_manager.h b/krita/ui/kis_action_manager.h --- a/krita/ui/kis_action_manager.h +++ b/krita/ui/kis_action_manager.h @@ -56,26 +56,46 @@ virtual ~KisActionManager(); void setView(QPointer imageView); - + + /** + * Add an existing action to the action manager. + */ void addAction(const QString& name, KisAction* action); + + /** + * Stop managing an action. + */ void takeAction(KisAction* action); + /** + * Create a new KisAction. Looks up data from the .action data files. + */ + KisAction *createAction(const QString &name); + + /** + * Look up an action by name. + */ KisAction *actionByName(const QString &name) const; - void registerOperationUIFactory(KisOperationUIFactory* factory); - void registerOperation(KisOperation* operation); - void runOperation(const QString &id); + + void registerOperationUIFactory(KisOperationUIFactory* factory); + void registerOperation(KisOperation* operation); + void runOperation(const QString &id); void runOperationFromConfiguration(KisOperationConfiguration* config); - /// Update actions handled by kis_action_manager to set enabled/disabled. - /// This is used to grey out buttons that can't be pressed. + /** + * Update actions handled by kis_action_manager to set enabled. + * This is used to grey out buttons that can't be pressed. + */ void updateGUI(); - /// Create a KisAction based on a KStandardAction. The KStandardAction is deleted. + /** + * Create a KisAction based on a KStandardAction. The KStandardAction is deleted. + */ KisAction *createStandardAction(KStandardAction::StandardAction, const QObject *receiver, const char *member); diff --git a/krita/ui/kis_action_manager.cpp b/krita/ui/kis_action_manager.cpp --- a/krita/ui/kis_action_manager.cpp +++ b/krita/ui/kis_action_manager.cpp @@ -31,6 +31,15 @@ #include "operations/kis_operation.h" #include "kis_layer.h" #include "KisDocument.h" +#include "kis_action_registry.h" + +#include "QFile" +#include +#include + +#include "QFile" +#include +#include class Q_DECL_HIDDEN KisActionManager::Private { @@ -57,6 +66,47 @@ KisActionManager::~KisActionManager() { + +#if 0 + if ((d->actions.size() > 0)) { + + QDomDocument doc; + QDomElement e = doc.createElement("Actions"); + e.setAttribute("version", "2"); + doc.appendChild(e); + + foreach(KisAction *action, d->actions) { + QDomElement a = doc.createElement("Action"); + a.setAttribute("name", action->objectName()); + + // But seriously, XML is the worst format ever designed + auto addElement = [&](QString title, QString content) { + QDomElement newNode = doc.createElement(title); + QDomText newText = doc.createTextNode(content); + newNode.appendChild(newText); + a.appendChild(newNode); + }; + + addElement("icon", action->icon().name()); + addElement("text", action->text()); + addElement("whatsThis" , action->whatsThis()); + addElement("toolTip" , action->toolTip()); + addElement("iconText" , action->iconText()); + addElement("shortcut" , action->shortcut().toString()); + addElement("activationFlags" , QString::number(action->activationFlags(),2));; + addElement("activationConditions" , QString::number(action->activationConditions(),2)); + addElement("defaultShortcut" , action->defaultShortcut().toString()); + addElement("isCheckable" , QString((action->isChecked() ? "true" : "false"))); + addElement("statusTip", action->statusTip()); + e.appendChild(a); + } + QFile f("ActionManager.action"); + f.open(QFile::WriteOnly); + f.write(doc.toString().toUtf8()); + f.close(); + + } +#endif delete d; } @@ -78,6 +128,7 @@ d->viewManager->actionCollection()->setDefaultShortcut(action, action->defaultShortcut()); d->actions.append(action); action->setActionManager(this); + KisActionRegistry::instance()->addAction(name, action); } void KisActionManager::takeAction(KisAction* action) @@ -100,6 +151,29 @@ return 0; } + +KisAction *KisActionManager::createAction(const QString &name) +{ + KisAction *a = actionByName(name); // Check if the action already exists + if (a) { + return a; + } + + // There is some tension here. KisActionManager is supposed to be in control + // of global actions, but these actions are supposed to be duplicated. We + // will add them to the KisActionRegistry for the time being so we can get + // properly categorized shortcuts. + a = new KisAction(); + KisActionRegistry::instance()->propertizeAction(name, a); + KisActionRegistry::instance()->addAction(name, a); + + // TODO: Add other static data (activationFlags, etc.) using getActionXml(); + + addAction(name, a); + + return a; +} + void KisActionManager::updateGUI() { //TODO other flags @@ -213,7 +287,7 @@ } enable = enable && (int)(action->activationConditions() & conditions) == (int)action->activationConditions(); - + if (node && enable) { foreach (const QString &type, action->excludedNodeTypes()) { if (node->inherits(type.toLatin1())) { diff --git a/krita/ui/kis_canvas_controls_manager.cpp b/krita/ui/kis_canvas_controls_manager.cpp --- a/krita/ui/kis_canvas_controls_manager.cpp +++ b/krita/ui/kis_canvas_controls_manager.cpp @@ -50,24 +50,16 @@ void KisCanvasControlsManager::setup(KisActionManager *actionManager) { - KisAction *lighterColor = new KisAction(i18n("Make brush color lighter")); - lighterColor->setDefaultShortcut(Qt::Key_L); - actionManager->addAction("make_brush_color_lighter", lighterColor); + KisAction *lighterColor = actionManager->createAction("make_brush_color_lighter"); connect(lighterColor, SIGNAL(triggered()), SLOT(makeColorLighter())); - KisAction *darkerColor = new KisAction(i18n("Make brush color darker")); - darkerColor->setDefaultShortcut(Qt::Key_K); - actionManager->addAction("make_brush_color_darker", darkerColor); + KisAction *darkerColor = actionManager->createAction("make_brush_color_darker"); connect(darkerColor, SIGNAL(triggered()), SLOT(makeColorDarker())); - KisAction *increaseOpacity = new KisAction(i18n("Increase opacity")); - increaseOpacity->setDefaultShortcut(Qt::Key_O); - actionManager->addAction("increase_opacity", increaseOpacity); + KisAction *increaseOpacity = actionManager->createAction("increase_opacity"); connect(increaseOpacity, SIGNAL(triggered()), SLOT(increaseOpacity())); - KisAction *decreaseOpacity = new KisAction(i18n("Decrease opacity")); - decreaseOpacity->setDefaultShortcut(Qt::Key_I); - actionManager->addAction("decrease_opacity", decreaseOpacity); + KisAction *decreaseOpacity = actionManager->createAction("decrease_opacity"); connect(decreaseOpacity, SIGNAL(triggered()), SLOT(decreaseOpacity())); } diff --git a/krita/ui/kis_filter_manager.cc b/krita/ui/kis_filter_manager.cc --- a/krita/ui/kis_filter_manager.cc +++ b/krita/ui/kis_filter_manager.cc @@ -97,10 +97,7 @@ d->actionManager = actionManager; // Setup reapply action - d->reapplyAction = new KisAction(i18n("Apply Filter Again"), this); - d->reapplyAction->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::Key_F)); - d->actionManager->addAction("filter_apply_again", d->reapplyAction); - + d->reapplyAction = d->actionManager->createAction("filter_apply_again"); d->reapplyAction->setEnabled(false); connect(d->reapplyAction, SIGNAL(triggered()), SLOT(reapplyLastFilter())); diff --git a/krita/ui/kis_image_manager.cc b/krita/ui/kis_image_manager.cc --- a/krita/ui/kis_image_manager.cc +++ b/krita/ui/kis_image_manager.cc @@ -58,40 +58,32 @@ void KisImageManager::setup(KisActionManager *actionManager) { - KisAction *action = new KisAction(i18n("I&mport Layer..."), this); + KisAction *action = actionManager->createAction("import_layer_from_file"); action->setActivationFlags(KisAction::ACTIVE_LAYER); - actionManager->addAction("import_layer_from_file", action); connect(action, SIGNAL(triggered()), this, SLOT(slotImportLayerFromFile())); - action = new KisAction(KisIconUtils::loadIcon("configure"), i18n("Properties..."), this); + action = actionManager->createAction("image_properties"); action->setActivationFlags(KisAction::ACTIVE_NODE); - actionManager->addAction("image_properties", action); connect(action, SIGNAL(triggered()), this, SLOT(slotImageProperties())); - action = new KisAction(KisIconUtils::loadIcon("document-new"), i18n("as Paint Layer..."), this); + action = actionManager->createAction("import_layer_as_paint_layer"); action->setActivationFlags(KisAction::ACTIVE_NODE); - actionManager->addAction("import_layer_as_paint_layer", action); connect(action, SIGNAL(triggered()), this, SLOT(slotImportLayerFromFile())); - action = new KisAction(KisIconUtils::loadIcon("edit-copy"), i18n("as Transparency Mask..."), this); + action = actionManager->createAction("import_layer_as_transparency_mask"); action->setActivationFlags(KisAction::ACTIVE_NODE); - actionManager->addAction("import_layer_as_transparency_mask", action); connect(action, SIGNAL(triggered()), this, SLOT(slotImportLayerAsTransparencyMask())); - action = new KisAction(KisIconUtils::loadIcon("view-filter"), i18n("as Filter Mask..."), this); + action = actionManager->createAction("import_layer_as_filter_mask"); action->setActivationFlags(KisAction::ACTIVE_NODE); - actionManager->addAction("import_layer_as_filter_mask", action); connect(action, SIGNAL(triggered()), this, SLOT(slotImportLayerAsFilterMask())); - action = new KisAction(KisIconUtils::loadIcon("edit-paste"), i18n("as Selection Mask..."), this); + action = actionManager->createAction("import_layer_as_selection_mask"); action->setActivationFlags(KisAction::ACTIVE_NODE); - actionManager->addAction("import_layer_as_selection_mask", action); connect(action, SIGNAL(triggered()), this, SLOT(slotImportLayerAsSelectionMask())); - action = new KisAction(KisIconUtils::loadIcon("format-stroke-color"), i18n("Image Background Color and Transparency..."), this); + action = actionManager->createAction("image_color"); action->setActivationFlags(KisAction::ACTIVE_NODE); - action->setToolTip(i18n("Change the background color of the image")); - actionManager->addAction("image_color", action); connect(action, SIGNAL(triggered()), this, SLOT(slotImageColor())); } diff --git a/krita/ui/kis_layer_manager.cc b/krita/ui/kis_layer_manager.cc --- a/krita/ui/kis_layer_manager.cc +++ b/krita/ui/kis_layer_manager.cc @@ -290,54 +290,42 @@ void KisLayerManager::setup(KisActionManager* actionManager) { - m_imageFlatten = new KisAction(i18n("&Flatten image"), this); + m_imageFlatten = actionManager->createAction("flatten_image"); m_imageFlatten->setActivationFlags(KisAction::ACTIVE_LAYER); - m_imageFlatten->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_E)); - actionManager->addAction("flatten_image", m_imageFlatten); connect(m_imageFlatten, SIGNAL(triggered()), this, SLOT(flattenImage())); - m_imageMergeLayer = new KisAction(i18n("&Merge with Layer Below"), this); + m_imageMergeLayer = actionManager->createAction("merge_layer"); m_imageMergeLayer->setActivationFlags(KisAction::ACTIVE_LAYER); - m_imageMergeLayer->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::Key_E)); - actionManager->addAction("merge_layer", m_imageMergeLayer); connect(m_imageMergeLayer, SIGNAL(triggered()), this, SLOT(mergeLayer())); - m_flattenLayer = new KisAction(i18n("&Flatten Layer"), this); + m_flattenLayer = actionManager->createAction("flatten_layer"); m_flattenLayer->setActivationFlags(KisAction::ACTIVE_LAYER); - actionManager->addAction("flatten_layer", m_flattenLayer); connect(m_flattenLayer, SIGNAL(triggered()), this, SLOT(flattenLayer())); - KisAction * action = new KisAction(i18n("Rename current layer"), this); + KisAction * action = actionManager->createAction("RenameCurrentLayer"); action->setActivationFlags(KisAction::ACTIVE_LAYER); - action->setDefaultShortcut(QKeySequence(Qt::Key_F2)); - actionManager->addAction("RenameCurrentLayer", action); connect(action, SIGNAL(triggered()), this, SLOT(layerProperties())); - m_rasterizeLayer = new KisAction(i18n("Rasterize Layer"), this); + m_rasterizeLayer = actionManager->createAction("rasterize_layer"); m_rasterizeLayer->setActivationFlags(KisAction::ACTIVE_SHAPE_LAYER); m_rasterizeLayer->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - actionManager->addAction("rasterize_layer", m_rasterizeLayer); connect(m_rasterizeLayer, SIGNAL(triggered()), this, SLOT(rasterizeLayer())); - m_groupLayersSave = new KisAction(KisIconUtils::loadIcon("document-save"), i18n("Save Group Layers..."), this); + m_groupLayersSave = actionManager->createAction("save_groups_as_images"); m_groupLayersSave->setActivationFlags(KisAction::ACTIVE_LAYER); - actionManager->addAction("save_groups_as_images", m_groupLayersSave); connect(m_groupLayersSave, SIGNAL(triggered()), this, SLOT(saveGroupLayers())); - m_imageResizeToLayer = new KisAction(i18n("Trim to Current Layer"), this); + m_imageResizeToLayer = actionManager->createAction("resizeimagetolayer"); m_imageResizeToLayer->setActivationFlags(KisAction::ACTIVE_LAYER); - actionManager->addAction("resizeimagetolayer", m_imageResizeToLayer); connect(m_imageResizeToLayer, SIGNAL(triggered()), this, SLOT(imageResizeToActiveLayer())); - KisAction *trimToImage = new KisAction(KisIconUtils::loadIcon("trim-to-image"), i18n("Trim to Image Size"), this); - trimToImage->setActivationFlags(KisAction::ACTIVE_IMAGE); - actionManager->addAction("trim_to_image", trimToImage); - connect(trimToImage, SIGNAL(triggered()), this, SLOT(trimToImage())); + action = actionManager->createAction("trim_to_image"); + action->setActivationFlags(KisAction::ACTIVE_IMAGE); + connect(action, SIGNAL(triggered()), this, SLOT(trimToImage())); - m_layerStyle = new KisAction(i18n("Layer Style..."), this); + m_layerStyle = actionManager->createAction("layer_style"); m_layerStyle->setActivationFlags(KisAction::ACTIVE_LAYER); m_layerStyle->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - actionManager->addAction("layer_style", m_layerStyle); connect(m_layerStyle, SIGNAL(triggered()), this, SLOT(layerStyle())); } diff --git a/krita/ui/kis_node_manager.cpp b/krita/ui/kis_node_manager.cpp --- a/krita/ui/kis_node_manager.cpp +++ b/krita/ui/kis_node_manager.cpp @@ -191,25 +191,18 @@ } -#define NEW_LAYER_ACTION(id, text, layerType, icon) \ +#define NEW_LAYER_ACTION(id, layerType) \ { \ - action = new KisAction(icon, text, this); \ + action = actionManager->createAction(id); \ action->setActivationFlags(KisAction::ACTIVE_NODE); \ - actionManager->addAction(id, action); \ m_d->nodeCreationSignalMapper.setMapping(action, layerType); \ connect(action, SIGNAL(triggered()), \ &m_d->nodeCreationSignalMapper, SLOT(map())); \ } -#define NEW_LAYER_ACTION_KEY(id, text, layerType, icon, shortcut) \ - { \ - NEW_LAYER_ACTION(id, text, layerType, icon); \ - action->setShortcut(QKeySequence(shortcut)); \ - } - -#define NEW_MASK_ACTION(id, text, layerType, icon) \ +#define NEW_MASK_ACTION(id, layerType) \ { \ - NEW_LAYER_ACTION(id, text, layerType, icon); \ + NEW_LAYER_ACTION(id, layerType); \ action->setActivationFlags(KisAction::ACTIVE_LAYER); \ } @@ -229,76 +222,54 @@ m_d->layerManager.setup(actionManager); m_d->maskManager.setup(actionCollection, actionManager); - KisAction * action = new KisAction(KisIconUtils::loadIcon("symmetry-horizontal"), i18n("Mirror Layer Horizontally"), this); + KisAction * action = actionManager->createAction("mirrorNodeX"); action->setActivationFlags(KisAction::ACTIVE_NODE); action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - actionManager->addAction("mirrorNodeX", action); connect(action, SIGNAL(triggered()), this, SLOT(mirrorNodeX())); - action = new KisAction(KisIconUtils::loadIcon("symmetry-vertical"), i18n("Mirror Layer Vertically"), this); + action = actionManager->createAction("mirrorNodeY"); action->setActivationFlags(KisAction::ACTIVE_NODE); action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - actionManager->addAction("mirrorNodeY", action); connect(action, SIGNAL(triggered()), this, SLOT(mirrorNodeY())); - action = new KisAction(i18n("Activate next layer"), this); + action = actionManager->createAction("activateNextLayer"); action->setActivationFlags(KisAction::ACTIVE_LAYER); - action->setDefaultShortcut(QKeySequence(Qt::Key_PageUp)); - actionManager->addAction("activateNextLayer", action); connect(action, SIGNAL(triggered()), this, SLOT(activateNextNode())); - action = new KisAction(i18n("Activate previous layer"), this); + action = actionManager->createAction("activatePreviousLayer"); action->setActivationFlags(KisAction::ACTIVE_LAYER); - action->setDefaultShortcut(QKeySequence(Qt::Key_PageDown)); - actionManager->addAction("activatePreviousLayer", action); connect(action, SIGNAL(triggered()), this, SLOT(activatePreviousNode())); - action = new KisAction(KisIconUtils::loadIcon("document-save"), i18n("Save Layer/Mask..."), this); + action = actionManager->createAction("save_node_as_image"); action->setActivationFlags(KisAction::ACTIVE_NODE); - actionManager->addAction("save_node_as_image", action); connect(action, SIGNAL(triggered()), this, SLOT(saveNodeAsImage())); - action = new KisAction(KisIconUtils::loadIcon("edit-copy"), i18n("&Duplicate Layer or Mask"), this); + action = actionManager->createAction("duplicatelayer"); action->setActivationFlags(KisAction::ACTIVE_NODE); - action->setDefaultShortcut(QKeySequence(Qt::ControlModifier + Qt::Key_J)); - actionManager->addAction("duplicatelayer", action); connect(action, SIGNAL(triggered()), this, SLOT(duplicateActiveNode())); - NEW_LAYER_ACTION_KEY("add_new_paint_layer", i18n("&Paint Layer"), - "KisPaintLayer", KisIconUtils::loadIcon("document-new"), - Qt::Key_Insert); + NEW_LAYER_ACTION("add_new_paint_layer", "KisPaintLayer"); - NEW_LAYER_ACTION_KEY("add_new_group_layer", i18n("&Group Layer"), - "KisGroupLayer", KisIconUtils::loadIcon("folder"), - Qt::ControlModifier + Qt::Key_G); + NEW_LAYER_ACTION("add_new_group_layer", "KisGroupLayer"); - NEW_LAYER_ACTION("add_new_clone_layer", i18n("&Clone Layer"), - "KisCloneLayer", KisIconUtils::loadIcon("edit-copy")); + NEW_LAYER_ACTION("add_new_clone_layer", "KisCloneLayer"); - NEW_LAYER_ACTION("add_new_shape_layer", i18n("&Vector Layer"), - "KisShapeLayer", KisIconUtils::loadIcon("bookmarks")); + NEW_LAYER_ACTION("add_new_shape_layer", "KisShapeLayer"); - NEW_LAYER_ACTION("add_new_adjustment_layer", i18n("&Filter Layer..."), - "KisAdjustmentLayer", KisIconUtils::loadIcon("view-filter")); + NEW_LAYER_ACTION("add_new_adjustment_layer", "KisAdjustmentLayer"); - NEW_LAYER_ACTION("add_new_fill_layer", i18n("&Fill Layer..."), - "KisGeneratorLayer", KisIconUtils::loadIcon("krita_tool_color_fill")); + NEW_LAYER_ACTION("add_new_fill_layer", "KisGeneratorLayer"); - NEW_LAYER_ACTION("add_new_file_layer", i18n("&File Layer..."), - "KisFileLayer", KisIconUtils::loadIcon("document-open")); + NEW_LAYER_ACTION("add_new_file_layer", "KisFileLayer"); - NEW_MASK_ACTION("add_new_transparency_mask", i18n("&Transparency Mask"), - "KisTransparencyMask", KisIconUtils::loadIcon("edit-copy")); + NEW_MASK_ACTION("add_new_transparency_mask", "KisTransparencyMask"); - NEW_MASK_ACTION("add_new_filter_mask", i18n("&Filter Mask..."), - "KisFilterMask", KisIconUtils::loadIcon("view-filter")); + NEW_MASK_ACTION("add_new_filter_mask", "KisFilterMask"); - NEW_MASK_ACTION("add_new_transform_mask", i18n("&Transform Mask..."), - "KisTransformMask", KisIconUtils::loadIcon("bookmarks")); + NEW_MASK_ACTION("add_new_transform_mask", "KisTransformMask"); - NEW_MASK_ACTION("add_new_selection_mask", i18n("&Local Selection"), - "KisSelectionMask", KisIconUtils::loadIcon("edit-paste")); + NEW_MASK_ACTION("add_new_selection_mask", "KisSelectionMask"); connect(&m_d->nodeCreationSignalMapper, SIGNAL(mapped(const QString &)), this, SLOT(createNode(const QString &))); @@ -318,28 +289,24 @@ connect(&m_d->nodeConversionSignalMapper, SIGNAL(mapped(const QString &)), this, SLOT(convertNode(const QString &))); - action = new KisAction(KisIconUtils::loadIcon("layer-visible-off"), i18n("&Isolate Layer"), this); + action = actionManager->createAction("isolate_layer"); action->setCheckable(true); action->setActivationFlags(KisAction::ACTIVE_NODE); - actionManager->addAction("isolate_layer", action); connect(action, SIGNAL(triggered(bool)), this, SLOT(toggleIsolateMode(bool))); - action = new KisAction(KisIconUtils::loadIcon("edit-copy"), i18n("Alpha into Mask"), this); + action = actionManager->createAction("split_alpha_into_mask"); action->setActivationFlags(KisAction::ACTIVE_LAYER); action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE_PAINT_DEVICE); - actionManager->addAction("split_alpha_into_mask", action); connect(action, SIGNAL(triggered()), this, SLOT(slotSplitAlphaIntoMask())); - action = new KisAction(KisIconUtils::loadIcon("transparency-enabled"), i18n("Write as Alpha"), this); + action = actionManager->createAction("split_alpha_write"); action->setActivationFlags(KisAction::ACTIVE_TRANSPARENCY_MASK); action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - actionManager->addAction("split_alpha_write", action); connect(action, SIGNAL(triggered()), this, SLOT(slotSplitAlphaWrite())); - action = new KisAction(KisIconUtils::loadIcon("document-save"), i18n("Save Merged..."), this); + action = actionManager->createAction("split_alpha_save_merged"); action->setActivationFlags(KisAction::ACTIVE_TRANSPARENCY_MASK); // HINT: we can save even when the nodes are not editable - actionManager->addAction("split_alpha_save_merged", action); connect(action, SIGNAL(triggered()), this, SLOT(slotSplitAlphaSaveMerged())); connect(this, SIGNAL(sigNodeActivated(KisNodeSP)), SLOT(slotUpdateIsolateModeAction())); diff --git a/krita/ui/kis_paintop_box.cc b/krita/ui/kis_paintop_box.cc --- a/krita/ui/kis_paintop_box.cc +++ b/krita/ui/kis_paintop_box.cc @@ -79,6 +79,7 @@ #include "tool/kis_tool.h" #include "kis_signals_blocker.h" #include "kis_action_manager.h" +#include "kis_action_registry.h" typedef KoResourceServerSimpleConstruction > KisPaintOpPresetResourceServer; typedef KoResourceServerAdapter > KisPaintOpPresetResourceServerAdapter; @@ -136,57 +137,52 @@ m_eraseModeButton->setFixedSize(iconsize, iconsize); m_eraseModeButton->setCheckable(true); - m_eraseAction = new KisAction(i18n("Set eraser mode"), m_eraseModeButton); + m_eraseAction = m_viewManager->actionManager()->createAction("erase_action"); m_eraseAction->setActivationFlags(KisAction::ACTIVE_DEVICE); m_eraseAction->setIcon(KisIconUtils::loadIcon("draw-eraser")); - m_eraseAction->setDefaultShortcut(Qt::Key_E); m_eraseAction->setCheckable(true); m_eraseModeButton->setDefaultAction(m_eraseAction); - m_viewManager->actionCollection()->addAction("erase_action", m_eraseAction); eraserBrushSize = 0; // brush size changed when using erase mode m_reloadButton = new QToolButton(this); m_reloadButton->setFixedSize(iconsize, iconsize); m_reloadButton->setCheckable(true); - m_reloadAction = new KisAction(i18n("Reload Original Preset"), m_reloadButton); + m_reloadAction = m_viewManager->actionManager()->createAction("reload_preset_action"); m_reloadAction->setActivationFlags(KisAction::ACTIVE_DEVICE); m_reloadAction->setIcon(KisIconUtils::loadIcon("view-refresh")); m_reloadButton->setDefaultAction(m_reloadAction); - m_viewManager->actionCollection()->addAction("reload_preset_action", m_reloadAction); m_alphaLockButton = new QToolButton(this); m_alphaLockButton->setFixedSize(iconsize, iconsize); m_alphaLockButton->setCheckable(true); - KisAction* alphaLockAction = new KisAction(i18n("Preserve Alpha"), m_alphaLockButton); + + KisAction* alphaLockAction = m_viewManager->actionManager()->createAction("preserve_alpha"); alphaLockAction->setActivationFlags(KisAction::ACTIVE_DEVICE); alphaLockAction->setIcon(KisIconUtils::loadIcon("transparency-unlocked")); alphaLockAction->setCheckable(true); m_alphaLockButton->setDefaultAction(alphaLockAction); - m_viewManager->actionCollection()->addAction("preserve_alpha", alphaLockAction); m_hMirrorButton = new QToolButton(this); m_hMirrorButton->setFixedSize(iconsize, iconsize); m_hMirrorButton->setCheckable(true); - m_hMirrorAction = new KisAction(i18n("Set horizontal mirror mode"), m_hMirrorButton); + m_hMirrorAction = m_viewManager->actionManager()->createAction("hmirror_action"); m_hMirrorAction->setIcon(KisIconUtils::loadIcon("symmetry-horizontal")); m_hMirrorAction->setActivationFlags(KisAction::ACTIVE_DEVICE); m_hMirrorAction->setCheckable(true); m_hMirrorButton->setDefaultAction(m_hMirrorAction); - m_viewManager->actionCollection()->addAction("hmirror_action", m_hMirrorAction); m_vMirrorButton = new QToolButton(this); m_vMirrorButton->setFixedSize(iconsize, iconsize); m_vMirrorButton->setCheckable(true); - m_vMirrorAction = new KisAction(i18n("Set vertical mirror mode"), m_vMirrorButton); + m_vMirrorAction = m_viewManager->actionManager()->createAction("vmirror_action"); m_vMirrorAction->setActivationFlags(KisAction::ACTIVE_DEVICE); m_vMirrorAction->setIcon(KisIconUtils::loadIcon("symmetry-vertical")); m_vMirrorAction->setCheckable(true); m_vMirrorButton->setDefaultAction(m_vMirrorAction); - m_viewManager->actionCollection()->addAction("vmirror_action", m_vMirrorAction); const bool sliderLabels = cfg.sliderLabels(); int sliderWidth; @@ -286,67 +282,61 @@ QWidgetAction * action; action = new QWidgetAction(this); - action->setText(i18n("Brush composite")); view->actionCollection()->addAction("composite_actions", action); action->setDefaultWidget(compositeActions); action = new QWidgetAction(this); - action->setText(i18n("Brush option slider 1")); - view->actionCollection()->addAction("brushslider1", action); + KisActionRegistry::instance()->propertizeAction("brushslider1", action); action->setDefaultWidget(m_sliderChooser[0]); connect(action, SIGNAL(triggered()), m_sliderChooser[0], SLOT(showPopupWidget())); connect(m_viewManager->mainWindow(), SIGNAL(themeChanged()), m_sliderChooser[0], SLOT(updateThemedIcons())); action = new QWidgetAction(this); - action->setText(i18n("Brush option slider 2")); + KisActionRegistry::instance()->propertizeAction("brushslider2", action); view->actionCollection()->addAction("brushslider2", action); action->setDefaultWidget(m_sliderChooser[1]); connect(action, SIGNAL(triggered()), m_sliderChooser[1], SLOT(showPopupWidget())); connect(m_viewManager->mainWindow(), SIGNAL(themeChanged()), m_sliderChooser[1], SLOT(updateThemedIcons())); action = new QWidgetAction(this); - action->setText(i18n("Brush option slider 3")); + KisActionRegistry::instance()->propertizeAction("brushslider3", action); view->actionCollection()->addAction("brushslider3", action); action->setDefaultWidget(m_sliderChooser[2]); connect(action, SIGNAL(triggered()), m_sliderChooser[2], SLOT(showPopupWidget())); connect(m_viewManager->mainWindow(), SIGNAL(themeChanged()), m_sliderChooser[2], SLOT(updateThemedIcons())); action = new QWidgetAction(this); - action->setText(i18n("Next Favourite Preset")); - view->actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::Key_Comma)); + KisActionRegistry::instance()->propertizeAction("next_favorite_preset", action); view->actionCollection()->addAction("next_favorite_preset", action); connect(action, SIGNAL(triggered()), this, SLOT(slotNextFavoritePreset())); action = new QWidgetAction(this); - action->setText(i18n("Previous Favourite Preset")); - view->actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::Key_Period)); + KisActionRegistry::instance()->propertizeAction("previous_favorite_preset", action); view->actionCollection()->addAction("previous_favorite_preset", action); connect(action, SIGNAL(triggered()), this, SLOT(slotPreviousFavoritePreset())); action = new QWidgetAction(this); - action->setText(i18n("Switch to Previous Preset")); - view->actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::Key_Slash)); + KisActionRegistry::instance()->propertizeAction("previous_preset", action); view->actionCollection()->addAction("previous_preset", action); connect(action, SIGNAL(triggered()), this, SLOT(slotSwitchToPreviousPreset())); if (!cfg.toolOptionsInDocker()) { action = new QWidgetAction(this); - action->setText(i18n("Show Tool Options")); + KisActionRegistry::instance()->propertizeAction("show_tool_options", action); + // TODO: check how this is serialized, add it to krita.action view->actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::Key_Backslash)); view->actionCollection()->addAction("show_tool_options", action); connect(action, SIGNAL(triggered()), m_toolOptionsPopupButton, SLOT(showPopupWidget())); } action = new QWidgetAction(this); - action->setText(i18n("Show Brush Editor")); - view->actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::Key_F5)); - view->actionCollection()->addAction("show_brush_editor", action); + KisActionRegistry::instance()->propertizeAction("show_brush_editor", action); connect(action, SIGNAL(triggered()), m_brushEditorPopupButton, SLOT(showPopupWidget())); action = new QWidgetAction(this); - action->setText(i18n("Show Brush Presets")); - view->actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::Key_F6)); + KisActionRegistry::instance()->propertizeAction("show_brush_presets", action); + view->actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::Key_F6)); // TODO: check this view->actionCollection()->addAction("show_brush_presets", action); connect(action, SIGNAL(triggered()), m_presetSelectorPopupButton, SLOT(showPopupWidget())); @@ -358,12 +348,12 @@ mirrorLayout->setContentsMargins(0, 0, 0, 0); action = new QWidgetAction(this); - action->setText(i18n("Mirror")); + KisActionRegistry::instance()->propertizeAction("mirror_actions", action); action->setDefaultWidget(mirrorActions); view->actionCollection()->addAction("mirror_actions", action); action = new QWidgetAction(this); - action->setText(i18n("Workspaces")); + KisActionRegistry::instance()->propertizeAction("workspaces", action); view->actionCollection()->addAction("workspaces", action); action->setDefaultWidget(m_workspaceWidget); diff --git a/krita/ui/kis_selection_manager.cc b/krita/ui/kis_selection_manager.cc --- a/krita/ui/kis_selection_manager.cc +++ b/krita/ui/kis_selection_manager.cc @@ -124,154 +124,112 @@ m_copy = actionManager->createStandardAction(KStandardAction::Copy, this, SLOT(copy())); m_paste = actionManager->createStandardAction(KStandardAction::Paste, this, SLOT(paste())); - KisAction *copySharp = new KisAction(i18n("Copy (sharp)"), this); - copySharp->setActivationFlags(KisAction::PIXELS_SELECTED); - actionManager->addAction("copy_sharp", copySharp); - connect(copySharp, SIGNAL(triggered()), this, SLOT(copySharp())); - - KisAction *cutSharp = new KisAction(i18n("Cut (sharp)"), this); - cutSharp->setActivationFlags(KisAction::PIXELS_SELECTED); - actionManager->addAction("cut_sharp", cutSharp); - connect(cutSharp, SIGNAL(triggered()), this, SLOT(cutSharp())); - - m_pasteNew = new KisAction(i18n("Paste into &New Image"), this); - m_pasteNew->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_N)); - actionManager->addAction("paste_new", m_pasteNew); + KisAction *action = actionManager->createAction("copy_sharp"); + action->setActivationFlags(KisAction::PIXELS_SELECTED); + connect(action, SIGNAL(triggered()), this, SLOT(copySharp())); + + action = actionManager->createAction("cut_sharp"); + action->setActivationFlags(KisAction::PIXELS_SELECTED); + connect(action, SIGNAL(triggered()), this, SLOT(cutSharp())); + + m_pasteNew = actionManager->createAction("paste_new"); connect(m_pasteNew, SIGNAL(triggered()), this, SLOT(pasteNew())); - m_pasteAt = new KisAction(i18n("Paste at cursor"), this); - actionManager->addAction("paste_at", m_pasteAt); + m_pasteAt = actionManager->createAction("paste_at"); connect(m_pasteAt, SIGNAL(triggered()), this, SLOT(pasteAt())); - m_copyMerged = new KisAction(i18n("Copy merged"), this); + m_copyMerged = actionManager->createAction("copy_merged"); m_copyMerged->setActivationFlags(KisAction::PIXELS_SELECTED); - m_copyMerged->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C)); - actionManager->addAction("copy_merged", m_copyMerged); connect(m_copyMerged, SIGNAL(triggered()), this, SLOT(copyMerged())); - m_selectAll = new KisAction(KisIconUtils::loadIcon("select-all"), i18n("Select &All"), this); - m_selectAll->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::Key_A)); - actionManager->addAction("select_all", m_selectAll); + m_selectAll = actionManager->createAction("select_all"); connect(m_selectAll, SIGNAL(triggered()), this, SLOT(selectAll())); - m_deselect = new KisAction(KisIconUtils::loadIcon("select-clear"), i18n("Deselect"), this); + m_deselect = actionManager->createAction("deselect"); m_deselect->setActivationFlags(KisAction::PIXELS_SELECTED | KisAction::SHAPES_SELECTED); - m_deselect->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_A)); - actionManager->addAction("deselect", m_deselect); connect(m_deselect, SIGNAL(triggered()), this, SLOT(deselect())); - m_clear = new KisAction(KisIconUtils::loadIcon("select-clear"), i18n("Clear"), this); + m_clear = actionManager->createAction("clear"); m_clear->setActivationFlags(KisAction::ACTIVE_IMAGE); - m_clear->setDefaultShortcut(QKeySequence((Qt::Key_Delete))); - actionManager->addAction("clear", m_clear); connect(m_clear, SIGNAL(triggered()), SLOT(clear())); - m_reselect = new KisAction(i18n("&Reselect"), this); - m_reselect->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D)); - actionManager->addAction("reselect", m_reselect); + m_reselect = actionManager->createAction("reselect"); connect(m_reselect, SIGNAL(triggered()), this, SLOT(reselect())); - m_invert = new KisAction(i18n("&Invert Selection"), this); + m_invert = actionManager->createAction("invert"); m_invert->setActivationFlags(KisAction::PIXEL_SELECTION_WITH_PIXELS); m_invert->setActivationConditions(KisAction::SELECTION_EDITABLE); m_invert->setOperationID("invertselection"); - m_invert->setToolTip("foo"); - - m_invert->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I)); - actionManager->addAction("invert", m_invert); actionManager->registerOperation(new KisInvertSelectionOperaton); - m_copyToNewLayer = new KisAction(i18n("Copy Selection to New Layer"), this); + m_copyToNewLayer = actionManager->createAction("copy_selection_to_new_layer"); m_copyToNewLayer->setActivationFlags(KisAction::PIXELS_SELECTED); - m_copyToNewLayer->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_J)); - actionManager->addAction("copy_selection_to_new_layer", m_copyToNewLayer); connect(m_copyToNewLayer, SIGNAL(triggered()), this, SLOT(copySelectionToNewLayer())); - m_cutToNewLayer = new KisAction(i18n("Cut Selection to New Layer"), this); + m_cutToNewLayer = actionManager->createAction("cut_selection_to_new_layer"); m_cutToNewLayer->setActivationFlags(KisAction::PIXELS_SELECTED); m_cutToNewLayer->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - m_cutToNewLayer->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_J)); - actionManager->addAction("cut_selection_to_new_layer", m_cutToNewLayer); connect(m_cutToNewLayer, SIGNAL(triggered()), this, SLOT(cutToNewLayer())); - m_fillForegroundColor = new KisAction(i18n("Fill with Foreground Color"), this); + m_fillForegroundColor = actionManager->createAction("fill_selection_foreground_color"); m_fillForegroundColor->setActivationFlags(KisAction::ACTIVE_DEVICE); m_fillForegroundColor->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - m_fillForegroundColor->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Backspace)); - actionManager->addAction("fill_selection_foreground_color", m_fillForegroundColor); connect(m_fillForegroundColor, SIGNAL(triggered()), this, SLOT(fillForegroundColor())); - m_fillBackgroundColor = new KisAction(i18n("Fill with Background Color"), this); + m_fillBackgroundColor = actionManager->createAction("fill_selection_background_color"); m_fillBackgroundColor->setActivationFlags(KisAction::ACTIVE_DEVICE); m_fillBackgroundColor->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - m_fillBackgroundColor->setDefaultShortcut(QKeySequence(Qt::Key_Backspace)); - actionManager->addAction("fill_selection_background_color", m_fillBackgroundColor); connect(m_fillBackgroundColor, SIGNAL(triggered()), this, SLOT(fillBackgroundColor())); - m_fillPattern = new KisAction(i18n("Fill with Pattern"), this); + m_fillPattern = actionManager->createAction("fill_selection_pattern"); m_fillPattern->setActivationFlags(KisAction::ACTIVE_DEVICE); m_fillPattern->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - actionManager->addAction("fill_selection_pattern", m_fillPattern); connect(m_fillPattern, SIGNAL(triggered()), this, SLOT(fillPattern())); - m_fillForegroundColorOpacity = new KisAction(i18n("Fill with Foreground Color (Opacity)"), this); + m_fillForegroundColorOpacity = actionManager->createAction("fill_selection_foreground_color_opacity"); m_fillForegroundColorOpacity->setActivationFlags(KisAction::ACTIVE_DEVICE); m_fillForegroundColorOpacity->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - m_fillForegroundColorOpacity->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Backspace)); - actionManager->addAction("fill_selection_foreground_color_opacity", m_fillForegroundColorOpacity); connect(m_fillForegroundColorOpacity, SIGNAL(triggered()), this, SLOT(fillForegroundColorOpacity())); - m_fillBackgroundColorOpacity = new KisAction(i18n("Fill with Background Color (Opacity)"), this); + m_fillBackgroundColorOpacity = actionManager->createAction("fill_selection_background_color_opacity"); m_fillBackgroundColorOpacity->setActivationFlags(KisAction::ACTIVE_DEVICE); m_fillBackgroundColorOpacity->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - m_fillBackgroundColorOpacity->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::Key_Backspace)); - actionManager->addAction("fill_selection_background_color_opacity", m_fillBackgroundColorOpacity); connect(m_fillBackgroundColorOpacity, SIGNAL(triggered()), this, SLOT(fillBackgroundColorOpacity())); - m_fillPatternOpacity = new KisAction(i18n("Fill with Pattern (Opacity)"), this); + m_fillPatternOpacity = actionManager->createAction("fill_selection_pattern_opacity"); m_fillPatternOpacity->setActivationFlags(KisAction::ACTIVE_DEVICE); m_fillPatternOpacity->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE); - actionManager->addAction("fill_selection_pattern_opacity", m_fillPatternOpacity); connect(m_fillPatternOpacity, SIGNAL(triggered()), this, SLOT(fillPatternOpacity())); - m_strokeShapes = new KisAction(i18nc("@action:inmenu", "Stro&ke selected shapes"), this); + m_strokeShapes = actionManager->createAction("stroke_shapes"); m_strokeShapes->setActivationFlags(KisAction::SHAPES_SELECTED); - actionManager->addAction("stroke_shapes", m_strokeShapes); connect(m_strokeShapes, SIGNAL(triggered()), this, SLOT(paintSelectedShapes())); - m_toggleDisplaySelection = new KisAction(i18n("Display Selection"), this); + m_toggleDisplaySelection = actionManager->createAction("toggle_display_selection"); m_toggleDisplaySelection->setCheckable(true); m_toggleDisplaySelection->setActivationFlags(KisAction::ACTIVE_NODE); - - m_toggleDisplaySelection->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::Key_H)); - actionManager->addAction("toggle_display_selection", m_toggleDisplaySelection); connect(m_toggleDisplaySelection, SIGNAL(triggered()), this, SLOT(toggleDisplaySelection())); m_toggleDisplaySelection->setChecked(true); - m_imageResizeToSelection = new KisAction(i18n("Trim to Selection"), this); + m_imageResizeToSelection = actionManager->createAction("resizeimagetoselection"); m_imageResizeToSelection->setActivationFlags(KisAction::PIXELS_SELECTED); - actionManager->addAction("resizeimagetoselection", m_imageResizeToSelection); connect(m_imageResizeToSelection, SIGNAL(triggered()), this, SLOT(imageResizeToSelection())); - KisAction *action = new KisAction(i18nc("@action:inmenu", "&Convert to Vector Selection"), this); + action = actionManager->createAction("convert_to_vector_selection"); action->setActivationFlags(KisAction::PIXEL_SELECTION_WITH_PIXELS); - actionManager->addAction("convert_to_vector_selection", action); connect(action, SIGNAL(triggered()), SLOT(convertToVectorSelection())); - action = new KisAction(i18nc("@action:inmenu", "Convert &Shapes to Vector Selection"), this); + action = actionManager->createAction("convert_shapes_to_vector_selection"); action->setActivationFlags(KisAction::SHAPES_SELECTED); - actionManager->addAction("convert_shapes_to_vector_selection", action); connect(action, SIGNAL(triggered()), SLOT(convertShapesToVectorSelection())); - action = new KisAction(i18nc("@action:inmenu", "&Convert to Shape"), this); + action = actionManager->createAction("convert_selection_to_shape"); action->setActivationFlags(KisAction::PIXEL_SELECTION_WITH_PIXELS); - actionManager->addAction("convert_selection_to_shape", action); connect(action, SIGNAL(triggered()), SLOT(convertToShape())); - m_toggleSelectionOverlayMode = new KisAction(i18nc("@action:inmenu", "&Toggle Selection Display Mode"), this); - actionManager->addAction("toggle-selection-overlay-mode", m_toggleSelectionOverlayMode); + m_toggleSelectionOverlayMode = actionManager->createAction("toggle-selection-overlay-mode"); connect(m_toggleSelectionOverlayMode, SIGNAL(triggered()), SLOT(slotToggleSelectionDecoration())); QClipboard *cb = QApplication::clipboard(); diff --git a/krita/ui/kis_view_plugin.h b/krita/ui/kis_view_plugin.h --- a/krita/ui/kis_view_plugin.h +++ b/krita/ui/kis_view_plugin.h @@ -47,6 +47,8 @@ */ void addAction(const QString& name, KisAction* action); + KisAction* createAction(const QString& name); + void addUIFactory(KisOperationUIFactory* factory); void addOperation(KisOperation* operation); diff --git a/krita/ui/kis_view_plugin.cpp b/krita/ui/kis_view_plugin.cpp --- a/krita/ui/kis_view_plugin.cpp +++ b/krita/ui/kis_view_plugin.cpp @@ -40,6 +40,14 @@ } } +KisAction* KisViewPlugin::createAction(const QString& name) +{ + if (m_view) { + return m_view->actionManager()->createAction(name); + } + return 0; +} + void KisViewPlugin::addUIFactory(KisOperationUIFactory* factory) { if (m_view) { diff --git a/krita/ui/tool/kis_tool.cc b/krita/ui/tool/kis_tool.cc --- a/krita/ui/tool/kis_tool.cc +++ b/krita/ui/tool/kis_tool.cc @@ -68,6 +68,7 @@ #include "kis_action_registry.h" + struct KisTool::Private { Private() : currentPattern(0), @@ -104,12 +105,12 @@ KActionCollection *collection = this->canvas()->canvasController()->actionCollection(); if (!collection->action("toggle_fg_bg")) { - QAction *toggleFgBg = KisActionRegistry::instance()->makeQAction("toggle_fg_bg", collection, "Canvas"); + QAction *toggleFgBg = KisActionRegistry::instance()->makeQAction("toggle_fg_bg", collection); collection->addAction("toggle_fg_bg", toggleFgBg); } if (!collection->action("reset_fg_bg")) { - QAction *toggleFgBg = KisActionRegistry::instance()->makeQAction("reset_fg_bg", collection, "Canvas"); + QAction *toggleFgBg = KisActionRegistry::instance()->makeQAction("reset_fg_bg", collection); collection->addAction("reset_fg_bg", toggleFgBg); } diff --git a/krita/ui/tool/kis_tool_polyline_base.cpp b/krita/ui/tool/kis_tool_polyline_base.cpp --- a/krita/ui/tool/kis_tool_polyline_base.cpp +++ b/krita/ui/tool/kis_tool_polyline_base.cpp @@ -44,14 +44,9 @@ m_type(type), m_closeSnappingActivated(false) { - KisCanvas2 * kiscanvas = dynamic_cast(this->canvas()); - KActionCollection *collection = this->canvas()->canvasController()->actionCollection(); - if (kiscanvas && kiscanvas->viewManager()) { - QAction *undo_polygon_selection = new QAction("Undo Polygon Selection Points",this); - undo_polygon_selection->setShortcut(QKeySequence(Qt::ShiftModifier + Qt::Key_Z)); - collection->addAction("undo_polygon_selection", undo_polygon_selection); - addAction("undo_polygon_selection", undo_polygon_selection); - } + QAction *undo_polygon_selection = + KisActionRegistry::instance()->makeQAction("undo_polygon_selection", this); + addAction("undo_polygon_selection", undo_polygon_selection); } diff --git a/libs/flake/KoToolBase.h b/libs/flake/KoToolBase.h --- a/libs/flake/KoToolBase.h +++ b/libs/flake/KoToolBase.h @@ -125,6 +125,7 @@ */ QAction *action(const QString &name) const; + /** * Called when (one of) the mouse or stylus buttons is pressed. * Implementors should call event->ignore() if they do not actually use the event. diff --git a/libs/flake/KoToolBase.cpp b/libs/flake/KoToolBase.cpp --- a/libs/flake/KoToolBase.cpp +++ b/libs/flake/KoToolBase.cpp @@ -60,41 +60,45 @@ Q_D(const KoToolBase); // Enable this to easily generate action files for tools -// if (d->actions.size() > 0) { - -// QDomDocument doc; -// QDomElement e = doc.createElement("Actions"); -// e.setAttribute("name", toolId()); -// e.setAttribute("version", "1"); -// doc.appendChild(e); - -// foreach(QAction *ac, d->actions.values()) { -// QAction *action = qobject_cast(ac); -// if (action) { -// QDomElement a = doc.createElement("Action"); -// a.setAttribute("name", action->objectName()); -// a.setAttribute("icon", action->icon().name()); -// a.setAttribute("text" , action->text()); -// a.setAttribute("whatsThis" , action->whatsThis()); -// a.setAttribute("toolTip" , action->toolTip()); -// a.setAttribute("iconText" , action->iconText()); -// a.setAttribute("shortcut" , action->shortcut(QAction::ActiveShortcut).toString()); -// a.setAttribute("defaultShortcut" , action->shortcut(QAction::DefaultShortcut).toString()); -// a.setAttribute("isCheckable" , QString((action->isChecked() ? "true" : "false"))); -// a.setAttribute("statusTip", action->statusTip()); -// e.appendChild(a); -// } -// else { -// qDebug() << "Got a QAction:" << ac->objectName(); -// } - -// } -// QFile f(toolId() + ".action"); -// f.open(QFile::WriteOnly); -// f.write(doc.toString().toUtf8()); -// f.close(); -// } + // if (actions().size() > 0) { + + // QDomDocument doc; + // QDomElement e = doc.createElement("Actions"); + // e.setAttribute("name", toolId()); + // e.setAttribute("version", "2"); + // doc.appendChild(e); + + // foreach(QAction *action, actions().values()) { + // QDomElement a = doc.createElement("Action"); + // a.setAttribute("name", action->objectName()); + + // // But seriously, XML is the worst format ever designed + // auto addElement = [&](QString title, QString content) { + // QDomElement newNode = doc.createElement(title); + // QDomText newText = doc.createTextNode(content); + // newNode.appendChild(newText); + // a.appendChild(newNode); + // }; + + // addElement("icon", action->icon().name()); + // addElement("text", action->text()); + // addElement("whatsThis" , action->whatsThis()); + // addElement("toolTip" , action->toolTip()); + // addElement("iconText" , action->iconText()); + // addElement("shortcut" , action->shortcut().toString()); + // addElement("defaultShortcut" , action->shortcut().toString()); + // addElement("isCheckable" , QString((action->isChecked() ? "true" : "false"))); + // addElement("statusTip", action->statusTip()); + // e.appendChild(a); + // } + // QFile f(toolId() + ".action"); + // f.open(QFile::WriteOnly); + // f.write(doc.toString().toUtf8()); + // f.close(); + + // } + // else { // qDebug() << "Tool" << toolId() << "has no actions"; // } diff --git a/libs/flake/KoToolManager.h b/libs/flake/KoToolManager.h --- a/libs/flake/KoToolManager.h +++ b/libs/flake/KoToolManager.h @@ -156,7 +156,7 @@ * @param ac the actionCollection that will be the parent of the actions. * @param controller tools registered with this controller will have all their actions added as well. */ - void registerTools(KActionCollection *ac, KoCanvasController *controller); + void registerToolActions(KActionCollection *ac, KoCanvasController *controller); /** * Register a new canvas controller @@ -224,6 +224,9 @@ */ QList toolActionList() const; + /// Update the internal shortcuts of each tool. (Activation shortcuts are exposed already.) + void updateToolShortcuts(); + /// Request tool activation for the given canvas controller void requestToolActivation(KoCanvasController *controller); diff --git a/libs/flake/KoToolManager.cpp b/libs/flake/KoToolManager.cpp --- a/libs/flake/KoToolManager.cpp +++ b/libs/flake/KoToolManager.cpp @@ -40,6 +40,7 @@ #include "tools/KoCreateShapesTool.h" #include "tools/KoZoomTool.h" #include "tools/KoPanTool.h" +#include "kis_action_registry.h" // Qt + kde #include @@ -53,6 +54,7 @@ #include #include #include +#include #include #include @@ -64,76 +66,6 @@ Q_GLOBAL_STATIC(KoToolManager, s_instance) -class Q_DECL_HIDDEN KoToolAction::Private -{ -public: - ToolHelper* toolHelper; -}; - -KoToolAction::KoToolAction(ToolHelper* toolHelper) - : QObject(toolHelper) - , d(new Private) -{ - d->toolHelper = toolHelper; -} - -KoToolAction::~KoToolAction() -{ - delete d; -} - -void KoToolAction::trigger() -{ - d->toolHelper->activate(); -} - - -QString KoToolAction::iconText() const -{ - return d->toolHelper->iconText(); -} - -QString KoToolAction::toolTip() const -{ - return d->toolHelper->toolTip(); -} - -QString KoToolAction::id() const -{ - return d->toolHelper->id(); -} - -QString KoToolAction::iconName() const -{ - return d->toolHelper->iconName(); -} - -QKeySequence KoToolAction::shortcut() const -{ - return d->toolHelper->shortcut(); -} - - -QString KoToolAction::section() const -{ - return d->toolHelper->toolType(); -} - -int KoToolAction::priority() const -{ - return d->toolHelper->priority(); -} - -int KoToolAction::buttonGroupId() const -{ - return d->toolHelper->uniqueId(); -} - -QString KoToolAction::visibilityCode() const -{ - return d->toolHelper->activationShapeId(); -} - class CanvasData { @@ -255,873 +187,896 @@ QMap, QString> disabledCanvasShortcuts; ///< Shortcuts that were temporarily removed from canvas actions because the tool overrides }; -KoToolManager::Private::Private(KoToolManager *qq) - : q(qq), - canvasData(0), - layerExplicitlyDisabled(false) + +// ******** KoToolManager ********** +KoToolManager::KoToolManager() + : QObject(), + d(new Private(this)) { + connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), + this, SLOT(movedFocus(QWidget*, QWidget*))); } -KoToolManager::Private::~Private() +KoToolManager::~KoToolManager() { - qDeleteAll(tools); + delete d; } -// helper method. -CanvasData *KoToolManager::Private::createCanvasData(KoCanvasController *controller, const KoInputDevice &device) +QList KoToolManager::toolActionList() const { - QHash toolsHash; - foreach(ToolHelper *tool, tools) { - QPair toolPair = q->createTools(controller, tool); - if (toolPair.second) { // only if a real tool was created - toolsHash.insert(toolPair.first, toolPair.second); + QList answer; + answer.reserve(d->tools.count()); + foreach(ToolHelper *tool, d->tools) { + if (tool->id() == KoCreateShapesTool_ID) + continue; // don't show this one. + answer.append(tool->toolAction()); + } + return answer; +} + +void KoToolManager::requestToolActivation(KoCanvasController * controller) +{ + if (d->canvasses.contains(controller)) { + QString activeToolId = d->canvasses.value(controller).first()->activeToolId; + foreach(ToolHelper * th, d->tools) { + if (th->id() == activeToolId) { + d->toolActivated(th); + break; + } } } - KoCreateShapesTool *createShapesTool = dynamic_cast(toolsHash.value(KoCreateShapesTool_ID)); - Q_ASSERT(createShapesTool); - QString id = KoShapeRegistry::instance()->keys()[0]; - createShapesTool->setShapeId(id); +} - CanvasData *cd = new CanvasData(controller, device); - cd->allTools = toolsHash; - return cd; +KoInputDevice KoToolManager::currentInputDevice() const +{ + return d->inputDevice; } -void KoToolManager::Private::setup() +void KoToolManager::registerToolActions(KActionCollection *ac, KoCanvasController *controller) { - if (tools.size() > 0) - return; + Q_ASSERT(controller); + Q_ASSERT(ac); - KoShapeRegistry::instance(); - KoToolRegistry *registry = KoToolRegistry::instance(); - foreach(const QString & id, registry->keys()) { - ToolHelper *t = new ToolHelper(registry->value(id)); - tools.append(t); + d->setup(); + + if (!d->canvasses.contains(controller)) { + return; } - // connect to all tools so we can hear their button-clicks - foreach(ToolHelper *tool, tools) - connect(tool, SIGNAL(toolActivated(ToolHelper*)), q, SLOT(toolActivated(ToolHelper*))); + // Actions available during the use of individual tools + CanvasData *cd = d->canvasses.value(controller).first(); + foreach(KoToolBase *tool, cd->allTools) { + QHash actions = tool->actions(); + QHash::const_iterator action(actions.constBegin()); + for (; action != actions.constEnd(); ++action) { + if (!ac->action(action.key())) + ac->addAction(action.key(), action.value()); + } + } - // load pluggable input devices - KoInputDeviceHandlerRegistry::instance(); + // Actions used to switch tools via shortcuts + foreach(ToolHelper * th, d->tools) { + if (ac->action(th->id())) { + continue; + } + ShortcutToolAction* action = th->createShortcutToolAction(ac); + ac->addCategorizedAction(th->id(), action, "tool-shortcuts"); + } } -void KoToolManager::Private::connectActiveTool() +void KoToolManager::addController(KoCanvasController *controller) { - if (canvasData->activeTool) { - connect(canvasData->activeTool, SIGNAL(cursorChanged(const QCursor &)), - q, SLOT(updateCursor(const QCursor &))); - connect(canvasData->activeTool, SIGNAL(activateTool(const QString &)), - q, SLOT(switchToolRequested(const QString &))); - connect(canvasData->activeTool, SIGNAL(activateTemporary(const QString &)), - q, SLOT(switchToolTemporaryRequested(const QString &))); - connect(canvasData->activeTool, SIGNAL(done()), q, SLOT(switchBackRequested())); - connect(canvasData->activeTool, SIGNAL(statusTextChanged(const QString &)), - q, SIGNAL(changedStatusText(const QString &))); - } + Q_ASSERT(controller); + if (d->canvasses.contains(controller)) + return; + d->setup(); + d->attachCanvas(controller); + connect(controller->proxyObject, SIGNAL(destroyed(QObject*)), this, SLOT(attemptCanvasControllerRemoval(QObject*))); + connect(controller->proxyObject, SIGNAL(canvasRemoved(KoCanvasController*)), this, SLOT(detachCanvas(KoCanvasController*))); + connect(controller->proxyObject, SIGNAL(canvasSet(KoCanvasController*)), this, SLOT(attachCanvas(KoCanvasController*))); +} - // we expect the tool to emit a cursor on activation. - updateCursor(Qt::ForbiddenCursor); +void KoToolManager::removeCanvasController(KoCanvasController *controller) +{ + Q_ASSERT(controller); + disconnect(controller->proxyObject, SIGNAL(canvasRemoved(KoCanvasController*)), this, SLOT(detachCanvas(KoCanvasController*))); + disconnect(controller->proxyObject, SIGNAL(canvasSet(KoCanvasController*)), this, SLOT(attachCanvas(KoCanvasController*))); + d->detachCanvas(controller); } -void KoToolManager::Private::disconnectActiveTool() +void KoToolManager::attemptCanvasControllerRemoval(QObject* controller) { - if (canvasData->activeTool) { - canvasData->deactivateToolActions(); - // repaint the decorations before we deactivate the tool as it might deleted - // data needed for the repaint - canvasData->activeTool->deactivate(); - disconnect(canvasData->activeTool, SIGNAL(cursorChanged(const QCursor&)), - q, SLOT(updateCursor(const QCursor&))); - disconnect(canvasData->activeTool, SIGNAL(activateTool(const QString &)), - q, SLOT(switchToolRequested(const QString &))); - disconnect(canvasData->activeTool, SIGNAL(activateTemporary(const QString &)), - q, SLOT(switchToolTemporaryRequested(const QString &))); - disconnect(canvasData->activeTool, SIGNAL(done()), q, SLOT(switchBackRequested())); - disconnect(canvasData->activeTool, SIGNAL(statusTextChanged(const QString &)), - q, SIGNAL(changedStatusText(const QString &))); + KoCanvasControllerProxyObject* controllerActual = qobject_cast(controller); + if (controllerActual) { + removeCanvasController(controllerActual->canvasController()); } +} - // emit a empty status text to clear status text from last active tool - emit q->changedStatusText(QString()); +void KoToolManager::updateShapeControllerBase(KoShapeBasedDocumentBase *shapeController, KoCanvasController *canvasController) +{ + if (!d->canvasses.contains(canvasController)) + return; + + QList canvasses = d->canvasses[canvasController]; + foreach(CanvasData *canvas, canvasses) { + foreach(KoToolBase *tool, canvas->allTools.values()) { + tool->updateShapeController(shapeController); + } + } } -void KoToolManager::Private::switchTool(KoToolBase *tool, bool temporary) +void KoToolManager::switchToolRequested(const QString & id) { + Q_ASSERT(d->canvasData); + if (!d->canvasData) return; - Q_ASSERT(tool); - if (canvasData == 0) - return; + while (!d->canvasData->stack.isEmpty()) // switching means to flush the stack + d->canvasData->stack.pop(); + d->switchTool(id, false); +} - if (canvasData->activeTool == tool && tool->toolId() != KoInteractionTool_ID) - return; +void KoToolManager::switchInputDeviceRequested(const KoInputDevice &id) +{ + if (!d->canvasData) return; + d->switchInputDevice(id); +} - disconnectActiveTool(); - canvasData->activeTool = tool; - connectActiveTool(); - postSwitchTool(temporary); +void KoToolManager::switchToolTemporaryRequested(const QString &id) +{ + d->switchTool(id, true); } -void KoToolManager::Private::switchTool(const QString &id, bool temporary) +void KoToolManager::switchBackRequested() { - Q_ASSERT(canvasData); - if (!canvasData) return; + if (!d->canvasData) return; - if (canvasData->activeTool && temporary) - canvasData->stack.push(canvasData->activeToolId); - canvasData->activeToolId = id; - KoToolBase *tool = canvasData->allTools.value(id); - if (! tool) { + if (d->canvasData->stack.isEmpty()) { + // default to changing to the interactionTool + d->switchTool(KoInteractionTool_ID, false); return; } + d->switchTool(d->canvasData->stack.pop(), false); +} - foreach(ToolHelper *th, tools) { - if (th->id() == id) { - canvasData->activationShapeId = th->activationShapeId(); - break; +KoCreateShapesTool * KoToolManager::shapeCreatorTool(KoCanvasBase *canvas) const +{ + Q_ASSERT(canvas); + foreach(KoCanvasController *controller, d->canvasses.keys()) { + if (controller->canvas() == canvas) { + KoCreateShapesTool *createTool = dynamic_cast + (d->canvasData->allTools.value(KoCreateShapesTool_ID)); + Q_ASSERT(createTool /* ID changed? */); + return createTool; } } - - switchTool(tool, temporary); + Q_ASSERT(0); // this should not happen + return 0; } -void KoToolManager::Private::postSwitchTool(bool temporary) +KoToolBase *KoToolManager::toolById(KoCanvasBase *canvas, const QString &id) const { -#ifndef NDEBUG - int canvasCount = 1; - foreach(QList list, canvasses) { - bool first = true; - foreach(CanvasData *data, list) { - if (first) { - debugFlake << "Canvas" << canvasCount++; - } - debugFlake << " +- Tool:" << data->activeToolId << (data == canvasData ? " *" : ""); - first = false; - } + Q_ASSERT(canvas); + foreach(KoCanvasController *controller, d->canvasses.keys()) { + if (controller->canvas() == canvas) + return d->canvasData->allTools.value(id); } -#endif - Q_ASSERT(canvasData); - if (!canvasData) return; + return 0; +} - KoToolBase::ToolActivation toolActivation; - if (temporary) - toolActivation = KoToolBase::TemporaryActivation; - else - toolActivation = KoToolBase::DefaultActivation; - QSet shapesToOperateOn; - if (canvasData->activeTool - && canvasData->activeTool->canvas() - && canvasData->activeTool->canvas()->shapeManager()) { - KoSelection *selection = canvasData->activeTool->canvas()->shapeManager()->selection(); - Q_ASSERT(selection); +KoCanvasController *KoToolManager::activeCanvasController() const +{ + if (! d->canvasData) return 0; + return d->canvasData->canvas; +} - foreach(KoShape *shape, selection->selectedShapes()) { - QSet delegates = shape->toolDelegates(); - if (delegates.isEmpty()) { // no delegates, just the orig shape - shapesToOperateOn << shape; - } else { - shapesToOperateOn += delegates; +QString KoToolManager::preferredToolForSelection(const QList &shapes) +{ + QList types; + foreach(KoShape *shape, shapes) + if (! types.contains(shape->shapeId())) + types.append(shape->shapeId()); + + QString toolType = KoInteractionTool_ID; + int prio = INT_MAX; + foreach(ToolHelper *helper, d->tools) { + if (helper->priority() >= prio) + continue; + if (helper->toolType() == KoToolFactoryBase::mainToolType()) + continue; + + bool toolWillWork = false; + foreach (const QString &type, types) { + if (helper->activationShapeId().split(',').contains(type)) { + toolWillWork = true; + break; } } + if (toolWillWork) { + toolType = helper->id(); + prio = helper->priority(); + } } + return toolType; +} - if (canvasData->canvas->canvas()) { - // Caller of postSwitchTool expect this to be called to update the selected tool - updateToolForProxy(); - canvasData->activeTool->activate(toolActivation, shapesToOperateOn); - KoCanvasBase *canvas = canvasData->canvas->canvas(); - canvas->updateInputMethodInfo(); - } else { - canvasData->activeTool->activate(toolActivation, shapesToOperateOn); +void KoToolManager::injectDeviceEvent(KoInputDeviceHandlerEvent * event) +{ + if (d->canvasData && d->canvasData->canvas->canvas()) { + if (static_cast(event->type()) == KoInputDeviceHandlerEvent::ButtonPressed) + d->canvasData->activeTool->customPressEvent(event->pointerEvent()); + else if (static_cast(event->type()) == KoInputDeviceHandlerEvent::ButtonReleased) + d->canvasData->activeTool->customReleaseEvent(event->pointerEvent()); + else if (static_cast(event->type()) == KoInputDeviceHandlerEvent::PositionChanged) + d->canvasData->activeTool->customMoveEvent(event->pointerEvent()); } +} - QList > optionWidgetList = canvasData->activeTool->optionWidgets(); - if (optionWidgetList.empty()) { // no option widget. - QWidget *toolWidget; - QString title; - foreach(ToolHelper *tool, tools) { - if (tool->id() == canvasData->activeTool->toolId()) { - title = tool->toolTip(); - break; +void KoToolManager::addDeferredToolFactory(KoToolFactoryBase *toolFactory) +{ + ToolHelper *tool = new ToolHelper(toolFactory); + // make sure all plugins are loaded as otherwise we will not load them + d->setup(); + d->tools.append(tool); + + // connect to all tools so we can hear their button-clicks + connect(tool, SIGNAL(toolActivated(ToolHelper*)), this, SLOT(toolActivated(ToolHelper*))); + + // now create tools for all existing canvases + foreach(KoCanvasController *controller, d->canvasses.keys()) { + + // this canvascontroller is unknown, which is weird + if (!d->canvasses.contains(controller)) { + continue; + } + + // create a tool for all canvasdata objects (i.e., all input devices on this canvas) + foreach (CanvasData *cd, d->canvasses[controller]) { + QPair toolPair = createTools(controller, tool); + if (toolPair.second) { + cd->allTools.insert(toolPair.first, toolPair.second); } } - toolWidget = canvasData->dummyToolWidget; - if (toolWidget == 0) { - toolWidget = new QWidget(); - toolWidget->setObjectName("DummyToolWidget"); - QVBoxLayout *layout = new QVBoxLayout(toolWidget); - layout->setMargin(3); - canvasData->dummyToolLabel = new QLabel(toolWidget); - layout->addWidget(canvasData->dummyToolLabel); - layout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding)); - toolWidget->setLayout(layout); - canvasData->dummyToolWidget = toolWidget; + + // Then create a button for the toolbox for this canvas + if (tool->id() == KoCreateShapesTool_ID) { + continue; } - canvasData->dummyToolLabel->setText(i18n("Active tool: %1", title)); - optionWidgetList.append(toolWidget); + + emit addedTool(tool->toolAction(), controller); } +} - // Activate the actions for the currently active tool - canvasData->activateToolActions(); +QPair KoToolManager::createTools(KoCanvasController *controller, ToolHelper *tool) +{ + // XXX: maybe this method should go into the private class? - emit q->changedTool(canvasData->canvas, uniqueToolIds.value(canvasData->activeTool)); + QHash origHash; - KoCanvasControllerWidget *canvasControllerWidget = dynamic_cast(canvasData->canvas); - if (canvasControllerWidget) { - canvasControllerWidget->setToolOptionWidgets(optionWidgetList); + if (d->canvasses.contains(controller)) { + origHash = d->canvasses.value(controller).first()->allTools; } -} + if (origHash.contains(tool->id())) { + return QPair(tool->id(), origHash.value(tool->id())); + } -void KoToolManager::Private::switchCanvasData(CanvasData *cd) -{ - Q_ASSERT(cd); + debugFlake << "Creating tool" << tool->id() << ". Activated on:" << tool->activationShapeId() << ", prio:" << tool->priority(); - KoCanvasBase *oldCanvas = 0; - KoInputDevice oldInputDevice; + KoToolBase *tl = tool->createTool(controller->canvas()); + if (tl) { + d->uniqueToolIds.insert(tl, tool->uniqueId()); - if (canvasData) { - oldCanvas = canvasData->canvas->canvas(); - oldInputDevice = canvasData->inputDevice; + tl->setObjectName(tool->id()); - if (canvasData->activeTool) { - disconnectActiveTool(); + foreach(QAction *action, tl->actions()) { + action->setEnabled(false); } - KoToolProxy *proxy = proxies.value(oldCanvas); - Q_ASSERT(proxy); - proxy->setActiveTool(0); } - canvasData = cd; - inputDevice = canvasData->inputDevice; - - if (canvasData->activeTool) { - connectActiveTool(); - postSwitchTool(false); + KoZoomTool *zoomTool = dynamic_cast(tl); + if (zoomTool) { + zoomTool->setCanvasController(controller); } - if (oldInputDevice != canvasData->inputDevice) { - emit q->inputDeviceChanged(canvasData->inputDevice); + KoPanTool *panTool = dynamic_cast(tl); + if (panTool) { + panTool->setCanvasController(controller); } - if (oldCanvas != canvasData->canvas->canvas()) { - emit q->changedCanvas(canvasData->canvas->canvas()); - } + return QPair(tool->id(), tl); } -void KoToolManager::Private::toolActivated(ToolHelper *tool) +// NOT IMPLEMENTED +void KoToolManager::updateToolShortcuts() { - Q_ASSERT(tool); - - Q_ASSERT(canvasData); - if (!canvasData) return; - KoToolBase *t = canvasData->allTools.value(tool->id()); - Q_ASSERT(t); - - canvasData->activeToolId = tool->id(); - canvasData->activationShapeId = tool->activationShapeId(); - - switchTool(t, false); + // auto actionRegistry = KisActionRegistry::instance(); + // foreach (KoToolBase *t, allTools) { + // for (auto it = t->actions().constBegin(); + // it != t->actions().constEnd(); + // ++it;) { + // actionRegistry->updateShortcut(it.key(), it.value()); + // } + // } } -void KoToolManager::Private::detachCanvas(KoCanvasController *controller) +KoToolManager* KoToolManager::instance() { - Q_ASSERT(controller); - // check if we are removing the active canvas controller - if (canvasData && canvasData->canvas == controller) { - KoCanvasController *newCanvas = 0; - // try to find another canvas controller beside the one we are removing - foreach(KoCanvasController* canvas, canvasses.keys()) { - if (canvas != controller) { - // yay found one - newCanvas = canvas; - break; - } - } - if (newCanvas) { - switchCanvasData(canvasses.value(newCanvas).first()); - } else { - KoCanvasControllerWidget *canvasControllerWidget = dynamic_cast(canvasData->canvas); - if (canvasControllerWidget) { - canvasControllerWidget->setToolOptionWidgets(QList >()); - } - // as a last resort just set a blank one - canvasData = 0; - } - } - - KoToolProxy *proxy = proxies.value(controller->canvas()); - if (proxy) - proxy->setActiveTool(0); - - QList tools; - foreach(CanvasData *canvasData, canvasses.value(controller)) { - foreach(KoToolBase *tool, canvasData->allTools) { - if (! tools.contains(tool)) { - tools.append(tool); - } - } - delete canvasData; - } - foreach(KoToolBase *tool, tools) { - uniqueToolIds.remove(tool); - delete tool; - } - canvasses.remove(controller); - emit q->changedCanvas(canvasData ? canvasData->canvas->canvas() : 0); + return s_instance; } -void KoToolManager::Private::attachCanvas(KoCanvasController *controller) +QString KoToolManager::activeToolId() const { - Q_ASSERT(controller); - CanvasData *cd = createCanvasData(controller, KoInputDevice::mouse()); + if (!d->canvasData) return QString(); + return d->canvasData->activeToolId; +} - // switch to new canvas as the active one. - switchCanvasData(cd); - inputDevice = cd->inputDevice; - QList canvasses_; - canvasses_.append(cd); - canvasses[controller] = canvasses_; +KoToolManager::Private *KoToolManager::priv() +{ + return d; +} - KoToolProxy *tp = proxies[controller->canvas()]; - if (tp) - tp->priv()->setCanvasController(controller); - if (cd->activeTool == 0) { - // no active tool, so we activate the highest priority main tool - int highestPriority = INT_MAX; - ToolHelper * helper = 0; - foreach(ToolHelper * th, tools) { - if (th->toolType() == KoToolFactoryBase::mainToolType()) { - if (th->priority() < highestPriority) { - highestPriority = qMin(highestPriority, th->priority()); - helper = th; - } - } - } - if (helper) - toolActivated(helper); - } +/**** KoToolManager::Private ****/ - Connector *connector = new Connector(controller->canvas()->shapeManager()); - connect(connector, SIGNAL(selectionChanged(QList)), q, - SLOT(selectionChanged(QList))); - connect(controller->canvas()->shapeManager()->selection(), - SIGNAL(currentLayerChanged(const KoShapeLayer*)), - q, SLOT(currentLayerChanged(const KoShapeLayer*))); - - emit q->changedCanvas(canvasData ? canvasData->canvas->canvas() : 0); +KoToolManager::Private::Private(KoToolManager *qq) + : q(qq), + canvasData(0), + layerExplicitlyDisabled(false) +{ } -void KoToolManager::Private::movedFocus(QWidget *from, QWidget *to) +KoToolManager::Private::~Private() { - Q_UNUSED(from); - // no canvas anyway or no focus set anyway? - if (!canvasData || to == 0) { - return; - } + qDeleteAll(tools); +} - // Check if this app is about QWidget-based KoCanvasControllerWidget canvasses - // XXX: Focus handling for non-qwidget based canvases! - KoCanvasControllerWidget *canvasControllerWidget = dynamic_cast(canvasData->canvas); - if (!canvasControllerWidget) { - return; +// helper method. +CanvasData *KoToolManager::Private::createCanvasData(KoCanvasController *controller, const KoInputDevice &device) +{ + QHash toolsHash; + foreach(ToolHelper *tool, tools) { + QPair toolPair = q->createTools(controller, tool); + if (toolPair.second) { // only if a real tool was created + toolsHash.insert(toolPair.first, toolPair.second); + } } + KoCreateShapesTool *createShapesTool = dynamic_cast(toolsHash.value(KoCreateShapesTool_ID)); + Q_ASSERT(createShapesTool); + QString id = KoShapeRegistry::instance()->keys()[0]; + createShapesTool->setShapeId(id); - // canvasWidget is set as focusproxy for KoCanvasControllerWidget, - // so all focus checks are to be done against canvasWidget objects + CanvasData *cd = new CanvasData(controller, device); + cd->allTools = toolsHash; + return cd; +} - // focus returned to current canvas? - if (to == canvasData->canvas->canvas()->canvasWidget()) { - // nothing to do +void KoToolManager::Private::setup() +{ + if (tools.size() > 0) return; - } - // if the 'to' is one of our canvasWidgets, then switch. - - // for code simplicity the current canvas will be checked again, - // but would have been catched already in the lines above, so no issue - KoCanvasController *newCanvas = 0; - foreach(KoCanvasController* canvas, canvasses.keys()) { - if (canvas->canvas()->canvasWidget() == to) { - newCanvas = canvas; - break; - } + KoShapeRegistry::instance(); + KoToolRegistry *registry = KoToolRegistry::instance(); + foreach(const QString & id, registry->keys()) { + ToolHelper *t = new ToolHelper(registry->value(id)); + tools.append(t); } - // none of our canvasWidgets got focus? - if (newCanvas == 0) { - return; - } + // connect to all tools so we can hear their button-clicks + foreach(ToolHelper *tool, tools) + connect(tool, SIGNAL(toolActivated(ToolHelper*)), q, SLOT(toolActivated(ToolHelper*))); - // switch to canvasdata matching inputdevice used last with this app instance - foreach(CanvasData *data, canvasses.value(newCanvas)) { - if (data->inputDevice == inputDevice) { - switchCanvasData(data); - return; - } - } - // if no such inputDevice for this canvas, then simply fallback to first one - switchCanvasData(canvasses.value(newCanvas).first()); + // load pluggable input devices + KoInputDeviceHandlerRegistry::instance(); } -void KoToolManager::Private::updateCursor(const QCursor &cursor) +void KoToolManager::Private::connectActiveTool() { - Q_ASSERT(canvasData); - Q_ASSERT(canvasData->canvas); - Q_ASSERT(canvasData->canvas->canvas()); - canvasData->canvas->canvas()->setCursor(cursor); + if (canvasData->activeTool) { + connect(canvasData->activeTool, SIGNAL(cursorChanged(const QCursor &)), + q, SLOT(updateCursor(const QCursor &))); + connect(canvasData->activeTool, SIGNAL(activateTool(const QString &)), + q, SLOT(switchToolRequested(const QString &))); + connect(canvasData->activeTool, SIGNAL(activateTemporary(const QString &)), + q, SLOT(switchToolTemporaryRequested(const QString &))); + connect(canvasData->activeTool, SIGNAL(done()), q, SLOT(switchBackRequested())); + connect(canvasData->activeTool, SIGNAL(statusTextChanged(const QString &)), + q, SIGNAL(changedStatusText(const QString &))); + } + + // we expect the tool to emit a cursor on activation. + updateCursor(Qt::ForbiddenCursor); } -void KoToolManager::Private::selectionChanged(const QList &shapes) -{ - QList types; - foreach(KoShape *shape, shapes) { - QSet delegates = shape->toolDelegates(); - if (delegates.isEmpty()) { // no delegates, just the orig shape - delegates << shape; - } - foreach (KoShape *shape2, delegates) { - Q_ASSERT(shape2); - if (! types.contains(shape2->shapeId())) { - types.append(shape2->shapeId()); - } - } - } - // check if there is still a shape selected the active tool can work on - // there needs to be at least one shape for a tool without an activationShapeId - // to work - // if not change the current tool to the default tool - if (!(canvasData->activationShapeId.isNull() && shapes.size() > 0) - && canvasData->activationShapeId != "flake/always" - && canvasData->activationShapeId != "flake/edit") { - - bool currentToolWorks = false; - foreach (const QString &type, types) { - if (canvasData->activationShapeId.split(',').contains(type)) { - currentToolWorks = true; - break; - } - } - if (!currentToolWorks) { - switchTool(KoInteractionTool_ID, false); - } +void KoToolManager::Private::disconnectActiveTool() +{ + if (canvasData->activeTool) { + canvasData->deactivateToolActions(); + // repaint the decorations before we deactivate the tool as it might deleted + // data needed for the repaint + canvasData->activeTool->deactivate(); + disconnect(canvasData->activeTool, SIGNAL(cursorChanged(const QCursor&)), + q, SLOT(updateCursor(const QCursor&))); + disconnect(canvasData->activeTool, SIGNAL(activateTool(const QString &)), + q, SLOT(switchToolRequested(const QString &))); + disconnect(canvasData->activeTool, SIGNAL(activateTemporary(const QString &)), + q, SLOT(switchToolTemporaryRequested(const QString &))); + disconnect(canvasData->activeTool, SIGNAL(done()), q, SLOT(switchBackRequested())); + disconnect(canvasData->activeTool, SIGNAL(statusTextChanged(const QString &)), + q, SIGNAL(changedStatusText(const QString &))); } - emit q->toolCodesSelected(types); + // emit a empty status text to clear status text from last active tool + emit q->changedStatusText(QString()); } -void KoToolManager::Private::currentLayerChanged(const KoShapeLayer *layer) + +void KoToolManager::Private::switchTool(KoToolBase *tool, bool temporary) { - emit q->currentLayerChanged(canvasData->canvas, layer); - layerExplicitlyDisabled = layer && !layer->isEditable(); - updateToolForProxy(); - debugFlake << "Layer changed to" << layer << "explicitly disabled:" << layerExplicitlyDisabled; + Q_ASSERT(tool); + if (canvasData == 0) + return; + + if (canvasData->activeTool == tool && tool->toolId() != KoInteractionTool_ID) + return; + + disconnectActiveTool(); + canvasData->activeTool = tool; + connectActiveTool(); + postSwitchTool(temporary); } -void KoToolManager::Private::updateToolForProxy() + + +void KoToolManager::Private::switchTool(const QString &id, bool temporary) { - KoToolProxy *proxy = proxies.value(canvasData->canvas->canvas()); - if(!proxy) return; + Q_ASSERT(canvasData); + if (!canvasData) return; - bool canUseTool = !layerExplicitlyDisabled || canvasData->activationShapeId.endsWith(QLatin1String("/always")); - proxy->setActiveTool(canUseTool ? canvasData->activeTool : 0); + if (canvasData->activeTool && temporary) + canvasData->stack.push(canvasData->activeToolId); + canvasData->activeToolId = id; + KoToolBase *tool = canvasData->allTools.value(id); + if (! tool) { + return; + } + + foreach(ToolHelper *th, tools) { + if (th->id() == id) { + canvasData->activationShapeId = th->activationShapeId(); + break; + } + } + + switchTool(tool, temporary); } -void KoToolManager::Private::switchInputDevice(const KoInputDevice &device) +void KoToolManager::Private::postSwitchTool(bool temporary) { +#ifndef NDEBUG + int canvasCount = 1; + foreach(QList list, canvasses) { + bool first = true; + foreach(CanvasData *data, list) { + if (first) { + debugFlake << "Canvas" << canvasCount++; + } + debugFlake << " +- Tool:" << data->activeToolId << (data == canvasData ? " *" : ""); + first = false; + } + } +#endif Q_ASSERT(canvasData); if (!canvasData) return; - if (inputDevice == device) return; - if (inputDevice.isMouse() && device.isMouse()) return; - if (device.isMouse() && !inputDevice.isMouse()) { - // we never switch back to mouse from a tablet input device, so the user can use the - // mouse to edit the settings for a tool activated by a tablet. See bugs - // https://bugs.kde.org/show_bug.cgi?id=283130 and https://bugs.kde.org/show_bug.cgi?id=285501. - // We do continue to switch between tablet devices, thought. - return; + + KoToolBase::ToolActivation toolActivation; + if (temporary) + toolActivation = KoToolBase::TemporaryActivation; + else + toolActivation = KoToolBase::DefaultActivation; + QSet shapesToOperateOn; + if (canvasData->activeTool + && canvasData->activeTool->canvas() + && canvasData->activeTool->canvas()->shapeManager()) { + KoSelection *selection = canvasData->activeTool->canvas()->shapeManager()->selection(); + Q_ASSERT(selection); + + foreach(KoShape *shape, selection->selectedShapes()) { + QSet delegates = shape->toolDelegates(); + if (delegates.isEmpty()) { // no delegates, just the orig shape + shapesToOperateOn << shape; + } else { + shapesToOperateOn += delegates; + } + } } - QList items = canvasses[canvasData->canvas]; + if (canvasData->canvas->canvas()) { + // Caller of postSwitchTool expect this to be called to update the selected tool + updateToolForProxy(); + canvasData->activeTool->activate(toolActivation, shapesToOperateOn); + KoCanvasBase *canvas = canvasData->canvas->canvas(); + canvas->updateInputMethodInfo(); + } else { + canvasData->activeTool->activate(toolActivation, shapesToOperateOn); + } - // disable all actions for all tools in the all canvasdata objects for this canvas. - foreach(CanvasData *cd, items) { - foreach(KoToolBase* tool, cd->allTools) { - foreach(QAction * action, tool->actions()) { - action->setEnabled(false); + QList > optionWidgetList = canvasData->activeTool->optionWidgets(); + if (optionWidgetList.empty()) { // no option widget. + QWidget *toolWidget; + QString title; + foreach(ToolHelper *tool, tools) { + if (tool->id() == canvasData->activeTool->toolId()) { + title = tool->toolTip(); + break; } } + toolWidget = canvasData->dummyToolWidget; + if (toolWidget == 0) { + toolWidget = new QWidget(); + toolWidget->setObjectName("DummyToolWidget"); + QVBoxLayout *layout = new QVBoxLayout(toolWidget); + layout->setMargin(3); + canvasData->dummyToolLabel = new QLabel(toolWidget); + layout->addWidget(canvasData->dummyToolLabel); + layout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding)); + toolWidget->setLayout(layout); + canvasData->dummyToolWidget = toolWidget; + } + canvasData->dummyToolLabel->setText(i18n("Active tool: %1", title)); + optionWidgetList.append(toolWidget); } - // search for a canvasdata object for the current input device - foreach(CanvasData *cd, items) { - if (cd->inputDevice == device) { - switchCanvasData(cd); + // Activate the actions for the currently active tool + canvasData->activateToolActions(); - if (!canvasData->activeTool) { - switchTool(KoInteractionTool_ID, false); - } + emit q->changedTool(canvasData->canvas, uniqueToolIds.value(canvasData->activeTool)); - return; - } + KoCanvasControllerWidget *canvasControllerWidget = dynamic_cast(canvasData->canvas); + if (canvasControllerWidget) { + canvasControllerWidget->setToolOptionWidgets(optionWidgetList); } +} - // still here? That means we need to create a new CanvasData instance with the current InputDevice. - CanvasData *cd = createCanvasData(canvasData->canvas, device); - // switch to new canvas as the active one. - QString oldTool = canvasData->activeToolId; - items.append(cd); - canvasses[cd->canvas] = items; +void KoToolManager::Private::switchCanvasData(CanvasData *cd) +{ + Q_ASSERT(cd); - switchCanvasData(cd); + KoCanvasBase *oldCanvas = 0; + KoInputDevice oldInputDevice; - q->switchToolRequested(oldTool); -} + if (canvasData) { + oldCanvas = canvasData->canvas->canvas(); + oldInputDevice = canvasData->inputDevice; -void KoToolManager::Private::registerToolProxy(KoToolProxy *proxy, KoCanvasBase *canvas) -{ - proxies.insert(canvas, proxy); - foreach(KoCanvasController *controller, canvasses.keys()) { - if (controller->canvas() == canvas) { - proxy->priv()->setCanvasController(controller); - break; + if (canvasData->activeTool) { + disconnectActiveTool(); } + + KoToolProxy *proxy = proxies.value(oldCanvas); + Q_ASSERT(proxy); + proxy->setActiveTool(0); } -} -void KoToolManager::Private::switchToolByShortcut(QKeyEvent *event) -{ - QKeySequence item(event->key() | ((Qt::ControlModifier | Qt::AltModifier) & event->modifiers())); + canvasData = cd; + inputDevice = canvasData->inputDevice; - if (event->key() == Qt::Key_Space && event->modifiers() == 0) { - switchTool(KoPanTool_ID, true); - } else if (event->key() == Qt::Key_Escape && event->modifiers() == 0) { - switchTool(KoInteractionTool_ID, false); + if (canvasData->activeTool) { + connectActiveTool(); + postSwitchTool(false); } -} -// ******** KoToolManager ********** -KoToolManager::KoToolManager() - : QObject(), - d(new Private(this)) -{ - connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), - this, SLOT(movedFocus(QWidget*, QWidget*))); -} + if (oldInputDevice != canvasData->inputDevice) { + emit q->inputDeviceChanged(canvasData->inputDevice); + } -KoToolManager::~KoToolManager() -{ - delete d; + if (oldCanvas != canvasData->canvas->canvas()) { + emit q->changedCanvas(canvasData->canvas->canvas()); + } } -QList KoToolManager::toolActionList() const + +void KoToolManager::Private::toolActivated(ToolHelper *tool) { - QList answer; - answer.reserve(d->tools.count()); - foreach(ToolHelper *tool, d->tools) { - if (tool->id() == KoCreateShapesTool_ID) - continue; // don't show this one. - answer.append(tool->toolAction()); - } - return answer; + Q_ASSERT(tool); + + Q_ASSERT(canvasData); + if (!canvasData) return; + KoToolBase *t = canvasData->allTools.value(tool->id()); + Q_ASSERT(t); + + canvasData->activeToolId = tool->id(); + canvasData->activationShapeId = tool->activationShapeId(); + + switchTool(t, false); } -void KoToolManager::requestToolActivation(KoCanvasController * controller) +void KoToolManager::Private::detachCanvas(KoCanvasController *controller) { - if (d->canvasses.contains(controller)) { - QString activeToolId = d->canvasses.value(controller).first()->activeToolId; - foreach(ToolHelper * th, d->tools) { - if (th->id() == activeToolId) { - d->toolActivated(th); + Q_ASSERT(controller); + // check if we are removing the active canvas controller + if (canvasData && canvasData->canvas == controller) { + KoCanvasController *newCanvas = 0; + // try to find another canvas controller beside the one we are removing + foreach(KoCanvasController* canvas, canvasses.keys()) { + if (canvas != controller) { + // yay found one + newCanvas = canvas; break; } } + if (newCanvas) { + switchCanvasData(canvasses.value(newCanvas).first()); + } else { + KoCanvasControllerWidget *canvasControllerWidget = dynamic_cast(canvasData->canvas); + if (canvasControllerWidget) { + canvasControllerWidget->setToolOptionWidgets(QList >()); + } + // as a last resort just set a blank one + canvasData = 0; + } } -} -KoInputDevice KoToolManager::currentInputDevice() const -{ - return d->inputDevice; -} - -void KoToolManager::registerTools(KActionCollection *ac, KoCanvasController *controller) -{ - Q_ASSERT(controller); - Q_ASSERT(ac); - - d->setup(); - - if (!d->canvasses.contains(controller)) { - return; - } + KoToolProxy *proxy = proxies.value(controller->canvas()); + if (proxy) + proxy->setActiveTool(0); - // Actions available during the use of individual tools - CanvasData *cd = d->canvasses.value(controller).first(); - foreach(KoToolBase *tool, cd->allTools) { - QHash actions = tool->actions(); - QHash::const_iterator action(actions.constBegin()); - for (; action != actions.constEnd(); ++action) { - if (!ac->action(action.key())) - ac->addAction(action.key(), action.value()); + QList tools; + foreach(CanvasData *canvasData, canvasses.value(controller)) { + foreach(KoToolBase *tool, canvasData->allTools) { + if (! tools.contains(tool)) { + tools.append(tool); + } } + delete canvasData; } - - // Actions used to switch tools via shortcuts - foreach(ToolHelper * th, d->tools) { - if (ac->action(th->id())) { - continue; - } - ShortcutToolAction* action = th->createShortcutToolAction(ac); - ac->addAction(th->id(), action); + foreach(KoToolBase *tool, tools) { + uniqueToolIds.remove(tool); + delete tool; } + canvasses.remove(controller); + emit q->changedCanvas(canvasData ? canvasData->canvas->canvas() : 0); } -void KoToolManager::addController(KoCanvasController *controller) +void KoToolManager::Private::attachCanvas(KoCanvasController *controller) { Q_ASSERT(controller); - if (d->canvasses.contains(controller)) - return; - d->setup(); - d->attachCanvas(controller); - connect(controller->proxyObject, SIGNAL(destroyed(QObject*)), this, SLOT(attemptCanvasControllerRemoval(QObject*))); - connect(controller->proxyObject, SIGNAL(canvasRemoved(KoCanvasController*)), this, SLOT(detachCanvas(KoCanvasController*))); - connect(controller->proxyObject, SIGNAL(canvasSet(KoCanvasController*)), this, SLOT(attachCanvas(KoCanvasController*))); -} + CanvasData *cd = createCanvasData(controller, KoInputDevice::mouse()); -void KoToolManager::removeCanvasController(KoCanvasController *controller) -{ - Q_ASSERT(controller); - disconnect(controller->proxyObject, SIGNAL(canvasRemoved(KoCanvasController*)), this, SLOT(detachCanvas(KoCanvasController*))); - disconnect(controller->proxyObject, SIGNAL(canvasSet(KoCanvasController*)), this, SLOT(attachCanvas(KoCanvasController*))); - d->detachCanvas(controller); -} + // switch to new canvas as the active one. + switchCanvasData(cd); -void KoToolManager::attemptCanvasControllerRemoval(QObject* controller) -{ - KoCanvasControllerProxyObject* controllerActual = qobject_cast(controller); - if (controllerActual) { - removeCanvasController(controllerActual->canvasController()); - } -} + inputDevice = cd->inputDevice; + QList canvasses_; + canvasses_.append(cd); + canvasses[controller] = canvasses_; -void KoToolManager::updateShapeControllerBase(KoShapeBasedDocumentBase *shapeController, KoCanvasController *canvasController) -{ - if (!d->canvasses.contains(canvasController)) - return; + KoToolProxy *tp = proxies[controller->canvas()]; + if (tp) + tp->priv()->setCanvasController(controller); - QList canvasses = d->canvasses[canvasController]; - foreach(CanvasData *canvas, canvasses) { - foreach(KoToolBase *tool, canvas->allTools.values()) { - tool->updateShapeController(shapeController); + if (cd->activeTool == 0) { + // no active tool, so we activate the highest priority main tool + int highestPriority = INT_MAX; + ToolHelper * helper = 0; + foreach(ToolHelper * th, tools) { + if (th->toolType() == KoToolFactoryBase::mainToolType()) { + if (th->priority() < highestPriority) { + highestPriority = qMin(highestPriority, th->priority()); + helper = th; + } + } } + if (helper) + toolActivated(helper); } -} - -void KoToolManager::switchToolRequested(const QString & id) -{ - Q_ASSERT(d->canvasData); - if (!d->canvasData) return; - while (!d->canvasData->stack.isEmpty()) // switching means to flush the stack - d->canvasData->stack.pop(); - d->switchTool(id, false); -} + Connector *connector = new Connector(controller->canvas()->shapeManager()); + connect(connector, SIGNAL(selectionChanged(QList)), q, + SLOT(selectionChanged(QList))); + connect(controller->canvas()->shapeManager()->selection(), + SIGNAL(currentLayerChanged(const KoShapeLayer*)), + q, SLOT(currentLayerChanged(const KoShapeLayer*))); -void KoToolManager::switchInputDeviceRequested(const KoInputDevice &id) -{ - if (!d->canvasData) return; - d->switchInputDevice(id); + emit q->changedCanvas(canvasData ? canvasData->canvas->canvas() : 0); } -void KoToolManager::switchToolTemporaryRequested(const QString &id) +void KoToolManager::Private::movedFocus(QWidget *from, QWidget *to) { - d->switchTool(id, true); -} + Q_UNUSED(from); + // no canvas anyway or no focus set anyway? + if (!canvasData || to == 0) { + return; + } -void KoToolManager::switchBackRequested() -{ - if (!d->canvasData) return; + // Check if this app is about QWidget-based KoCanvasControllerWidget canvasses + // XXX: Focus handling for non-qwidget based canvases! + KoCanvasControllerWidget *canvasControllerWidget = dynamic_cast(canvasData->canvas); + if (!canvasControllerWidget) { + return; + } - if (d->canvasData->stack.isEmpty()) { - // default to changing to the interactionTool - d->switchTool(KoInteractionTool_ID, false); + // canvasWidget is set as focusproxy for KoCanvasControllerWidget, + // so all focus checks are to be done against canvasWidget objects + + // focus returned to current canvas? + if (to == canvasData->canvas->canvas()->canvasWidget()) { + // nothing to do return; } - d->switchTool(d->canvasData->stack.pop(), false); -} -KoCreateShapesTool * KoToolManager::shapeCreatorTool(KoCanvasBase *canvas) const -{ - Q_ASSERT(canvas); - foreach(KoCanvasController *controller, d->canvasses.keys()) { - if (controller->canvas() == canvas) { - KoCreateShapesTool *createTool = dynamic_cast - (d->canvasData->allTools.value(KoCreateShapesTool_ID)); - Q_ASSERT(createTool /* ID changed? */); - return createTool; + // if the 'to' is one of our canvasWidgets, then switch. + + // for code simplicity the current canvas will be checked again, + // but would have been catched already in the lines above, so no issue + KoCanvasController *newCanvas = 0; + foreach(KoCanvasController* canvas, canvasses.keys()) { + if (canvas->canvas()->canvasWidget() == to) { + newCanvas = canvas; + break; } } - Q_ASSERT(0); // this should not happen - return 0; -} -KoToolBase *KoToolManager::toolById(KoCanvasBase *canvas, const QString &id) const -{ - Q_ASSERT(canvas); - foreach(KoCanvasController *controller, d->canvasses.keys()) { - if (controller->canvas() == canvas) - return d->canvasData->allTools.value(id); + // none of our canvasWidgets got focus? + if (newCanvas == 0) { + return; } - return 0; + + // switch to canvasdata matching inputdevice used last with this app instance + foreach(CanvasData *data, canvasses.value(newCanvas)) { + if (data->inputDevice == inputDevice) { + switchCanvasData(data); + return; + } + } + // if no such inputDevice for this canvas, then simply fallback to first one + switchCanvasData(canvasses.value(newCanvas).first()); } -KoCanvasController *KoToolManager::activeCanvasController() const +void KoToolManager::Private::updateCursor(const QCursor &cursor) { - if (! d->canvasData) return 0; - return d->canvasData->canvas; + Q_ASSERT(canvasData); + Q_ASSERT(canvasData->canvas); + Q_ASSERT(canvasData->canvas->canvas()); + canvasData->canvas->canvas()->setCursor(cursor); } -QString KoToolManager::preferredToolForSelection(const QList &shapes) +void KoToolManager::Private::selectionChanged(const QList &shapes) { QList types; - foreach(KoShape *shape, shapes) - if (! types.contains(shape->shapeId())) - types.append(shape->shapeId()); + foreach(KoShape *shape, shapes) { + QSet delegates = shape->toolDelegates(); + if (delegates.isEmpty()) { // no delegates, just the orig shape + delegates << shape; + } - QString toolType = KoInteractionTool_ID; - int prio = INT_MAX; - foreach(ToolHelper *helper, d->tools) { - if (helper->priority() >= prio) - continue; - if (helper->toolType() == KoToolFactoryBase::mainToolType()) - continue; + foreach (KoShape *shape2, delegates) { + Q_ASSERT(shape2); + if (! types.contains(shape2->shapeId())) { + types.append(shape2->shapeId()); + } + } + } - bool toolWillWork = false; + // check if there is still a shape selected the active tool can work on + // there needs to be at least one shape for a tool without an activationShapeId + // to work + // if not change the current tool to the default tool + if (!(canvasData->activationShapeId.isNull() && shapes.size() > 0) + && canvasData->activationShapeId != "flake/always" + && canvasData->activationShapeId != "flake/edit") { + + bool currentToolWorks = false; foreach (const QString &type, types) { - if (helper->activationShapeId().split(',').contains(type)) { - toolWillWork = true; + if (canvasData->activationShapeId.split(',').contains(type)) { + currentToolWorks = true; break; } } - if (toolWillWork) { - toolType = helper->id(); - prio = helper->priority(); + if (!currentToolWorks) { + switchTool(KoInteractionTool_ID, false); } } - return toolType; -} -void KoToolManager::injectDeviceEvent(KoInputDeviceHandlerEvent * event) -{ - if (d->canvasData && d->canvasData->canvas->canvas()) { - if (static_cast(event->type()) == KoInputDeviceHandlerEvent::ButtonPressed) - d->canvasData->activeTool->customPressEvent(event->pointerEvent()); - else if (static_cast(event->type()) == KoInputDeviceHandlerEvent::ButtonReleased) - d->canvasData->activeTool->customReleaseEvent(event->pointerEvent()); - else if (static_cast(event->type()) == KoInputDeviceHandlerEvent::PositionChanged) - d->canvasData->activeTool->customMoveEvent(event->pointerEvent()); - } + emit q->toolCodesSelected(types); } -void KoToolManager::addDeferredToolFactory(KoToolFactoryBase *toolFactory) +void KoToolManager::Private::currentLayerChanged(const KoShapeLayer *layer) { - ToolHelper *tool = new ToolHelper(toolFactory); - // make sure all plugins are loaded as otherwise we will not load them - d->setup(); - d->tools.append(tool); - - // connect to all tools so we can hear their button-clicks - connect(tool, SIGNAL(toolActivated(ToolHelper*)), this, SLOT(toolActivated(ToolHelper*))); - - // now create tools for all existing canvases - foreach(KoCanvasController *controller, d->canvasses.keys()) { - - // this canvascontroller is unknown, which is weird - if (!d->canvasses.contains(controller)) { - continue; - } - - // create a tool for all canvasdata objects (i.e., all input devices on this canvas) - foreach (CanvasData *cd, d->canvasses[controller]) { - QPair toolPair = createTools(controller, tool); - if (toolPair.second) { - cd->allTools.insert(toolPair.first, toolPair.second); - } - } - - // Then create a button for the toolbox for this canvas - if (tool->id() == KoCreateShapesTool_ID) { - continue; - } + emit q->currentLayerChanged(canvasData->canvas, layer); + layerExplicitlyDisabled = layer && !layer->isEditable(); + updateToolForProxy(); - emit addedTool(tool->toolAction(), controller); - } + debugFlake << "Layer changed to" << layer << "explicitly disabled:" << layerExplicitlyDisabled; } -QPair KoToolManager::createTools(KoCanvasController *controller, ToolHelper *tool) +void KoToolManager::Private::updateToolForProxy() { - // XXX: maybe this method should go into the private class? + KoToolProxy *proxy = proxies.value(canvasData->canvas->canvas()); + if(!proxy) return; - QHash origHash; + bool canUseTool = !layerExplicitlyDisabled || canvasData->activationShapeId.endsWith(QLatin1String("/always")); + proxy->setActiveTool(canUseTool ? canvasData->activeTool : 0); +} - if (d->canvasses.contains(controller)) { - origHash = d->canvasses.value(controller).first()->allTools; +void KoToolManager::Private::switchInputDevice(const KoInputDevice &device) +{ + Q_ASSERT(canvasData); + if (!canvasData) return; + if (inputDevice == device) return; + if (inputDevice.isMouse() && device.isMouse()) return; + if (device.isMouse() && !inputDevice.isMouse()) { + // we never switch back to mouse from a tablet input device, so the user can use the + // mouse to edit the settings for a tool activated by a tablet. See bugs + // https://bugs.kde.org/show_bug.cgi?id=283130 and https://bugs.kde.org/show_bug.cgi?id=285501. + // We do continue to switch between tablet devices, thought. + return; } - if (origHash.contains(tool->id())) { - return QPair(tool->id(), origHash.value(tool->id())); - } + QList items = canvasses[canvasData->canvas]; - debugFlake << "Creating tool" << tool->id() << ". Activated on:" << tool->activationShapeId() << ", prio:" << tool->priority(); + // disable all actions for all tools in the all canvasdata objects for this canvas. + foreach(CanvasData *cd, items) { + foreach(KoToolBase* tool, cd->allTools) { + foreach(QAction * action, tool->actions()) { + action->setEnabled(false); + } + } + } - KoToolBase *tl = tool->createTool(controller->canvas()); - if (tl) { - d->uniqueToolIds.insert(tl, tool->uniqueId()); + // search for a canvasdata object for the current input device + foreach(CanvasData *cd, items) { + if (cd->inputDevice == device) { + switchCanvasData(cd); - tl->setObjectName(tool->id()); + if (!canvasData->activeTool) { + switchTool(KoInteractionTool_ID, false); + } - foreach(QAction *action, tl->actions()) { - action->setEnabled(false); + return; } - - } - - KoZoomTool *zoomTool = dynamic_cast(tl); - if (zoomTool) { - zoomTool->setCanvasController(controller); } - KoPanTool *panTool = dynamic_cast(tl); - if (panTool) { - panTool->setCanvasController(controller); - } + // still here? That means we need to create a new CanvasData instance with the current InputDevice. + CanvasData *cd = createCanvasData(canvasData->canvas, device); + // switch to new canvas as the active one. + QString oldTool = canvasData->activeToolId; - return QPair(tool->id(), tl); -} + items.append(cd); + canvasses[cd->canvas] = items; + switchCanvasData(cd); -KoToolManager* KoToolManager::instance() -{ - return s_instance; + q->switchToolRequested(oldTool); } -QString KoToolManager::activeToolId() const +void KoToolManager::Private::registerToolProxy(KoToolProxy *proxy, KoCanvasBase *canvas) { - if (!d->canvasData) return QString(); - return d->canvasData->activeToolId; + proxies.insert(canvas, proxy); + foreach(KoCanvasController *controller, canvasses.keys()) { + if (controller->canvas() == canvas) { + proxy->priv()->setCanvasController(controller); + break; + } + } } -KoToolManager::Private *KoToolManager::priv() +void KoToolManager::Private::switchToolByShortcut(QKeyEvent *event) { - return d; + QKeySequence item(event->key() | ((Qt::ControlModifier | Qt::AltModifier) & event->modifiers())); + + if (event->key() == Qt::Key_Space && event->modifiers() == 0) { + switchTool(KoPanTool_ID, true); + } else if (event->key() == Qt::Key_Escape && event->modifiers() == 0) { + switchTool(KoInteractionTool_ID, false); + } } //have to include this because of Q_PRIVATE_SLOT diff --git a/libs/flake/KoToolManager_p.cpp b/libs/flake/KoToolManager_p.cpp --- a/libs/flake/KoToolManager_p.cpp +++ b/libs/flake/KoToolManager_p.cpp @@ -23,7 +23,7 @@ #include #include #include - +#include "kis_action_registry.h" static int newUniqueToolHelperId() { @@ -128,7 +128,8 @@ ShortcutToolAction* ToolHelper::createShortcutToolAction(QObject *parent) { ShortcutToolAction* action = new ShortcutToolAction(id(), text(), parent); - action->setShortcut(shortcut()); + + KisActionRegistry::instance()->propertizeAction(id(), action); connect(action, SIGNAL(changed()), SLOT(shortcutToolActionUpdated())); @@ -154,6 +155,81 @@ return m_toolFactory->shortcut(); } + +// ************ KoToolAction::Private ********** + +class Q_DECL_HIDDEN KoToolAction::Private +{ +public: + ToolHelper* toolHelper; +}; + +KoToolAction::KoToolAction(ToolHelper* toolHelper) + : QObject(toolHelper) + , d(new Private) +{ + d->toolHelper = toolHelper; +} + +KoToolAction::~KoToolAction() +{ + delete d; +} + +void KoToolAction::trigger() +{ + d->toolHelper->activate(); +} + + +QString KoToolAction::iconText() const +{ + return d->toolHelper->iconText(); +} + +QString KoToolAction::toolTip() const +{ + return d->toolHelper->toolTip(); +} + +QString KoToolAction::id() const +{ + return d->toolHelper->id(); +} + +QString KoToolAction::iconName() const +{ + return d->toolHelper->iconName(); +} + +QKeySequence KoToolAction::shortcut() const +{ + return d->toolHelper->shortcut(); +} + + +QString KoToolAction::section() const +{ + return d->toolHelper->toolType(); +} + +int KoToolAction::priority() const +{ + return d->toolHelper->priority(); +} + +int KoToolAction::buttonGroupId() const +{ + return d->toolHelper->uniqueId(); +} + +QString KoToolAction::visibilityCode() const +{ + return d->toolHelper->activationShapeId(); +} + + + // ************ Connector ********** Connector::Connector(KoShapeManager *parent) : QObject(parent), @@ -181,7 +257,8 @@ void ShortcutToolAction::actionTriggered() { - // TODO: why not ToolHelper::activate(); and thus a slightly different behaviour? + // todo: why not ToolHelper::activate(); and thus a slightly different behaviour? + // Answering the todo item: switchToolRequested KoToolManager::instance()->switchToolRequested(m_toolID); } diff --git a/libs/flake/tools/KoPathTool.cpp b/libs/flake/tools/KoPathTool.cpp --- a/libs/flake/tools/KoPathTool.cpp +++ b/libs/flake/tools/KoPathTool.cpp @@ -49,6 +49,7 @@ #include "KoConnectionShape.h" #include "KoSnapGuide.h" #include "KoShapeController.h" +#include "kis_action_registry.h" #include @@ -106,71 +107,67 @@ { QActionGroup *points = new QActionGroup(this); // m_pointTypeGroup->setExclusive(true); - m_actionPathPointCorner = new QAction(koIcon("pathpoint-corner"), i18n("Corner point"), this); + KisActionRegistry *actionRegistry = KisActionRegistry::instance(); + m_actionPathPointCorner = actionRegistry->makeQAction("pathpoint-corner", this); addAction("pathpoint-corner", m_actionPathPointCorner); m_actionPathPointCorner->setData(KoPathPointTypeCommand::Corner); points->addAction(m_actionPathPointCorner); - m_actionPathPointSmooth = new QAction(koIcon("pathpoint-smooth"), i18n("Smooth point"), this); + m_actionPathPointSmooth = actionRegistry->makeQAction("pathpoint-smooth", this); addAction("pathpoint-smooth", m_actionPathPointSmooth); m_actionPathPointSmooth->setData(KoPathPointTypeCommand::Smooth); points->addAction(m_actionPathPointSmooth); - m_actionPathPointSymmetric = new QAction(koIcon("pathpoint-symmetric"), i18n("Symmetric Point"), this); + m_actionPathPointSymmetric = actionRegistry->makeQAction("pathpoint-symmetric", this); addAction("pathpoint-symmetric", m_actionPathPointSymmetric); m_actionPathPointSymmetric->setData(KoPathPointTypeCommand::Symmetric); points->addAction(m_actionPathPointSymmetric); - m_actionCurvePoint = new QAction(koIcon("pathpoint-curve"), i18n("Make curve point"), this); + m_actionCurvePoint = actionRegistry->makeQAction("pathpoint-curve", this); addAction("pathpoint-curve", m_actionCurvePoint); connect(m_actionCurvePoint, SIGNAL(triggered()), this, SLOT(pointToCurve())); - m_actionLinePoint = new QAction(koIcon("pathpoint-line"), i18n("Make line point"), this); + m_actionLinePoint = actionRegistry->makeQAction("pathpoint-line", this); addAction("pathpoint-line", m_actionLinePoint); connect(m_actionLinePoint, SIGNAL(triggered()), this, SLOT(pointToLine())); - m_actionLineSegment = new QAction(koIcon("pathsegment-line"), i18n("Segment to Line"), this); - m_actionLineSegment->setShortcut(Qt::Key_F); + m_actionLineSegment = actionRegistry->makeQAction("pathsegment-line", this); addAction("pathsegment-line", m_actionLineSegment); connect(m_actionLineSegment, SIGNAL(triggered()), this, SLOT(segmentToLine())); - m_actionCurveSegment = new QAction(koIcon("pathsegment-curve"), i18n("Segment to Curve"), this); - m_actionCurveSegment->setShortcut(Qt::Key_C); + m_actionCurveSegment = actionRegistry->makeQAction("pathsegment-curve", this); addAction("pathsegment-curve", m_actionCurveSegment); connect(m_actionCurveSegment, SIGNAL(triggered()), this, SLOT(segmentToCurve())); - m_actionAddPoint = new QAction(koIcon("pathpoint-insert"), i18n("Insert point"), this); - m_actionAddPoint->setShortcut(Qt::Key_Insert); + m_actionAddPoint = actionRegistry->makeQAction("pathpoint-insert", this); addAction("pathpoint-insert", m_actionAddPoint); connect(m_actionAddPoint, SIGNAL(triggered()), this, SLOT(insertPoints())); - m_actionRemovePoint = new QAction(koIcon("pathpoint-remove"), i18n("Remove point"), this); - m_actionRemovePoint->setShortcut(Qt::Key_Backspace); + m_actionRemovePoint = actionRegistry->makeQAction("pathpoint-remove", this); addAction("pathpoint-remove", m_actionRemovePoint); connect(m_actionRemovePoint, SIGNAL(triggered()), this, SLOT(removePoints())); - m_actionBreakPoint = new QAction(koIcon("path-break-point"), i18n("Break at point"), this); + m_actionBreakPoint = actionRegistry->makeQAction("path-break-point", this); addAction("path-break-point", m_actionBreakPoint); connect(m_actionBreakPoint, SIGNAL(triggered()), this, SLOT(breakAtPoint())); - m_actionBreakSegment = new QAction(koIcon("path-break-segment"), i18n("Break at segment"), this); + m_actionBreakSegment = actionRegistry->makeQAction("path-break-segment", this); addAction("path-break-segment", m_actionBreakSegment); connect(m_actionBreakSegment, SIGNAL(triggered()), this, SLOT(breakAtSegment())); - m_actionJoinSegment = new QAction(koIcon("pathpoint-join"), i18n("Join with segment"), this); - m_actionJoinSegment->setShortcut(Qt::Key_J); + m_actionJoinSegment = actionRegistry->makeQAction("pathpoint-join", this); addAction("pathpoint-join", m_actionJoinSegment); connect(m_actionJoinSegment, SIGNAL(triggered()), this, SLOT(joinPoints())); - m_actionMergePoints = new QAction(koIcon("pathpoint-merge"), i18n("Merge points"), this); + m_actionMergePoints = actionRegistry->makeQAction("pathpoint-merge", this); addAction("pathpoint-merge", m_actionMergePoints); connect(m_actionMergePoints, SIGNAL(triggered()), this, SLOT(mergePoints())); - m_actionConvertToPath = new QAction(koIcon("convert-to-path"), i18n("To Path"), this); - m_actionConvertToPath->setShortcut(Qt::Key_P); + m_actionConvertToPath = actionRegistry->makeQAction("convert-to-path", this); addAction("convert-to-path", m_actionConvertToPath); connect(m_actionConvertToPath, SIGNAL(triggered()), this, SLOT(convertToPath())); + connect(points, SIGNAL(triggered(QAction*)), this, SLOT(pointTypeChanged(QAction*))); connect(&m_pointSelection, SIGNAL(selectionChanged()), this, SLOT(pointSelectionChanged())); diff --git a/libs/kotext/KoTextDocument.cpp b/libs/kotext/KoTextDocument.cpp --- a/libs/kotext/KoTextDocument.cpp +++ b/libs/kotext/KoTextDocument.cpp @@ -15,7 +15,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * - * You should have received a copy of the GNU Library General Public License + * You should have received a copy of the GNU Library General Public Licen give you se * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. diff --git a/libs/widgetutils/kis_action_registry.h b/libs/widgetutils/kis_action_registry.h --- a/libs/widgetutils/kis_action_registry.h +++ b/libs/widgetutils/kis_action_registry.h @@ -47,46 +47,52 @@ /** * Get shortcut for an action */ - QKeySequence getPreferredShortcut(QString name); + QKeySequence getPreferredShortcut(const QString &name); /** * Get shortcut for an action */ - QKeySequence getDefaultShortcut(QString name); + QKeySequence getDefaultShortcut(const QString &name); /** * Get custom shortcut for an action */ - QKeySequence getCustomShortcut(QString name); + QKeySequence getCustomShortcut(const QString &name); + + + /** + * Get category name + */ + QKeySequence getCategory(const QString &name); /** - * @return DOM info for an action @a name. + * @return DOM info for an action @a name. Might be private. * * Allows somewhat flexible info structure for KisActions, QActions, * whatever else we decide on doing later. */ - QDomElement getActionXml(QString name); + QDomElement getActionXml(const QString &name); /** * Saves action in a category. Note that this grabs ownership of the action. */ - void addAction(QString name, QAction *a, QString category = "Krita"); + void addAction(const QString &name, QAction *a); /** * Produces a new QAction based on the .action data files. + * + * N.B. this action will not be saved in the registry. */ - QAction * makeQAction(QString name, QObject *parent, QString category = QString()); - - KActionCollection * getDefaultCollection(); + QAction * makeQAction(const QString &name, QObject *parent); /** * Fills the standard QAction properties of an action. * * @return true if the action was loaded successfully. */ - bool propertizeAction(QString name, QAction *a); + bool propertizeAction(const QString &name, QAction *a); /** @@ -101,15 +107,27 @@ /** - * Run shortcuts dialog. + * Display the shortcut configuration dialog. */ void configureShortcuts(KActionCollection *ac); + + /** + * Call after settings are changed. + */ + void notifySettingsUpdated(); + /** * Constructor. Please don't touch! */ KisActionRegistry(); + // Undocumented + void updateShortcut(const QString &name, QAction *ac); + KActionCollection * getDefaultCollection(); + + + private: class Private; Private * const d; diff --git a/libs/widgetutils/kis_action_registry.cpp b/libs/widgetutils/kis_action_registry.cpp --- a/libs/widgetutils/kis_action_registry.cpp +++ b/libs/widgetutils/kis_action_registry.cpp @@ -25,28 +25,62 @@ #include #include #include +#include #include "kis_debug.h" #include "KoResourcePaths.h" #include "kis_icon_utils.h" #include "kactioncollection.h" +#include "kactioncategory.h" #include "kis_action_registry.h" namespace { - struct actionInfoItem { - QDomElement xmlData; + /** + * We associate several pieces of information with each shortcut. The first + * piece of information is a QDomElement, containing the raw data from the + * .action XML file. The second and third are QKeySequences, the first of + * which is the default shortcut, the last of which is any custom shortcut. + * The last two are the KActionCollection and KActionCategory used to + * organize the shortcut editor. + */ + struct ActionInfoItem { + QDomElement xmlData; QKeySequence defaultShortcut; QKeySequence customShortcut; + QString collectionName; + QString categoryName; }; QKeySequence getShortcutFromXml(QDomElement node) { return node.firstChildElement("shortcut").text(); }; - actionInfoItem emptyActionInfo; // Used as default return value + ActionInfoItem emptyActionInfo; // Used as default return value + + + QString quietlyTranslate(const QString &s) { + if (s.isEmpty()) { + return s; + } + if (i18n(s.toUtf8().constData()).isEmpty()) { + dbgAction << "No translation found for" << s; + return s; + } + return i18n(s.toUtf8().constData()); + }; + + + QKeySequence preferredShortcut(ActionInfoItem action) { + if (action.customShortcut.isEmpty()) { + return action.defaultShortcut; + } else { + return action.customShortcut; + } + }; + }; @@ -57,26 +91,18 @@ Private(KisActionRegistry *_q) : q(_q) {}; - /** - * We associate three pieces of information with each shortcut name. The - * first piece of information is a QDomElement, containing the raw data from - * the .action XML file. The second and third are QKeySequences, the first - * of which is the default shortcut, the last of which is any custom - * shortcut. - * - * QHash is most efficient as long as the action name keys are kept relatively short. - */ - QHash actionInfoList; - KSharedConfigPtr cfg{0}; + // This is the main place containing ActionInfoItems. + QMap actionInfoList; void loadActionFiles(); void loadActionCollections(); - actionInfoItem actionInfo(QString name) { + void loadCustomShortcuts(QString filename = QStringLiteral("kritashortcutsrc")); + ActionInfoItem actionInfo(const QString &name) { return actionInfoList.value(name, emptyActionInfo); }; KisActionRegistry *q; KActionCollection * defaultActionCollection; - QHash actionCollections; + QMap actionCollections; }; @@ -91,168 +117,141 @@ KisActionRegistry::KisActionRegistry() : d(new KisActionRegistry::Private(this)) { - d->cfg = KSharedConfig::openConfig("krbitashortcutsrc"); d->loadActionFiles(); - - // Should change to , then translate - d->defaultActionCollection = new KActionCollection(this, "Krita"); - d->actionCollections.insert("Krita", d->defaultActionCollection); - + d->loadCustomShortcuts(); } -// No this isn't the most efficient logic, but it's nice and readable. -QKeySequence KisActionRegistry::getPreferredShortcut(QString name) +// Not the most efficient logic, but simple and readable. +QKeySequence KisActionRegistry::getPreferredShortcut(const QString &name) { - QKeySequence customShortcut = getCustomShortcut(name); - - if (customShortcut.isEmpty()) { - return getDefaultShortcut(name); - } else { - return getCustomShortcut(name); - } -}; - -QKeySequence KisActionRegistry::getDefaultShortcut(QString name) -{ - return d->actionInfo(name).defaultShortcut; + return preferredShortcut(d->actionInfo(name)); }; -QKeySequence KisActionRegistry::getCustomShortcut(QString name) +QKeySequence KisActionRegistry::getCategory(const QString &name) { - return d->actionInfo(name).customShortcut; + return d->actionInfo(name).categoryName; }; - QStringList KisActionRegistry::allActions() { return d->actionInfoList.keys(); }; -QDomElement KisActionRegistry::getActionXml(QString name) -{ - return d->actionInfo(name).xmlData; -}; - KActionCollection * KisActionRegistry::getDefaultCollection() { - return d->defaultActionCollection; + return d->actionCollections.value("Krita"); }; -void KisActionRegistry::addAction(QString name, QAction *a, QString category) +void KisActionRegistry::addAction(const QString &name, QAction *a) { - KActionCollection *ac; - if (d->actionCollections.contains(category)) { - ac = d->actionCollections.value(category); - } else { - ac = new KActionCollection(this, category); - d->actionCollections.insert(category, ac); - dbgAction << "Adding a new KActionCollection - " << category; - } + auto info = d->actionInfo(name); - if (!ac->action(name)) { - ac->addAction(name, a); + KActionCollection *collection = d->actionCollections.value(info.collectionName); + if (!collection) { + qDebug() << "No collection found for action" << name; + return; + } + if (collection->action(name)) { + dbgAction << "duplicate action" << name << "in collection" << collection->componentName(); } else { - dbgAction << "duplicate action" << name << a << "in collection" << ac->componentName(); } - - // TODO: look into the loading/saving mechanism - ac->readSettings(); + collection->addCategorizedAction(name, a, info.categoryName); }; +void KisActionRegistry::notifySettingsUpdated() +{ + d->loadCustomShortcuts(); +}; -QAction * KisActionRegistry::makeQAction(QString name, QObject *parent, QString category) +QAction * KisActionRegistry::makeQAction(const QString &name, QObject *parent) { QAction * a = new QAction(parent); if (!d->actionInfoList.contains(name)) { dbgAction << "Warning: requested data for unknown action" << name; return a; } - propertizeAction(name, a); - addAction(name, a, category); - return a; }; void KisActionRegistry::configureShortcuts(KActionCollection *ac) { - KisShortcutsDialog dlg; - dlg.addCollection(ac); + for (auto i = d->actionCollections.constBegin(); i != d->actionCollections.constEnd(); i++ ) { dlg.addCollection(i.value(), i.key()); } + /* Testing */ + // QStringList mainWindowActions; + // foreach (auto a, ac->actions()) { + // mainWindowActions << a->objectName(); + // } + // dlg.addCollection(ac, "TESTING: XMLGUI-MAINWINDOW"); + dlg.configure(); // Show the dialog. + + d->loadCustomShortcuts(); } +void KisActionRegistry::updateShortcut(const QString &name, QAction *action) +{ + action->setShortcut(preferredShortcut(d->actionInfo(name))); +} -bool KisActionRegistry::propertizeAction(QString name, QAction * a) + +bool KisActionRegistry::propertizeAction(const QString &name, QAction * a) { - QStringList actionNames = allActions(); - QDomElement actionXml = getActionXml(name); + ActionInfoItem info = d->actionInfo(name); + QDomElement actionXml = info.xmlData; + if (actionXml.text().isEmpty()) { + dbgAction << "No XML data found for action" << name; + return false; + } // Convenience macros to extract text of a child node. auto getChildContent = [=](QString node){return actionXml.firstChildElement(node).text();}; // i18n requires converting format from QString. - auto getChildContent_i18n = [=](QString node) { - if (getChildContent(node).isEmpty()) { - dbgAction << "Found empty string to translate for property" << node; - return QString(); - } - return i18n(getChildContent(node).toUtf8().constData()); - }; - - - QString icon = getChildContent("icon"); - QString text = getChildContent("text"); + auto getChildContent_i18n = [=](QString node){return quietlyTranslate(getChildContent(node));}; + + // Note: the fields in the .action documents marked for translation are determined by extractrc. + QString icon = getChildContent("icon"); + QString text = getChildContent("text"); + QString whatsthis = getChildContent_i18n("whatsThis"); + QString toolTip = getChildContent_i18n("toolTip"); + QString statusTip = getChildContent_i18n("statusTip"); + QString iconText = getChildContent_i18n("iconText"); + bool isCheckable = getChildContent("isCheckable") == QString("true"); - // Note: these fields in the .action definitions are marked for translation. - QString whatsthis = getChildContent_i18n("whatsThis"); - QString toolTip = getChildContent_i18n("toolTip"); - QString statusTip = getChildContent_i18n("statusTip"); - QString iconText = getChildContent_i18n("iconText"); - bool isCheckable = getChildContent("isCheckable") == QString("true"); - QKeySequence shortcut = QKeySequence(getChildContent("shortcut")); - QKeySequence defaultShortcut = QKeySequence(getChildContent("defaultShortcut")); - a->setObjectName(name); // This is helpful!! + a->setObjectName(name); // This is helpful, should be added more places in Krita a->setIcon(KisIconUtils::loadIcon(icon.toLatin1())); a->setText(text); a->setObjectName(name); a->setWhatsThis(whatsthis); a->setToolTip(toolTip); a->setStatusTip(statusTip); a->setIconText(iconText); - a->setShortcut(shortcut); a->setCheckable(isCheckable); - // XXX: this totally duplicates KisAction::setDefaultShortcut - QList listifiedShortcut; - listifiedShortcut.append(shortcut); - setProperty("defaultShortcuts", qVariantFromValue(listifiedShortcut)); + a->setShortcut(preferredShortcut(info)); + auto propertizedShortcut = qVariantFromValue(QList() << info.defaultShortcut); + a->setProperty("defaultShortcuts", propertizedShortcut); - - // TODO: check for colliding shortcuts, or make sure it happens smartly inside kactioncollection - // - // Ultimately we want to have more than one KActionCollection, so we can - // have things like Ctrl+I be italics in the text editor widget, while not - // complaining about conflicts elsewhere. Right now, we use only one - // collection, and we don't make things like the text editor configurable, - // so duplicate shortcuts are handled mostly automatically by the shortcut - // editor. + // TODO: check for colliding shortcuts, either with some code like this, or + // by relying on the code existing inside kactioncollection // // QMap existingShortcuts; // foreach(QAction* action, actionCollection->actions()) { @@ -293,38 +292,91 @@ f.open(QFile::ReadOnly); doc.setContent(f.readAll()); - QDomElement actions = doc.documentElement(); // Whole document - QString collection = actions.attribute("name"); - QDomElement actionXml = actions.firstChild().toElement(); // Single Action + QDomElement base = doc.documentElement(); // "ActionCollection" outer group + QString collectionName = base.attribute("name"); + QString version = base.attribute("version"); + if (version != "2") { + errAction << ".action XML file" << actionDefinition << "has incorrect version; skipping."; + continue; + } - while (!actionXml.isNull()) { - if (actionXml.tagName() == "Action") { - // Read name from format - QString name = actionXml.attribute("name"); - // Very bad things - if (name.isEmpty()) { - errAction << "Unnamed action in definitions file " << actionDefinition; - continue; - } + KActionCollection *actionCollection; + if (!actionCollections.contains(collectionName)) { + actionCollection = new KActionCollection(q, collectionName); + actionCollections.insert(collectionName, actionCollection); + dbgAction << "Adding a new action collection " << collectionName; + } else { + actionCollection = actionCollections.value(collectionName); + } + + // Loop over nodes. Each of these corresponds to a + // KActionCategory, producing a group of actions in the shortcut dialog. + QDomElement actions = base.firstChild().toElement(); + while (!actions.isNull()) { + + // field + QDomElement categoryTextNode = actions.firstChild().toElement(); + QString categoryName = quietlyTranslate(categoryTextNode.text()); + KActionCategory *category = actionCollection->getCategory(categoryName); + dbgAction << "Using category" << categoryName; + + // tags + QDomElement actionXml = categoryTextNode.nextSiblingElement(); + + // Loop over individual actions + while (!actionXml.isNull()) { + if (actionXml.tagName() == "Action") { + // Read name from format + QString name = actionXml.attribute("name"); + + // Bad things + if (name.isEmpty()) { + errAction << "Unnamed action in definitions file " << actionDefinition; + } + + else if (actionInfoList.contains(name)) { + // errAction << "NOT COOL: Duplicated action name from xml data: " << name; + } + + else { + ActionInfoItem info; + info.xmlData = actionXml; + info.defaultShortcut = getShortcutFromXml(actionXml); + info.customShortcut = QKeySequence(); + info.categoryName = categoryName; + info.collectionName = collectionName; + + // dbgAction << "default shortcut for" << name << " - " << info.defaultShortcut; + actionInfoList.insert(name,info); + } - if (actionInfoList.contains(name)) { - errAction << "Warning: Duplicated action name: " << name; } + actionXml = actionXml.nextSiblingElement(); + } + actions = actions.nextSiblingElement(); + } + + } - actionInfoItem info; - info.xmlData = actionXml; - info.defaultShortcut = getShortcutFromXml(actionXml); - info.customShortcut = info.defaultShortcut; //TODO: Read from KisConfig +}; +void KisActionRegistry::Private::loadCustomShortcuts(QString filename) +{ + Q_UNUSED(filename); - dbgAction << "default shortcut for" << name << " - " << info.defaultShortcut; + const KConfigGroup localShortcuts(KSharedConfig::openConfig("kritashortcutsrc"), + QStringLiteral("Shortcuts")); - actionInfoList.insert(name,info); - } - actionXml = actionXml.nextSiblingElement(); - } - } + if (!localShortcuts.exists()) { + return; + } + for (auto i = actionInfoList.begin(); i != actionInfoList.end(); ++i) { + if (localShortcuts.hasKey(i.key())) { + QString entry = localShortcuts.readEntry(i.key(), QString()); + i.value().customShortcut = QKeySequence(entry); + } + } }; diff --git a/libs/widgetutils/xmlgui/KisShortcutsEditor.h b/libs/widgetutils/xmlgui/KisShortcutsEditor.h --- a/libs/widgetutils/xmlgui/KisShortcutsEditor.h +++ b/libs/widgetutils/xmlgui/KisShortcutsEditor.h @@ -186,15 +186,7 @@ /** * Write the current settings to the \p config object. * - * This does not initialize the \p config object. It adds the - * configuration. - * - * @note this will not save the global configuration! globalaccel holds - * that part of the configuration. - * @see writeGlobalConfig() - * - * @param config Config object to save to or, or null to use the - * applications config object + * @param config Config object to save to. Default is kritashortcutsrc. * */ void writeConfiguration(KConfigGroup *config = 0) const; diff --git a/libs/widgetutils/xmlgui/KisShortcutsEditor.cpp b/libs/widgetutils/xmlgui/KisShortcutsEditor.cpp --- a/libs/widgetutils/xmlgui/KisShortcutsEditor.cpp +++ b/libs/widgetutils/xmlgui/KisShortcutsEditor.cpp @@ -26,6 +26,7 @@ #include "KisShortcutsEditor.h" #include "KisShortcutsEditor_p.h" #include "config-xmlgui.h" +#include "kis_action_registry.h" // The following is needed for KisShortcutsEditorPrivate and QTreeWidgetHack // #include "KisShortcutsDialog_p.h" @@ -43,6 +44,7 @@ #include #include +#include #include #include "kactioncollection.h" #include "kactioncategory.h" @@ -112,7 +114,7 @@ /** * Forward this actioncollection to the delegate which will do conflict checking. - * TODO this seems to _replace_ any existing collections in the delegate. So, is that cool? + * This _replaces_ existing collections in the delegate. */ d->actionCollections.append(collection); d->delegate->setCheckActionCollections(d->actionCollections); @@ -142,16 +144,25 @@ // Add a subtree for each category? Perhaps easier to think that this // doesn't exist. Basically you add KActionCategory as a QObject child of // KActionCollection, and then tag objects as belonging to the category. - QList categories = collection->findChildren(); - foreach (KActionCategory *category, categories) { + foreach (KActionCategory *category, collection->categories()) { + + // Don't display empty categories. + if (category->actions().isEmpty()) { + continue; + } + hierarchy[KisShortcutsEditorPrivate::Action] = d->findOrMakeItem(hierarchy[KisShortcutsEditorPrivate::Program], category->text()); - // Add every item from each category. + // Add every item from the category. foreach (QAction *action, category->actions()) { actionsSeen.insert(action); d->addAction(action, hierarchy, KisShortcutsEditorPrivate::Action); } + + // Fold in each KActionCategory by default. + hierarchy[KisShortcutsEditorPrivate::Action]->setExpanded(false); + } // Finally, tack on any uncategorized actions. @@ -194,13 +205,23 @@ collection->writeSettings(&group, true); } } + + KisActionRegistry::instance()->notifySettingsUpdated(); } void KisShortcutsEditor::writeConfiguration(KConfigGroup *config) const { + // This is a horrible mess with pointers... + auto cg = KConfigGroup(KSharedConfig::openConfig("kritashortcutsrc"), "Shortcuts"); + if (config == 0) { + config = &cg; + } + foreach (KActionCollection *collection, d->actionCollections) { - collection->writeSettings(config); + collection->writeSettings(config, true); } + + KisActionRegistry::instance()->notifySettingsUpdated(); } //slot diff --git a/libs/widgetutils/xmlgui/KisShortcutsEditor_p.h b/libs/widgetutils/xmlgui/KisShortcutsEditor_p.h --- a/libs/widgetutils/xmlgui/KisShortcutsEditor_p.h +++ b/libs/widgetutils/xmlgui/KisShortcutsEditor_p.h @@ -50,8 +50,8 @@ public: //! Represents the three hierarchies the dialog displays. - enum hierarchyLevel {Root = 0, /* Base level node (i.e. Krita) */ - Program, /* What is this? Each ActionCollection gets one... */ + enum hierarchyLevel {Root = 0, /* Base level node (Tools, Krita...) */ + Program, /* We use this like "Path Tool, Default Tool," */ Action}; /* Individual actions */ diff --git a/libs/widgetutils/xmlgui/KisShortcutsEditor_p.cpp b/libs/widgetutils/xmlgui/KisShortcutsEditor_p.cpp --- a/libs/widgetutils/xmlgui/KisShortcutsEditor_p.cpp +++ b/libs/widgetutils/xmlgui/KisShortcutsEditor_p.cpp @@ -116,13 +116,11 @@ // Construct the actual treeview items. The work happens here. // - // XXX: disentangle the confusing, dire warning left here previously: - // "This code doesn't allow editing of QAction. It can not distinguish - // between default and active shortcuts. This breaks many assumptions the - // editor makes." + // Don't feed the editor raw QActions. This code requires that the + // "defaultShortcut" dynamic property be set. // - // Note: Krita never sets the property "isShortcutConfigurable" so we will - // add every action here. + // Note: Krita never sets the property "isShortcutConfigurable". + // Perhaps it could be useful. const QVariant value = action->property("isShortcutConfigurable"); if (!value.isValid() || value.toBool()) { new KisShortcutsEditorItem((hier[level]), action); diff --git a/libs/widgetutils/xmlgui/kactioncollection.h b/libs/widgetutils/xmlgui/kactioncollection.h --- a/libs/widgetutils/xmlgui/kactioncollection.h +++ b/libs/widgetutils/xmlgui/kactioncollection.h @@ -35,6 +35,7 @@ class KConfigGroup; class QActionGroup; class QString; +class KActionCategory; /** * \short A container for a set of QAction objects. @@ -136,6 +137,11 @@ void readSettings(KConfigGroup *config = 0); /** + * Update shortcuts from the KisActionRegistry. + */ + void updateShortcuts(); + + /** * Write the current configurable key associations. If @a is nonzero, use * that configuration group. * @@ -230,6 +236,20 @@ */ const KXMLGUIClient *parentGUIClient() const; + + /** + * Returns the KActionCategories inside this collection + */ + QList categories() const; + + + /** + * Gets a category with name @p name inside this collection. + * + * Creates a new category if one does not exist. + */ + KActionCategory *getCategory(const QString &categoryName); + Q_SIGNALS: /** * Indicates that \a action was inserted into this action collection. @@ -297,6 +317,13 @@ Q_INVOKABLE QAction *addAction(const QString &name, QAction *action); /** + * Adds a new action to the collection in category @p category. + * + * The category will be created if it does not already exist. + */ + Q_INVOKABLE QAction *addCategorizedAction(const QString &name, QAction *action, const QString &categoryName); + + /** * Adds a list of actions to the collection. * * The objectName of the actions is used as their internal name in the collection. diff --git a/libs/widgetutils/xmlgui/kactioncollection.cpp b/libs/widgetutils/xmlgui/kactioncollection.cpp --- a/libs/widgetutils/xmlgui/kactioncollection.cpp +++ b/libs/widgetutils/xmlgui/kactioncollection.cpp @@ -29,6 +29,8 @@ #include "kactioncategory.h" #include "kxmlguiclient.h" #include "kxmlguifactory.h" +#include "kactioncategory.h" +#include "kis_action_registry.h" #include #include @@ -123,6 +125,27 @@ delete d; } + +QList KActionCollection::categories() const +{ + return this->findChildren(); +} + +KActionCategory *KActionCollection::getCategory(const QString &name) { + KActionCategory *category = 0; + foreach (KActionCategory *c, categories()) { + if (c->text() == name) { + category = c; + } + } + + if (category == 0) { + category = new KActionCategory(name, this); + } + return category; +}; + + void KActionCollection::clear() { d->actionByName.clear(); @@ -227,6 +250,11 @@ return set.toList(); } +QAction *KActionCollection::addCategorizedAction(const QString &name, QAction *action, const QString &categoryName) +{ + return getCategory(categoryName)->addAction(name, action); +} + QAction *KActionCollection::addAction(const QString &name, QAction *action) { if (!action) { @@ -411,9 +439,21 @@ d->configGroup = group; } +void KActionCollection::updateShortcuts() +{ + auto actionRegistry = KisActionRegistry::instance(); + + for (QMap::ConstIterator it = d->actionByName.constBegin(); + it != d->actionByName.constEnd(); ++it) { + actionRegistry->updateShortcut(it.key(), it.value()); + } +} + + void KActionCollection::readSettings(KConfigGroup *config) { - KConfigGroup cg(KSharedConfig::openConfig(), configGroup()); + // TODO: perhaps get rid of this + KConfigGroup cg(KSharedConfig::openConfig("kritashortcutsrc"), configGroup()); if (!config) { config = &cg; } diff --git a/plugins/artistictextshape/ArtisticTextTool.cpp b/plugins/artistictextshape/ArtisticTextTool.cpp --- a/plugins/artistictextshape/ArtisticTextTool.cpp +++ b/plugins/artistictextshape/ArtisticTextTool.cpp @@ -43,6 +43,7 @@ #include #include #include +#include "kis_action_registry.h" #include #include @@ -75,48 +76,42 @@ : KoToolBase(canvas), m_selection(canvas, this), m_currentShape(0), m_hoverText(0), m_hoverPath(0), m_hoverHandle(false) , m_textCursor( -1 ), m_showCursor( true ), m_currentStrategy(0) { - m_detachPath = new QAction(koIcon("artistictext-detach-path"), i18n("Detach Path"), this); + KisActionRegistry *actionRegistry = KisActionRegistry::instance(); + m_detachPath = actionRegistry->makeQAction("artistictext_detach_from_path", this); m_detachPath->setEnabled( false ); connect( m_detachPath, SIGNAL(triggered()), this, SLOT(detachPath()) ); addAction("artistictext_detach_from_path", m_detachPath); - m_convertText = new QAction(koIcon("pathshape"), i18n("Convert to Path"), this); + m_convertText = actionRegistry->makeQAction("artistictext_convert_to_path", this); m_convertText->setEnabled( false ); connect( m_convertText, SIGNAL(triggered()), this, SLOT(convertText()) ); addAction("artistictext_convert_to_path", m_convertText); - m_fontBold = new QAction(koIcon("format-text-bold"), i18n("Bold text"), this); - m_fontBold->setCheckable(true); + m_fontBold = actionRegistry->makeQAction("artistictext_font_bold", this); connect(m_fontBold, SIGNAL(toggled(bool)), this, SLOT(toggleFontBold(bool))); addAction("artistictext_font_bold", m_fontBold); - m_fontItalic = new QAction(koIcon("format-text-italic"), i18n("Italic text"), this); - m_fontItalic->setCheckable(true); + m_fontItalic = actionRegistry->makeQAction("artistictext_font_italic", this); connect(m_fontItalic, SIGNAL(toggled(bool)), this, SLOT(toggleFontItalic(bool))); addAction("artistictext_font_italic", m_fontItalic); - m_superScript = new QAction(koIcon("format-text-superscript"), i18n("Superscript"), this); - m_superScript->setCheckable(true); + m_superScript = actionRegistry->makeQAction("artistictext_superscript", this); connect(m_superScript, SIGNAL(triggered()), this, SLOT(setSuperScript())); addAction("artistictext_superscript", m_superScript); - m_subScript = new QAction(koIcon("format-text-subscript"), i18n("Subscript"), this); - m_subScript->setCheckable(true); + m_subScript = actionRegistry->makeQAction("artistictext_subscript", this); connect(m_subScript, SIGNAL(triggered()), this, SLOT(setSubScript())); addAction("artistictext_subscript", m_subScript); - QAction *anchorStart = new QAction(koIcon("format-justify-left"), i18n("Anchor at Start"), this); - anchorStart->setCheckable( true ); + QAction *anchorStart = actionRegistry->makeQAction("artistictext_anchor_start", this); anchorStart->setData(ArtisticTextShape::AnchorStart); addAction("artistictext_anchor_start", anchorStart); - QAction *anchorMiddle = new QAction(koIcon("format-justify-center"), i18n("Anchor at Middle"), this); - anchorMiddle->setCheckable( true ); + QAction *anchorMiddle = actionRegistry->makeQAction("artistictext_anchor_middle", this); anchorMiddle->setData(ArtisticTextShape::AnchorMiddle); addAction("artistictext_anchor_middle", anchorMiddle); - QAction *anchorEnd = new QAction(koIcon("format-justify-right"), i18n("Anchor at End"), this); - anchorEnd->setCheckable( true ); + QAction *anchorEnd = actionRegistry->makeQAction("artistictext_anchor_end", this); anchorEnd->setData(ArtisticTextShape::AnchorEnd); addAction("artistictext_anchor_end", anchorEnd); diff --git a/plugins/defaultTools/connectionTool/ConnectionTool.cpp b/plugins/defaultTools/connectionTool/ConnectionTool.cpp --- a/plugins/defaultTools/connectionTool/ConnectionTool.cpp +++ b/plugins/defaultTools/connectionTool/ConnectionTool.cpp @@ -52,6 +52,7 @@ #include #include +#include "kis_action_registry.h" #include #include @@ -74,51 +75,52 @@ connectPixmap.load(":/cursor_connect.png"); m_connectCursor = QCursor(connectPixmap, 4, 1); - m_editConnectionPoint = new QAction(i18n("Edit connection points"), this); + KisActionRegistry * actionRegistry = KisActionRegistry::instance(); + m_editConnectionPoint = actionRegistry->makeQAction("toggle-edit-mode", this); m_editConnectionPoint->setCheckable(true); addAction("toggle-edit-mode", m_editConnectionPoint); - m_alignPercent = new QAction(QString("%"), this); + m_alignPercent = actionRegistry->makeQAction("align-relative", this); m_alignPercent->setCheckable(true); addAction("align-relative", m_alignPercent); - m_alignLeft = new QAction(koIcon("align-horizontal-left"), i18n("Align to left edge"), this); + m_alignLeft = actionRegistry->makeQAction("align-left", this); m_alignLeft->setCheckable(true); addAction("align-left", m_alignLeft); - m_alignCenterH = new QAction(koIcon("align-horizontal-center"), i18n("Align to horizontal center"), this); + m_alignCenterH = actionRegistry->makeQAction("align-centerh", this); m_alignCenterH->setCheckable(true); addAction("align-centerh", m_alignCenterH); - m_alignRight = new QAction(koIcon("align-horizontal-right"), i18n("Align to right edge"), this); + m_alignRight = actionRegistry->makeQAction("align-right", this); m_alignRight->setCheckable(true); addAction("align-right", m_alignRight); - m_alignTop = new QAction(koIcon("align-vertical-top"), i18n("Align to top edge"), this); + m_alignTop = actionRegistry->makeQAction("align-top", this); m_alignTop->setCheckable(true); addAction("align-top", m_alignTop); - m_alignCenterV = new QAction(koIcon("align-vertical-center"), i18n("Align to vertical center"), this); + m_alignCenterV = actionRegistry->makeQAction("align-centerv", this); m_alignCenterV->setCheckable(true); addAction("align-centerv", m_alignCenterV); - m_alignBottom = new QAction(koIcon("align-vertical-bottom"), i18n("Align to bottom edge"), this); + m_alignBottom = actionRegistry->makeQAction("align-bottom", this); m_alignBottom->setCheckable(true); addAction("align-bottom", m_alignBottom); - m_escapeAll = new QAction(koIcon("escape-direction-all"), i18n("Escape in all directions"), this); + m_escapeAll = actionRegistry->makeQAction("escape-all", this); m_escapeAll->setCheckable(true); addAction("escape-all", m_escapeAll); - m_escapeHorizontal = new QAction(koIcon("escape-direction-horizontal"), i18n("Escape in horizontal directions"), this); + m_escapeHorizontal = actionRegistry->makeQAction("escape-horizontal", this); m_escapeHorizontal->setCheckable(true); addAction("escape-horizontal", m_escapeHorizontal); - m_escapeVertical = new QAction(koIcon("escape-direction-vertical"), i18n("Escape in vertical directions"), this); + m_escapeVertical = actionRegistry->makeQAction("escape-vertical", this); m_escapeVertical->setCheckable(true); addAction("escape-vertical", m_escapeVertical); - m_escapeLeft = new QAction(koIcon("escape-direction-left"), i18n("Escape in left direction"), this); + m_escapeLeft = actionRegistry->makeQAction("escape-left", this); m_escapeLeft->setCheckable(true); addAction("escape-left", m_escapeLeft); - m_escapeRight = new QAction(koIcon("escape-direction-right"), i18n("Escape in right direction"), this); + m_escapeRight = actionRegistry->makeQAction("escape-right", this); m_escapeRight->setCheckable(true); addAction("escape-right", m_escapeRight); - m_escapeUp = new QAction(koIcon("escape-direction-up"), i18n("Escape in up direction"), this); + m_escapeUp = actionRegistry->makeQAction("escape-up", this); m_escapeUp->setCheckable(true); addAction("escape-up", m_escapeUp); - m_escapeDown = new QAction(koIcon("escape-direction-down"), i18n("Escape in down direction"), this); + m_escapeDown = actionRegistry->makeQAction("escape-down", this); m_escapeDown->setCheckable(true); addAction("escape-down", m_escapeDown); diff --git a/plugins/defaultTools/defaulttool/DefaultTool.cpp b/plugins/defaultTools/defaulttool/DefaultTool.cpp --- a/plugins/defaultTools/defaulttool/DefaultTool.cpp +++ b/plugins/defaultTools/defaulttool/DefaultTool.cpp @@ -56,6 +56,7 @@ #include #include #include +#include "kis_action_registry.h" #include @@ -211,64 +212,53 @@ void DefaultTool::setupActions() { - QAction * actionBringToFront = new QAction(koIcon("object-order-front-calligra"), - i18n("Bring to &Front"), this); - actionBringToFront->setShortcut(QKeySequence("Ctrl+Shift+]")); + KisActionRegistry * actionRegistry = KisActionRegistry::instance(); + + QAction * actionBringToFront = actionRegistry->makeQAction("object_order_front", this); addAction("object_order_front", actionBringToFront); connect(actionBringToFront, SIGNAL(triggered()), this, SLOT(selectionBringToFront())); - QAction * actionRaise = new QAction(koIcon("object-order-raise-calligra"), i18n("&Raise"), this); - actionRaise->setShortcut(QKeySequence("Ctrl+]")); + QAction * actionRaise = actionRegistry->makeQAction("object_order_raise", this); addAction("object_order_raise", actionRaise); connect(actionRaise, SIGNAL(triggered()), this, SLOT(selectionMoveUp())); - QAction * actionLower = new QAction(koIcon("object-order-lower-calligra"), i18n("&Lower"), this); - actionLower->setShortcut(QKeySequence("Ctrl+[")); + QAction * actionLower = actionRegistry->makeQAction("object_order_lower", this); addAction("object_order_lower", actionLower); connect(actionLower, SIGNAL(triggered()), this, SLOT(selectionMoveDown())); - QAction * actionSendToBack = new QAction(koIcon("object-order-back-calligra"), - i18n("Send to &Back"), this); - actionSendToBack->setShortcut(QKeySequence("Ctrl+Shift+[")); + QAction * actionSendToBack = actionRegistry->makeQAction("object_order_back", this); addAction("object_order_back", actionSendToBack); connect(actionSendToBack, SIGNAL(triggered()), this, SLOT(selectionSendToBack())); - QAction * actionAlignLeft = new QAction(koIcon("object-align-horizontal-left-calligra"), - i18n("Align Left"), this); + QAction * actionAlignLeft = actionRegistry->makeQAction("object_align_horizontal_left", this); addAction("object_align_horizontal_left", actionAlignLeft); connect(actionAlignLeft, SIGNAL(triggered()), this, SLOT(selectionAlignHorizontalLeft())); - QAction * actionAlignCenter = new QAction(koIcon("object-align-horizontal-center-calligra"), - i18n("Horizontally Center"), this); + QAction * actionAlignCenter = actionRegistry->makeQAction("object_align_horizontal_center", this); addAction("object_align_horizontal_center", actionAlignCenter); connect(actionAlignCenter, SIGNAL(triggered()), this, SLOT(selectionAlignHorizontalCenter())); - QAction * actionAlignRight = new QAction(koIcon("object-align-horizontal-right-calligra"), - i18n("Align Right"), this); + QAction * actionAlignRight = actionRegistry->makeQAction("object_align_horizontal_right", this); addAction("object_align_horizontal_right", actionAlignRight); connect(actionAlignRight, SIGNAL(triggered()), this, SLOT(selectionAlignHorizontalRight())); - QAction * actionAlignTop = new QAction(koIcon("object-align-vertical-top-calligra"), i18n("Align Top"), this); + QAction * actionAlignTop = actionRegistry->makeQAction("object_align_vertical_top", this); addAction("object_align_vertical_top", actionAlignTop); connect(actionAlignTop, SIGNAL(triggered()), this, SLOT(selectionAlignVerticalTop())); - QAction * actionAlignMiddle = new QAction(koIcon("object-align-vertical-center-calligra"), - i18n("Vertically Center"), this); + QAction * actionAlignMiddle = actionRegistry->makeQAction("object_align_vertical_center", this); addAction("object_align_vertical_center", actionAlignMiddle); connect(actionAlignMiddle, SIGNAL(triggered()), this, SLOT(selectionAlignVerticalCenter())); - QAction * actionAlignBottom = new QAction(koIcon("object-align-vertical-bottom-calligra"), - i18n("Align Bottom"), this); + QAction * actionAlignBottom = actionRegistry->makeQAction("object_align_vertical_bottom", this); addAction("object_align_vertical_bottom", actionAlignBottom); connect(actionAlignBottom, SIGNAL(triggered()), this, SLOT(selectionAlignVerticalBottom())); - QAction * actionGroupBottom = new QAction(koIcon("object-group-calligra"), - i18n("Group"), this); + QAction * actionGroupBottom = actionRegistry->makeQAction("object_group", this); addAction("object_group", actionGroupBottom); connect(actionGroupBottom, SIGNAL(triggered()), this, SLOT(selectionGroup())); - QAction * actionUngroupBottom = new QAction(koIcon("object-ungroup-calligra"), - i18n("Ungroup"), this); + QAction * actionUngroupBottom = actionRegistry->makeQAction("object_ungroup", this); addAction("object_ungroup", actionUngroupBottom); connect(actionUngroupBottom, SIGNAL(triggered()), this, SLOT(selectionUngroup())); } diff --git a/plugins/textshape/ReferencesTool.cpp b/plugins/textshape/ReferencesTool.cpp --- a/plugins/textshape/ReferencesTool.cpp +++ b/plugins/textshape/ReferencesTool.cpp @@ -41,8 +41,9 @@ #include #include #include -#include +#include "kis_action_registry.h" +#include #include #include #include @@ -122,33 +123,30 @@ void ReferencesTool::createActions() { - QWidgetAction *wAction = 0; + KisActionRegistry * actionRegistry = KisActionRegistry::instance(); - QAction *action = new QAction(i18n("Insert"), this); + QAction *action = actionRegistry->makeQAction("insert_tableofcontents", this); addAction("insert_tableofcontents", action); - action->setToolTip(i18n("Insert a Table of Contents into the document.")); - action = new QAction(i18n("Insert Custom..."), this); + action = actionRegistry->makeQAction("insert_configure_tableofcontents", this); addAction("insert_configure_tableofcontents", action); - action->setToolTip(i18n("Insert a custom Table of Contents into the document.")); - action = new QAction(koIcon("configure"), i18n("Configure..."), this); + action = actionRegistry->makeQAction("format_tableofcontents", this); addAction("format_tableofcontents", action); - action->setToolTip(i18n("Configure the Table of Contents")); - connect(action, SIGNAL(triggered()), this, SLOT(formatTableOfContents())); + connect(action, SIGNAL(triggered().act), this, SLOT(formatTableOfContents())); - action = new QAction(i18n("Insert footnote with auto number"),this); + action = actionRegistry->makeQAction("insert_autofootnote", this); addAction("insert_autofootnote",action); connect(action, SIGNAL(triggered()), this, SLOT(insertAutoFootNote())); - wAction = new QWidgetAction(this); + QWidgetAction * wAction = new QWidgetAction(this); wAction->setText(i18n("Insert Labeled Footnote")); QWidget *w = new LabeledWidget(wAction, i18n("Insert with label:"), LabeledWidget::INLINE, false); wAction->setDefaultWidget(w); addAction("insert_labeledfootnote", wAction); connect(w, SIGNAL(triggered(QString)), this, SLOT(insertLabeledFootNote(QString))); - action = new QAction(i18n("Insert endnote with auto number"),this); + action = actionRegistry->makeQAction("insert_autoendnote", this); addAction("insert_autoendnote",action); connect(action, SIGNAL(triggered()), this, SLOT(insertAutoEndNote())); @@ -158,35 +156,30 @@ wAction->setDefaultWidget(w); addAction("insert_labeledendnote", wAction); connect(w, SIGNAL(triggered(QString)), this, SLOT(insertLabeledEndNote(QString))); - action = new QAction(koIcon("configure"), i18n("Settings..."), this); + action = actionRegistry->makeQAction("format_footnotes", this); addAction("format_footnotes",action); connect(action, SIGNAL(triggered()), this, SLOT(showFootnotesConfigureDialog())); - action = new QAction(koIcon("configure"), i18n("Settings..."), this); + action = actionRegistry->makeQAction("format_endnotes", this); addAction("format_endnotes",action); connect(action, SIGNAL(triggered()), this, SLOT(showEndnotesConfigureDialog())); - action = new QAction(i18n("Insert Citation"), this); + action = actionRegistry->makeQAction("insert_citation", this); addAction("insert_citation",action); - action->setToolTip(i18n("Insert a citation into the document.")); connect(action, SIGNAL(triggered()), this, SLOT(insertCitation())); - action = new QAction(i18n("Insert Bibliography"), this); + action = actionRegistry->makeQAction("insert_bibliography", this); addAction("insert_bibliography",action); - action->setToolTip(i18n("Insert a bibliography into the document.")); - action = new QAction(i18n("Insert Custom Bibliography"), this); + action = actionRegistry->makeQAction("insert_custom_bibliography", this); addAction("insert_custom_bibliography", action); - action->setToolTip(i18n("Insert a custom Bibliography into the document.")); - action = new QAction(i18n("Configure"),this); + action = actionRegistry->makeQAction("configure_bibliography", this); addAction("configure_bibliography",action); - action->setToolTip(i18n("Configure the bibliography")); connect(action, SIGNAL(triggered()), this, SLOT(configureBibliography())); - action = new QAction(i18n("Insert Link"), this); + action = actionRegistry->makeQAction("insert_link", this); addAction("insert_link", action); - action->setToolTip(i18n("Insert a weblink or link to a bookmark.")); connect(action, SIGNAL(triggered()), this, SLOT(insertLink())); wAction = new QWidgetAction(this); @@ -198,13 +191,11 @@ connect(m_bmark, SIGNAL(triggered(QString)), this, SLOT(insertBookmark(QString))); wAction->setToolTip(i18n("Insert a Bookmark. This is useful to create links that point to areas within the document")); - action = new QAction(i18n("Bookmarks"), this); + action = actionRegistry->makeQAction("invoke_bookmark_handler", this); addAction("invoke_bookmark_handler", action); - action->setToolTip(i18n("Display a pop up that hosts the options to add new Bookmark or handle existing Bookmarks")); - action = new QAction(i18n("Manage Bookmarks"), this); + action = actionRegistry->makeQAction("manage_bookmarks", this); addAction("manage_bookmarks", action); - action->setToolTip(i18n("Manage your Bookmarks. Check where are they pointing to, Delete or Rename.")); } diff --git a/plugins/textshape/TextTool.cpp b/plugins/textshape/TextTool.cpp --- a/plugins/textshape/TextTool.cpp +++ b/plugins/textshape/TextTool.cpp @@ -75,6 +75,7 @@ #include //#include #include +#include "kis_action_registry.h" #include #include @@ -213,124 +214,116 @@ bool useAdvancedText = !(canvas()->resourceManager()->intResource(KoCanvasResourceManager::ApplicationSpeciality) & KoCanvasResourceManager::NoAdvancedText); - m_actionConfigureSection = new QAction(koIcon("configure"), i18n("Configure current section"), this); //FIXME: Find another icon for this. + KisActionRegistry *actionRegistry = KisActionRegistry::instance(); + + // FIXME: find new icons for these + m_actionConfigureSection = actionRegistry->makeQAction("configure_section", this); addAction("configure_section", m_actionConfigureSection); connect(m_actionConfigureSection, SIGNAL(triggered(bool)), this, SLOT(configureSection())); - m_actionInsertSection = new QAction(koIcon("insert-text"), i18n("Insert new section"), this); //FIXME: Find another icon for this. + m_actionInsertSection = actionRegistry->makeQAction("insert_section", this); addAction("insert_section", m_actionInsertSection); connect(m_actionInsertSection, SIGNAL(triggered(bool)), this, SLOT(insertNewSection())); - m_actionSplitSections = new QAction(koIcon("split"), i18n("Insert paragraph between sections"), this); //FIXME: Find another icon for this. + m_actionSplitSections = actionRegistry->makeQAction("split_sections", this); addAction("split_sections", m_actionSplitSections); connect(m_actionSplitSections, SIGNAL(triggered(bool)), this, SLOT(splitSections())); - m_actionPasteAsText = new QAction(koIcon("edit-paste"), i18n("Paste As Text"), this); - m_actionPasteAsText->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_V); + m_actionPasteAsText = actionRegistry->makeQAction("edit_paste_text", this); addAction("edit_paste_text", m_actionPasteAsText); connect(m_actionPasteAsText, SIGNAL(triggered(bool)), this, SLOT(pasteAsText())); - m_actionFormatBold = new QAction(koIcon("format-text-bold"), i18n("Bold"), this); - m_actionFormatBold->setShortcut(Qt::CTRL + Qt::Key_B); + m_actionFormatBold = actionRegistry->makeQAction("format_bold", this); addAction("format_bold", m_actionFormatBold); m_actionFormatBold->setCheckable(true); connect(m_actionFormatBold, SIGNAL(triggered(bool)), this, SLOT(bold(bool))); - m_actionFormatItalic = new QAction(koIcon("format-text-italic"), i18n("Italic"), this); - m_actionFormatItalic->setShortcut(Qt::CTRL + Qt::Key_I); + m_actionFormatItalic = actionRegistry->makeQAction("format_italic", this); m_actionFormatItalic->setCheckable(true); addAction("format_italic", m_actionFormatItalic); connect(m_actionFormatItalic, SIGNAL(triggered(bool)), this, SLOT(italic(bool))); - m_actionFormatUnderline = new QAction(koIcon("format-text-underline"), i18nc("Text formatting", "Underline"), this); - m_actionFormatUnderline->setShortcut(Qt::CTRL + Qt::Key_U); + m_actionFormatUnderline = actionRegistry->makeQAction("format_underline", this); m_actionFormatUnderline->setCheckable(true); addAction("format_underline", m_actionFormatUnderline); connect(m_actionFormatUnderline, SIGNAL(triggered(bool)), this, SLOT(underline(bool))); - m_actionFormatStrikeOut = new QAction(koIcon("format-text-strikethrough"), i18n("Strikethrough"), this); + m_actionFormatStrikeOut = actionRegistry->makeQAction("format_strike", this); m_actionFormatStrikeOut->setCheckable(true); addAction("format_strike", m_actionFormatStrikeOut); connect(m_actionFormatStrikeOut, SIGNAL(triggered(bool)), this, SLOT(strikeOut(bool))); QActionGroup *alignmentGroup = new QActionGroup(this); - m_actionAlignLeft = new QAction(koIcon("format-justify-left"), i18n("Align Left"), this); - m_actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L); + m_actionAlignLeft = actionRegistry->makeQAction("format_alignleft", this); m_actionAlignLeft->setCheckable(true); alignmentGroup->addAction(m_actionAlignLeft); addAction("format_alignleft", m_actionAlignLeft); connect(m_actionAlignLeft, SIGNAL(triggered(bool)), this, SLOT(alignLeft())); - m_actionAlignRight = new QAction(koIcon("format-justify-right"), i18n("Align Right"), this); - m_actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R); + m_actionAlignRight = actionRegistry->makeQAction("format_alignright", this); m_actionAlignRight->setCheckable(true); alignmentGroup->addAction(m_actionAlignRight); addAction("format_alignright", m_actionAlignRight); connect(m_actionAlignRight, SIGNAL(triggered(bool)), this, SLOT(alignRight())); - m_actionAlignCenter = new QAction(koIcon("format-justify-center"), i18n("Align Center"), this); - m_actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E); + m_actionAlignCenter = actionRegistry->makeQAction("format_aligncenter", this); m_actionAlignCenter->setCheckable(true); addAction("format_aligncenter", m_actionAlignCenter); alignmentGroup->addAction(m_actionAlignCenter); connect(m_actionAlignCenter, SIGNAL(triggered(bool)), this, SLOT(alignCenter())); - m_actionAlignBlock = new QAction(koIcon("format-justify-fill"), i18n("Align Block"), this); - m_actionAlignBlock->setShortcut(Qt::CTRL + Qt::Key_J); + m_actionAlignBlock = actionRegistry->makeQAction("format_alignblock", this); m_actionAlignBlock->setCheckable(true); alignmentGroup->addAction(m_actionAlignBlock); addAction("format_alignblock", m_actionAlignBlock); connect(m_actionAlignBlock, SIGNAL(triggered(bool)), this, SLOT(alignBlock())); - m_actionChangeDirection = new QAction(koIcon("format-text-direction-rtl"), i18n("Change text direction"), this); - m_actionChangeDirection->setToolTip(i18n("Change writing direction")); - m_actionChangeDirection->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_D); + m_actionChangeDirection = actionRegistry->makeQAction("change_text_direction", this); m_actionChangeDirection->setCheckable(true); addAction("change_text_direction", m_actionChangeDirection); connect(m_actionChangeDirection, SIGNAL(triggered()), this, SLOT(textDirectionChanged())); - m_actionFormatSuper = new QAction(koIcon("format-text-superscript"), i18n("Superscript"), this); - m_actionFormatSuper->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_P); + m_actionFormatSuper = actionRegistry->makeQAction("format_super", this); m_actionFormatSuper->setCheckable(true); addAction("format_super", m_actionFormatSuper); connect(m_actionFormatSuper, SIGNAL(triggered(bool)), this, SLOT(superScript(bool))); - m_actionFormatSub = new QAction(koIcon("format-text-subscript"), i18n("Subscript"), this); - m_actionFormatSub->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B); + m_actionFormatSub = actionRegistry->makeQAction("format_sub", this); m_actionFormatSub->setCheckable(true); addAction("format_sub", m_actionFormatSub); connect(m_actionFormatSub, SIGNAL(triggered(bool)), this, SLOT(subScript(bool))); - const char* const increaseIndentActionIconName = - QApplication::isRightToLeft() ? koIconNameCStr("format-indent-less") : koIconNameCStr("format-indent-more"); - m_actionFormatIncreaseIndent = new QAction( - KisIconUtils::loadIcon(QLatin1String(increaseIndentActionIconName)), - i18n("Increase Indent"), this); + + // TODO: check these rtl-things work properly + m_actionFormatIncreaseIndent = actionRegistry->makeQAction("format_increaseindent", this); addAction("format_increaseindent", m_actionFormatIncreaseIndent); connect(m_actionFormatIncreaseIndent, SIGNAL(triggered()), this, SLOT(increaseIndent())); - const char* const decreaseIndentActionIconName = - QApplication::isRightToLeft() ? koIconNameCStr("format-indent-more") : koIconNameCStr("format-indent-less"); - m_actionFormatDecreaseIndent = new QAction(KisIconUtils::loadIcon(QLatin1String(decreaseIndentActionIconName)), - i18n("Decrease Indent"), this); + m_actionFormatDecreaseIndent = actionRegistry->makeQAction("format_decreaseindent", this); addAction("format_decreaseindent", m_actionFormatDecreaseIndent); connect(m_actionFormatDecreaseIndent, SIGNAL(triggered()), this, SLOT(decreaseIndent())); - QAction *action = new QAction(koIcon("format-list-unordered"), i18n("Bullet list"), this); + const char* const increaseIndentActionIconName = + QApplication::isRightToLeft() ? koIconNameCStr("format-indent-less") : koIconNameCStr("format-indent-more"); + m_actionFormatIncreaseIndent->setIcon(koIcon(increaseIndentActionIconName)); + + const char* const decreaseIndentActionIconName = + QApplication::isRightToLeft() ? koIconNameCStr("format_decreaseindent") : koIconNameCStr("format-indent-less"); + m_actionFormatIncreaseIndent->setIcon(koIcon(increaseIndentActionIconName)); + + QAction *action = actionRegistry->makeQAction("format_bulletlist", this); addAction("format_bulletlist", action); - action = new QAction(koIcon("format-list-ordered"), i18n("Numbered list"), this); + action = actionRegistry->makeQAction("format_numberlist", this); addAction("format_numberlist", action); - action = new QAction(i18n("Increase Font Size"), this); - action->setShortcut(Qt::CTRL + Qt::Key_Greater); + action = actionRegistry->makeQAction("fontsizeup", this); addAction("fontsizeup", action); connect(action, SIGNAL(triggered()), this, SLOT(increaseFontSize())); - action = new QAction(i18n("Decrease Font Size"), this); - action->setShortcut(Qt::CTRL + Qt::Key_Less); + action = actionRegistry->makeQAction("fontsizedown", this); addAction("fontsizedown", action); connect(action, SIGNAL(triggered()), this, SLOT(decreaseFontSize())); @@ -344,171 +337,131 @@ addAction("insert_variable", m_variableMenu); // ------------------- Actions with a key binding and no GUI item - action = new QAction(i18n("Insert Non-Breaking Space"), this); - action->setShortcut(Qt::CTRL + Qt::Key_Space); + action = actionRegistry->makeQAction("nonbreaking_space", this); addAction("nonbreaking_space", action); connect(action, SIGNAL(triggered()), this, SLOT(nonbreakingSpace())); - action = new QAction(i18n("Insert Non-Breaking Hyphen"), this); - action->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Minus); + action = actionRegistry->makeQAction("nonbreaking_hyphen", this); addAction("nonbreaking_hyphen", action); connect(action, SIGNAL(triggered()), this, SLOT(nonbreakingHyphen())); - action = new QAction(i18n("Insert Index"), this); - action->setShortcut(Qt::CTRL + Qt::Key_T); + action = actionRegistry->makeQAction("insert_index", this); addAction("insert_index", action); connect(action, SIGNAL(triggered()), this, SLOT(insertIndexMarker())); - action = new QAction(i18n("Insert Soft Hyphen"), this); - //action->setShortcut(Qt::CTRL + Qt::Key_Minus); // TODO this one is also used for the kde-global zoom-out :( + action = actionRegistry->makeQAction("soft_hyphen", this); + // TODO: double check this one works, conflicts with "zoom out" addAction("soft_hyphen", action); connect(action, SIGNAL(triggered()), this, SLOT(softHyphen())); if (useAdvancedText) { - action = new QAction(i18n("Line Break"), this); - action->setShortcut(Qt::SHIFT + Qt::Key_Return); + action = actionRegistry->makeQAction("line_break", this); addAction("line_break", action); connect(action, SIGNAL(triggered()), this, SLOT(lineBreak())); - action = new QAction(koIcon("insert-pagebreak"), i18n("Page Break"), this); - action->setShortcut(Qt::CTRL + Qt::Key_Return); + action = actionRegistry->makeQAction("insert_framebreak", this); addAction("insert_framebreak", action); connect(action, SIGNAL(triggered()), this, SLOT(insertFrameBreak())); - action->setToolTip(i18n("Insert a page break")); - action->setWhatsThis(i18n("All text after this point will be moved into the next page.")); } - action = new QAction(i18n("Font..."), this); - action->setShortcut(Qt::ALT + Qt::CTRL + Qt::Key_F); - action->setToolTip(i18n("Change character size, font, boldface, italics etc.")); - action->setWhatsThis(i18n("Change the attributes of the currently selected characters.")); + action = actionRegistry->makeQAction("format_font", this); addAction("format_font", action); connect(action, SIGNAL(triggered()), this, SLOT(selectFont())); + m_actionFormatFontSize = new FontSizeAction(i18n("Font Size"), this); addAction("format_fontsize", m_actionFormatFontSize); connect(m_actionFormatFontSize, SIGNAL(fontSizeChanged(qreal)), this, SLOT(setFontSize(qreal))); m_actionFormatTextColor = new KoColorPopupAction(this); - m_actionFormatTextColor->setIcon(koIcon("format-text-color")); - m_actionFormatTextColor->setToolTip(i18n("Text Color...")); - m_actionFormatTextColor->setText(i18n("Text Color")); addAction("format_textcolor", m_actionFormatTextColor); connect(m_actionFormatTextColor, SIGNAL(colorChanged(const KoColor &)), this, SLOT(setTextColor(const KoColor &))); m_actionFormatBackgroundColor = new KoColorPopupAction(this); - m_actionFormatBackgroundColor->setIcon(koIcon("format-fill-color")); - m_actionFormatBackgroundColor->setToolTip(i18n("Background Color...")); - m_actionFormatBackgroundColor->setText(i18n("Background")); addAction("format_backgroundcolor", m_actionFormatBackgroundColor); connect(m_actionFormatBackgroundColor, SIGNAL(colorChanged(const KoColor &)), this, SLOT(setBackgroundColor(const KoColor &))); - m_growWidthAction = new QAction(koIcon("zoom-fit-best"), i18n("Grow To Fit Width"), this); - m_growWidthAction->setCheckable(true); + m_growWidthAction = actionRegistry->makeQAction("grow_to_fit_width", this); addAction("grow_to_fit_width", m_growWidthAction); connect(m_growWidthAction, SIGNAL(triggered(bool)), this, SLOT(setGrowWidthToFit(bool))); - m_growHeightAction = new QAction(koIcon("zoom-fit-best"), i18n("Grow To Fit Height"), this); - m_growHeightAction->setCheckable(true); + m_growHeightAction = actionRegistry->makeQAction("grow_to_fit_height", this); addAction("grow_to_fit_height", m_growHeightAction); connect(m_growHeightAction, SIGNAL(triggered(bool)), this, SLOT(setGrowHeightToFit(bool))); - m_shrinkToFitAction = new QAction(koIcon("zoom-fit-best"), i18n("Shrink To Fit"), this); - m_shrinkToFitAction->setCheckable(true); + m_shrinkToFitAction = actionRegistry->makeQAction("shrink_to_fit", this); addAction("shrink_to_fit", m_shrinkToFitAction); connect(m_shrinkToFitAction, SIGNAL(triggered(bool)), this, SLOT(setShrinkToFit(bool))); if (useAdvancedText) { - action = new QAction(koIcon("insert-table"), i18n("Insert Custom..."), this); - action->setToolTip(i18n("Insert a table into the document.")); + action = actionRegistry->makeQAction("insert_table", this); addAction("insert_table", action); connect(action, SIGNAL(triggered()), this, SLOT(insertTable())); - action = new QAction(koIcon("edit-table-insert-row-above"), i18n("Row Above"), this); - action->setToolTip(i18n("Insert Row Above")); + action = actionRegistry->makeQAction("insert_tablerow_above", this); addAction("insert_tablerow_above", action); connect(action, SIGNAL(triggered(bool)), this, SLOT(insertTableRowAbove())); - action = new QAction(koIcon("edit-table-insert-row-below"), i18n("Row Below"), this); - action->setToolTip(i18n("Insert Row Below")); + action = actionRegistry->makeQAction("insert_tablerow_below", this); addAction("insert_tablerow_below", action); connect(action, SIGNAL(triggered(bool)), this, SLOT(insertTableRowBelow())); - action = new QAction(koIcon("edit-table-insert-column-left"), i18n("Column Left"), this); - action->setToolTip(i18n("Insert Column Left")); + action = actionRegistry->makeQAction("insert_tablecolumn_left", this); addAction("insert_tablecolumn_left", action); connect(action, SIGNAL(triggered(bool)), this, SLOT(insertTableColumnLeft())); - action = new QAction(koIcon("edit-table-insert-column-right"), i18n("Column Right"), this); - action->setToolTip(i18n("Insert Column Right")); + action = actionRegistry->makeQAction("insert_tablecolumn_right", this); addAction("insert_tablecolumn_right", action); connect(action, SIGNAL(triggered(bool)), this, SLOT(insertTableColumnRight())); - action = new QAction(koIcon("edit-table-delete-column"), i18n("Column"), this); - action->setToolTip(i18n("Delete Column")); + action = actionRegistry->makeQAction("delete_tablecolumn", this); addAction("delete_tablecolumn", action); connect(action, SIGNAL(triggered(bool)), this, SLOT(deleteTableColumn())); - action = new QAction(koIcon("edit-table-delete-row"), i18n("Row"), this); - action->setToolTip(i18n("Delete Row")); + action = actionRegistry->makeQAction("delete_tablerow", this); addAction("delete_tablerow", action); connect(action, SIGNAL(triggered(bool)), this, SLOT(deleteTableRow())); - action = new QAction(koIcon("edit-table-cell-merge"), i18n("Merge Cells"), this); + action = actionRegistry->makeQAction("merge_tablecells", this); addAction("merge_tablecells", action); connect(action, SIGNAL(triggered(bool)), this, SLOT(mergeTableCells())); - action = new QAction(koIcon("edit-table-cell-split"), i18n("Split Cells"), this); + action = actionRegistry->makeQAction("split_tablecells", this); addAction("split_tablecells", action); connect(action, SIGNAL(triggered(bool)), this, SLOT(splitTableCells())); - action = new QAction(koIcon("borderpainter"), "", this); - action->setToolTip(i18n("Select a border style and paint that style onto a table")); + action = actionRegistry->makeQAction("activate_borderpainter", this); addAction("activate_borderpainter", action); } - action = new QAction(i18n("Paragraph..."), this); - action->setShortcut(Qt::ALT + Qt::CTRL + Qt::Key_P); - action->setToolTip(i18n("Change paragraph margins, text flow, borders, bullets, numbering etc.")); - action->setWhatsThis(i18n("

Change paragraph margins, text flow, borders, bullets, numbering etc.

Select text in multiple paragraphs to change the formatting of all selected paragraphs.

If no text is selected, the paragraph where the cursor is located will be changed.

")); + action = actionRegistry->makeQAction("format_paragraph", this); addAction("format_paragraph", action); connect(action, SIGNAL(triggered()), this, SLOT(formatParagraph())); - action = new QAction(i18n("Style Manager..."), this); - action->setShortcut(Qt::ALT + Qt::CTRL + Qt::Key_S); - action->setToolTip(i18n("Change attributes of styles")); - action->setWhatsThis(i18n("

Change font and paragraph attributes of styles.

Multiple styles can be changed using the dialog box.

")); + action = actionRegistry->makeQAction("format_stylist", this); addAction("format_stylist", action); connect(action, SIGNAL(triggered()), this, SLOT(showStyleManager())); action = KStandardAction::selectAll(this, SLOT(selectAll()), this); addAction("edit_select_all", action); - action = new QAction(i18n("Special Character..."), this); - action->setIcon(koIcon("character-set")); - action->setShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_C); - action->setToolTip(i18n("Insert one or more symbols or characters not found on the keyboard")); - action->setWhatsThis(i18n("Insert one or more symbols or characters not found on the keyboard.")); + action = actionRegistry->makeQAction("insert_specialchar", this); addAction("insert_specialchar", action); connect(action, SIGNAL(triggered()), this, SLOT(insertSpecialCharacter())); - action = new QAction(i18n("Repaint"), this); - action->setIcon(koIcon("view-refresh")); + action = actionRegistry->makeQAction("repaint", this); addAction("repaint", action); connect(action, SIGNAL(triggered()), this, SLOT(relayoutContent())); - action = new QAction(i18n("Insert Comment"), this); - action->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_C); + action = actionRegistry->makeQAction("insert_annotation", this); addAction("insert_annotation", action); connect(action, SIGNAL(triggered()), this, SLOT(insertAnnotation())); #ifndef NDEBUG - action = new QAction("Paragraph Debug", this); // do NOT add i18n! - action->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::ALT + Qt::Key_P); + action = actionRegistry->makeQAction("detailed_debug_paragraphs", this); addAction("detailed_debug_paragraphs", action); connect(action, SIGNAL(triggered()), this, SLOT(debugTextDocument())); - action = new QAction("Styles Debug", this); // do NOT add i18n! - action->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::ALT + Qt::Key_S); + action = actionRegistry->makeQAction("detailed_debug_styles", this); addAction("detailed_debug_styles", action); connect(action, SIGNAL(triggered()), this, SLOT(debugTextStyles())); #endif