Commit e1c28432 authored by David Faure's avatar David Faure
Browse files

Port from UserIcon to having the icons in a QRC file

Summary: I hear this was the last use of UserIcon...

Test Plan: Builds, runs, the icons appear (like the blue prism above the transparent color)

Reviewers: vkrause, nicolasfella, broulik

Reviewed By: broulik

Differential Revision: https://phabricator.kde.org/D25467
parent bfeead33
......@@ -320,6 +320,8 @@ set(kolourpaint_SRCS
add_subdirectory(lgpl)
qt5_add_resources(kolourpaint_SRCS kolourpaint.qrc)
#
# Executable
#
......
......@@ -201,9 +201,14 @@ static void toolButtonSetLook (QToolButton *button,
const QString &iconName,
const QString &name)
{
QPixmap icon = UserIcon (iconName);
button->setIconSize (QSize (icon.width (), icon.height ()));
button->setIcon (icon);
QPixmap icon;
const QString qrcPath = QStringLiteral(":/icons/") + iconName;
if (!icon.load (qrcPath)) {
qWarning() << qrcPath << "not found";
} else {
button->setIconSize (QSize (icon.width (), icon.height ()));
button->setIcon (icon);
}
button->setToolButtonStyle (Qt::ToolButtonTextUnderIcon);
button->setText (name);
......
......@@ -101,10 +101,10 @@ void kpTransformRotateDialog::createDirectionGroupBox ()
auto *antiClockwisePixmapLabel = new QLabel (directionGroupBox);
antiClockwisePixmapLabel->setPixmap (UserIcon (QStringLiteral("image_rotate_anticlockwise")));
antiClockwisePixmapLabel->setPixmap (QStringLiteral(":/icons/image_rotate_anticlockwise"));
auto *clockwisePixmapLabel = new QLabel (directionGroupBox);
clockwisePixmapLabel->setPixmap (UserIcon (QStringLiteral("image_rotate_clockwise")));
clockwisePixmapLabel->setPixmap (QStringLiteral(":/icons/image_rotate_clockwise"));
m_antiClockwiseRadioButton = new QRadioButton (i18n ("Cou&nterclockwise"), directionGroupBox);
......
......@@ -103,7 +103,7 @@ void kpTransformSkewDialog::createAngleGroupBox ()
auto *horizontalSkewPixmapLabel = new QLabel (angleGroupBox);
horizontalSkewPixmapLabel->setPixmap (UserIcon (QStringLiteral("image_skew_horizontal")));
horizontalSkewPixmapLabel->setPixmap (QStringLiteral(":/icons/image_skew_horizontal"));
auto *horizontalSkewLabel = new QLabel (i18n ("&Horizontal:"), angleGroupBox);
m_horizontalSkewInput = new QSpinBox;
......@@ -115,7 +115,7 @@ void kpTransformSkewDialog::createAngleGroupBox ()
auto *verticalSkewPixmapLabel = new QLabel (angleGroupBox);
verticalSkewPixmapLabel->setPixmap (UserIcon (QStringLiteral("image_skew_vertical")));
verticalSkewPixmapLabel->setPixmap (QStringLiteral(":/icons/image_skew_vertical"));
auto *verticalSkewLabel = new QLabel (i18n ("&Vertical:"), angleGroupBox);
m_verticalSkewInput = new QSpinBox;
......
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/icons">
<file alias="colorbutton_swap_16x16.png">pics/custom/colorbutton_swap_16x16.png</file>
<file alias="color_transparent_26x26.png">pics/custom/color_transparent_26x26.png</file>
<file alias="image_rotate_anticlockwise.png">pics/custom/image_rotate_anticlockwise.png</file>
<file alias="image_rotate_clockwise.png">pics/custom/image_rotate_clockwise.png</file>
<file alias="image_skew_horizontal.png">pics/custom/image_skew_horizontal.png</file>
<file alias="image_skew_vertical.png">pics/custom/image_skew_vertical.png</file>
<file alias="option_opaque.png">pics/custom/option_opaque.png</file>
<file alias="option_transparent.png">pics/custom/option_transparent.png</file>
<file alias="resize.png">pics/custom/resize.png</file>
<file alias="scale.png">pics/custom/scale.png</file>
<file alias="smooth_scale.png">pics/custom/smooth_scale.png</file>
<file alias="tool_spraycan_17x17.png">pics/custom/tool_spraycan_17x17.png</file>
<file alias="tool_spraycan_29x29.png">pics/custom/tool_spraycan_29x29.png</file>
<file alias="tool_spraycan_9x9.png">pics/custom/tool_spraycan_9x9.png</file>
</qresource>
</RCC>
add_subdirectory( action )
add_subdirectory( app )
add_subdirectory( custom )
add_subdirectory( action )
add_subdirectory( app )
install(FILES
tool_spraycan_9x9.png
tool_spraycan_17x17.png
tool_spraycan_29x29.png
color_transparent_26x26.png
colorbutton_swap_16x16.png
option_opaque.png option_transparent.png
resize.png scale.png
smooth_scale.png
image_skew_horizontal.png
image_skew_vertical.png
image_rotate_anticlockwise.png
image_rotate_clockwise.png
DESTINATION ${DATA_INSTALL_DIR}/kolourpaint/pics)
......@@ -152,7 +152,7 @@ QSize kpDualColorButton::sizeHint () const
// protected
QRect kpDualColorButton::swapPixmapRect () const
{
QPixmap swapPixmap = UserIcon (QStringLiteral("colorbutton_swap_16x16"));
QPixmap swapPixmap = QStringLiteral(":/icons/colorbutton_swap_16x16");
return {contentsRect ().width () - swapPixmap.width (), 0,
swapPixmap.width (), swapPixmap.height ()};
......@@ -399,7 +399,7 @@ void kpDualColorButton::paintEvent (QPaintEvent *e)
// Draw "Swap Colours" button (top-right).
QPixmap swapPixmap = UserIcon (QStringLiteral("colorbutton_swap_16x16"));
QPixmap swapPixmap = QStringLiteral(":/icons/colorbutton_swap_16x16");
if (!isEnabled ())
{
// Don't let the fill() touch the mask.
......@@ -425,7 +425,7 @@ void kpDualColorButton::paintEvent (QPaintEvent *e)
<< endl;
#endif
if (m_color [1].isTransparent ()) { // only if fully transparent
painter.drawPixmap (bgRectInside, UserIcon (QStringLiteral("color_transparent_26x26")));
painter.drawPixmap (bgRectInside, QStringLiteral(":/icons/color_transparent_26x26"));
}
else {
painter.fillRect (bgRectInside, m_color [1].toQColor ());
......@@ -452,7 +452,7 @@ void kpDualColorButton::paintEvent (QPaintEvent *e)
<< endl;
#endif
if (m_color [0].isTransparent ()) { // only if fully transparent
painter.drawPixmap (fgRectInside, UserIcon (QStringLiteral("color_transparent_26x26")));
painter.drawPixmap (fgRectInside, QStringLiteral(":/icons/color_transparent_26x26"));
}
else {
painter.fillRect (fgRectInside, m_color [0].toQColor ());
......
......@@ -49,7 +49,7 @@ kpTransparentColorCell::kpTransparentColorCell (QWidget *parent)
QSizePolicy::Fixed/*vertical*/);
setFrameStyle (QFrame::Panel | QFrame::Sunken);
m_pixmap = UserIcon (QStringLiteral("color_transparent_26x26"));
m_pixmap = QStringLiteral(":/icons/color_transparent_26x26");
this->setToolTip( i18n ("Transparent"));
}
......
......@@ -40,9 +40,9 @@
kpToolWidgetOpaqueOrTransparent::kpToolWidgetOpaqueOrTransparent (QWidget *parent, const QString &name)
: kpToolWidgetBase (parent, name)
{
addOption (UserIcon (QStringLiteral("option_opaque")), i18n ("Opaque")/*tooltip*/);
addOption (QStringLiteral(":/icons/option_opaque"), i18n ("Opaque")/*tooltip*/);
startNewOptionRow ();
addOption (UserIcon (QStringLiteral("option_transparent")), i18n ("Transparent")/*tooltip*/);
addOption (QStringLiteral(":/icons/option_transparent"), i18n ("Transparent")/*tooltip*/);
finishConstruction (0, 0);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment