Vidalia 0.3.1
BridgeDownloaderProgressDialog.cpp
Go to the documentation of this file.
1/*
2** This file is part of Vidalia, and is subject to the license terms in the
3** LICENSE file, found in the top level directory of this distribution. If you
4** did not receive the LICENSE file with this file, you may obtain it from the
5** Vidalia source package distributed by the Vidalia Project at
6** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7** including this file, may be copied, modified, propagated, or distributed
8** except according to the terms described in the LICENSE file.
9*/
10
11/*
12** \file BridgeDownloaderProgressDialog.cpp
13** \brief Displays the progress of a request for bridge addresses
14*/
15
17
18#include <QTimer>
19
20
22 : QDialog(parent)
23{
24 ui.setupUi(this);
25
26 connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)),
27 this, SLOT(buttonClicked(QAbstractButton *)));
28
29 setModal(true);
30}
31
32void
34{
35 if (visible) {
36 ui.progressBar->setRange(0, 0);
37 ui.buttonBox->setStandardButtons(QDialogButtonBox::Cancel);
38 }
39 QDialog::setVisible(visible);
40}
41
42void
44{
45 ui.lblStatus->setText(status);
46}
47
48void
50{
51 ui.progressBar->setRange(0, total);
52 ui.progressBar->setValue(done);
53}
54
55void
57{
58 Q_UNUSED(bridges);
59
60 accept();
61}
62
63void
65{
66 ui.lblStatus->setText(tr("Unable to download bridges: %1").arg(error));
67
68 ui.progressBar->setRange(0, 1);
69 ui.progressBar->setValue(1);
70
71 ui.buttonBox->setStandardButtons(QDialogButtonBox::Cancel
72 | QDialogButtonBox::Retry
73 | QDialogButtonBox::Help);
74}
75
76void
78{
79 int standardButton = ui.buttonBox->standardButton(button);
80 if (standardButton == QDialogButtonBox::Retry) {
81 setStatus(tr("Retrying bridge request..."));
83 ui.buttonBox->setStandardButtons(QDialogButtonBox::Cancel);
84
85 QTimer::singleShot(1000, this, SIGNAL(retry()));
86 } else {
87 done(standardButton);
88 }
89}
90
stop errmsg connect(const QHostAddress &address, quint16 port)
Ui::BridgeDownloaderProgressDialog ui
void buttonClicked(QAbstractButton *button)
void setDownloadProgress(qint64 value, qint64 maximum)
void bridgeRequestFinished(const QStringList &bridges)
DebugMessage error(const QString &fmt)
Definition: tcglobal.cpp:40