connect(m_view.buttonEdit, SIGNAL(clicked()), this, SLOT(slotEditProfile()));
connect(m_view.buttonDelete, SIGNAL(clicked()), this, SLOT(slotDeleteProfile()));
connect(m_view.abort_job, SIGNAL(clicked()), this, SLOT(slotAbortCurrentJob()));
+ connect(m_view.start_job, SIGNAL(clicked()), this, SLOT(slotStartCurrentJob()));
connect(m_view.clean_up, SIGNAL(clicked()), this, SLOT(slotCLeanUpJobs()));
connect(m_view.hide_log, SIGNAL(clicked()), this, SLOT(slotHideLog()));
if (item->data(1, Qt::UserRole + 2).toInt() == WAITINGJOB) {
item->setData(1, Qt::UserRole + 1, QTime::currentTime());
waitingJob = true;
- if (item->data(1, Qt::UserRole + 4).isNull()) {
- // Normal render process
- if (QProcess::startDetached(m_renderer, item->data(1, Qt::UserRole + 3).toStringList()) == false) {
- item->setData(1, Qt::UserRole + 2, FINISHEDJOB);
- item->setData(1, Qt::UserRole, i18n("Rendering crashed"));
- item->setIcon(0, KIcon("dialog-close"));
- item->setData(2, Qt::UserRole, 100);
- } else KNotification::event("RenderStarted", i18n("Rendering <i>%1</i> started", item->text(1)), QPixmap(), this);
- } else {
- // Script item
- if (QProcess::startDetached(item->data(1, Qt::UserRole + 3).toString()) == false) {
- item->setData(1, Qt::UserRole + 2, FINISHEDJOB);
- item->setData(1, Qt::UserRole, i18n("Rendering crashed"));
- item->setIcon(0, KIcon("dialog-close"));
- item->setData(2, Qt::UserRole, 100);
- }
- }
+ startRendering(item);
break;
}
item = m_view.running_jobs->itemBelow(item);
if (waitingJob == false && m_view.shutdown->isChecked()) emit shutdown();
}
+void RenderWidget::startRendering(QTreeWidgetItem *item)
+{
+ if (item->data(1, Qt::UserRole + 4).isNull()) {
+ // Normal render process
+ if (QProcess::startDetached(m_renderer, item->data(1, Qt::UserRole + 3).toStringList()) == false) {
+ item->setData(1, Qt::UserRole + 2, FINISHEDJOB);
+ item->setData(1, Qt::UserRole, i18n("Rendering crashed"));
+ item->setIcon(0, KIcon("dialog-close"));
+ item->setData(2, Qt::UserRole, 100);
+ } else KNotification::event("RenderStarted", i18n("Rendering <i>%1</i> started", item->text(1)), QPixmap(), this);
+ } else {
+ // Script item
+ if (QProcess::startDetached(item->data(1, Qt::UserRole + 3).toString()) == false) {
+ item->setData(1, Qt::UserRole + 2, FINISHEDJOB);
+ item->setData(1, Qt::UserRole, i18n("Rendering crashed"));
+ item->setIcon(0, KIcon("dialog-close"));
+ item->setData(2, Qt::UserRole, 100);
+ }
+ }
+}
+
int RenderWidget::waitingJobsCount() const
{
int count = 0;
bool replaceVorbisCodec = false;
if (!acodecsList.contains("vorbis") && acodecsList.contains("libvorbis")) replaceVorbisCodec = true;
bool replaceLibfaacCodec = false;
- if (!acodecsList.contains("libfaac") && acodecsList.contains("aac")) replaceLibfaacCodec = true;
+ if (!acodecsList.contains("aac") && acodecsList.contains("libfaac")) replaceLibfaacCodec = true;
if (editable || groups.count() == 0) {
// replace vorbis with libvorbis
params = params.replace("vorbis", "libvorbis");
}
- if (replaceLibfaacCodec && params.contains("acodec=libfaac")) {
+ if (replaceLibfaacCodec && params.contains("acodec=aac")) {
// replace libfaac with aac
- params = params.replace("libfaac", "aac");
+ params = params.replace("aac", "libfaac");
}
QString category = profile.attribute("category", i18n("Custom"));
// replace vorbis with libvorbis
params = params.replace("vorbis", "libvorbis");
}
- if (replaceLibfaacCodec && params.contains("acodec=libfaac")) {
+ if (replaceLibfaacCodec && params.contains("acodec=aac")) {
// replace libfaac with aac
- params = params.replace("libfaac", "aac");
+ params = params.replace("aac", "libfaac");
}
prof_extension = profileElement.attribute("extension");
}
}
+void RenderWidget::slotStartCurrentJob()
+{
+ QTreeWidgetItem *current = m_view.running_jobs->currentItem();
+ if (current && current->data(1, Qt::UserRole + 2).toInt() == WAITINGJOB)
+ startRendering(current);
+ m_view.start_job->setEnabled(false);
+}
+
void RenderWidget::slotCheckJob()
{
bool activate = false;
QTreeWidgetItem *current = m_view.running_jobs->currentItem();
if (current) {
- if (current->data(1, Qt::UserRole + 2).toInt() == RUNNINGJOB)
+ if (current->data(1, Qt::UserRole + 2).toInt() == RUNNINGJOB) {
m_view.abort_job->setText(i18n("Abort Job"));
- else m_view.abort_job->setText(i18n("Remove Job"));
+ m_view.start_job->setEnabled(false);
+ } else {
+ m_view.abort_job->setText(i18n("Remove Job"));
+ m_view.start_job->setEnabled(current->data(1, Qt::UserRole + 2).toInt() == WAITINGJOB);
+ }
activate = true;
}
m_view.abort_job->setEnabled(activate);