2
* Copyright (C) 2011 by Marco MArtin <mart@kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Library General Public License as
6
* published by the Free Software Foundation; either version 2, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Library General Public License for more details
14
* You should have received a copy of the GNU Library General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27
org.kde.qtextracomponents
30
TODO i need more info here
34
Returns if the icon is valid or not.
37
Returns the dir,in which the icon exists.
41
import org.kde.plasma.core 0.1 as PlasmaCore
42
import org.kde.qtextracomponents 0.1
47
property bool valid: false
49
property variant source
53
if (typeof source != "string") {
54
imageLoader.sourceComponent = iconComponent
57
} else if (source == "") {
58
imageLoader.sourceComponent = null
63
svgIcon.imagePath = "toolbar-icons/"+root.source.split("-")[0]
64
if (!svgIcon.isValid() || !svgIcon.hasElement(root.source)) {
65
svgIcon.imagePath = "icons/"+root.source.split("-")[0]
68
if (svgIcon.isValid() && svgIcon.hasElement(root.source)) {
69
imageLoader.sourceComponent = svgComponent
70
} else if ((root.source.indexOf(".") == -1 && root.source.indexOf(":") == -1)) {
71
imageLoader.sourceComponent = iconComponent
73
imageLoader.sourceComponent = imageComponent
78
implicitWidth: theme.smallIconSize
79
implicitHeight: theme.smallIconSize
85
function roundToStandardSize(size)
87
if (size >= theme.enormousIconSize) {
88
return theme.enormousIconSize
89
} else if (size >= theme.hugeIconSize) {
90
return theme.hugeIconSize
91
} else if (size >= theme.largeIconSize) {
92
return theme.largeIconSize
93
} else if (size >= theme.mediumIconSize) {
94
return theme.mediumIconSize
95
} else if (size >= theme.smallMediumIconSize) {
96
return theme.smallMediumIconSize
98
return theme.smallIconSize
111
elementId: root.source
121
icon: (typeof source == "string") ? QIcon(root.source) : root.source
132
sourceSize.width: width
133
sourceSize.height: height
134
fillMode: Image.PreserveAspectFit