ScxmlEditor: Themable toolbar icons for Adjust and Align actions

Change-Id: Ibd3a70a17362431fb1b11aecd18e9af6276b30c3
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Alessandro Portale
2016-10-25 00:05:26 +02:00
parent f35d71478d
commit dc25b692fa
23 changed files with 243 additions and 14 deletions

View File

@@ -1,14 +1,23 @@
<RCC> <RCC>
<qresource prefix="/scxmleditor"> <qresource prefix="/scxmleditor">
<file>images/adjust_height.png</file> <file>images/adjust_height.png</file>
<file>images/adjust_height@2x.png</file>
<file>images/adjust_size.png</file> <file>images/adjust_size.png</file>
<file>images/adjust_size@2x.png</file>
<file>images/adjust_width.png</file> <file>images/adjust_width.png</file>
<file>images/adjust_width@2x.png</file>
<file>images/align_bottom.png</file> <file>images/align_bottom.png</file>
<file>images/align_bottom@2x.png</file>
<file>images/align_horizontal.png</file> <file>images/align_horizontal.png</file>
<file>images/align_horizontal@2x.png</file>
<file>images/align_left.png</file> <file>images/align_left.png</file>
<file>images/align_left@2x.png</file>
<file>images/align_right.png</file> <file>images/align_right.png</file>
<file>images/align_right@2x.png</file>
<file>images/align_top.png</file> <file>images/align_top.png</file>
<file>images/align_top@2x.png</file>
<file>images/align_vertical.png</file> <file>images/align_vertical.png</file>
<file>images/align_vertical@2x.png</file>
<file>images/colorthemes.png</file> <file>images/colorthemes.png</file>
<file>images/final.png</file> <file>images/final.png</file>
<file>images/font_color.png</file> <file>images/font_color.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 973 B

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

View File

@@ -289,8 +289,8 @@ void MainWidget::init()
// Init ToolButtons // Init ToolButtons
auto stateColorButton = new ColorToolButton("StateColor", ":/scxmleditor/images/state_color.png", tr("State Color")); auto stateColorButton = new ColorToolButton("StateColor", ":/scxmleditor/images/state_color.png", tr("State Color"));
auto fontColorButton = new ColorToolButton("FontColor", ":/scxmleditor/images/font_color.png", tr("Font Color")); auto fontColorButton = new ColorToolButton("FontColor", ":/scxmleditor/images/font_color.png", tr("Font Color"));
QToolButton *alignToolButton = createToolButton(":/scxmleditor/images/align_left.png", tr("Align Left"), QToolButton::MenuButtonPopup); QToolButton *alignToolButton = createToolButton(m_actionHandler->action(ActionAlignLeft)->icon(), tr("Align Left"), QToolButton::MenuButtonPopup);
QToolButton *adjustToolButton = createToolButton(":/scxmleditor/images/adjust_width.png", tr("Adjust Width"), QToolButton::MenuButtonPopup); QToolButton *adjustToolButton = createToolButton(m_actionHandler->action(ActionAdjustWidth)->icon(), tr("Adjust Width"), QToolButton::MenuButtonPopup);
// Connect state color change // Connect state color change
connect(stateColorButton, &ColorToolButton::colorSelected, [this](const QString &color) { connect(stateColorButton, &ColorToolButton::colorSelected, [this](const QString &color) {
@@ -725,10 +725,10 @@ void MainWidget::setMagnifier(bool m)
} }
} }
QToolButton *MainWidget::createToolButton(const QString &iconName, const QString &tooltip, QToolButton::ToolButtonPopupMode mode) QToolButton *MainWidget::createToolButton(const QIcon &icon, const QString &tooltip, QToolButton::ToolButtonPopupMode mode)
{ {
auto button = new QToolButton; auto button = new QToolButton;
button->setIcon(QIcon(iconName)); button->setIcon(icon);
button->setToolTip(tooltip); button->setToolTip(tooltip);
button->setPopupMode(mode); button->setPopupMode(mode);

View File

@@ -108,7 +108,7 @@ signals:
void dirtyChanged(bool dirty); void dirtyChanged(bool dirty);
private: private:
QToolButton *createToolButton(const QString &iconName, const QString &tooltip, QToolButton::ToolButtonPopupMode mode); QToolButton *createToolButton(const QIcon &icon, const QString &tooltip, QToolButton::ToolButtonPopupMode mode);
void documentChanged(); void documentChanged();
void createUi(); void createUi();
void init(); void init();

View File

@@ -59,15 +59,15 @@ ActionHandler::ActionHandler(QObject *parent)
{ Utils::Icon({{":/scxmleditor/images/icon-export-canvas.png", Utils::Theme::IconsBaseColor}}), AH::tr("Export to Image"), AH::tr("Export to Image"), "Ctrl+Shift+E", false }, { Utils::Icon({{":/scxmleditor/images/icon-export-canvas.png", Utils::Theme::IconsBaseColor}}), AH::tr("Export to Image"), AH::tr("Export to Image"), "Ctrl+Shift+E", false },
{ Utils::Icon(":/scxmleditor/images/fullnamespace.png"), AH::tr("Toggle Full Namespace"), AH::tr("Toggle Full Namespace"), "Ctrl+Shift+N", true }, { Utils::Icon(":/scxmleditor/images/fullnamespace.png"), AH::tr("Toggle Full Namespace"), AH::tr("Toggle Full Namespace"), "Ctrl+Shift+N", true },
{ Utils::Icon(":/scxmleditor/images/align_left.png"), AH::tr("Align Left"), AH::tr("Align Left (Ctrl+L,1)"), "Ctrl+L,1", false }, { Utils::Icon({{":/scxmleditor/images/align_left.png", Utils::Theme::IconsBaseColor}}), AH::tr("Align Left"), AH::tr("Align Left (Ctrl+L,1)"), "Ctrl+L,1", false },
{ Utils::Icon(":/scxmleditor/images/align_right.png"), AH::tr("Align Right"), AH::tr("Align Right (Ctrl+L,2)"), "Ctrl+L,2", false }, { Utils::Icon({{":/scxmleditor/images/align_right.png", Utils::Theme::IconsBaseColor}}), AH::tr("Align Right"), AH::tr("Align Right (Ctrl+L,2)"), "Ctrl+L,2", false },
{ Utils::Icon(":/scxmleditor/images/align_top.png"), AH::tr("Align Top"), AH::tr("Align Top (Ctrl+L,3)"), "Ctrl+L,3", false }, { Utils::Icon({{":/scxmleditor/images/align_top.png", Utils::Theme::IconsBaseColor}}), AH::tr("Align Top"), AH::tr("Align Top (Ctrl+L,3)"), "Ctrl+L,3", false },
{ Utils::Icon(":/scxmleditor/images/align_bottom.png"), AH::tr("Align Bottom"), AH::tr("Align Bottom (Ctrl+L,4)"), "Ctrl+L,4", false }, { Utils::Icon({{":/scxmleditor/images/align_bottom.png", Utils::Theme::IconsBaseColor}}), AH::tr("Align Bottom"), AH::tr("Align Bottom (Ctrl+L,4)"), "Ctrl+L,4", false },
{ Utils::Icon(":/scxmleditor/images/align_horizontal.png"), AH::tr("Align Horizontal"), AH::tr("Align Horizontal (Ctrl+L,5)"), "Ctrl+L,5", false }, { Utils::Icon({{":/scxmleditor/images/align_horizontal.png", Utils::Theme::IconsBaseColor}}), AH::tr("Align Horizontal"), AH::tr("Align Horizontal (Ctrl+L,5)"), "Ctrl+L,5", false },
{ Utils::Icon(":/scxmleditor/images/align_vertical.png"), AH::tr("Align Vertical"), AH::tr("Align Vertical (Ctrl+L,6)"), "Ctrl+L,6", false }, { Utils::Icon({{":/scxmleditor/images/align_vertical.png", Utils::Theme::IconsBaseColor}}), AH::tr("Align Vertical"), AH::tr("Align Vertical (Ctrl+L,6)"), "Ctrl+L,6", false },
{ Utils::Icon(":/scxmleditor/images/adjust_width.png"), AH::tr("Adjust Width"), AH::tr("Adjust Width (Ctrl+L,7)"), "Ctrl+L,7", false }, { Utils::Icon({{":/scxmleditor/images/adjust_width.png", Utils::Theme::IconsBaseColor}}), AH::tr("Adjust Width"), AH::tr("Adjust Width (Ctrl+L,7)"), "Ctrl+L,7", false },
{ Utils::Icon(":/scxmleditor/images/adjust_height.png"), AH::tr("Adjust Height"), AH::tr("Adjust Height (Ctrl+L,8)"), "Ctrl+L,8", false }, { Utils::Icon({{":/scxmleditor/images/adjust_height.png", Utils::Theme::IconsBaseColor}}), AH::tr("Adjust Height"), AH::tr("Adjust Height (Ctrl+L,8)"), "Ctrl+L,8", false },
{ Utils::Icon(":/scxmleditor/images/adjust_size.png"), AH::tr("Adjust Size"), AH::tr("Adjust Size (Ctrl+L,9)"), "Ctrl+L,9", false }, { Utils::Icon({{":/scxmleditor/images/adjust_size.png", Utils::Theme::IconsBaseColor}}), AH::tr("Adjust Size"), AH::tr("Adjust Size (Ctrl+L,9)"), "Ctrl+L,9", false },
{ Utils::Icon(":/scxmleditor/images/statistics.png"), AH::tr("Show Statistics..."), AH::tr("Show Statistics"), "", false } { Utils::Icon(":/scxmleditor/images/statistics.png"), AH::tr("Show Statistics..."), AH::tr("Show Statistics"), "", false }
}; };

View File

@@ -3770,6 +3770,226 @@
d="m 1240,574.5 -5,0" d="m 1240,574.5 -5,0"
sodipodi:nodetypes="cc" /> sodipodi:nodetypes="cc" />
</g> </g>
<g
transform="translate(176,0)"
style="display:inline"
id="src/plugins/scxmleditor/common/images/adjust_height">
<rect
style="fill:#ffffff;fill-opacity:1"
x="1228"
y="568"
width="16"
height="16"
id="rect6782-96-0-0-7-8-1-0-4-0-1-7-9-1-9-5-6" />
<rect
style="fill:#b3b3b3;fill-opacity:1;stroke:#000000;stroke-width:0.5"
id="rect4532"
width="3.5"
height="13.5"
x="1229.25"
y="569.25" />
<rect
style="fill:#b3b3b3;fill-opacity:1;stroke:#000000;stroke-width:0.5"
id="rect4534"
width="3.5"
height="8.5"
x="1235.25"
y="569.25" />
<path
style="stroke:#000000"
d="m 1240,569.5 3,0"
id="path4536"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="stroke:#000000"
d="m 1240,582.5 3,0"
id="path4538"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="stroke:#000000"
d="m 1241.5,569.5 c 0,13 0,13 0,13"
id="path4540"
inkscape:connector-curvature="0" />
<rect
style="fill:#cccccc"
id="rect5232"
width="4"
height="5"
x="1235"
y="578" />
</g>
<use
x="0"
y="0"
xlink:href="#src/plugins/scxmleditor/common/images/adjust_height"
id="src/plugins/scxmleditor/common/images/adjust_width"
transform="matrix(0,1,1,0,852,-836)"
width="100%"
height="100%" />
<g
transform="translate(208,0)"
style="display:inline"
id="src/plugins/scxmleditor/common/images/adjust_size">
<rect
style="fill:#ffffff;fill-opacity:1"
x="1228"
y="568"
width="16"
height="16"
id="rect6782-96-0-0-7-8-1-0-4-0-1-7-9-1-9-5-6-6" />
<g
id="g5500">
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4536-4"
d="m 1229,569.5 3,0"
style="stroke:#000000" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4540-7"
d="m 1230.5,569.5 0,13.5"
style="stroke:#000000" />
</g>
<g
id="g5496"
transform="matrix(0,1,-1,0,1813.5,-651.5)" />
<use
x="0"
y="0"
xlink:href="#g5500"
id="use5504"
transform="matrix(0,1,-1,0,1812,-649)"
width="100%"
height="100%" />
<rect
style="fill:#cccccc"
id="rect5232-6"
width="11"
height="11"
x="1232"
y="569" />
<rect
style="fill:#b3b3b3;fill-opacity:1;stroke:#000000;stroke-width:0.5"
id="rect4534-2"
width="4.5"
height="6.5"
x="1232.25"
y="573.25" />
</g>
<g
transform="translate(224,0)"
style="display:inline"
id="src/plugins/scxmleditor/common/images/align_bottom">
<rect
style="fill:#ffffff;fill-opacity:1"
x="1228"
y="568"
width="16"
height="16"
id="rect6782-96-0-0-7-8-1-0-4-0-1-7-9-1-9-5-6-3" />
<path
style="stroke:#000000"
d="m 1243,582.5 -14,0"
id="path4540-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<rect
style="fill:#b3b3b3;fill-opacity:1;stroke:#000000;stroke-width:0.5"
id="rect4534-6-5"
width="3.5"
height="11.5"
x="1229.25"
y="569.25" />
<rect
style="fill:#b3b3b3;fill-opacity:1;stroke:#000000;stroke-width:0.5"
id="rect4534-6-5-4"
width="3.5"
height="8.5"
x="1239.25"
y="572.25" />
<rect
style="fill:#b3b3b3;fill-opacity:1;stroke:#000000;stroke-width:0.5"
id="rect4534-6-5-0"
width="3.5"
height="4.5"
x="1234.25"
y="576.25" />
</g>
<use
x="0"
y="0"
xlink:href="#src/plugins/scxmleditor/common/images/align_bottom"
id="src/plugins/scxmleditor/common/images/align_right"
transform="matrix(0,1,1,0,900,-884)"
width="100%"
height="100%" />
<use
x="0"
y="0"
xlink:href="#src/plugins/scxmleditor/common/images/align_bottom"
id="src/plugins/scxmleditor/common/images/align_top"
transform="matrix(1,0,0,-1,32,1152)"
width="100%"
height="100%" />
<use
x="0"
y="0"
xlink:href="#src/plugins/scxmleditor/common/images/align_bottom"
id="src/plugins/scxmleditor/common/images/align_left"
transform="matrix(0,1,-1,0,2084,-884)"
width="100%"
height="100%" />
<g
transform="translate(288,0)"
style="display:inline"
id="src/plugins/scxmleditor/common/images/align_horizontal">
<rect
style="fill:#ffffff;fill-opacity:1"
x="1228"
y="568"
width="16"
height="16"
id="rect6782-96-0-0-7-8-1-0-4-0-1-7-9-1-9-5-6-3-0" />
<rect
style="fill:#b3b3b3;fill-opacity:1;stroke:#000000;stroke-width:0.5"
id="rect4534-6-5-6"
width="3.5"
height="12.5"
x="1229.25"
y="570.25" />
<rect
style="fill:#b3b3b3;fill-opacity:1;stroke:#000000;stroke-width:0.5"
id="rect4534-6-5-4-0"
width="3.5"
height="8.5"
x="1239.25"
y="572.25" />
<rect
style="fill:#b3b3b3;fill-opacity:1;stroke:#000000;stroke-width:0.5"
id="rect4534-6-5-0-8"
width="3.5"
height="4.5"
x="1234.25"
y="574.25" />
<path
style="stroke:#000000"
d="m 1243,576.5 -14,0"
id="path4540-6-4"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
<use
x="0"
y="0"
xlink:href="#src/plugins/scxmleditor/common/images/align_horizontal"
id="src/plugins/scxmleditor/common/images/align_vertical"
transform="matrix(0,1,1,0,964,-948)"
width="100%"
height="100%" />
</g> </g>
<g <g
inkscape:groupmode="layer" inkscape:groupmode="layer"

Before

Width:  |  Height:  |  Size: 226 KiB

After

Width:  |  Height:  |  Size: 232 KiB