Advertisement
Guest User

OsdItem.qml

a guest
Jan 8th, 2017
678
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 2.63 KB | None | 0 0
  1. /*
  2.  * Copyright 2014 Martin Klapetek <mklapetek@kde.org>
  3.  *
  4.  * This program is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU General Public License as
  6.  * published by the Free Software Foundation; either version 2 of
  7.  * the License, or (at your option) any later version.
  8.  *
  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 General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16.  */
  17.  
  18. import QtQuick 2.0
  19. import org.kde.plasma.core 2.0 as PlasmaCore
  20. import org.kde.plasma.components 2.0 as PlasmaComponents
  21. import org.kde.plasma.extras 2.0 as PlasmaExtra
  22. import QtQuick.Window 2.2
  23.  
  24. Item {
  25.     property QtObject rootItem
  26.     height: progressBar.height
  27.     width: Math.min(units.gridUnit * 15, Screen.desktopAvailableHeight / 5)
  28. //     width: height
  29.  
  30.     //  /--------------------\
  31.     //  |      spacing       |
  32.     //  | /----------------\ |
  33.     //  | |                | |
  34.     //  | |      icon      | |
  35.     //  | |                | |
  36.     //  | |                | |
  37.     //  | \----------------/ |
  38.     //  |      spacing       |
  39.     //  | [progressbar/text] |
  40.     //  |      spacing       |
  41.     //  \--------------------/
  42.  
  43. //     PlasmaCore.IconItem {
  44. //         id: icon
  45. //
  46. //         height: parent.height - progressBar.height - ((units.smallSpacing/2) * 3) //it's an svg
  47. //         width: parent.width
  48. //
  49. //         source: rootItem.icon
  50. //     }
  51.  
  52.     PlasmaComponents.ProgressBar {
  53.         id: progressBar
  54.  
  55.         anchors {
  56.             bottom: parent.bottom
  57.             left: parent.left
  58.             right: parent.right
  59.             margins: Math.floor(units.smallSpacing / 2)
  60.         }
  61.  
  62.         visible: rootItem.showingProgress
  63.         minimumValue: 0
  64.         maximumValue: 100
  65.  
  66.         value: Number(rootItem.osdValue)
  67.     }
  68.     PlasmaExtra.Heading {
  69.         anchors {
  70.             bottom: parent.bottom
  71.             left: parent.left
  72.             right: parent.right
  73.             margins: Math.floor(units.smallSpacing / 2)
  74.         }
  75.  
  76.         visible: !rootItem.showingProgress
  77.         text: rootItem.showingProgress ? "" : (rootItem.osdValue ? rootItem.osdValue : "")
  78.         horizontalAlignment: Text.AlignHCenter
  79.         wrapMode: Text.NoWrap
  80.         elide: Text.ElideLeft
  81.         minimumPointSize: theme.defaultFont.pointSize
  82.         fontSizeMode: Text.HorizontalFit
  83.     }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement