From 724d6eb0116e201271dc779a115b219ff95bbdf9 Mon Sep 17 00:00:00 2001 From: Dalton Durst Date: Sun, 26 Apr 2020 13:12:29 -0500 Subject: [PATCH] Add custom bfb icon in /custom/graphics With this commit, a custom SVG file will be loaded from /custom/graphics/homebutton.svg and used rather than the default icon. This allows distributors to have their own logo or another symbol as the bfb icon. This repurposes the WallpaperResolver, so I've renamed it to ImageResolver to better suit its new job. --- ...{WallpaperResolver.qml => ImageResolver.qml} | 0 qml/Launcher/LauncherPanel.qml | 17 ++++++++++++++--- qml/Shell.qml | 2 +- tests/qmltests/CMakeLists.txt | 2 +- ...lpaperResolver.qml => tst_ImageResolver.qml} | 12 ++++++------ 5 files changed, 22 insertions(+), 11 deletions(-) rename qml/Components/{WallpaperResolver.qml => ImageResolver.qml} (100%) rename tests/qmltests/Components/{tst_WallpaperResolver.qml => tst_ImageResolver.qml} (89%) diff --git a/qml/Components/WallpaperResolver.qml b/qml/Components/ImageResolver.qml similarity index 100% rename from qml/Components/WallpaperResolver.qml rename to qml/Components/ImageResolver.qml diff --git a/qml/Launcher/LauncherPanel.qml b/qml/Launcher/LauncherPanel.qml index 695d177be4..66391c77c0 100644 --- a/qml/Launcher/LauncherPanel.qml +++ b/qml/Launcher/LauncherPanel.qml @@ -90,16 +90,27 @@ Rectangle { color: UbuntuColors.orange readonly property bool highlighted: root.highlightIndex == -1; - Icon { + Image { objectName: "dashItem" width: parent.width * .6 height: width anchors.centerIn: parent - source: "graphics/home.svg" - color: "white" + source: homeIconResolver.background rotation: root.rotation } + ImageResolver { + id: homeIconResolver + objectName: "homeIconResolver" + + readonly property url defaultHomeIcon: "graphics/home.svg" + + candidates: [ + "file:///custom/graphics/homebutton.svg", + defaultHomeIcon + ] + } + AbstractButton { id: dashItem anchors.fill: parent diff --git a/qml/Shell.qml b/qml/Shell.qml index ebc7cf0205..4d592220c4 100644 --- a/qml/Shell.qml +++ b/qml/Shell.qml @@ -160,7 +160,7 @@ StyledItem { property real edgeSize: units.gu(settings.edgeDragWidth) - WallpaperResolver { + ImageResolver { id: wallpaperResolver objectName: "wallpaperResolver" diff --git a/tests/qmltests/CMakeLists.txt b/tests/qmltests/CMakeLists.txt index 61b82cb4d3..2059a8470e 100644 --- a/tests/qmltests/CMakeLists.txt +++ b/tests/qmltests/CMakeLists.txt @@ -23,7 +23,7 @@ add_unity8_qmltest(Components Rating) add_unity8_qmltest(Components SharingPicker) add_unity8_qmltest(Components Showable) add_unity8_qmltest(Components VirtualTouchPad) -add_unity8_qmltest(Components WallpaperResolver) +add_unity8_qmltest(Components ImageResolver) add_unity8_qmltest(Components ZoomableImage) add_unity8_qmltest(Greeter Clock) add_unity8_qmltest(Greeter Greeter) diff --git a/tests/qmltests/Components/tst_WallpaperResolver.qml b/tests/qmltests/Components/tst_ImageResolver.qml similarity index 89% rename from tests/qmltests/Components/tst_WallpaperResolver.qml rename to tests/qmltests/Components/tst_ImageResolver.qml index fcedd3aee5..005304d235 100644 --- a/tests/qmltests/Components/tst_WallpaperResolver.qml +++ b/tests/qmltests/Components/tst_ImageResolver.qml @@ -26,15 +26,15 @@ Image { width: units.gu(70) height: units.gu(70) - source: wallpaperResolver.background + source: imageResolver.background - WallpaperResolver { - id: wallpaperResolver + ImageResolver { + id: imageResolver } UnityTestCase { id: testCase - name: "WallpaperResolver" + name: "ImageResolver" when: windowShown function test_background_data() { @@ -68,8 +68,8 @@ Image { } function test_background(data) { - wallpaperResolver.candidates = data.list; - tryCompare(wallpaperResolver, "background", data.output); + imageResolver.candidates = data.list; + tryCompare(imageResolver, "background", data.output); } } }