1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of libmeegotouch.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "progressbarpage.h"
#include <MButton>
#include <MLabel>
#include <MTheme>
#include <MLocale>
#include <MLinearLayoutPolicy>
#include <MGridLayoutPolicy>
#include <MProgressIndicator>
#include <MSceneManager>
#include <QPropertyAnimation>
ProgressBarPage::ProgressBarPage() :
TemplatePage(TemplatePage::SimpleWidgets),
bar1(0),
bar2(0),
label1(0),
label2(0),
position(0)
{
}
ProgressBarPage::~ProgressBarPage()
{
}
QString ProgressBarPage::timedemoTitle()
{
return "ProgressBar";
}
void ProgressBarPage::createContent()
{
TemplatePage::createContent();
label1 = new MLabel();
containerPolicy->addItem(label1);
bar1 = new MProgressIndicator(0, MProgressIndicator::barType);
// Since range's type is int, we want a fairly large number here, to get a smooth animation
bar1->setRange(0, 1000);
bar1->setValue(0);
containerPolicy->addItem(bar1);
label2 = new MLabel();
containerPolicy->addItem(label2);
bar2 = new MProgressIndicator(0, MProgressIndicator::barType);
bar2->setRange(0, 9);
bar2->setUnknownDuration(true);
containerPolicy->addItem(bar2);
QPropertyAnimation* animation = new QPropertyAnimation(bar1, "value", this);
// loop forever
animation->setLoopCount(-1);
// start and end value should match bar1's range
animation->setStartValue(0);
animation->setEndValue(1000);
// 10 seconds to fill the bar
animation->setDuration(10000);
animation->start();
retranslateUi();
}
void ProgressBarPage::retranslateUi()
{
//% "Progress Bar"
setTitle(qtTrId("xx_progressbar_page_title"));
if (!isContentCreated())
return;
//% "A Progress Bar can indicate an ongoing process "
//% "with either known or unknown durations."
infoLabel->setText("<a></a>" + qtTrId("xx_progressbar_page_info_label"));
//% "Downloading nicepic.jpg"
label1->setText(qtTrId("xx_progressindicator_known_duration_bar"));
//% "Installing CoolApp"
label2->setText(qtTrId("xx_progressindicator_unknown_duration_bar"));
}
|