Use icons from icon theme.
|
@ -824,8 +824,8 @@
|
|||
</widget>
|
||||
<widget class="QWidget" name="tabInformation">
|
||||
<attribute name="icon">
|
||||
<iconset resource="share/resources/tapeicon.qrc">
|
||||
<normaloff>:/tapeicon/16x16/info.png</normaloff>:/tapeicon/16x16/info.png</iconset>
|
||||
<iconset theme="documentinfo">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>Information</string>
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "vwidgetdetails.h"
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../vmisc/theme/vtheme.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vtools/tools/vtoolseamallowance.h"
|
||||
|
@ -61,14 +62,6 @@ enum PieceColumn
|
|||
InLayout = 0,
|
||||
PieceName = 1
|
||||
};
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, allowDetailIcon, (QLatin1String("://icon/16x16/allow_detail.png"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, forbidDetailIcon, (QLatin1String("://icon/16x16/forbid_detail.png"))) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -148,6 +141,7 @@ void VWidgetDetails::changeEvent(QEvent *event)
|
|||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
||||
// remember to call base class implementation
|
||||
QWidget::changeEvent(event);
|
||||
}
|
||||
|
@ -235,7 +229,18 @@ void VWidgetDetails::ToggledPieceItem(QTableWidgetItem *item)
|
|||
if (details->contains(id))
|
||||
{
|
||||
const bool inLayout = details->value(id).IsInLayout();
|
||||
inLayout ? item->setIcon(QIcon(*allowDetailIcon)) : item->setIcon(QIcon(*forbidDetailIcon));
|
||||
if (inLayout)
|
||||
{
|
||||
item->setIcon(
|
||||
QIcon::fromTheme(QStringLiteral("gtk-ok"),
|
||||
VTheme::GetFallbackThemeIcon(QStringLiteral("16/actions/gtk-ok"), QSize(16, 16))));
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setIcon(
|
||||
QIcon::fromTheme(QStringLiteral("gtk-no"),
|
||||
VTheme::GetFallbackThemeIcon(QStringLiteral("16/actions/gtk-no"), QSize(16, 16))));
|
||||
}
|
||||
|
||||
VToolSeamAllowance *tool = nullptr;
|
||||
try
|
||||
|
@ -255,7 +260,20 @@ auto VWidgetDetails::PrepareInLayoutColumnCell(const VPiece &det, quint32 id) ->
|
|||
{
|
||||
auto *item = new QTableWidgetItem();
|
||||
item->setTextAlignment(Qt::AlignHCenter);
|
||||
item->setIcon(det.IsInLayout() ? QIcon(*allowDetailIcon) : QIcon(*forbidDetailIcon));
|
||||
|
||||
if (det.IsInLayout())
|
||||
{
|
||||
item->setIcon(
|
||||
QIcon::fromTheme(QStringLiteral("gtk-ok"),
|
||||
VTheme::GetFallbackThemeIcon(QStringLiteral("16/actions/gtk-ok"), QSize(16, 16))));
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setIcon(
|
||||
QIcon::fromTheme(QStringLiteral("gtk-no"),
|
||||
VTheme::GetFallbackThemeIcon(QStringLiteral("16/actions/gtk-no"), QSize(16, 16))));
|
||||
}
|
||||
|
||||
item->setData(Qt::UserRole, id);
|
||||
|
||||
// set the item non-editable (view only), and non-selectable
|
||||
|
|
|
@ -56,12 +56,12 @@
|
|||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderHighlightSections">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderMinimumSectionSize">
|
||||
<number>10</number>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderHighlightSections">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -421,8 +421,8 @@
|
|||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../libs/vmisc/share/resources/icon.qrc">
|
||||
<normaloff>:/icon/16x16/broom@2x.png</normaloff>:/icon/16x16/broom@2x.png</iconset>
|
||||
<iconset theme="edit-clear-history">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
<file>icon/32x32/arrowLeftUp.png</file>
|
||||
<file>icon/32x32/putHereLeft.png</file>
|
||||
<file>icon/path_config.png</file>
|
||||
<file>icon/16x16/info.png</file>
|
||||
<file>icon/16x16/measurement.png</file>
|
||||
<file>icon/16x16/landscape.png</file>
|
||||
<file>icon/16x16/portrait.png</file>
|
||||
|
@ -36,10 +35,6 @@
|
|||
<file>icon/32x32/syncM.png</file>
|
||||
<file>icon/16x16/operations.png</file>
|
||||
<file>icon/16x16/operations@2x.png</file>
|
||||
<file>icon/16x16/allow_detail.png</file>
|
||||
<file>icon/16x16/allow_detail@2x.png</file>
|
||||
<file>icon/16x16/forbid_detail.png</file>
|
||||
<file>icon/16x16/forbid_detail@2x.png</file>
|
||||
<file>icon/32x32/grainline.png</file>
|
||||
<file>icon/32x32/grainline@2x.png</file>
|
||||
<file>icon/32x32/labels.png</file>
|
||||
|
@ -52,8 +47,6 @@
|
|||
<file>icon/32x32/passmark@2x.png</file>
|
||||
<file>icon/32x32/button.png</file>
|
||||
<file>icon/32x32/button@2x.png</file>
|
||||
<file>icon/16x16/broom.png</file>
|
||||
<file>icon/16x16/broom@2x.png</file>
|
||||
<file>icon/16x16/font_preferences@2x.png</file>
|
||||
<file>icon/16x16/font_preferences.png</file>
|
||||
<file>icon/32x32/font_preferences@2x.png</file>
|
||||
|
|
Before Width: | Height: | Size: 487 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 743 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 762 B |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 886 B |
|
@ -1 +1,13 @@
|
|||
<svg viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg"><path d="m7.6660156 6-5.8808594 5.734375-.7851562.765625.7851562.765625 5.8808594 5.734375h10.2792964 1.554688.5.5c.277 0 .5-.223.5-.5v-12c0-.277-.223-.5-.5-.5h-1-1.554688zm2.7675784 3.25 2.232422 2.177734 2.234375-2.177734 1.099609 1.072266-2.232422 2.177734 2.232422 2.177734-1.099609 1.072266-2.234375-2.177734-2.232422 2.177734-1.0996096-1.072266 2.2324216-2.177734-2.2324216-2.177734z" fill="#4d4d4d"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
|
||||
<defs id="defs3051">
|
||||
<style type="text/css" id="current-color-scheme">
|
||||
.ColorScheme-Text {
|
||||
color:#363636;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<path style="fill:currentColor;fill-opacity:1;stroke:none"
|
||||
d="M 2.5 2 C 2.2238576 2 2 2.2238576 2 2.5 C 2 2.7761424 2.2238576 3 2.5 3 C 2.7761424 3 3 2.7761424 3 2.5 C 3 2.2238576 2.7761424 2 2.5 2 z M 5.5 2 C 5.2238576 2 5 2.2238576 5 2.5 C 5 2.7761424 5.2238576 3 5.5 3 C 5.7761424 3 6 2.7761424 6 2.5 C 6 2.2238576 5.7761424 2 5.5 2 z M 13.160156 2 L 9.7382812 6.3105469 C 9.062765 6.0537156 8.2111082 5.9824498 7 6 C 5.6442244 7.2930815 4.7507597 7.7091991 2 8 L 2 9 C 4.1137135 12.371692 5.4745763 14 9 14 L 10 14 C 11.073961 12.616195 11.627119 11.610169 12 10 L 12 9 C 11.558507 8.0093924 11.158004 7.334604 10.673828 6.8789062 L 14 2.6601562 L 13.160156 2 z M 4 4 C 3.4477153 4 3 4.4477153 3 5 C 3 5.5522847 3.4477153 6 4 6 C 4.5522847 6 5 5.5522847 5 5 C 5 4.4477153 4.5522847 4 4 4 z M 7.5292969 7.1015625 C 9.6322903 7.2655765 10.168585 8.0162663 10.857422 9.6992188 C 10.284594 11.24586 10.385403 11.602833 9.2734375 12.96875 C 6.1355922 12.694915 5.052768 11.540538 3.3261719 8.8300781 C 5.122354 8.7567482 6.1084274 8.1046285 7.5292969 7.1015625 z "
|
||||
class="ColorScheme-Text"
|
||||
/>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 473 B After Width: | Height: | Size: 1.3 KiB |
|
@ -1 +1,13 @@
|
|||
<svg viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg"><path d="m7.6660156 6-5.8808594 5.734375-.7851562.765625.7851562.765625 5.8808594 5.734375h10.2792964 1.554688.5.5c.277 0 .5-.223.5-.5v-12c0-.277-.223-.5-.5-.5h-1-1.554688zm2.7675784 3.25 2.232422 2.177734 2.234375-2.177734 1.099609 1.072266-2.232422 2.177734 2.232422 2.177734-1.099609 1.072266-2.234375-2.177734-2.232422 2.177734-1.0996096-1.072266 2.2324216-2.177734-2.2324216-2.177734z" fill="#4d4d4d"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
|
||||
<defs id="defs3051">
|
||||
<style type="text/css" id="current-color-scheme">
|
||||
.ColorScheme-Text {
|
||||
color:#363636;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<path style="fill:currentColor;fill-opacity:1;stroke:none"
|
||||
d="M 2.5 2 C 2.2238576 2 2 2.2238576 2 2.5 C 2 2.7761424 2.2238576 3 2.5 3 C 2.7761424 3 3 2.7761424 3 2.5 C 3 2.2238576 2.7761424 2 2.5 2 z M 5.5 2 C 5.2238576 2 5 2.2238576 5 2.5 C 5 2.7761424 5.2238576 3 5.5 3 C 5.7761424 3 6 2.7761424 6 2.5 C 6 2.2238576 5.7761424 2 5.5 2 z M 13.160156 2 L 9.7382812 6.3105469 C 9.062765 6.0537156 8.2111082 5.9824498 7 6 C 5.6442244 7.2930815 4.7507597 7.7091991 2 8 L 2 9 C 4.1137135 12.371692 5.4745763 14 9 14 L 10 14 C 11.073961 12.616195 11.627119 11.610169 12 10 L 12 9 C 11.558507 8.0093924 11.158004 7.334604 10.673828 6.8789062 L 14 2.6601562 L 13.160156 2 z M 4 4 C 3.4477153 4 3 4.4477153 3 5 C 3 5.5522847 3.4477153 6 4 6 C 4.5522847 6 5 5.5522847 5 5 C 5 4.4477153 4.5522847 4 4 4 z M 7.5292969 7.1015625 C 9.6322903 7.2655765 10.168585 8.0162663 10.857422 9.6992188 C 10.284594 11.24586 10.385403 11.602833 9.2734375 12.96875 C 6.1355922 12.694915 5.052768 11.540538 3.3261719 8.8300781 C 5.122354 8.7567482 6.1084274 8.1046285 7.5292969 7.1015625 z "
|
||||
class="ColorScheme-Text"
|
||||
/>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 473 B After Width: | Height: | Size: 1.3 KiB |
|
@ -68,6 +68,8 @@ using namespace bpstd::literals::chrono_literals;
|
|||
#include "../vabstractapplication.h"
|
||||
#include "vscenestylesheet.h"
|
||||
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
|
||||
namespace
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
|
||||
|
@ -336,11 +338,21 @@ auto VTheme::ColorSheme() -> VColorSheme
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VTheme::SetIconTheme()
|
||||
auto VTheme::DefaultThemeName() -> QString
|
||||
{
|
||||
VColorSheme colorScheme = ColorSheme();
|
||||
QString themePrefix = (colorScheme == VColorSheme::Light ? QStringLiteral("Light") : QStringLiteral("Dark"));
|
||||
|
||||
#if defined(Q_OS_MACX)
|
||||
return QStringLiteral("La-Sierra-%1").arg(themePrefix);
|
||||
#else
|
||||
return QStringLiteral("Eleven-%1").arg(themePrefix);
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VTheme::SetIconTheme()
|
||||
{
|
||||
static const char *GENERIC_ICON_TO_CHECK = "document-open";
|
||||
if (not QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK))
|
||||
{
|
||||
|
@ -348,12 +360,7 @@ void VTheme::SetIconTheme()
|
|||
// use an icon theme that we provide via a .qrc file
|
||||
// This case happens under Windows and Mac OS X
|
||||
// This does not happen under GNOME or KDE
|
||||
|
||||
#if defined(Q_OS_MACX)
|
||||
QIcon::setThemeName(QStringLiteral("La-Sierra-%1").arg(themePrefix));
|
||||
#else
|
||||
QIcon::setThemeName(QStringLiteral("Eleven-%1").arg(themePrefix));
|
||||
#endif
|
||||
QIcon::setThemeName(DefaultThemeName());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -362,7 +369,7 @@ void VTheme::SetIconTheme()
|
|||
if ((themeMode == VThemeMode::Dark && !ShouldApplyDarkTheme()) ||
|
||||
(themeMode == VThemeMode::Light && ShouldApplyDarkTheme()))
|
||||
{
|
||||
QIcon::setThemeName(QStringLiteral("Eleven-%1").arg(themePrefix));
|
||||
QIcon::setThemeName(DefaultThemeName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -506,6 +513,18 @@ void VTheme::ResetThemeSettings() const
|
|||
emit Instance()->ThemeSettingsChanged();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VTheme::GetFallbackThemeIcon(const QString &iconName, QSize iconSize) -> QIcon
|
||||
{
|
||||
QString filePath = QStringLiteral(":icons/%1/%2.svg").arg(DefaultThemeName(), iconName);
|
||||
|
||||
QIcon icon;
|
||||
icon.addFile(filePath, iconSize, QIcon::Normal, QIcon::On);
|
||||
iconSize *= 2;
|
||||
icon.addFile(filePath, iconSize, QIcon::Normal, QIcon::On);
|
||||
return icon;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VTheme::GetIconResource(const QString &root, const QString &iconName) -> QIcon
|
||||
{
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
void SetToAutoTheme() const;
|
||||
void ResetThemeSettings() const;
|
||||
|
||||
static auto GetFallbackThemeIcon(const QString &iconName, QSize iconSize) -> QIcon;
|
||||
static auto GetIconResource(const QString &root, const QString &iconName) -> QIcon;
|
||||
static auto GetPixmapResource(const QString &root, const QString &iconName) -> QPixmap;
|
||||
static auto GetResourceName(const QString &root, const QString &iconName) -> QString;
|
||||
|
@ -64,6 +65,7 @@ public:
|
|||
static auto IsInDarkTheme() -> bool;
|
||||
static auto ShouldApplyDarkTheme() -> bool;
|
||||
static auto ColorSheme() -> VColorSheme;
|
||||
static auto DefaultThemeName() -> QString;
|
||||
static void SetIconTheme();
|
||||
static void InitThemeMode();
|
||||
static auto ThemeStylesheet() -> QString;
|
||||
|
|