~michael-sheldon/webbrowser-app/fix-1531179

« back to all changes in this revision

Viewing changes to src/app/webbrowser/IndeterminateProgressBar.qml

  • Committer: CI Train Bot
  • Author(s): Michael Sheldon
  • Date: 2015-12-21 20:39:33 UTC
  • mfrom: (1106.3.119 implement-download-folder)
  • Revision ID: ci-train-bot@canonical.com-20151221203933-o2ijlcmhhyoi62wk
Add support for handling downloads internally within the browser. Fixes: #1354391
Approved by: Olivier Tilloy

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2015 Canonical Ltd.
 
3
 *
 
4
 * This file is part of webbrowser-app.
 
5
 *
 
6
 * webbrowser-app is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; version 3.
 
9
 *
 
10
 * webbrowser-app is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
import QtQuick 2.4
 
20
import Ubuntu.Components 1.3
 
21
 
 
22
Rectangle {   
 
23
    id: progressBar
 
24
 
 
25
    property real progress
 
26
    property bool indeterminateProgress: false
 
27
 
 
28
    radius: width/3
 
29
    color: Theme.palette.normal.base
 
30
 
 
31
    Rectangle {
 
32
        id: currentProgress
 
33
        height: parent.height
 
34
        radius: parent.radius
 
35
        anchors.left: parent.left
 
36
        anchors.leftMargin: 0
 
37
        anchors.top: parent.top
 
38
        color: UbuntuColors.orange
 
39
        width: indeterminateProgress ? parent.width / 6 : (progress / 100) * parent.width
 
40
 
 
41
        SequentialAnimation {
 
42
            running: indeterminateProgress
 
43
            onRunningChanged: {
 
44
                currentProgress.anchors.leftMargin = 0;
 
45
            }
 
46
            loops: Animation.Infinite
 
47
            PropertyAnimation { target: currentProgress.anchors; property: "leftMargin"; from: 0.0; to: parent.width  - parent.width / 6; duration: UbuntuAnimation.SleepyDuration; easing.type:  Easing.InOutQuad; }
 
48
            PropertyAnimation { target: currentProgress.anchors; property: "leftMargin"; from: parent.width  - parent.width / 6; to: 0; duration: UbuntuAnimation.SleepyDuration; easing.type: Easing.InOutQuad; }
 
49
        }
 
50
    }
 
51
}