From 20ceaabff94330507020776d9d6b43108db508d4 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Fri, 31 May 2013 13:38:21 +0200 Subject: [PATCH] Fix include. fix indent. Minor optimization --- src/documentchecker.cpp | 4 +- src/doubleparameterwidget.cpp | 4 +- src/dragvalue.cpp | 60 ++++-- src/dvdwizard.cpp | 365 +++++++++++++++++----------------- src/dvdwizard.h | 2 - src/dvdwizardmenu.cpp | 2 +- src/dvdwizardmenu.h | 6 +- 7 files changed, 233 insertions(+), 210 deletions(-) diff --git a/src/documentchecker.cpp b/src/documentchecker.cpp index f2b09d62..042b95cc 100644 --- a/src/documentchecker.cpp +++ b/src/documentchecker.cpp @@ -822,8 +822,8 @@ void DocumentChecker::checkStatus() int ix = 0; QTreeWidgetItem *child = m_ui.treeWidget->topLevelItem(ix); while (child) { - int status = child->data(0, statusRole).toInt(); - if (status == CLIPMISSING || status == LUMAMISSING || status == CLIPWRONGDURATION) { + int childStatus = child->data(0, statusRole).toInt(); + if (childStatus == CLIPMISSING || childStatus == LUMAMISSING || childStatus == CLIPWRONGDURATION) { status = false; break; } diff --git a/src/doubleparameterwidget.cpp b/src/doubleparameterwidget.cpp index ce8153a5..ec2af513 100644 --- a/src/doubleparameterwidget.cpp +++ b/src/doubleparameterwidget.cpp @@ -32,7 +32,7 @@ DoubleParameterWidget::DoubleParameterWidget(const QString &name, double value, double min, double max, double defaultValue, const QString &comment, int id, const QString &suffix, int decimals, QWidget *parent) : - QWidget(parent) + QWidget(parent) { setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum); QGridLayout *layout = new QGridLayout(this); @@ -43,7 +43,7 @@ DoubleParameterWidget::DoubleParameterWidget(const QString &name, double value, layout->addWidget(m_dragVal, 0, 1); if (!comment.isEmpty()) { - setToolTip(comment); + setToolTip(comment); } m_dragVal->setValue(value, false); connect(m_dragVal, SIGNAL(valueChanged(double,bool)), this, SLOT(slotSetValue(double,bool))); diff --git a/src/dragvalue.cpp b/src/dragvalue.cpp index 0dad4689..64a8f2ee 100644 --- a/src/dragvalue.cpp +++ b/src/dragvalue.cpp @@ -79,8 +79,7 @@ DragValue::DragValue(const QString &label, double defaultValue, int decimals, do l->addWidget(m_intEdit); connect(m_intEdit, SIGNAL(valueChanged(int)), this, SLOT(slotSetValue(int))); connect(m_intEdit, SIGNAL(editingFinished()), this, SLOT(slotEditingFinished())); - } - else { + } else { m_doubleEdit = new QDoubleSpinBox(this); m_doubleEdit->setDecimals(decimals); m_doubleEdit->setFocusPolicy(Qt::StrongFocus); @@ -103,8 +102,10 @@ DragValue::DragValue(const QString &label, double defaultValue, int decimals, do connect(m_label, SIGNAL(valueChanged(double,bool)), this, SLOT(setValueFromProgress(double,bool))); connect(m_label, SIGNAL(resetValue()), this, SLOT(slotReset())); setLayout(l); - if (m_intEdit) m_label->setMaximumHeight(m_intEdit->sizeHint().height()); - else m_label->setMaximumHeight(m_doubleEdit->sizeHint().height()); + if (m_intEdit) + m_label->setMaximumHeight(m_intEdit->sizeHint().height()); + else + m_label->setMaximumHeight(m_doubleEdit->sizeHint().height()); m_menu = new QMenu(this); @@ -148,14 +149,18 @@ DragValue::~DragValue() int DragValue::spinSize() { - if (m_intEdit) return m_intEdit->sizeHint().width(); - else return m_doubleEdit->sizeHint().width(); + if (m_intEdit) + return m_intEdit->sizeHint().width(); + else + return m_doubleEdit->sizeHint().width(); } void DragValue::setSpinSize(int width) { - if (m_intEdit) m_intEdit->setMinimumWidth(width); - else m_doubleEdit->setMinimumWidth(width); + if (m_intEdit) + m_intEdit->setMinimumWidth(width); + else + m_doubleEdit->setMinimumWidth(width); } void DragValue::slotSetInTimeline() @@ -186,24 +191,34 @@ qreal DragValue::value() const void DragValue::setMaximum(qreal max) { - m_maximum = max; - if (m_intEdit) m_intEdit->setRange(m_minimum, m_maximum); - else m_doubleEdit->setRange(m_minimum, m_maximum); + if (m_maximum != max) { + m_maximum = max; + if (m_intEdit) + m_intEdit->setRange(m_minimum, m_maximum); + else + m_doubleEdit->setRange(m_minimum, m_maximum); + } } void DragValue::setMinimum(qreal min) { - m_minimum = min; - if (m_intEdit) m_intEdit->setRange(m_minimum, m_maximum); - else m_doubleEdit->setRange(m_minimum, m_maximum); + if (m_minimum != min) { + m_minimum = min; + if (m_intEdit) + m_intEdit->setRange(m_minimum, m_maximum); + else + m_doubleEdit->setRange(m_minimum, m_maximum); + } } void DragValue::setRange(qreal min, qreal max) { m_maximum = max; m_minimum = min; - if (m_intEdit) m_intEdit->setRange(m_minimum, m_maximum); - else m_doubleEdit->setRange(m_minimum, m_maximum); + if (m_intEdit) + m_intEdit->setRange(m_minimum, m_maximum); + else + m_doubleEdit->setRange(m_minimum, m_maximum); } void DragValue::setPrecision(int /*precision*/) @@ -254,8 +269,10 @@ void DragValue::slotSetValue(double value) void DragValue::setValueFromProgress(double value, bool final) { value = m_minimum + value * (m_maximum - m_minimum) / m_label->maximum(); - if (m_decimals == 0) setValue(qRound(value), final); - else setValue(value, final); + if (m_decimals == 0) + setValue(qRound(value), final); + else + setValue(value, final); } void DragValue::setValue(double value, bool final) @@ -285,8 +302,11 @@ void DragValue::focusOutEvent(QFocusEvent*) void DragValue::focusInEvent(QFocusEvent* e) { - if (m_intEdit) m_intEdit->setFocusPolicy(Qt::WheelFocus); - else m_doubleEdit->setFocusPolicy(Qt::WheelFocus); + if (m_intEdit) + m_intEdit->setFocusPolicy(Qt::WheelFocus); + else + m_doubleEdit->setFocusPolicy(Qt::WheelFocus); + if (e->reason() == Qt::TabFocusReason || e->reason() == Qt::BacktabFocusReason) { if (m_intEdit) m_intEdit->setFocus(e->reason()); else m_doubleEdit->setFocus(e->reason()); diff --git a/src/dvdwizard.cpp b/src/dvdwizard.cpp index 1d87611b..33c568fe 100644 --- a/src/dvdwizard.cpp +++ b/src/dvdwizard.cpp @@ -41,11 +41,11 @@ DvdWizard::DvdWizard(MonitorManager *manager, const QString &url, QWidget *parent) : - QWizard(parent) - , m_dvdauthor(NULL) - , m_mkiso(NULL) - , m_vobitem(NULL) - , m_burnMenu(new QMenu(this)) + QWizard(parent) + , m_dvdauthor(NULL) + , m_mkiso(NULL) + , m_vobitem(NULL) + , m_burnMenu(new QMenu(this)) { setWindowTitle(i18n("DVD Wizard")); //setPixmap(QWizard::WatermarkPixmap, QPixmap(KStandardDirs::locate("appdata", "banner.png"))); @@ -156,7 +156,7 @@ void DvdWizard::slotPageChanged(int page) m_pageVob->updateChapters(m_pageChapters->chaptersData()); } else if (page == 1) { m_pageChapters->setVobFiles(m_pageVob->dvdFormat(), m_pageVob->selectedUrls(), m_pageVob->durations(), m_pageVob->chapters()); - setTitleFormat(Qt::PlainText); + setTitleFormat(Qt::PlainText); } else if (page == 2) { m_pageChapters->stopMonitor(); m_pageVob->updateChapters(m_pageChapters->chaptersData()); @@ -241,7 +241,7 @@ void DvdWizard::generateDvd() m_pageMenu->createButtonImages(m_selectedImage.fileName(), m_highlightedImage.fileName(), false); m_pageMenu->createBackgroundImage(m_menuImageBackground.fileName(), false); images->setIcon(KIcon("dialog-ok")); - connect(&m_menuJob, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotProcessMenuStatus(int,QProcess::ExitStatus))); + connect(&m_menuJob, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotProcessMenuStatus(int,QProcess::ExitStatus))); //kDebug() << "/// STARTING MLT VOB CREATION: "<menuMovie()) { // create menu vob file @@ -257,30 +257,30 @@ void DvdWizard::generateDvd() args << "-consumer" << "avformat:" + m_menuVideo.fileName()<<"properties=DVD"; m_menuJob.start(KdenliveSettings::rendererpath(), args); } else { - // Movie as menu background, do the compositing - m_vobitem = m_status.job_progress->item(1); + // Movie as menu background, do the compositing + m_vobitem = m_status.job_progress->item(1); m_status.job_progress->setCurrentRow(1); m_vobitem->setIcon(KIcon("system-run")); - int menuLength = m_pageMenu->menuMovieLength(); - if (menuLength == -1) { - // menu movie is invalid - errorMessage(i18n("Menu movie is invalid")); - m_status.button_start->setEnabled(true); + int menuLength = m_pageMenu->menuMovieLength(); + if (menuLength == -1) { + // menu movie is invalid + errorMessage(i18n("Menu movie is invalid")); + m_status.button_start->setEnabled(true); m_status.button_abort->setEnabled(false); return; - } + } QStringList args; args.append("-profile"); args.append(m_pageVob->dvdProfile()); args.append(m_pageMenu->menuMoviePath()); - args << "-track" << m_menuImageBackground.fileName(); - args << "out=" + QString::number(menuLength); - args << "-transition" << "composite" << "always_active=1"; + args << "-track" << m_menuImageBackground.fileName(); + args << "out=" + QString::number(menuLength); + args << "-transition" << "composite" << "always_active=1"; args << "-consumer" << "avformat:" + m_menuFinalVideo.fileName()<<"properties=DVD"; - m_menuJob.start(KdenliveSettings::rendererpath(), args); - //kDebug()<<"// STARTING MENU JOB, image: "<setPlainText(m_authorFile.readAll()); m_status.button_start->setEnabled(true); kDebug() << "/// RENDERING SPUMUX MENU crashed"; - return; - } + return; + } } else { kDebug() << "/// RENDERING SPUMUX MENU timed out"; errorMessage(i18n("Rendering job timed out")); @@ -393,92 +393,92 @@ void DvdWizard::processSpumux() m_status.menu_file->setPlainText(m_menuFile.readAll()); m_status.dvd_file->setPlainText(m_authorFile.readAll()); m_status.button_start->setEnabled(true); - return; + return; } if (m_pageVob->dvdFormat() == PAL_WIDE || m_pageVob->dvdFormat() == NTSC_WIDE) { - // Second step processing for 16:9 DVD, add letterbox stream - m_pageMenu->createButtonImages(m_selectedLetterImage.fileName(), m_highlightedLetterImage.fileName(), true); - buttons = m_pageMenu->buttonsInfo(true); - - QDomDocument docLetter; - QDomElement subLetter = docLetter.createElement("subpictures"); - docLetter.appendChild(subLetter); - QDomElement streamLetter = docLetter.createElement("stream"); - subLetter.appendChild(streamLetter); - QDomElement spuLetter = docLetter.createElement("spu"); - streamLetter.appendChild(spuLetter); - spuLetter.setAttribute("force", "yes"); - spuLetter.setAttribute("start", "00:00:00.00"); - spuLetter.setAttribute("select", m_selectedLetterImage.fileName()); - spuLetter.setAttribute("highlight", m_highlightedLetterImage.fileName()); - - max = buttons.count() - 1; - i = 0; - QMapIterator it2(buttons); - while (it2.hasNext()) { - it2.next(); - QDomElement but = docLetter.createElement("button"); - but.setAttribute("name", 'b' + QString::number(i)); - if (i < max) but.setAttribute("down", 'b' + QString::number(i + 1)); - else but.setAttribute("down", "b0"); - if (i > 0) but.setAttribute("up", 'b' + QString::number(i - 1)); - else but.setAttribute("up", 'b' + QString::number(max)); - QRect r = it2.value(); - // We need to make sure that the y coordinate is a multiple of 2, otherwise button may not be displayed - buttonsTarget.append(it2.key()); - int y0 = r.y(); - if (y0 % 2 == 1) y0++; - int y1 = r.bottom(); - if (y1 % 2 == 1) y1--; - but.setAttribute("x0", QString::number(r.x())); - but.setAttribute("y0", QString::number(y0)); - but.setAttribute("x1", QString::number(r.right())); - but.setAttribute("y1", QString::number(y1)); - spuLetter.appendChild(but); - ++i; - } - - //kDebug() << " SPUMUX DATA: " << doc.toString(); - - if (data.open(QFile::WriteOnly)) { - data.write(docLetter.toString().toUtf8()); - } - data.close(); - spumux.setStandardInputFile(m_menuVobFile.fileName()); - spumux.setStandardOutputFile(m_letterboxMovie.fileName()); - args.clear(); - args << "-s" << "1" << m_menuFile.fileName(); - spumux.start("spumux", args); - //kDebug() << "SPM ARGS LETTERBOX: " << args << m_menuVideo.fileName() << m_letterboxMovie.fileName(); - if (spumux.waitForFinished()) { - m_status.error_log->append(spumux.readAllStandardError()); - if (spumux.exitStatus() == QProcess::CrashExit) { - //TODO: inform user via messagewidget after string freeze - QByteArray result = spumux.readAllStandardError(); - spuitem->setIcon(KIcon("dialog-close")); - m_status.error_log->append(result); - m_status.error_box->setHidden(false); - m_status.error_box->setTabBarHidden(false); - m_status.menu_file->setPlainText(m_menuFile.readAll()); - m_status.dvd_file->setPlainText(m_authorFile.readAll()); - m_status.button_start->setEnabled(true); - kDebug() << "/// RENDERING SPUMUX MENU crashed"; - return; - } - } else { - kDebug() << "/// RENDERING SPUMUX MENU timed out"; - errorMessage(i18n("Rendering job timed out")); - spuitem->setIcon(KIcon("dialog-close")); - m_status.error_log->append("
" + i18n("Menu job timed out")); - m_status.error_log->scrollToAnchor("result"); - m_status.error_box->setHidden(false); - m_status.error_box->setTabBarHidden(false); - m_status.menu_file->setPlainText(m_menuFile.readAll()); - m_status.dvd_file->setPlainText(m_authorFile.readAll()); - m_status.button_start->setEnabled(true); - return; - } - menuMovieUrl = m_letterboxMovie.fileName(); + // Second step processing for 16:9 DVD, add letterbox stream + m_pageMenu->createButtonImages(m_selectedLetterImage.fileName(), m_highlightedLetterImage.fileName(), true); + buttons = m_pageMenu->buttonsInfo(true); + + QDomDocument docLetter; + QDomElement subLetter = docLetter.createElement("subpictures"); + docLetter.appendChild(subLetter); + QDomElement streamLetter = docLetter.createElement("stream"); + subLetter.appendChild(streamLetter); + QDomElement spuLetter = docLetter.createElement("spu"); + streamLetter.appendChild(spuLetter); + spuLetter.setAttribute("force", "yes"); + spuLetter.setAttribute("start", "00:00:00.00"); + spuLetter.setAttribute("select", m_selectedLetterImage.fileName()); + spuLetter.setAttribute("highlight", m_highlightedLetterImage.fileName()); + + max = buttons.count() - 1; + i = 0; + QMapIterator it2(buttons); + while (it2.hasNext()) { + it2.next(); + QDomElement but = docLetter.createElement("button"); + but.setAttribute("name", 'b' + QString::number(i)); + if (i < max) but.setAttribute("down", 'b' + QString::number(i + 1)); + else but.setAttribute("down", "b0"); + if (i > 0) but.setAttribute("up", 'b' + QString::number(i - 1)); + else but.setAttribute("up", 'b' + QString::number(max)); + QRect r = it2.value(); + // We need to make sure that the y coordinate is a multiple of 2, otherwise button may not be displayed + buttonsTarget.append(it2.key()); + int y0 = r.y(); + if (y0 % 2 == 1) y0++; + int y1 = r.bottom(); + if (y1 % 2 == 1) y1--; + but.setAttribute("x0", QString::number(r.x())); + but.setAttribute("y0", QString::number(y0)); + but.setAttribute("x1", QString::number(r.right())); + but.setAttribute("y1", QString::number(y1)); + spuLetter.appendChild(but); + ++i; + } + + //kDebug() << " SPUMUX DATA: " << doc.toString(); + + if (data.open(QFile::WriteOnly)) { + data.write(docLetter.toString().toUtf8()); + } + data.close(); + spumux.setStandardInputFile(m_menuVobFile.fileName()); + spumux.setStandardOutputFile(m_letterboxMovie.fileName()); + args.clear(); + args << "-s" << "1" << m_menuFile.fileName(); + spumux.start("spumux", args); + //kDebug() << "SPM ARGS LETTERBOX: " << args << m_menuVideo.fileName() << m_letterboxMovie.fileName(); + if (spumux.waitForFinished()) { + m_status.error_log->append(spumux.readAllStandardError()); + if (spumux.exitStatus() == QProcess::CrashExit) { + //TODO: inform user via messagewidget after string freeze + QByteArray result = spumux.readAllStandardError(); + spuitem->setIcon(KIcon("dialog-close")); + m_status.error_log->append(result); + m_status.error_box->setHidden(false); + m_status.error_box->setTabBarHidden(false); + m_status.menu_file->setPlainText(m_menuFile.readAll()); + m_status.dvd_file->setPlainText(m_authorFile.readAll()); + m_status.button_start->setEnabled(true); + kDebug() << "/// RENDERING SPUMUX MENU crashed"; + return; + } + } else { + kDebug() << "/// RENDERING SPUMUX MENU timed out"; + errorMessage(i18n("Rendering job timed out")); + spuitem->setIcon(KIcon("dialog-close")); + m_status.error_log->append("

" + i18n("Menu job timed out")); + m_status.error_log->scrollToAnchor("result"); + m_status.error_box->setHidden(false); + m_status.error_box->setTabBarHidden(false); + m_status.menu_file->setPlainText(m_menuFile.readAll()); + m_status.dvd_file->setPlainText(m_authorFile.readAll()); + m_status.button_start->setEnabled(true); + return; + } + menuMovieUrl = m_letterboxMovie.fileName(); } else menuMovieUrl = m_menuVobFile.fileName(); @@ -525,44 +525,44 @@ void DvdWizard::processDvdauthor(const QString &menuMovieUrl, const QMap dvdFormat()) { - case PAL_WIDE: - menuvideo.setAttribute("format", "pal"); - menuvideo.setAttribute("aspect", "16:9"); - menuvideo.setAttribute("widescreen", "nopanscan"); - break; - case NTSC_WIDE: - menuvideo.setAttribute("format", "ntsc"); - menuvideo.setAttribute("aspect", "16:9"); - menuvideo.setAttribute("widescreen", "nopanscan"); - break; - case NTSC: - menuvideo.setAttribute("format", "ntsc"); - menuvideo.setAttribute("aspect", "4:3"); - break; - default: - menuvideo.setAttribute("format", "pal"); - menuvideo.setAttribute("aspect", "4:3"); - break; - } - - - if (m_pageVob->dvdFormat() == PAL_WIDE || m_pageVob->dvdFormat() == NTSC_WIDE) { - // Add letterbox stream info - QDomElement subpict = dvddoc.createElement("subpicture"); - QDomElement stream = dvddoc.createElement("stream"); - stream.setAttribute("id", "0"); - stream.setAttribute("mode", "widescreen"); - subpict.appendChild(stream); - QDomElement stream2 = dvddoc.createElement("stream"); - stream2.setAttribute("id", "1"); - stream2.setAttribute("mode", "letterbox"); - subpict.appendChild(stream2); - menus.appendChild(subpict); - } + + QDomElement menuvideo = dvddoc.createElement("video"); + menus.appendChild(menuvideo); + switch (m_pageVob->dvdFormat()) { + case PAL_WIDE: + menuvideo.setAttribute("format", "pal"); + menuvideo.setAttribute("aspect", "16:9"); + menuvideo.setAttribute("widescreen", "nopanscan"); + break; + case NTSC_WIDE: + menuvideo.setAttribute("format", "ntsc"); + menuvideo.setAttribute("aspect", "16:9"); + menuvideo.setAttribute("widescreen", "nopanscan"); + break; + case NTSC: + menuvideo.setAttribute("format", "ntsc"); + menuvideo.setAttribute("aspect", "4:3"); + break; + default: + menuvideo.setAttribute("format", "pal"); + menuvideo.setAttribute("aspect", "4:3"); + break; + } + + + if (m_pageVob->dvdFormat() == PAL_WIDE || m_pageVob->dvdFormat() == NTSC_WIDE) { + // Add letterbox stream info + QDomElement subpict = dvddoc.createElement("subpicture"); + QDomElement stream = dvddoc.createElement("stream"); + stream.setAttribute("id", "0"); + stream.setAttribute("mode", "widescreen"); + subpict.appendChild(stream); + QDomElement stream2 = dvddoc.createElement("stream"); + stream2.setAttribute("id", "1"); + stream2.setAttribute("mode", "letterbox"); + subpict.appendChild(stream2); + menus.appendChild(subpict); + } QDomElement pgc = dvddoc.createElement("pgc"); pgc.setAttribute("entry", "root"); menus.appendChild(pgc); @@ -570,7 +570,7 @@ void DvdWizard::processDvdauthor(const QString &menuMovieUrl, const QMap dvdFormat()) { - case PAL_WIDE: - video.setAttribute("format", "pal"); - video.setAttribute("aspect", "16:9"); - break; - case NTSC_WIDE: - video.setAttribute("format", "ntsc"); - video.setAttribute("aspect", "16:9"); - break; - case NTSC: - video.setAttribute("format", "ntsc"); - video.setAttribute("aspect", "4:3"); - break; - default: - video.setAttribute("format", "pal"); - video.setAttribute("aspect", "4:3"); - break; + case PAL_WIDE: + video.setAttribute("format", "pal"); + video.setAttribute("aspect", "16:9"); + break; + case NTSC_WIDE: + video.setAttribute("format", "ntsc"); + video.setAttribute("aspect", "16:9"); + break; + case NTSC: + video.setAttribute("format", "ntsc"); + video.setAttribute("aspect", "4:3"); + break; + default: + video.setAttribute("format", "pal"); + video.setAttribute("aspect", "4:3"); + break; } QDomElement pgc2; @@ -667,7 +667,7 @@ void DvdWizard::processDvdauthor(const QString &menuMovieUrl, const QMap = 0x040600 QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - env.insert("VIDEO_FORMAT", m_pageVob->dvdFormat() == PAL || m_pageVob->dvdFormat() == PAL_WIDE ? "PAL" : "NTSC"); + env.insert("VIDEO_FORMAT", m_pageVob->dvdFormat() == PAL || m_pageVob->dvdFormat() == PAL_WIDE ? "PAL" : "NTSC"); m_dvdauthor->setProcessEnvironment(env); #else QStringList env = QProcess::systemEnvironment(); @@ -685,7 +685,7 @@ void DvdWizard::processDvdauthor(const QString &menuMovieUrl, const QMap setIcon(KIcon("dialog-close")); @@ -876,13 +876,13 @@ void DvdWizard::slotPreview() programNames << "xine" << "vlc"; QString exec; foreach(const QString &prog, programNames) { - exec = KStandardDirs::findExe(prog); - if (!exec.isEmpty()) { - break; - } + exec = KStandardDirs::findExe(prog); + if (!exec.isEmpty()) { + break; + } } if (exec.isEmpty()) { - KMessageBox::sorry(this, i18n("Previewing requires one of these applications (%1)", programNames.join(","))); + KMessageBox::sorry(this, i18n("Previewing requires one of these applications (%1)", programNames.join(","))); } else QProcess::startDetached(exec, QStringList() << "dvd://" + m_status.iso_image->url().path()); } @@ -930,9 +930,11 @@ void DvdWizard::slotAbort() void DvdWizard::slotSave() { KUrl url = KFileDialog::getSaveUrl(KUrl("kfiledialog:///projectfolder"), "*.kdvd", this, i18n("Save DVD Project")); - if (url.isEmpty()) return; + if (url.isEmpty()) + return; - if (currentId() == 0) m_pageChapters->setVobFiles(m_pageVob->dvdFormat(), m_pageVob->selectedUrls(), m_pageVob->durations(), m_pageVob->chapters()); + if (currentId() == 0) + m_pageChapters->setVobFiles(m_pageVob->dvdFormat(), m_pageVob->selectedUrls(), m_pageVob->durations(), m_pageVob->chapters()); QDomDocument doc; QDomElement dvdproject = doc.createElement("dvdproject"); @@ -964,8 +966,9 @@ void DvdWizard::slotSave() void DvdWizard::slotLoad() { - KUrl url = KFileDialog::getOpenUrl(KUrl("kfiledialog:///projectfolder"), "*.kdvd"); - if (url.isEmpty()) return; + const KUrl url = KFileDialog::getOpenUrl(KUrl("kfiledialog:///projectfolder"), "*.kdvd"); + if (url.isEmpty()) + return; QDomDocument doc; QFile file(url.path()); doc.setContent(&file, false); @@ -983,8 +986,8 @@ void DvdWizard::slotLoad() m_status.iso_image->setUrl(KUrl(dvdproject.attribute("iso_image"))); QString intro = dvdproject.attribute("intro_movie"); if (!intro.isEmpty()) { - m_pageVob->slotAddVobFile(KUrl(intro)); - m_pageVob->setUseIntroMovie(true); + m_pageVob->slotAddVobFile(KUrl(intro)); + m_pageVob->setUseIntroMovie(true); } QDomNodeList vobs = doc.elementsByTagName("vob"); diff --git a/src/dvdwizard.h b/src/dvdwizard.h index c5451616..2684380d 100644 --- a/src/dvdwizard.h +++ b/src/dvdwizard.h @@ -22,8 +22,6 @@ #define DVDWIZARD_H #include -#include -#include #include #include diff --git a/src/dvdwizardmenu.cpp b/src/dvdwizardmenu.cpp index 569a062b..986ff507 100644 --- a/src/dvdwizardmenu.cpp +++ b/src/dvdwizardmenu.cpp @@ -187,7 +187,7 @@ bool DvdWizardMenu::isComplete() const DvdButton *button = static_cast < DvdButton* >(list.at(i)); QList collisions = button->collidingItems(); if (!collisions.isEmpty()) { - for (int j = 0; j < collisions.count(); j++) { + for (int j = 0; j < collisions.count(); ++j) { if (collisions.at(j)->type() == button->type()) { #if KDE_IS_VERSION(4,7,0) m_menuMessage->setText(i18n("Buttons overlapping")); diff --git a/src/dvdwizardmenu.h b/src/dvdwizardmenu.h index c0edadb5..c4496b2f 100644 --- a/src/dvdwizardmenu.h +++ b/src/dvdwizardmenu.h @@ -126,8 +126,10 @@ protected: DvdScene *sc = static_cast < DvdScene * >(scene()); newPos.setX(qMax(newPos.x(), 0)); newPos.setY(qMax(newPos.y(), 0)); - if (newPos.x() + sceneShape.width() > sc->width()) newPos.setX(sc->width() - sceneShape.width()); - if (newPos.y() + sceneShape.height() > sc->height()) newPos.setY(sc->height() - sceneShape.height()); + if (newPos.x() + sceneShape.width() > sc->width()) + newPos.setX(sc->width() - sceneShape.width()); + if (newPos.y() + sceneShape.height() > sc->height()) + newPos.setY(sc->height() - sceneShape.height()); sceneShape.translate(newPos - pos()); QList list = scene()->items(sceneShape, Qt::IntersectsItemShape); -- 2.39.2