Vidalia  0.3.1
BridgeDownloaderProgressDialog.h
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.h
13 ** \brief Displays the progress of a request for bridge addresses
14 */
15 
16 #ifndef _BRIDGEDOWNLOADERPROGRESSDIALOG_H
17 #define _BRIDGEDOWNLOADERPROGRESSDIALOG_H
18 
19 #include "ui_BridgeDownloaderProgressDialog.h"
20 
21 #include <QDialog>
22 
23 
24 class BridgeDownloaderProgressDialog : public QDialog
25 {
26  Q_OBJECT
27 
28 public:
29  /** Default constructor.
30  */
31  BridgeDownloaderProgressDialog(QWidget *parent = 0);
32 
33 public slots:
34  /** Sets the status message text in the dialog to <b>status</b>.
35  */
36  void setStatus(const QString &status);
37 
38  /** Updates the bridge download progress bar to <b>value</b> out of
39  * <b>maximum</b> steps. If <b>value</b> and <b>maximum</b> are both 0,
40  * then a "busy" progress bar is displayed.
41  */
42  void setDownloadProgress(qint64 value, qint64 maximum);
43 
44  /** Called when the bridge download completes successfully and discards
45  * the progress dialog with an Accept result code. <b>bridges</b>
46  * contains the list of bridges downloaded, but is currently ignored.
47  */
48  void bridgeRequestFinished(const QStringList &bridges);
49 
50  /** Called when the bridge download fails. The string <b>error</b>
51  * provides a human-readable description of the reason the download
52  * failed, which is displayed for the user.
53  */
54  void bridgeRequestFailed(const QString &error);
55 
56 signals:
57  /** Emitted when the user clicks the "Retry" button after a previous
58  * bridge request has failed.
59  */
60  void retry();
61 
62 protected:
63  /** Overloaded method called when the progress dialog is first shown in
64  * order to initialize the progress bar, status text and dialog button
65  * box.
66  */
67  virtual void setVisible(bool visible);
68 
69 private slots:
70  /** Called when <b>button</b> is clicked in the progress dialog's
71  * QDialogButtonBox. Dismisses the dialog and sets the result code to
72  * the QDialogButtonBox::StandardButton enum value indicated by
73  * <b>button</b>.
74  */
75  void buttonClicked(QAbstractButton *button);
76 
77 private:
78  /**< Qt Designer generated object. */
79  Ui::BridgeDownloaderProgressDialog ui;
80 };
81 
82 #endif
83