-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from ccatterina/album-cover-as-toolbar-icon
Album cover as toolbar icon
- Loading branch information
Showing
4 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import QtQuick 2.15 | ||
import QtQuick.Layouts 1.15 | ||
import org.kde.plasma.components 3.0 as PlasmaComponents3 | ||
import org.kde.plasma.core 2.0 as PlasmaCore | ||
|
||
Item { | ||
id: root | ||
property string type: "icon" | ||
property var imageUrl: null | ||
property var icon: null | ||
property real size: PlasmaCore.Units.iconSizes.medium | ||
|
||
Layout.preferredHeight: size | ||
Layout.preferredWidth: size | ||
|
||
onTypeChanged: () => { | ||
if ([ "icon", "image" ].includes(type)) { | ||
console.error("Panel icon type not supported") | ||
} | ||
if (type === "icon" && !icon) { | ||
console.error("Panel icon type is icon but no icon is set") | ||
} | ||
if (type === "image" && !imageUrl) { | ||
console.error("Panel icon type is image but no image url is set") | ||
} | ||
} | ||
|
||
PlasmaCore.IconItem { | ||
visible: type === "icon" | ||
id: iconComponent | ||
source: root.icon | ||
implicitHeight: root.size | ||
implicitWidth: root.size | ||
} | ||
|
||
Image { | ||
visible: type === "image" | ||
width: root.size | ||
height: root.size | ||
id: imageComponent | ||
source: root.imageUrl | ||
fillMode: Image.PreserveAspectFit | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters