Advertisement
Guest User

Osd.qml

a guest
Jan 8th, 2017
664
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 1.96 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 QtQuick.Window 2.2
  20. import org.kde.plasma.core 2.0 as PlasmaCore
  21. import org.kde.plasma.components 2.0 as PlasmaComponents
  22. import org.kde.plasma.extras 2.0 as PlasmaExtra
  23.  
  24. PlasmaCore.Dialog {
  25.     id: root
  26.     location: PlasmaCore.Types.Floating
  27.     type: PlasmaCore.Dialog.OnScreenDisplay
  28.     outputOnly: true
  29.  
  30.     // OSD Timeout in msecs - how long it will stay on the screen
  31.     property int timeout: 800
  32.     // This is either a text or a number, if showingProgress is set to true,
  33.     // the number will be used as a value for the progress bar
  34.     property var osdValue
  35.     // Icon name to display
  36.     property string icon
  37.     // Set to true if the value is meant for progress bar,
  38.     // false for displaying the value as normal text
  39.     property bool showingProgress: false
  40.  
  41.     property bool animateOpacity: false
  42.  
  43.     Behavior on opacity {
  44.         SequentialAnimation {
  45.             // prevent press and hold from flickering
  46.             PauseAnimation { duration: 100 }
  47.             NumberAnimation {
  48.                 duration: root.timeout
  49.                 easing.type: Easing.InQuad
  50.             }
  51.         }
  52.         enabled: root.animateOpacity
  53.     }
  54.  
  55.     mainItem: OsdItem {
  56.         rootItem: root
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement