Vidalia 0.2.12

UploadProgressDialog.cpp

Go to the documentation of this file.
00001 /*
00002 **  This file is part of Vidalia, and is subject to the license terms in the
00003 **  LICENSE file, found in the top level directory of this distribution. If you
00004 **  did not receive the LICENSE file with this file, you may obtain it from the
00005 **  Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.vidalia-project.net/. No part of Vidalia, including this file,
00007 **  may be copied, modified, propagated, or distributed except according to the
00008 **  terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file UploadProgressDialog.cpp
00013 ** \brief Displays the progress of uploading a crash report to the server
00014 */
00015 
00016 #include "UploadProgressDialog.h"
00017 
00018 
00019 UploadProgressDialog::UploadProgressDialog(QWidget *parent)
00020   : QDialog(parent)
00021 {
00022   ui.setupUi(this);
00023  
00024   setModal(true);
00025 }
00026 
00027 void
00028 UploadProgressDialog::setVisible(bool visible)
00029 {
00030   if (visible) {
00031     ui.progressBar->setRange(0, 0);
00032     ui.buttonBox->setStandardButtons(QDialogButtonBox::Cancel);
00033   }
00034   QDialog::setVisible(visible);
00035 }
00036 
00037 void
00038 UploadProgressDialog::setStatus(const QString &status)
00039 {
00040   ui.lblStatus->setText(status);
00041 }
00042 
00043 void
00044 UploadProgressDialog::setUploadProgress(int done, int total)
00045 {
00046   ui.progressBar->setRange(0, total);
00047   ui.progressBar->setValue(done);
00048 }
00049 
00050 void
00051 UploadProgressDialog::uploadFailed(const QString &error)
00052 {
00053   ui.lblStatus->setText(tr("Unable to send report: %1").arg(error));
00054 
00055   ui.progressBar->setRange(0, 1);
00056   ui.progressBar->setValue(1);
00057 
00058   ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok);
00059 }
00060