Add initial support for Apps menu icon display (show remote SVGs)
authorMichael Schuster <michael@schuster.ms>
Thu, 16 Jan 2020 17:43:48 +0000 (18:43 +0100)
committerMichael Schuster <michael@schuster.ms>
Thu, 16 Jan 2020 17:43:48 +0000 (18:43 +0100)
Caching and showing them from local data-URLs leaded to blurry rendering in Qt.

Signed-off-by: Michael Schuster <michael@schuster.ms>
src/gui/tray/UserModel.cpp
src/gui/tray/UserModel.h
src/gui/tray/Window.qml

index c0163876ce615200581f8ab0823c0a0c9fd71cca..7fee90aa783869086dc33f5744779e14136696f2 100644 (file)
@@ -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<int, QByteArray> UserAppsModel::roleNames() const
     QHash<int, QByteArray> roles;
     roles[NameRole] = "appName";
     roles[UrlRole] = "appUrl";
+    roles[IconUrlRole] = "appIconUrl";
     return roles;
 }
 
index 14b2b0c231ae46dda56aea4e2e46fd8fef80d0ae..db5807043713414328f84df3e95cbd5cb661a819 100644 (file)
@@ -159,7 +159,8 @@ public:
 
     enum UserAppsRoles {
         NameRole = Qt::UserRole + 1,
-        UrlRole
+        UrlRole,
+        IconUrlRole
     };
 
     void buildAppList();
index a13d0b385770b0daae0a6d4af4c9a90805448bee..9f4b8f5d3fd452b241ffd0909c6b036c826298f3 100644 (file)
@@ -414,7 +414,7 @@ Window {
                         Menu {\r
                             id: appsMenu\r
                             y: (trayWindowAppsButton.y + trayWindowAppsButton.height + 2)\r
-                            width: (trayWindowAppsButton.width * 2)\r
+                            width: (trayWindowAppsButton.width * 3)\r
                             closePolicy: "CloseOnPressOutside"\r
 \r
                             background: Rectangle {\r
@@ -430,6 +430,7 @@ Window {
                                 delegate: MenuItem {\r
                                     text: appName\r
                                     font.pixelSize: 12\r
+                                    icon.source: appIconUrl\r
                                     onTriggered: appsMenuModelBackend.openAppUrl(appUrl)\r
                                 }\r
                             }\r