diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2009-10-02 01:02:06 -0400 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2009-10-02 01:02:46 -0400 |
commit | 9805164f8879564e2db847c8b08377a7ace042b9 (patch) | |
tree | 0ae566e94c3490834932c8186126f1123db98239 /encodemp4jobgui.cpp | |
parent | Sizing fixes. (diff) | |
download | AnyRip-9805164f8879564e2db847c8b08377a7ace042b9.tar.xz AnyRip-9805164f8879564e2db847c8b08377a7ace042b9.zip |
Better termination conditions. StatusLabel.
Diffstat (limited to 'encodemp4jobgui.cpp')
-rw-r--r-- | encodemp4jobgui.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/encodemp4jobgui.cpp b/encodemp4jobgui.cpp index a9b1f14..680bbba 100644 --- a/encodemp4jobgui.cpp +++ b/encodemp4jobgui.cpp @@ -1,16 +1,23 @@ #include "encodemp4jobgui.h" #include "encodemp4job.h" #include <QVBoxLayout> +#include <QHBoxLayout> #include <QLabel> #include <QProgressBar> +#include <QPushButton> +#include <QStyle> EncodeMP4JobGui::EncodeMP4JobGui(EncodeMP4Job *job) { m_progressBar = new QProgressBar; - m_progressBar->setMaximum(10000); m_progressLabel = new QLabel; + QPushButton *cancel = new QPushButton(style()->standardIcon(QStyle::SP_DialogCancelButton), QString()); + connect(cancel, SIGNAL(clicked()), job, SLOT(terminate())); QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(m_progressBar); + QHBoxLayout *progressCancel = new QHBoxLayout; + progressCancel->addWidget(m_progressBar); + progressCancel->addWidget(cancel); + layout->addLayout(progressCancel); layout->addWidget(m_progressLabel); setLayout(layout); setTitle(tr("Encoding MP4 of %1").arg(job->video()->title())); @@ -19,7 +26,8 @@ EncodeMP4JobGui::EncodeMP4JobGui(EncodeMP4Job *job) } void EncodeMP4JobGui::encodeProgress(int currentTask, int totalTasks, float percent, float currentFps, float avgFps, QTime timeRemaining) { - m_progressBar->setValue((int)(percent * 100)); + m_progressBar->setValue((int)(percent * 100) + (currentTask - 1) * 10000); + m_progressBar->setMaximum(10000 * totalTasks); if (!timeRemaining.isNull() && avgFps != -1 && currentFps != -1) m_progressLabel->setText(tr("task %1 of %2, %4 fps (avg %5 fps), %3 remaining") .arg(QString::number(currentTask)) |