ProgressDialog::ProgressDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ProgressDialog) { MultiMCPlatform::fixWM_CLASS(this); ui->setupUi(this); updateSize(); changeProgress(0, 100); }
TaskDialog::TaskDialog(QWidget *parent) : QDialog(parent), ui(new Ui::TaskDialog) { ui->setupUi(this); updateSize(); changeProgress(0); }
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); connect(ui->push, SIGNAL(clicked()), &timer, SLOT(start())); connect(&timer, SIGNAL(timeout()), this, SLOT(changeProgress())); }
void Widget::changeProgress() { ui->progressBar->setValue(ui->progressBar->value() + 1); if (ui->progressBar->value() == 100) { timer.stop(); disconnect(&timer, SIGNAL(timeout()), this, SLOT(changeProgress())); disconnect(ui->push, SIGNAL(clicked()), &timer, SLOT(start())); ui->push->setText("Quit"); connect(ui->push, SIGNAL(clicked()), this, SLOT(onQuitClicked())); } }
int ProgressDialog::exec(ProgressProvider *task) { this->task = task; // Connect signals. connect(task, SIGNAL(started()), SLOT(onTaskStarted())); connect(task, SIGNAL(failed(QString)), SLOT(onTaskFailed(QString))); connect(task, SIGNAL(succeeded()), SLOT(onTaskSucceeded())); connect(task, SIGNAL(status(QString)), SLOT(changeStatus(const QString &))); connect(task, SIGNAL(progress(qint64, qint64)), SLOT(changeProgress(qint64, qint64))); // this makes sure that the task is started after the dialog is created QMetaObject::invokeMethod(task, "start", Qt::QueuedConnection); return QDialog::exec(); }
void video::download() { _step = 3; handler->clearDownloads(); connect(handler, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(changeProgress(qint64, qint64))); if (!this->_supportedQualities.at(_quality).videoUrl.isEmpty()) { qDebug() << "Downloading video file: " << this->_supportedQualities.at(_quality).videoUrl; handler->addDownload(this->_supportedQualities.at(_quality).videoUrl, this->_supportedQualities.at(_quality).chunkedDownload); } if (!this->_supportedQualities.at(_quality).audioUrl.isEmpty()) { qDebug() << "Downloading audio file: " << this->_supportedQualities.at(_quality).audioUrl; handler->addDownload(this->_supportedQualities.at(_quality).audioUrl, this->_supportedQualities.at(_quality).chunkedDownload); } }