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 ** \version $Id$ 00014 ** \brief Displays the progress of uploading a crash report to the server 00015 */ 00016 00017 #include "UploadProgressDialog.h" 00018 00019 00020 UploadProgressDialog::UploadProgressDialog(QWidget *parent) 00021 : QDialog(parent) 00022 { 00023 ui.setupUi(this); 00024 00025 setModal(true); 00026 } 00027 00028 void 00029 UploadProgressDialog::setVisible(bool visible) 00030 { 00031 if (visible) { 00032 ui.progressBar->setRange(0, 0); 00033 ui.buttonBox->setStandardButtons(QDialogButtonBox::Cancel); 00034 } 00035 QDialog::setVisible(visible); 00036 } 00037 00038 void 00039 UploadProgressDialog::setStatus(const QString &status) 00040 { 00041 ui.lblStatus->setText(status); 00042 } 00043 00044 void 00045 UploadProgressDialog::setUploadProgress(int done, int total) 00046 { 00047 ui.progressBar->setRange(0, total); 00048 ui.progressBar->setValue(done); 00049 } 00050 00051 void 00052 UploadProgressDialog::uploadFailed(const QString &error) 00053 { 00054 ui.lblStatus->setText(tr("Unable to send report: %1").arg(error)); 00055 00056 ui.progressBar->setRange(0, 1); 00057 ui.progressBar->setValue(1); 00058 00059 ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok); 00060 } 00061