X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Frenderwidget.cpp;h=6f91e5227450204ed0183061cd39e9c13d1c3d16;hb=e0fa1332f109b6455207ea701da386b2fddddf09;hp=ab8183e91eeefa1ad9d413f0d176115687cf4545;hpb=32c8c40056e65b230f058b168e8e078ba066038b;p=kdenlive diff --git a/src/renderwidget.cpp b/src/renderwidget.cpp index ab8183e9..6f91e522 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), @@ -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)) { @@ -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); } }