Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/backport kde fix 313 #6800

Merged
merged 10 commits into from
Jul 19, 2024
6 changes: 4 additions & 2 deletions src/gui/iconutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion src/gui/tray/AutoSizingMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 16 additions & 2 deletions src/gui/tray/HeaderButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtGraphicalEffects 1.15

// Custom qml modules are in /theme (and included by resources.qrc)
import Style 1.0
Expand All @@ -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
Expand All @@ -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
}
}
}
}
4 changes: 2 additions & 2 deletions src/gui/tray/TrayFoldersMenuButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ HeaderButton {
width: imageWidth
height: imageHeight

anchors.verticalCenter: parent
anchors.verticalCenter: parent.verticalCenter
}


Expand All @@ -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
}
Expand Down
9 changes: 6 additions & 3 deletions src/gui/tray/UserLine.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down
25 changes: 4 additions & 21 deletions src/gui/tray/Window.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -639,9 +623,9 @@ ApplicationWindow {
HeaderButton {
id: trayWindowTalkButton

visible: UserModel.currentUser.serverHasTalk
icon.source: "qrc:///client/theme/white/talk-app.svg"
icon.color: Style.currentUserHeaderTextColor
visible: UserModel.currentUser && UserModel.currentUser.serverHasTalk
icon.source: "image://svgimage-custom-color/talk-app.svg" + "/" + Style.currentUserHeaderTextColor

onClicked: UserModel.openCurrentAccountTalk()

Accessible.role: Accessible.Button
Expand All @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions src/gui/tray/svgimageprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 2 additions & 0 deletions theme.qrc.in
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,7 @@
<file>theme/delete.svg</file>
<file>theme/send.svg</file>
<file>theme/call-notification.wav</file>
<file>theme/more-apps.svg</file>
<file>theme/talk-app.svg</file>
</qresource>
</RCC>
55 changes: 55 additions & 0 deletions theme/more-apps.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions theme/talk-app.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading