X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Frenderwidget.cpp;h=16228dbacae73417a6b57f86f06d6d1952e6935d;hb=e17f9f3cafb3f9cd62a069d578797ad89b13ee4e;hp=c521e39fc7d5ec22543fea6d741ee13af8654902;hpb=e9388f39f0d977f0a89ed8c8971502c5f9d5065b;p=kdenlive diff --git a/src/renderwidget.cpp b/src/renderwidget.cpp index c521e39f..16228dba 100644 --- a/src/renderwidget.cpp +++ b/src/renderwidget.cpp @@ -134,7 +134,7 @@ const QString RenderJobItem::metadata() const } -RenderWidget::RenderWidget(const QString &projectfolder, bool enableProxy, MltVideoProfile profile, QWidget * parent) : +RenderWidget::RenderWidget(const QString &projectfolder, bool enableProxy, const MltVideoProfile &profile, QWidget * parent) : QDialog(parent), m_projectFolder(projectfolder), m_profile(profile), @@ -236,7 +236,7 @@ RenderWidget::RenderWidget(const QString &projectfolder, bool enableProxy, MltVi connect(m_view.delete_script, SIGNAL(clicked()), this, SLOT(slotDeleteScript())); connect(m_view.scripts_list, SIGNAL(itemSelectionChanged()), this, SLOT(slotCheckScript())); connect(m_view.running_jobs, SIGNAL(itemSelectionChanged()), this, SLOT(slotCheckJob())); - connect(m_view.running_jobs, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(slotPlayRendering(QTreeWidgetItem *, int))); + connect(m_view.running_jobs, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(slotPlayRendering(QTreeWidgetItem*,int))); connect(m_view.buttonInfo, SIGNAL(clicked()), this, SLOT(showInfoPanel())); @@ -255,13 +255,13 @@ RenderWidget::RenderWidget(const QString &projectfolder, bool enableProxy, MltVi connect(m_view.buttonClose3, SIGNAL(clicked()), this, SLOT(hide())); connect(m_view.rescale, SIGNAL(toggled(bool)), this, SLOT(setRescaleEnabled(bool))); connect(m_view.destination_list, SIGNAL(activated(int)), this, SLOT(refreshCategory())); - connect(m_view.out_file, SIGNAL(textChanged(const QString &)), this, SLOT(slotUpdateButtons())); - connect(m_view.out_file, SIGNAL(urlSelected(const KUrl &)), this, SLOT(slotUpdateButtons(const KUrl &))); + connect(m_view.out_file, SIGNAL(textChanged(QString)), this, SLOT(slotUpdateButtons())); + connect(m_view.out_file, SIGNAL(urlSelected(KUrl)), this, SLOT(slotUpdateButtons(KUrl))); connect(m_view.format_list, SIGNAL(currentRowChanged(int)), this, SLOT(refreshView())); connect(m_view.size_list, SIGNAL(currentRowChanged(int)), this, SLOT(refreshParams())); connect(m_view.show_all_profiles, SIGNAL(stateChanged(int)), this, SLOT(refreshView())); - connect(m_view.size_list, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(slotEditItem(QListWidgetItem *))); + connect(m_view.size_list, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(slotEditItem(QListWidgetItem*))); connect(m_view.render_guide, SIGNAL(clicked(bool)), this, SLOT(slotUpdateGuideBox())); connect(m_view.render_zone, SIGNAL(clicked(bool)), this, SLOT(slotUpdateGuideBox())); @@ -382,7 +382,7 @@ void RenderWidget::setGuides(QDomElement guidesxml, double duration) m_view.guide_start->clear(); m_view.guide_end->clear(); QDomNodeList nodes = guidesxml.elementsByTagName("guide"); - if (nodes.count() > 0) { + if (!nodes.isEmpty()) { m_view.guide_start->addItem(i18n("Beginning"), "0"); m_view.render_guide->setEnabled(true); m_view.create_chapter->setEnabled(true); @@ -391,7 +391,7 @@ void RenderWidget::setGuides(QDomElement guidesxml, double duration) m_view.create_chapter->setEnabled(false); } double fps = (double) m_profile.frame_rate_num / m_profile.frame_rate_den; - for (int i = 0; i < nodes.count(); i++) { + for (int i = 0; i < nodes.count(); ++i) { QDomElement e = nodes.item(i).toElement(); if (!e.isNull()) { GenTime pos = GenTime(e.attribute("time").toDouble()); @@ -400,7 +400,7 @@ void RenderWidget::setGuides(QDomElement guidesxml, double duration) m_view.guide_end->addItem(e.attribute("comment") + '/' + guidePos, e.attribute("time").toDouble()); } } - if (nodes.count() > 0) + if (!nodes.isEmpty()) m_view.guide_end->addItem(i18n("End"), QString::number(duration)); } @@ -408,7 +408,7 @@ void RenderWidget::setGuides(QDomElement guidesxml, double duration) * Will be called when the user selects an output file via the file dialog. * File extension will be added automatically. */ -void RenderWidget::slotUpdateButtons(KUrl url) +void RenderWidget::slotUpdateButtons(const KUrl &url) { if (m_view.out_file->url().isEmpty()) { m_view.buttonGenerateScript->setEnabled(false); @@ -423,9 +423,8 @@ void RenderWidget::slotUpdateButtons(KUrl url) m_view.buttonGenerateScript->setEnabled(false); return; } - QString extension = item->data(ExtensionRole).toString(); - url = filenameWithExtension(url, extension); - m_view.out_file->setUrl(url); + const QString extension = item->data(ExtensionRole).toString(); + m_view.out_file->setUrl(filenameWithExtension(url, extension)); } } @@ -450,7 +449,7 @@ void RenderWidget::slotSaveProfile() QDialog *d = new QDialog(this); ui.setupUi(d); - for (int i = 0; i < m_view.destination_list->count(); i++) + for (int i = 0; i < m_view.destination_list->count(); ++i) ui.destination_list->addItem(m_view.destination_list->itemIcon(i), m_view.destination_list->itemText(i), m_view.destination_list->itemData(i, Qt::UserRole)); ui.destination_list->setCurrentIndex(m_view.destination_list->currentIndex()); @@ -558,7 +557,7 @@ void RenderWidget::saveProfile(QDomElement newprofile) break; } } - i++; + ++i; } profiles.appendChild(newprofile); @@ -618,7 +617,7 @@ void RenderWidget::slotEditProfile() QDialog *d = new QDialog(this); ui.setupUi(d); - for (int i = 0; i < m_view.destination_list->count(); i++) + for (int i = 0; i < m_view.destination_list->count(); ++i) ui.destination_list->addItem(m_view.destination_list->itemIcon(i), m_view.destination_list->itemText(i), m_view.destination_list->itemData(i, Qt::UserRole)); ui.destination_list->setCurrentIndex(m_view.destination_list->currentIndex()); @@ -698,7 +697,7 @@ void RenderWidget::slotEditProfile() break; } } - i++; + ++i; } QDomElement profileElement = doc.createElement("profile"); @@ -780,7 +779,7 @@ void RenderWidget::slotDeleteProfile(bool refresh) doc.documentElement().removeChild(profiles.item(i)); break; } - i++; + ++i; } if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -866,7 +865,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const QListWidgetItem *item = m_view.size_list->currentItem(); if (!item) return; - QString dest = m_view.out_file->url().path(); + QString dest = m_view.out_file->url().path().trimmed(); if (dest.isEmpty()) return; // Check whether target file has an extension. @@ -1184,7 +1183,7 @@ int RenderWidget::waitingJobsCount() const return count; } -void RenderWidget::setProfile(MltVideoProfile profile) +void RenderWidget::setProfile(const MltVideoProfile &profile) { m_view.scanning_list->setCurrentIndex(0); m_view.rescale_width->setValue(KdenliveSettings::defaultrescalewidth()); @@ -1225,7 +1224,7 @@ void RenderWidget::refreshCategory(const QString &group, const QString &profile) m_view.open_browser->setVisible(false); // hide groups that are not in the correct destination - for (int i = 0; i < m_renderCategory.count(); i++) { + for (int i = 0; i < m_renderCategory.count(); ++i) { sizeItem = m_renderCategory.at(i); if (sizeItem->data(MetaGroupRole).toString() == destination) { m_view.format_list->addItem(sizeItem->clone()); @@ -1291,7 +1290,7 @@ void RenderWidget::refreshView(const QString &profile) const QColor disabledbg = scheme.background(KColorScheme::NegativeBackground).color(); double project_framerate = (double) m_profile.frame_rate_num / m_profile.frame_rate_den; - for (int i = 0; i < m_renderItems.count(); i++) { + for (int i = 0; i < m_renderItems.count(); ++i) { sizeItem = m_renderItems.at(i); QListWidgetItem *dupItem = NULL; if ((sizeItem->data(GroupRole).toString() == group || sizeItem->data(GroupRole).toString().isEmpty()) && sizeItem->data(MetaGroupRole).toString() == destination) { @@ -1392,7 +1391,7 @@ void RenderWidget::refreshView(const QString &profile) } } -KUrl RenderWidget::filenameWithExtension(KUrl url, QString extension) +KUrl RenderWidget::filenameWithExtension(KUrl url, const QString &extension) { if (url.isEmpty()) url = KUrl(m_projectFolder); QString directory = url.directory(KUrl::AppendTrailingSlash | KUrl::ObeyTrailingSlash); @@ -1507,7 +1506,7 @@ void RenderWidget::reloadProfiles() parseProfiles(); } -void RenderWidget::parseProfiles(QString meta, QString group, QString profile) +void RenderWidget::parseProfiles(const QString &meta, const QString &group, const QString &profile) { m_view.destination_list->blockSignals(true); m_view.destination_list->clear(); @@ -1547,7 +1546,7 @@ void RenderWidget::parseProfiles(QString meta, QString group, QString profile) refreshCategory(group, profile); } -void RenderWidget::parseFile(QString exportFile, bool editable) +void RenderWidget::parseFile(const QString &exportFile, bool editable) { kDebug() << "// Parsing file: " << exportFile; kDebug() << "------------------------------"; @@ -1576,7 +1575,7 @@ void RenderWidget::parseFile(QString exportFile, bool editable) newprofiles.setAttribute("version", 1); newdoc.appendChild(newprofiles); QDomNodeList profilelist = doc.elementsByTagName("profile"); - for (int i = 0; i < profilelist.count(); i++) { + for (int i = 0; i < profilelist.count(); ++i) { QString category = i18nc("Category Name", "Custom"); QString extension; QDomNode parent = profilelist.at(i).parentNode(); @@ -1766,7 +1765,7 @@ void RenderWidget::parseFile(QString exportFile, bool editable) n = n.nextSibling(); } - i++; + ++i; } } @@ -1873,7 +1872,7 @@ void RenderWidget::slotCheckJob() } m_view.abort_job->setEnabled(activate); /* - for (int i = 0; i < m_view.running_jobs->topLevelItemCount(); i++) { + for (int i = 0; i < m_view.running_jobs->topLevelItemCount(); ++i) { current = static_cast(m_view.running_jobs->topLevelItem(i)); if (current == static_cast (m_view.running_jobs->currentItem())) { current->setSizeHint(1, QSize(m_view.running_jobs->columnWidth(1), fontMetrics().height() * 3)); @@ -1957,7 +1956,7 @@ void RenderWidget::slotCheckScript() if (current == NULL) return; m_view.start_script->setEnabled(current->data(0, Qt::UserRole).toString().isEmpty()); m_view.delete_script->setEnabled(true); - for (int i = 0; i < m_view.scripts_list->topLevelItemCount(); i++) { + for (int i = 0; i < m_view.scripts_list->topLevelItemCount(); ++i) { current = m_view.scripts_list->topLevelItem(i); if (current == m_view.scripts_list->currentItem()) { current->setSizeHint(1, QSize(m_view.scripts_list->columnWidth(1), fontMetrics().height() * 3)); @@ -2020,7 +2019,7 @@ void RenderWidget::slotHideLog() m_view.error_box->setVisible(false); } -void RenderWidget::setRenderProfile(QMap props) +void RenderWidget::setRenderProfile(const QMap &props) { m_view.scanning_list->setCurrentIndex(props.value("renderscanning").toInt()); int exportAudio = props.value("renderexportaudio").toInt(); @@ -2238,7 +2237,7 @@ bool RenderWidget::proxyRendering() void RenderWidget::setRescaleEnabled(bool enable) { - for (int i = 0; i < m_view.rescale_box->layout()->count(); i++) { + for (int i = 0; i < m_view.rescale_box->layout()->count(); ++i) { if (m_view.rescale_box->itemAt(i)->widget()) m_view.rescale_box->itemAt(i)->widget()->setEnabled(enable); } } @@ -2260,3 +2259,5 @@ void RenderWidget::keyPressEvent(QKeyEvent *e) { else QDialog::keyPressEvent(e); } + +#include "renderwidget.moc"