| 1 |
/* |
| 2 |
* Copyright 2012 Canonical Ltd. |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU Lesser General Public License as published by |
| 6 |
* the Free Software Foundation; version 3. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
import QtQuick 2.4 |
| 18 |
|
| 19 |
/*! |
| 20 |
\qmltype ActivityIndicator |
| 21 |
\inqmlmodule Lomiri.Components |
| 22 |
\ingroup lomiri |
| 23 |
\brief The ActivityIndicator component visually indicates that a task of |
| 24 |
unknown duration is in progress, e.g. busy indication, connection in progress |
| 25 |
indication, etc. |
| 26 |
|
| 27 |
Note: for time consuming JavaScript operations use WorkerScript, otherwise no |
| 28 |
UI interaction will be possible and the ActicityIndicator animation will freeze. |
| 29 |
|
| 30 |
Example: |
| 31 |
\qml |
| 32 |
Item { |
| 33 |
ActivityIndicator { |
| 34 |
id: activity |
| 35 |
} |
| 36 |
|
| 37 |
Button { |
| 38 |
id: toggleActive |
| 39 |
text: (activity.running) ? "Deactivate" : "Activate" |
| 40 |
onClicked: activity.running = !activity.running |
| 41 |
} |
| 42 |
} |
| 43 |
\endqml |
| 44 |
*/ |
| 45 |
AnimatedItem { |
| 46 |
id: indicator |
| 47 |
|
| 48 |
/*! |
| 49 |
Presents whether there is activity to be visualized or not. The default value is false. |
| 50 |
When activated (set to true), an animation is shown indicating an ongoing activity, which |
| 51 |
continues until deactivated (set to false). |
| 52 |
*/ |
| 53 |
property bool running: false |
| 54 |
|
| 55 |
implicitWidth: units.gu(3) |
| 56 |
implicitHeight: units.gu(3) |
| 57 |
width: units.gu(3) |
| 58 |
height: units.gu(3) |
| 59 |
|
| 60 |
style: Theme.createStyleComponent("ActivityIndicatorStyle.qml", indicator) |
| 61 |
} |