diff --git a/src/gui/iconutils.cpp b/src/gui/iconutils.cpp index c25adbc76..22ce38f85 100644 --- a/src/gui/iconutils.cpp +++ b/src/gui/iconutils.cpp @@ -108,9 +108,11 @@ QImage createSvgImageWithCustomColor(const QString &fileName, return {}; } + const auto sizeToUse = requestedSize.isValid() || originalSize == nullptr ? requestedSize : *originalSize; + // some icons are present in white or black only, so, we need to check both when needed const auto iconBaseColors = QStringList{QStringLiteral("black"), QStringLiteral("white")}; - const auto customColorImage = findImageWithCustomColor(fileName, customColor, iconBaseColors, requestedSize); + const auto customColorImage = findImageWithCustomColor(fileName, customColor, iconBaseColors, sizeToUse); if (!customColorImage.isNull()) { return customColorImage; @@ -125,7 +127,7 @@ QImage createSvgImageWithCustomColor(const QString &fileName, return {}; } - const auto result = drawSvgWithCustomFillColor(sourceSvg, customColor, originalSize, requestedSize); + const auto result = drawSvgWithCustomFillColor(sourceSvg, customColor, originalSize, sizeToUse); Q_ASSERT(!result.isNull()); if (result.isNull()) { diff --git a/src/gui/tray/AutoSizingMenu.qml b/src/gui/tray/AutoSizingMenu.qml index 5be41907c..1d3134b37 100644 --- a/src/gui/tray/AutoSizingMenu.qml +++ b/src/gui/tray/AutoSizingMenu.qml @@ -8,7 +8,7 @@ Menu { var padding = 0; for (var i = 0; i < count; ++i) { var item = itemAt(i); - result = Math.max(item.contentItem.implicitWidth, result); + result = Math.max(item.implicitWidth, result); padding = Math.max(item.padding, padding); } return result + padding * 2; diff --git a/src/gui/tray/HeaderButton.qml b/src/gui/tray/HeaderButton.qml index ca46a3e1c..3d16aa350 100644 --- a/src/gui/tray/HeaderButton.qml +++ b/src/gui/tray/HeaderButton.qml @@ -18,7 +18,6 @@ import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 -import Qt5Compat.GraphicalEffects // Custom qml modules are in /theme (and included by resources.qrc) import Style 1.0 @@ -33,7 +32,6 @@ Button { icon.width: Style.headerButtonIconSize icon.height: Style.headerButtonIconSize - icon.color: palette.brightText Layout.alignment: Qt.AlignRight Layout.preferredWidth: Style.trayWindowHeaderHeight @@ -43,4 +41,20 @@ Button { color: root.hovered || root.visualFocus ? Style.currentUserHeaderTextColor : "transparent" opacity: 0.2 } + + contentItem: Item { + anchors.fill: parent + + Image { + id: internalImage + anchors.centerIn: parent + width: root.icon.width + height: root.icon.height + source: root.icon.source + sourceSize { + width: root.icon.width + height: root.icon.height + } + } + } } diff --git a/src/gui/tray/TrayFoldersMenuButton.qml b/src/gui/tray/TrayFoldersMenuButton.qml index 546ea447b..00c878dcc 100644 --- a/src/gui/tray/TrayFoldersMenuButton.qml +++ b/src/gui/tray/TrayFoldersMenuButton.qml @@ -124,7 +124,7 @@ HeaderButton { width: imageWidth height: imageHeight - anchors.verticalCenter: parent + anchors.verticalCenter: parent.verticalCenter } @@ -146,7 +146,7 @@ HeaderButton { cache: true source: "image://svgimage-custom-color/caret-down.svg/" + Style.currentUserHeaderTextColor - sourceSize: { + sourceSize { width: openLocalFolderButtonCaretIconLoader.imageWidth height: openLocalFolderButtonCaretIconLoader.imageHeight } diff --git a/src/gui/tray/UserLine.qml b/src/gui/tray/UserLine.qml index 8b5ebcebe..a546cf557 100644 --- a/src/gui/tray/UserLine.qml +++ b/src/gui/tray/UserLine.qml @@ -141,9 +141,6 @@ AbstractButton { Layout.fillHeight: true flat: true - icon.source: "qrc:///client/theme/more.svg" - icon.color: palette.buttonText - Accessible.role: Accessible.ButtonMenu Accessible.name: qsTr("Account actions") Accessible.onPressAction: userMoreButtonMouseArea.clicked() @@ -155,6 +152,12 @@ AbstractButton { color: userMoreButton.hovered || userMoreButton.visualFocus ? palette.highlight : "transparent" } + contentItem: Image { + anchors.fill: parent + source: "image://svgimage-custom-color/more.svg" + "/" + palette.buttonText + fillMode: Image.PreserveAspectFit + } + AutoSizingMenu { id: userMoreButtonMenu closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index f14b054f8..dd21cccca 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -312,22 +312,6 @@ ApplicationWindow { radius: Style.currentAccountButtonRadius } - contentItem: ScrollView { - id: accMenuScrollView - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - - data: WheelHandler { - target: accMenuScrollView.contentItem - } - ListView { - implicitHeight: contentHeight - model: accountMenu.contentModel - interactive: true - clip: true - currentIndex: accountMenu.currentIndex - } - } - onClosed: { // HACK: reload account Instantiator immediately by restting it - could be done better I guess // see also onVisibleChanged above @@ -640,7 +624,7 @@ ApplicationWindow { id: trayWindowTalkButton visible: UserModel.currentUser && UserModel.currentUser.serverHasTalk - icon.source: "qrc:///client/theme/white/talk-app.svg" + icon.source: "image://svgimage-custom-color/talk-app.svg" + "/" + Style.currentUserHeaderTextColor icon.color: Style.currentUserHeaderTextColor onClicked: UserModel.openCurrentAccountTalk() @@ -656,8 +640,7 @@ ApplicationWindow { HeaderButton { id: trayWindowAppsButton - icon.source: "qrc:///client/theme/white/more-apps.svg" - icon.color: Style.currentUserHeaderTextColor + icon.source: "image://svgimage-custom-color/more-apps.svg" + "/" + Style.currentUserHeaderTextColor onClicked: { if(appsMenuListView.count <= 0) { diff --git a/src/gui/tray/svgimageprovider.cpp b/src/gui/tray/svgimageprovider.cpp index ab5760700..b8297b27e 100644 --- a/src/gui/tray/svgimageprovider.cpp +++ b/src/gui/tray/svgimageprovider.cpp @@ -45,6 +45,10 @@ namespace Ui { return {}; } + if (size != nullptr && (size->width() <= 0 || size->height() <= 0)) { + *size = QSize(64, 64); + } + return IconUtils::createSvgImageWithCustomColor(pixmapName, pixmapColor, size, requestedSize); } } diff --git a/theme.qrc.in b/theme.qrc.in index e8d88fc8a..2405e4335 100644 --- a/theme.qrc.in +++ b/theme.qrc.in @@ -238,5 +238,7 @@ theme/delete.svg theme/send.svg theme/call-notification.wav + theme/more-apps.svg + theme/talk-app.svg diff --git a/theme/more-apps.svg b/theme/more-apps.svg new file mode 100644 index 000000000..6b1fd8773 --- /dev/null +++ b/theme/more-apps.svg @@ -0,0 +1,55 @@ + + diff --git a/theme/talk-app.svg b/theme/talk-app.svg new file mode 100644 index 000000000..40e01fe81 --- /dev/null +++ b/theme/talk-app.svg @@ -0,0 +1,40 @@ + + + + + +