mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-20 07:14:13 +02:00
Draw the Add PDF icon as an SVG
The "Add PDF" action used ico/22x22/pdf-import.png, a white page with a red PDF mark that sat apart from its neighbors "Add text" and "Add image", both gray line art in a square frame with a plus. It is now ico/scalable/pdf-import.svg, the same pixel design as insert-image.png: a frame, the letters PDF, a plus in the corner. One file serves every slot and stays sharp on high-DPI screens; the PNG is gone from both .qrc files. The canvas is 24 pixels with the art offset by one, like the Breeze SVGs already in the theme. Fusion's toolbar slot is 24 pixels: a 22 pixel PNG is drawn unscaled inside it, but a scalable icon is rendered at the slot size, and a 22 pixel grid stretched to 24 puts every one pixel line between pixels and reads blurry. The file uses currentColor like the Breeze SVGs already in the theme, so misc/make_icon_themes.py produces the dark copy the same way. A new ico/scalable/ folder holds QET's own vector icons; the direction arummler asked for in #690. tests/qttest/tst_qeticons: the icon resolves in both themes at 16, 22, 32 and 64 pixels, dark ink on the light theme and light ink on the dark one, and no 22 pixel PNG remains.
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -216,6 +216,7 @@ Clarification:
|
||||
ico/128x128/diagram.png by the QElectroTech team (License CC BY-ND 3.0)
|
||||
ico/128x128/document-export.png by the QElectroTech team (License CC BY-ND 3.0)
|
||||
ico/128x128/project.png by the QElectroTech team (License CC BY-ND 3.0)
|
||||
ico/scalable/pdf-import.svg by Jeff Patterson from the QElectroTech team (License CC BY-ND 3.0), laid out like ico/22x22/insert-image.png
|
||||
ico/256x256/* by Nuri from the QElectroTech team (License CC BY-ND 3.0)
|
||||
ico/breeze-icons/* by Nuri from the QElectroTech team (License CC BY-ND 3.0)
|
||||
ico/diagram.png by Nuri from the QElectroTech team (License CC BY-ND 3.0)
|
||||
|
||||
+2
-1
@@ -218,7 +218,6 @@
|
||||
<file alias="themes/qet/22x22/object-locked.png">22x22/object-locked.png</file>
|
||||
<file alias="themes/qet/22x22/object-rotate-right.png">22x22/object-rotate-right.png</file>
|
||||
<file alias="themes/qet/22x22/object-unlocked.png">22x22/object-unlocked.png</file>
|
||||
<file alias="themes/qet/22x22/pdf-import.png">22x22/pdf-import.png</file>
|
||||
<file alias="themes/qet/22x22/polygon.png">22x22/polygon.png</file>
|
||||
<file alias="themes/qet/22x22/portrait.png">22x22/portrait.png</file>
|
||||
<file alias="themes/qet/22x22/preferences-desktop-user.png">22x22/preferences-desktop-user.png</file>
|
||||
@@ -274,6 +273,7 @@
|
||||
<file alias="themes/qet/128x128/printer.png">128x128/printer.png</file>
|
||||
<file alias="themes/qet/128x128/project.png">128x128/project.png</file>
|
||||
<file alias="themes/qet/128x128/settings.png">128x128/settings.png</file>
|
||||
<file alias="themes/qet/scalable/pdf-import.svg">scalable/pdf-import.svg</file>
|
||||
<file alias="themes/qet/scalable/edit-opacity.svg">breeze-icons/scalable/apps/hidef/edit-opacity.svg</file>
|
||||
<file alias="themes/qet/scalable/image-flip-horizontal.svg">breeze-icons/scalable/apps/hidef/image-flip-horizontal-symbolic.svg</file>
|
||||
<file alias="themes/qet/scalable/image-flip-vertical.svg">breeze-icons/scalable/apps/hidef/image-flip-vertical-symbolic.svg</file>
|
||||
@@ -458,6 +458,7 @@
|
||||
<file>themes/qet-dark/48x48/view-pim-journal.png</file>
|
||||
<file>themes/qet-dark/128x128/plasmagik.png</file>
|
||||
<file>themes/qet-dark/128x128/settings.png</file>
|
||||
<file>themes/qet-dark/scalable/pdf-import.svg</file>
|
||||
<file>themes/qet-dark/scalable/edit-opacity.svg</file>
|
||||
<file>themes/qet-dark/scalable/image-flip-horizontal.svg</file>
|
||||
<file>themes/qet-dark/scalable/image-flip-vertical.svg</file>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<defs id="defs3051">
|
||||
<style type="text/css" id="current-color-scheme">
|
||||
.ColorScheme-Text {
|
||||
color:#4d4d4d;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<g transform="translate(1,1)">
|
||||
<path style="fill:currentColor;fill-opacity:1;stroke:none" d="M 3 3 h 16 v 1 h -16 Z M 3 4 h 1 v 15 h -1 Z M 4 18 h 10 v 1 h -10 Z M 18 4 h 1 v 8 h -1 Z M 16 14 h 1 v 5 h -1 Z M 14 16 h 5 v 1 h -5 Z" class="ColorScheme-Text"/>
|
||||
<path style="fill:currentColor;fill-opacity:1;stroke:none" d="M 5 7 h 1 v 1 h -1 Z M 6 7 h 1 v 1 h -1 Z M 7 7 h 1 v 1 h -1 Z M 5 8 h 1 v 1 h -1 Z M 7 8 h 1 v 1 h -1 Z M 5 9 h 1 v 1 h -1 Z M 6 9 h 1 v 1 h -1 Z M 7 9 h 1 v 1 h -1 Z M 5 10 h 1 v 1 h -1 Z M 5 11 h 1 v 1 h -1 Z M 9 7 h 1 v 1 h -1 Z M 10 7 h 1 v 1 h -1 Z M 9 8 h 1 v 1 h -1 Z M 11 8 h 1 v 1 h -1 Z M 9 9 h 1 v 1 h -1 Z M 11 9 h 1 v 1 h -1 Z M 9 10 h 1 v 1 h -1 Z M 11 10 h 1 v 1 h -1 Z M 9 11 h 1 v 1 h -1 Z M 10 11 h 1 v 1 h -1 Z M 13 7 h 1 v 1 h -1 Z M 14 7 h 1 v 1 h -1 Z M 15 7 h 1 v 1 h -1 Z M 13 8 h 1 v 1 h -1 Z M 13 9 h 1 v 1 h -1 Z M 14 9 h 1 v 1 h -1 Z M 13 10 h 1 v 1 h -1 Z M 13 11 h 1 v 1 h -1 Z" class="ColorScheme-Text"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,13 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<defs id="defs3051">
|
||||
<style type="text/css" id="current-color-scheme">
|
||||
.ColorScheme-Text {
|
||||
color:#dcdcdc;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<g transform="translate(1,1)">
|
||||
<path style="fill:#dcdcdc;fill-opacity:1;stroke:none" d="M 3 3 h 16 v 1 h -16 Z M 3 4 h 1 v 15 h -1 Z M 4 18 h 10 v 1 h -10 Z M 18 4 h 1 v 8 h -1 Z M 16 14 h 1 v 5 h -1 Z M 14 16 h 5 v 1 h -5 Z" class="ColorScheme-Text"/>
|
||||
<path style="fill:#dcdcdc;fill-opacity:1;stroke:none" d="M 5 7 h 1 v 1 h -1 Z M 6 7 h 1 v 1 h -1 Z M 7 7 h 1 v 1 h -1 Z M 5 8 h 1 v 1 h -1 Z M 7 8 h 1 v 1 h -1 Z M 5 9 h 1 v 1 h -1 Z M 6 9 h 1 v 1 h -1 Z M 7 9 h 1 v 1 h -1 Z M 5 10 h 1 v 1 h -1 Z M 5 11 h 1 v 1 h -1 Z M 9 7 h 1 v 1 h -1 Z M 10 7 h 1 v 1 h -1 Z M 9 8 h 1 v 1 h -1 Z M 11 8 h 1 v 1 h -1 Z M 9 9 h 1 v 1 h -1 Z M 11 9 h 1 v 1 h -1 Z M 9 10 h 1 v 1 h -1 Z M 11 10 h 1 v 1 h -1 Z M 9 11 h 1 v 1 h -1 Z M 10 11 h 1 v 1 h -1 Z M 13 7 h 1 v 1 h -1 Z M 14 7 h 1 v 1 h -1 Z M 15 7 h 1 v 1 h -1 Z M 13 8 h 1 v 1 h -1 Z M 13 9 h 1 v 1 h -1 Z M 14 9 h 1 v 1 h -1 Z M 13 10 h 1 v 1 h -1 Z M 13 11 h 1 v 1 h -1 Z" class="ColorScheme-Text"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -79,8 +79,10 @@ ALIASES = {
|
||||
"22x22/dialog-information.png": "folio-properties",
|
||||
}
|
||||
|
||||
# SVG icons referenced from sources/qeticons.cpp.
|
||||
# SVG icons referenced from sources/qeticons.cpp. ico/scalable/ holds the
|
||||
# ones drawn for QET as vectors; one file serves every size.
|
||||
SVGS = [
|
||||
"scalable/pdf-import.svg",
|
||||
"breeze-icons/scalable/apps/hidef/edit-opacity.svg",
|
||||
"breeze-icons/scalable/apps/hidef/image-flip-horizontal-symbolic.svg",
|
||||
"breeze-icons/scalable/apps/hidef/image-flip-vertical-symbolic.svg",
|
||||
|
||||
@@ -140,7 +140,6 @@
|
||||
<file>ico/22x22/go-up.png</file>
|
||||
<file>ico/22x22/hotspot.png</file>
|
||||
<file>ico/22x22/insert-image.png</file>
|
||||
<file>ico/22x22/pdf-import.png</file>
|
||||
<file>ico/22x22/label.png</file>
|
||||
<file>ico/22x22/landscape.png</file>
|
||||
<file>ico/22x22/line.png</file>
|
||||
|
||||
@@ -53,6 +53,7 @@ class tst_qeticons : public QObject
|
||||
void everyIconResolvesInBothThemes();
|
||||
void darkThemeFilesReadOnDarkPalette();
|
||||
void lightIconsStayLightInDarkTheme();
|
||||
void addPdfIconIsOneScalableFile();
|
||||
void toolbarIconIsReadable_data();
|
||||
void toolbarIconIsReadable();
|
||||
void panelProjectIconStaysSmall();
|
||||
@@ -163,7 +164,7 @@ void tst_qeticons::lightIconsStayLightInDarkTheme()
|
||||
{
|
||||
const QColor window = QET::Palette::fusionDark().color(QPalette::Active, QPalette::Window);
|
||||
QIcon::setThemeName(QStringLiteral("qet-dark"));
|
||||
for (const QString &name : {"pdf-import", "diagram", "label", "folio-new", "folio-delete",
|
||||
for (const QString &name : {"diagram", "label", "folio-new", "folio-delete",
|
||||
"folio-properties", "diagram_bg"})
|
||||
{
|
||||
QVERIFY2(!QFile::exists(QString(":/ico/themes/qet-dark/22x22/%1.png").arg(name)),
|
||||
@@ -178,6 +179,42 @@ void tst_qeticons::lightIconsStayLightInDarkTheme()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
The "Add PDF" icon is the first of QET's own icons drawn as an SVG:
|
||||
ico/scalable/pdf-import.svg, one file for every size, with a
|
||||
recolored copy in the dark theme. It must resolve in both themes at
|
||||
the toolbar size and above, dark ink on light and light ink on dark.
|
||||
Fusion's toolbar slot is 24 px, so the file is drawn on a 24 px
|
||||
canvas and its one pixel lines land on whole pixels there.
|
||||
*/
|
||||
void tst_qeticons::addPdfIconIsOneScalableFile()
|
||||
{
|
||||
QVERIFY(QFile::exists(":/ico/themes/qet/scalable/pdf-import.svg"));
|
||||
QVERIFY(QFile::exists(":/ico/themes/qet-dark/scalable/pdf-import.svg"));
|
||||
QVERIFY(!QFile::exists(":/ico/themes/qet/22x22/pdf-import.png"));
|
||||
|
||||
const QByteArray dump = qgetenv("QET_TEST_DUMP_DIR");
|
||||
for (const QString &theme : {"qet", "qet-dark"})
|
||||
{
|
||||
QIcon::setThemeName(theme);
|
||||
const QIcon icon = QIcon::fromTheme("pdf-import");
|
||||
QVERIFY2(!icon.isNull(), qPrintable(theme));
|
||||
for (int size : {16, 22, 24, 32, 64})
|
||||
{
|
||||
const QPixmap pixmap = icon.pixmap(size);
|
||||
QCOMPARE(pixmap.width(), size);
|
||||
if (!dump.isEmpty())
|
||||
pixmap.save(QString("%1/pdf-import-%2-%3.png").arg(QString::fromLocal8Bit(dump), theme).arg(size));
|
||||
const QColor mean = meanVisibleColor(pixmap.toImage());
|
||||
QVERIFY2(mean.isValid(), qPrintable(QString("%1 at %2 px is empty").arg(theme).arg(size)));
|
||||
if (theme == "qet")
|
||||
QVERIFY2(mean.lightnessF() < 0.5, qPrintable(QString("light theme at %1 px: lightness %2").arg(size).arg(mean.lightnessF())));
|
||||
else
|
||||
QVERIFY2(mean.lightnessF() > 0.6, qPrintable(QString("dark theme at %1 px: lightness %2").arg(size).arg(mean.lightnessF())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tst_qeticons::toolbarIconIsReadable_data()
|
||||
{
|
||||
QTest::addColumn<QString>("theme");
|
||||
|
||||
Reference in New Issue
Block a user