You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.6 KiB
87 lines
2.6 KiB
/* |
|
* Copyright 2014 Martin Klapetek <mklapetek@kde.org> |
|
* |
|
* This program is free software; you can redistribute it and/or |
|
* modify it under the terms of the GNU General Public License as |
|
* published by the Free Software Foundation; either version 2 of |
|
* the License, or (at your option) any later version. |
|
* |
|
* This program is distributed in the hope that it will be useful, |
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
* GNU General Public License for more details. |
|
* |
|
* You should have received a copy of the GNU General Public License |
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
*/ |
|
|
|
import QtQuick 2.0 |
|
import org.kde.plasma.core 2.0 as PlasmaCore |
|
import org.kde.plasma.components 3.0 as PlasmaComponents3 |
|
import org.kde.plasma.extras 2.0 as PlasmaExtra |
|
import QtQuick.Window 2.2 |
|
|
|
Item { |
|
property QtObject rootItem |
|
height: Math.min(units.gridUnit * 15, Screen.desktopAvailableHeight / 5) |
|
width: height |
|
|
|
// /--------------------\ |
|
// | spacing | |
|
// | /----------------\ | |
|
// | | | | |
|
// | | icon | | |
|
// | | | | |
|
// | | | | |
|
// | \----------------/ | |
|
// | spacing | |
|
// | [progressbar/text] | |
|
// | spacing | |
|
// \--------------------/ |
|
|
|
PlasmaCore.IconItem { |
|
id: icon |
|
|
|
height: parent.height - Math.max(progressBar.height, label.height) |
|
- ((units.smallSpacing/2) * 3) //it's an svg |
|
width: parent.width |
|
|
|
source: rootItem.icon |
|
} |
|
|
|
PlasmaComponents3.ProgressBar { |
|
id: progressBar |
|
|
|
anchors { |
|
bottom: parent.bottom |
|
left: parent.left |
|
right: parent.right |
|
margins: Math.floor(units.smallSpacing / 2) |
|
} |
|
|
|
visible: rootItem.showingProgress |
|
from: 0 |
|
to: 100 |
|
|
|
value: Number(rootItem.osdValue) |
|
} |
|
PlasmaExtra.Heading { |
|
id: label |
|
anchors { |
|
bottom: parent.bottom |
|
left: parent.left |
|
right: parent.right |
|
margins: Math.floor(units.smallSpacing / 2) |
|
} |
|
|
|
visible: !rootItem.showingProgress |
|
text: rootItem.showingProgress ? "" : (rootItem.osdValue ? rootItem.osdValue : "") |
|
horizontalAlignment: Text.AlignHCenter |
|
wrapMode: Text.WordWrap |
|
maximumLineCount: 2 |
|
elide: Text.ElideLeft |
|
minimumPointSize: theme.defaultFont.pointSize |
|
fontSizeMode: Text.HorizontalFit |
|
textFormat: Text.PlainText |
|
} |
|
}
|
|
|