2020-09-23 19:57:54 -04:00
|
|
|
// Copyright Mirage authors & contributors <https://github.com/mirukana/mirage>
|
2019-12-19 07:46:16 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-07-13 05:39:01 -04:00
|
|
|
import QtQuick 2.12
|
2019-09-12 17:27:26 -04:00
|
|
|
import QtGraphicalEffects 1.12
|
2019-04-26 21:16:45 -04:00
|
|
|
|
2019-09-12 17:27:26 -04:00
|
|
|
Image {
|
|
|
|
id: icon
|
|
|
|
|
|
|
|
property string svgName: ""
|
2019-12-04 09:08:38 -04:00
|
|
|
|
|
|
|
property bool small: false
|
|
|
|
property int dimension:
|
|
|
|
theme ?
|
|
|
|
(small ? theme.icons.smallDimension : theme.icons.dimension) :
|
|
|
|
(small ? 16 : 22)
|
|
|
|
|
2019-09-12 17:27:26 -04:00
|
|
|
property color colorize: theme.icons.colorize
|
2019-11-18 03:57:13 -04:00
|
|
|
property string iconPack: theme ? theme.icons.preferredPack : "thin"
|
2019-09-12 17:27:26 -04:00
|
|
|
|
2020-07-12 00:25:57 -04:00
|
|
|
cache: true
|
|
|
|
asynchronous: true
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
visible: Boolean(svgName)
|
|
|
|
source: svgName ? `../../icons/${iconPack}/${svgName}.svg` : ""
|
|
|
|
|
|
|
|
sourceSize.width: svgName ? dimension : 0
|
|
|
|
sourceSize.height: svgName ? dimension : 0
|
|
|
|
|
2019-09-12 17:27:26 -04:00
|
|
|
layer.enabled: ! Qt.colorEqual(colorize, "transparent")
|
|
|
|
layer.effect: ColorOverlay {
|
|
|
|
color: icon.colorize
|
|
|
|
cached: icon.cache
|
2019-12-06 07:10:22 -04:00
|
|
|
|
|
|
|
Behavior on color { HColorAnimation {} }
|
2019-09-12 17:27:26 -04:00
|
|
|
}
|
2019-04-26 21:16:45 -04:00
|
|
|
}
|