From 2ab88c576651508640539c586f563816ceb03fd7 Mon Sep 17 00:00:00 2001 From: Martchus Date: Wed, 27 Feb 2019 20:41:50 +0100 Subject: [PATCH] Add font awesome icons to models So it looks a bit more like the official UI. --- .../hicolor/scalable/fa-non-solid/file.svg | 1 + .../hicolor/scalable/fa-non-solid/folder.svg | 1 + .../hicolor/scalable/fa-non-solid/hdd.svg | 1 + .../icons/hicolor/scalable/fa/certificate.svg | 1 + .../icons/hicolor/scalable/fa/clock.svg | 1 + .../scalable/fa/cloud-download-alt.svg | 1 + .../hicolor/scalable/fa/cloud-upload-alt.svg | 1 + .../icons/hicolor/scalable/fa/cogs.svg | 1 + .../hicolor/scalable/fa/exchange-alt.svg | 1 + .../scalable/fa/exclamation-triangle.svg | 1 + .../icons/hicolor/scalable/fa/eye.svg | 1 + .../hicolor/scalable/fa/file-archive.svg | 1 + .../icons/hicolor/scalable/fa/folder-open.svg | 1 + .../icons/hicolor/scalable/fa/folder.svg | 1 + .../icons/hicolor/scalable/fa/globe.svg | 1 + .../icons/hicolor/scalable/fa/hashtag.svg | 1 + .../icons/hicolor/scalable/fa/home.svg | 1 + .../icons/hicolor/scalable/fa/link.svg | 1 + .../hicolor/scalable/fa/network-wired.svg | 1 + .../icons/hicolor/scalable/fa/redo.svg | 1 + .../icons/hicolor/scalable/fa/share-alt.svg | 1 + .../icons/hicolor/scalable/fa/tag.svg | 1 + model/resources/syncthingmodelicons.qrc | 22 +++++++++ model/syncthingdevicemodel.cpp | 30 +++++++++++- model/syncthingdevicemodel.h | 3 +- model/syncthingdirectorymodel.cpp | 32 ++++++++++++- model/syncthingdirectorymodel.h | 1 + model/syncthingicons.cpp | 47 +++++++++++++++++-- model/syncthingicons.h | 28 ++++++++++- model/syncthingmodel.cpp | 25 ++++++++-- plasmoid/package/contents/ui/DetailItem.qml | 24 ++++++---- plasmoid/package/contents/ui/DevicesPage.qml | 1 + .../package/contents/ui/DirectoriesPage.qml | 1 + .../contents/ui/FullRepresentation.qml | 4 +- tray/gui/traywidget.cpp | 8 ++-- .../scalable/fa/cloud-download-alt-solid.svg | 1 - .../scalable/fa/cloud-upload-alt-solid.svg | 1 - widgets/resources/syncthingwidgetsicons.qrc | 2 - 38 files changed, 219 insertions(+), 33 deletions(-) create mode 100644 model/resources/icons/hicolor/scalable/fa-non-solid/file.svg create mode 100644 model/resources/icons/hicolor/scalable/fa-non-solid/folder.svg create mode 100644 model/resources/icons/hicolor/scalable/fa-non-solid/hdd.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/certificate.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/clock.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/cloud-download-alt.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/cloud-upload-alt.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/cogs.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/exchange-alt.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/exclamation-triangle.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/eye.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/file-archive.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/folder-open.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/folder.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/globe.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/hashtag.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/home.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/link.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/network-wired.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/redo.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/share-alt.svg create mode 100644 model/resources/icons/hicolor/scalable/fa/tag.svg delete mode 100644 widgets/resources/icons/hicolor/scalable/fa/cloud-download-alt-solid.svg delete mode 100644 widgets/resources/icons/hicolor/scalable/fa/cloud-upload-alt-solid.svg diff --git a/model/resources/icons/hicolor/scalable/fa-non-solid/file.svg b/model/resources/icons/hicolor/scalable/fa-non-solid/file.svg new file mode 100644 index 0000000..9bc1513 --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa-non-solid/file.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa-non-solid/folder.svg b/model/resources/icons/hicolor/scalable/fa-non-solid/folder.svg new file mode 100644 index 0000000..7c9d6c4 --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa-non-solid/folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa-non-solid/hdd.svg b/model/resources/icons/hicolor/scalable/fa-non-solid/hdd.svg new file mode 100644 index 0000000..dbf616f --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa-non-solid/hdd.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/certificate.svg b/model/resources/icons/hicolor/scalable/fa/certificate.svg new file mode 100644 index 0000000..c57ab13 --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/certificate.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/clock.svg b/model/resources/icons/hicolor/scalable/fa/clock.svg new file mode 100644 index 0000000..6444d5b --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/clock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/cloud-download-alt.svg b/model/resources/icons/hicolor/scalable/fa/cloud-download-alt.svg new file mode 100644 index 0000000..3cd62ac --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/cloud-download-alt.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/cloud-upload-alt.svg b/model/resources/icons/hicolor/scalable/fa/cloud-upload-alt.svg new file mode 100644 index 0000000..8cf98e9 --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/cloud-upload-alt.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/cogs.svg b/model/resources/icons/hicolor/scalable/fa/cogs.svg new file mode 100644 index 0000000..c016886 --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/cogs.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/exchange-alt.svg b/model/resources/icons/hicolor/scalable/fa/exchange-alt.svg new file mode 100644 index 0000000..b22538a --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/exchange-alt.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/exclamation-triangle.svg b/model/resources/icons/hicolor/scalable/fa/exclamation-triangle.svg new file mode 100644 index 0000000..2ab5327 --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/exclamation-triangle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/eye.svg b/model/resources/icons/hicolor/scalable/fa/eye.svg new file mode 100644 index 0000000..477e9ed --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/eye.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/file-archive.svg b/model/resources/icons/hicolor/scalable/fa/file-archive.svg new file mode 100644 index 0000000..7c60e72 --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/file-archive.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/folder-open.svg b/model/resources/icons/hicolor/scalable/fa/folder-open.svg new file mode 100644 index 0000000..57dcfa6 --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/folder-open.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/folder.svg b/model/resources/icons/hicolor/scalable/fa/folder.svg new file mode 100644 index 0000000..c960768 --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/globe.svg b/model/resources/icons/hicolor/scalable/fa/globe.svg new file mode 100644 index 0000000..93b6178 --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/globe.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/hashtag.svg b/model/resources/icons/hicolor/scalable/fa/hashtag.svg new file mode 100644 index 0000000..2a6094f --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/hashtag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/home.svg b/model/resources/icons/hicolor/scalable/fa/home.svg new file mode 100644 index 0000000..27ee7ab --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/home.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/link.svg b/model/resources/icons/hicolor/scalable/fa/link.svg new file mode 100644 index 0000000..57caa9f --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/network-wired.svg b/model/resources/icons/hicolor/scalable/fa/network-wired.svg new file mode 100644 index 0000000..1be547c --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/network-wired.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/redo.svg b/model/resources/icons/hicolor/scalable/fa/redo.svg new file mode 100644 index 0000000..c536b37 --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/redo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/share-alt.svg b/model/resources/icons/hicolor/scalable/fa/share-alt.svg new file mode 100644 index 0000000..2f3151d --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/share-alt.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/icons/hicolor/scalable/fa/tag.svg b/model/resources/icons/hicolor/scalable/fa/tag.svg new file mode 100644 index 0000000..6793a2e --- /dev/null +++ b/model/resources/icons/hicolor/scalable/fa/tag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/model/resources/syncthingmodelicons.qrc b/model/resources/syncthingmodelicons.qrc index f19de25..64913ce 100644 --- a/model/resources/syncthingmodelicons.qrc +++ b/model/resources/syncthingmodelicons.qrc @@ -11,5 +11,27 @@ icons/hicolor/scalable/status/syncthing-error-sync.svg icons/hicolor/scalable/status/syncthing-sync-complete.svg icons/hicolor/scalable/status/syncthing-new.svg + icons/hicolor/scalable/fa/certificate.svg + icons/hicolor/scalable/fa/clock.svg + icons/hicolor/scalable/fa/cloud-download-alt.svg + icons/hicolor/scalable/fa/cloud-upload-alt.svg + icons/hicolor/scalable/fa/cogs.svg + icons/hicolor/scalable/fa/exchange-alt.svg + icons/hicolor/scalable/fa/exclamation-triangle.svg + icons/hicolor/scalable/fa/eye.svg + icons/hicolor/scalable/fa/file-archive.svg + icons/hicolor/scalable/fa/folder-open.svg + icons/hicolor/scalable/fa/folder.svg + icons/hicolor/scalable/fa/globe.svg + icons/hicolor/scalable/fa/hashtag.svg + icons/hicolor/scalable/fa/home.svg + icons/hicolor/scalable/fa/link.svg + icons/hicolor/scalable/fa/network-wired.svg + icons/hicolor/scalable/fa/redo.svg + icons/hicolor/scalable/fa/share-alt.svg + icons/hicolor/scalable/fa/tag.svg + icons/hicolor/scalable/fa-non-solid/file.svg + icons/hicolor/scalable/fa-non-solid/folder.svg + icons/hicolor/scalable/fa-non-solid/hdd.svg diff --git a/model/syncthingdevicemodel.cpp b/model/syncthingdevicemodel.cpp index 9e7b21a..b6b05b2 100644 --- a/model/syncthingdevicemodel.cpp +++ b/model/syncthingdevicemodel.cpp @@ -31,13 +31,14 @@ QHash SyncthingDeviceModel::roleNames() const { DeviceStatusColor, "statusColor" }, { DeviceId, "devId" }, { DeviceDetail, "detail" }, + { DeviceDetailIcon, "detailIcon" }, }; return roles; } const QVector &SyncthingDeviceModel::colorRoles() const { - static const QVector colorRoles({ Qt::ForegroundRole, DeviceStatusColor }); + static const QVector colorRoles({ Qt::DecorationRole, Qt::ForegroundRole, DeviceStatusColor, DeviceDetailIcon }); return colorRoles; } @@ -157,6 +158,33 @@ QVariant SyncthingDeviceModel::data(const QModelIndex &index, int role) const } } break; + case Qt::DecorationRole: + case DeviceDetailIcon: + if (index.column() == 0) { + // attribute icons + const auto &icons = m_brightColors ? fontAwesomeIconsForDarkTheme() : fontAwesomeIconsForLightTheme(); + switch (index.row()) { + case 0: + return icons.hashtag; + case 1: + return icons.link; + case 2: + return icons.eye; + case 3: + return icons.fileArchive; + case 4: + return icons.certificate; + case 5: + return icons.networkWired; + case 6: + return icons.cloudDownloadAlt; + case 7: + return icons.cloudUploadAlt; + case 8: + return icons.tag; + } + } + break; case Qt::ForegroundRole: switch (index.column()) { case 1: diff --git a/model/syncthingdevicemodel.h b/model/syncthingdevicemodel.h index 00e81ac..d941a50 100644 --- a/model/syncthingdevicemodel.h +++ b/model/syncthingdevicemodel.h @@ -21,7 +21,8 @@ public: DeviceStatusString, DeviceStatusColor, DeviceId, - DeviceDetail + DeviceDetail, + DeviceDetailIcon, }; explicit SyncthingDeviceModel(SyncthingConnection &connection, QObject *parent = nullptr); diff --git a/model/syncthingdirectorymodel.cpp b/model/syncthingdirectorymodel.cpp index ba23442..0cf0741 100644 --- a/model/syncthingdirectorymodel.cpp +++ b/model/syncthingdirectorymodel.cpp @@ -41,13 +41,14 @@ QHash SyncthingDirectoryModel::roleNames() const { DirectoryPath, "path" }, { DirectoryPullErrorCount, "pullErrorCount" }, { DirectoryDetail, "detail" }, + { DirectoryDetailIcon, "detailIcon" }, }; return roles; } const QVector &SyncthingDirectoryModel::colorRoles() const { - static const QVector colorRoles({ Qt::ForegroundRole, DirectoryStatusColor }); + static const QVector colorRoles({ Qt::DecorationRole, Qt::ForegroundRole, DirectoryStatusColor, DirectoryDetailIcon }); return colorRoles; } @@ -187,6 +188,35 @@ QVariant SyncthingDirectoryModel::data(const QModelIndex &index, int role) const } } break; + case Qt::DecorationRole: + case DirectoryDetailIcon: + if (index.column() == 0) { + // attribute icons + const auto &icons = m_brightColors ? fontAwesomeIconsForDarkTheme() : fontAwesomeIconsForLightTheme(); + switch (row) { + case 0: + return icons.hashtag; + case 1: + return icons.folderOpen; + case 2: + return icons.globe; + case 3: + return icons.home; + case 4: + return icons.shareAlt; + case 5: + return icons.cogs; + case 6: + return icons.refresh; + case 7: + return icons.clock; + case 8: + return icons.exchangeAlt; + case 9: + return icons.exclamationTriangle; + } + } + break; case Qt::ForegroundRole: switch (index.column()) { case 1: diff --git a/model/syncthingdirectorymodel.h b/model/syncthingdirectorymodel.h index bce1f33..7a77c49 100644 --- a/model/syncthingdirectorymodel.h +++ b/model/syncthingdirectorymodel.h @@ -23,6 +23,7 @@ public: DirectoryPath, DirectoryPullErrorCount, DirectoryDetail, + DirectoryDetailIcon, }; explicit SyncthingDirectoryModel(SyncthingConnection &connection, QObject *parent = nullptr); diff --git a/model/syncthingicons.cpp b/model/syncthingicons.cpp index f63c6c1..810fff5 100644 --- a/model/syncthingicons.cpp +++ b/model/syncthingicons.cpp @@ -55,15 +55,19 @@ QPixmap renderSvgImage(const QByteArray &contents, const QSize &size, int margin /*! * \brief Returns the font awesome icon with the specified \a iconName and \a color. */ -QByteArray loadFontAwesomeIcon(const QString &iconName, const QColor &color) +QByteArray loadFontAwesomeIcon(const QString &iconName, const QColor &color, bool solid) { QByteArray result; - QFile icon(QStringLiteral(":/icons/hicolor/scalable/fa/") % iconName % QStringLiteral(".svg")); + QFile icon((solid ? QStringLiteral(":/icons/hicolor/scalable/fa/") : QStringLiteral(":/icons/hicolor/scalable/fa-non-solid/")) % iconName + % QStringLiteral(".svg")); if (!icon.open(QFile::ReadOnly)) { return result; } result = icon.readAll(); - result.replace("currentColor", color.name(QColor::HexRgb).toUtf8()); + const auto pathBegin = result.indexOf(" 0) { + result.insert(pathBegin + 6, QStringLiteral("fill=\"") % color.name(QColor::HexRgb) % QStringLiteral("\" ")); + } return result; } @@ -81,10 +85,45 @@ StatusIcons::StatusIcons() { } -const StatusIcons LIB_SYNCTHING_MODEL_EXPORT &statusIcons() +FontAwesomeIcons::FontAwesomeIcons(const QColor &color, const QSize &size, int margin) + : hashtag(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("hashtag"), color), size, margin)) + , folderOpen(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("folder-open"), color), size, margin)) + , globe(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("globe"), color), size, margin)) + , home(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("home"), color), size, margin)) + , shareAlt(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("share-alt"), color), size, margin)) + , refresh(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("redo"), color), size, margin)) + , clock(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("clock"), color), size, margin)) + , exchangeAlt(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("exchange-alt"), color), size, margin)) + , exclamationTriangle(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("exclamation-triangle"), color), size, margin)) + , cogs(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("cogs"), color), size, margin)) + , link(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("link"), color), size, margin)) + , eye(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("eye"), color), size, margin)) + , fileArchive(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("file-archive"), color), size, margin)) + , folder(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("folder"), color), size, margin)) + , certificate(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("certificate"), color), size, margin)) + , networkWired(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("network-wired"), color), size, margin)) + , cloudDownloadAlt(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("cloud-download-alt"), color), size, margin)) + , cloudUploadAlt(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("cloud-upload-alt"), color), size, margin)) + , tag(renderSvgImage(loadFontAwesomeIcon(QStringLiteral("tag"), color), size, margin)) +{ +} + +const StatusIcons &statusIcons() { static const StatusIcons icons; return icons; } +const FontAwesomeIcons &fontAwesomeIconsForLightTheme() +{ + static const FontAwesomeIcons icons(QColor(10, 10, 10), QSize(64, 64), 8); + return icons; +} + +const FontAwesomeIcons &fontAwesomeIconsForDarkTheme() +{ + static const FontAwesomeIcons icons(Qt::white, QSize(64, 64), 8); + return icons; +} + } // namespace Data diff --git a/model/syncthingicons.h b/model/syncthingicons.h index e025738..a894b01 100644 --- a/model/syncthingicons.h +++ b/model/syncthingicons.h @@ -10,8 +10,6 @@ QT_FORWARD_DECLARE_CLASS(QColor) namespace Data { -QByteArray LIB_SYNCTHING_MODEL_EXPORT loadFontAwesomeIcon(const QString &iconName, const QColor &color); - struct StatusIcons { StatusIcons(); QIcon disconnected; @@ -26,9 +24,35 @@ struct StatusIcons { QIcon newItem; }; +struct FontAwesomeIcons { + FontAwesomeIcons(const QColor &color, const QSize &size, int margin); + QIcon hashtag; + QIcon folderOpen; + QIcon globe; + QIcon home; + QIcon shareAlt; + QIcon refresh; + QIcon clock; + QIcon exchangeAlt; + QIcon exclamationTriangle; + QIcon cogs; + QIcon link; + QIcon eye; + QIcon fileArchive; + QIcon folder; + QIcon certificate; + QIcon networkWired; + QIcon cloudDownloadAlt; + QIcon cloudUploadAlt; + QIcon tag; +}; + QPixmap LIB_SYNCTHING_MODEL_EXPORT renderSvgImage(const QString &path, const QSize &size = QSize(128, 128), int margin = 0); QPixmap LIB_SYNCTHING_MODEL_EXPORT renderSvgImage(const QByteArray &contents, const QSize &size = QSize(128, 128), int margin = 0); +QByteArray LIB_SYNCTHING_MODEL_EXPORT loadFontAwesomeIcon(const QString &iconName, const QColor &color, bool solid = true); const StatusIcons LIB_SYNCTHING_MODEL_EXPORT &statusIcons(); +const FontAwesomeIcons LIB_SYNCTHING_MODEL_EXPORT &fontAwesomeIconsForLightTheme(); +const FontAwesomeIcons LIB_SYNCTHING_MODEL_EXPORT &fontAwesomeIconsForDarkTheme(); } // namespace Data diff --git a/model/syncthingmodel.cpp b/model/syncthingmodel.cpp index e17a9cf..ff9b481 100644 --- a/model/syncthingmodel.cpp +++ b/model/syncthingmodel.cpp @@ -21,11 +21,26 @@ const QVector &SyncthingModel::colorRoles() const void SyncthingModel::setBrightColors(bool brightColors) { - if (m_brightColors != brightColors) { - m_brightColors = brightColors; - const QVector &affectedRoles = colorRoles(); - if (!affectedRoles.isEmpty()) { - emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1), affectedRoles); + if (m_brightColors == brightColors) { + return; + } + m_brightColors = brightColors; + + const QVector &affectedRoles = colorRoles(); + if (affectedRoles.isEmpty()) { + return; + } + + // update top-level indices + const auto rows = rowCount(); + emit dataChanged(index(0, 0), index(rows - 1, columnCount() - 1), affectedRoles); + + // update nested indices + for (auto i = 0; i != rows; ++i) { + const auto parentIndex = index(i, 0); + const auto childRows = rowCount(parentIndex); + if (childRows > 0) { + emit dataChanged(index(0, 0, parentIndex), index(childRows - 1, columnCount(parentIndex) - 1), affectedRoles); } } } diff --git a/plasmoid/package/contents/ui/DetailItem.qml b/plasmoid/package/contents/ui/DetailItem.qml index e4843a7..73cb7e5 100644 --- a/plasmoid/package/contents/ui/DetailItem.qml +++ b/plasmoid/package/contents/ui/DetailItem.qml @@ -1,5 +1,6 @@ import QtQuick 2.7 import QtQuick.Layouts 1.1 +import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents Item { @@ -13,21 +14,26 @@ Item { RowLayout { id: detailRow - spacing: theme.defaultFont.pointSize * 0.8 + width: parent.width - PlasmaComponents.Label { - Layout.preferredWidth: 100 - Layout.leftMargin: units.iconSizes.smallMedium - text: detailName + ":" - font.pointSize: theme.defaultFont.pointSize * 0.8 - font.weight: Font.DemiBold - horizontalAlignment: Qt.AlignRight + PlasmaCore.IconItem { + source: detailIcon + Layout.leftMargin: units.iconSizes.small * 1.1 + Layout.preferredWidth: units.iconSizes.small + Layout.preferredHeight: units.iconSizes.small + opacity: 0.8 } PlasmaComponents.Label { + Layout.preferredWidth: 100 + text: detailName + font.weight: Font.DemiBold + } + PlasmaComponents.Label { + Layout.leftMargin: theme.defaultFont.pointSize * 0.9 Layout.fillWidth: true text: detailValue - font.pointSize: theme.defaultFont.pointSize * 0.8 elide: Text.ElideRight + horizontalAlignment: Qt.AlignRight } } diff --git a/plasmoid/package/contents/ui/DevicesPage.qml b/plasmoid/package/contents/ui/DevicesPage.qml index b22ae16..b433cb5 100644 --- a/plasmoid/package/contents/ui/DevicesPage.qml +++ b/plasmoid/package/contents/ui/DevicesPage.qml @@ -71,6 +71,7 @@ Item { id: detailsView visible: item.expanded Layout.fillWidth: true + Layout.topMargin: 3 model: DelegateModel { model: plasmoid.nativeInterface.devModel diff --git a/plasmoid/package/contents/ui/DirectoriesPage.qml b/plasmoid/package/contents/ui/DirectoriesPage.qml index 9d24c37..c267bae 100644 --- a/plasmoid/package/contents/ui/DirectoriesPage.qml +++ b/plasmoid/package/contents/ui/DirectoriesPage.qml @@ -114,6 +114,7 @@ ColumnLayout { id: detailsView visible: item.expanded Layout.fillWidth: true + Layout.topMargin: 3 model: DelegateModel { model: plasmoid.nativeInterface.dirModel diff --git a/plasmoid/package/contents/ui/FullRepresentation.qml b/plasmoid/package/contents/ui/FullRepresentation.qml index 261be91..4b79f45 100644 --- a/plasmoid/package/contents/ui/FullRepresentation.qml +++ b/plasmoid/package/contents/ui/FullRepresentation.qml @@ -450,7 +450,7 @@ ColumnLayout { Layout.preferredHeight: 16 Layout.leftMargin: 10 source: plasmoid.nativeInterface.loadFontAwesomeIcon( - "cloud-download-alt-solid") + "cloud-download-alt") opacity: plasmoid.nativeInterface.hasIncomingTraffic ? 1.0 : 0.5 } PlasmaComponents.Label { @@ -471,7 +471,7 @@ ColumnLayout { Layout.preferredHeight: 16 Layout.leftMargin: 10 source: plasmoid.nativeInterface.loadFontAwesomeIcon( - "cloud-upload-alt-solid") + "cloud-upload-alt") opacity: plasmoid.nativeInterface.hasOutgoingTraffic ? 1.0 : 0.5 } PlasmaComponents.Label { diff --git a/tray/gui/traywidget.cpp b/tray/gui/traywidget.cpp index 14ee743..bf53f78 100644 --- a/tray/gui/traywidget.cpp +++ b/tray/gui/traywidget.cpp @@ -520,10 +520,10 @@ void TrayWidget::updateTraffic() QPixmap downloadIconActive; QPixmap downloadIconInactive; } icons; - icons.uploadIconActive = renderIcon(QStringLiteral("cloud-upload-alt-solid"), colorActive); - icons.uploadIconInactive = renderIcon(QStringLiteral("cloud-upload-alt-solid"), colorInactive); - icons.downloadIconActive = renderIcon(QStringLiteral("cloud-download-alt-solid"), colorActive); - icons.downloadIconInactive = renderIcon(QStringLiteral("cloud-download-alt-solid"), colorInactive); + icons.uploadIconActive = renderIcon(QStringLiteral("cloud-upload-alt"), colorActive); + icons.uploadIconInactive = renderIcon(QStringLiteral("cloud-upload-alt"), colorInactive); + icons.downloadIconActive = renderIcon(QStringLiteral("cloud-download-alt"), colorActive); + icons.downloadIconInactive = renderIcon(QStringLiteral("cloud-download-alt"), colorInactive); return icons; }(); diff --git a/widgets/resources/icons/hicolor/scalable/fa/cloud-download-alt-solid.svg b/widgets/resources/icons/hicolor/scalable/fa/cloud-download-alt-solid.svg deleted file mode 100644 index 5e47b45..0000000 --- a/widgets/resources/icons/hicolor/scalable/fa/cloud-download-alt-solid.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/widgets/resources/icons/hicolor/scalable/fa/cloud-upload-alt-solid.svg b/widgets/resources/icons/hicolor/scalable/fa/cloud-upload-alt-solid.svg deleted file mode 100644 index bbc5969..0000000 --- a/widgets/resources/icons/hicolor/scalable/fa/cloud-upload-alt-solid.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/widgets/resources/syncthingwidgetsicons.qrc b/widgets/resources/syncthingwidgetsicons.qrc index d989fc9..134de40 100644 --- a/widgets/resources/syncthingwidgetsicons.qrc +++ b/widgets/resources/syncthingwidgetsicons.qrc @@ -9,8 +9,6 @@ icons/hicolor/scalable/actions/list-remove.svg icons/hicolor/scalable/actions/edit-paste.svg icons/hicolor/scalable/app/syncthingtray.svg - icons/hicolor/scalable/fa/cloud-download-alt-solid.svg - icons/hicolor/scalable/fa/cloud-upload-alt-solid.svg icons/hicolor/scalable/actions/globe.svg icons/hicolor/scalable/places/user-home.svg icons/hicolor/scalable/emblems/emblem-important-old.svg