From: Michael Schuster Date: Thu, 16 Jan 2020 17:43:48 +0000 (+0100) Subject: Add initial support for Apps menu icon display (show remote SVGs) X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~413^2~14 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9abc1eb92170888a260bf899b52c267b5faa5153;p=nextcloud-desktop.git Add initial support for Apps menu icon display (show remote SVGs) Caching and showing them from local data-URLs leaded to blurry rendering in Qt. Signed-off-by: Michael Schuster --- diff --git a/src/gui/tray/UserModel.cpp b/src/gui/tray/UserModel.cpp index c0163876c..7fee90aa7 100644 --- a/src/gui/tray/UserModel.cpp +++ b/src/gui/tray/UserModel.cpp @@ -840,6 +840,8 @@ QVariant UserAppsModel::data(const QModelIndex &index, int role) const return _apps[index.row()]->name(); } else if (role == UrlRole) { return _apps[index.row()]->url(); + } else if (role == IconUrlRole) { + return _apps[index.row()]->iconUrl().toString(); } return QVariant(); } @@ -849,6 +851,7 @@ QHash UserAppsModel::roleNames() const QHash roles; roles[NameRole] = "appName"; roles[UrlRole] = "appUrl"; + roles[IconUrlRole] = "appIconUrl"; return roles; } diff --git a/src/gui/tray/UserModel.h b/src/gui/tray/UserModel.h index 14b2b0c23..db5807043 100644 --- a/src/gui/tray/UserModel.h +++ b/src/gui/tray/UserModel.h @@ -159,7 +159,8 @@ public: enum UserAppsRoles { NameRole = Qt::UserRole + 1, - UrlRole + UrlRole, + IconUrlRole }; void buildAppList(); diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index a13d0b385..9f4b8f5d3 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -414,7 +414,7 @@ Window { Menu { id: appsMenu y: (trayWindowAppsButton.y + trayWindowAppsButton.height + 2) - width: (trayWindowAppsButton.width * 2) + width: (trayWindowAppsButton.width * 3) closePolicy: "CloseOnPressOutside" background: Rectangle { @@ -430,6 +430,7 @@ Window { delegate: MenuItem { text: appName font.pixelSize: 12 + icon.source: appIconUrl onTriggered: appsMenuModelBackend.openAppUrl(appUrl) } }