Fix encoding of dvd vob menu file, use the new KMessageWidget to display infos in dvd wizard

svn path=/trunk/kdenlive/; revision=5995
parent 3e3180e7
......@@ -36,6 +36,7 @@
#include <QTimer>
#include <QDomDocument>
#include <QMenu>
#include <QGridLayout>
DvdWizard::DvdWizard(const QString &url, const QString &profile, QWidget *parent) :
......@@ -74,6 +75,13 @@ DvdWizard::DvdWizard(const QString &url, const QString &profile, QWidget *parent
m_status.iso_image->setMode(KFile::File);
m_status.iso_image->fileDialog()->setOperationMode(KFileDialog::Saving);
#if KDE_IS_VERSION(4,7,0)
m_isoMessage = new KMessageWidget;
QGridLayout *s = static_cast <QGridLayout*> (page4->layout());
s->addWidget(m_isoMessage, 5, 0, 1, -1);
m_isoMessage->hide();
#endif
addPage(page4);
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotPageChanged(int)));
......@@ -154,6 +162,9 @@ void DvdWizard::slotPageChanged(int page)
void DvdWizard::generateDvd()
{
#if KDE_IS_VERSION(4,7,0)
m_isoMessage->animatedHide();
#endif
m_status.error_box->setHidden(true);
m_status.error_box->setCurrentIndex(0);
m_status.error_box->setTabBarHidden(true);
......@@ -233,9 +244,9 @@ void DvdWizard::generateDvd()
args.append("out=100");
args << "-consumer" << "avformat:" + temp5.fileName();
if (m_pageMenu->isPalMenu()) {
args << "f=dvd" << "vcodec=mpeg2video" << "acodec=ac3" << "b=5000k" << "maxrate=8000k" << "minrate=0" << "bufsize=1835008" << "mux_packet_s=2048" << "mux_rate=10080000" << "ab=192k" << "ar=48000" << "s=720x576" << "g=15" << "me_range=63" << "trellis=1" << "profile=dv_pal";
args << "f=dvd" << "acodec=ac3" << "ab=192k" << "ar=48000" << "vcodec=mpeg2video" << "vb=5000k" << "maxrate=8000k" << "minrate=0" << "bufsize=1835008" << "mux_packet_s=2048" << "mux_rate=10080000" << "s=720x576" << "g=15" << "me_range=63" << "trellis=1";
} else {
args << "f=dvd" << "vcodec=mpeg2video" << "acodec=ac3" << "b=6000k" << "maxrate=9000k" << "minrate=0" << "bufsize=1835008" << "mux_packet_s=2048" << "mux_rate=10080000" << "ab=192k" << "ar=48000" << "s=720x480" << "g=18" << "me_range=63" << "trellis=1" << "profile=dv_ntsc";
args << "f=dvd" << "acodec=ac3" << "ab=192k" << "ar=48000" << "vcodec=mpeg2video" << "vb=6000k" << "maxrate=9000k" << "minrate=0" << "bufsize=1835008" << "mux_packet_s=2048" << "mux_rate=10080000" << "s=720x480" << "g=18" << "me_range=63" << "trellis=1";
}
kDebug() << "MLT ARGS: " << args;
......@@ -243,6 +254,7 @@ void DvdWizard::generateDvd()
renderbg.start(KdenliveSettings::rendererpath(), args);
if (renderbg.waitForFinished()) {
if (renderbg.exitStatus() == QProcess::CrashExit) {
//TODO: inform user via the m_isoMessage widget after string freeze
kDebug() << "/// RENDERING MENU vob crashed";
QByteArray result = renderbg.readAllStandardError();
vobitem->setIcon(KIcon("dialog-close"));
......@@ -254,6 +266,11 @@ void DvdWizard::generateDvd()
}
} else {
kDebug() << "/// RENDERING MENU vob timed out";
#if KDE_IS_VERSION(4,7,0)
m_isoMessage->setText(i18n("Rendering job timed out"));
m_isoMessage->setMessageType(KMessageWidget::Error);
m_isoMessage->animatedShow();
#endif
vobitem->setIcon(KIcon("dialog-close"));
m_status.error_log->append("<a name=\"result\" /><br /><strong>" + i18n("Rendering job timed out"));
m_status.error_log->scrollToAnchor("result");
......@@ -344,6 +361,7 @@ void DvdWizard::generateDvd()
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);
......@@ -357,6 +375,11 @@ void DvdWizard::generateDvd()
}
} else {
kDebug() << "/// RENDERING SPUMUX MENU timed out";
#if KDE_IS_VERSION(4,7,0)
m_isoMessage->setText(i18n("Rendering job timed out"));
m_isoMessage->setMessageType(KMessageWidget::Error);
m_isoMessage->animatedShow();
#endif
spuitem->setIcon(KIcon("dialog-close"));
m_status.error_log->append("<a name=\"result\" /><br /><strong>" + i18n("Menu job timed out"));
m_status.error_log->scrollToAnchor("result");
......@@ -527,6 +550,14 @@ void DvdWizard::slotRenderFinished(int exitCode, QProcess::ExitStatus status)
{
QListWidgetItem *authitem = m_status.job_progress->item(3);
if (status == QProcess::CrashExit || exitCode != 0) {
#if KDE_IS_VERSION(4,7,0)
//TODO: Clean up message string after string freeze
QString message = i18n("DVDAuthor process crashed.</strong><br />");
message.remove(QRegExp("<[^>]*>"));
m_isoMessage->setText(message);
m_isoMessage->setMessageType(KMessageWidget::Error);
m_isoMessage->animatedShow();
#endif
QString result(m_dvdauthor->readAllStandardError());
result.append("<a name=\"result\" /><br /><strong>");
result.append(i18n("DVDAuthor process crashed.</strong><br />"));
......@@ -554,6 +585,11 @@ void DvdWizard::slotRenderFinished(int exitCode, QProcess::ExitStatus status)
// Check if DVD structure has the necessary infos
if (!QFile::exists(m_status.tmp_folder->url().path() + "/DVD/VIDEO_TS/VIDEO_TS.IFO")) {
#if KDE_IS_VERSION(4,7,0)
m_isoMessage->setText(i18n("DVD structure broken"));
m_isoMessage->setMessageType(KMessageWidget::Error);
m_isoMessage->animatedShow();
#endif
m_status.error_log->append(m_creationLog + "<a name=\"result\" /><br /><strong>" + i18n("DVD structure broken"));
m_status.error_log->scrollToAnchor("result");
m_status.error_box->setHidden(false);
......@@ -603,6 +639,11 @@ void DvdWizard::slotIsoFinished(int exitCode, QProcess::ExitStatus status)
button(QWizard::FinishButton)->setEnabled(true);
QListWidgetItem *isoitem = m_status.job_progress->item(4);
if (status == QProcess::CrashExit || exitCode != 0) {
#if KDE_IS_VERSION(4,7,0)
m_isoMessage->setText(i18n("ISO creation process crashed."));
m_isoMessage->setMessageType(KMessageWidget::Error);
m_isoMessage->animatedShow();
#endif
QString result(m_mkiso->readAllStandardError());
result.append("<a name=\"result\" /><br /><strong>");
result.append(i18n("ISO creation process crashed."));
......@@ -635,6 +676,11 @@ void DvdWizard::slotIsoFinished(int exitCode, QProcess::ExitStatus status)
if (iso.exists()) {
KIO::NetAccess::del(m_status.iso_image->url(), this);
}
#if KDE_IS_VERSION(4,7,0)
m_isoMessage->setText(i18n("DVD ISO is broken"));
m_isoMessage->setMessageType(KMessageWidget::Error);
m_isoMessage->animatedShow();
#endif
m_status.error_log->append(m_creationLog + "<br /><a name=\"result\" /><strong>" + i18n("DVD ISO is broken") + "</strong>");
m_status.error_log->scrollToAnchor("result");
m_status.error_box->setHidden(false);
......@@ -650,6 +696,11 @@ void DvdWizard::slotIsoFinished(int exitCode, QProcess::ExitStatus status)
kDebug() << "ISO IMAGE " << m_status.iso_image->url().path() << " Successfully created";
cleanup();
kDebug() << m_creationLog;
#if KDE_IS_VERSION(4,7,0)
m_isoMessage->setText(i18n("DVD ISO image %1 successfully created.", m_status.iso_image->url().path()));
m_isoMessage->setMessageType(KMessageWidget::Positive);
m_isoMessage->animatedShow();
#endif
m_status.error_log->append("<a name=\"result\" /><strong>" + i18n("DVD ISO image %1 successfully created.", m_status.iso_image->url().path()) + "</strong>");
m_status.error_log->scrollToAnchor("result");
......
......@@ -48,6 +48,11 @@ private:
DvdWizardVob *m_pageVob;
DvdWizardMenu *m_pageMenu;
Ui::DvdWizardStatus_UI m_status;
#if KDE_IS_VERSION(4,7,0)
KMessageWidget *m_isoMessage;
#endif
DvdWizardChapters *m_pageChapters;
KTemporaryFile m_authorFile;
KTemporaryFile m_menuFile;
......
......@@ -36,6 +36,14 @@ DvdWizardMenu::DvdWizardMenu(const QString &profile, QWidget *parent) :
m_view.menu_preview->setMouseTracking(true);
connect(m_view.create_menu, SIGNAL(toggled(bool)), m_view.menu_box, SLOT(setEnabled(bool)));
connect(m_view.create_menu, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged()));
#if KDE_IS_VERSION(4,7,0)
m_menuMessage = new KMessageWidget;
QGridLayout *s = static_cast <QGridLayout*> (layout());
s->addWidget(m_menuMessage, 7, 0, 1, -1);
m_menuMessage->hide();
m_view.error_message->hide();
#endif
m_view.add_button->setIcon(KIcon("document-new"));
m_view.delete_button->setIcon(KIcon("trash-empty"));
......@@ -148,8 +156,14 @@ bool DvdWizardMenu::isComplete() const
if (!collisions.isEmpty()) {
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"));
m_menuMessage->setMessageType(KMessageWidget::Warning);
m_menuMessage->animatedShow();
#else
m_view.error_message->setText(i18n("Buttons overlapping"));
m_view.error_message->setHidden(false);
#endif
return false;
}
}
......@@ -159,19 +173,35 @@ bool DvdWizardMenu::isComplete() const
}
if (buttonCount == 0) {
//We need at least one button
#if KDE_IS_VERSION(4,7,0)
m_menuMessage->setText(i18n("No button in menu"));
m_menuMessage->setMessageType(KMessageWidget::Warning);
m_menuMessage->animatedShow();
#else
m_view.error_message->setText(i18n("No button in menu"));
m_view.error_message->setHidden(false);
#endif
return false;
}
if (!m_view.background_image->isHidden()) {
// Make sure user selected a valid image / video file
if (!QFile::exists(m_view.background_image->url().path())) {
#if KDE_IS_VERSION(4,7,0)
m_menuMessage->setText(i18n("Missing background image"));
m_menuMessage->setMessageType(KMessageWidget::Warning);
m_menuMessage->animatedShow();
#else
m_view.error_message->setText(i18n("Missing background image"));
m_view.error_message->setHidden(false);
#endif
return false;
}
}
#if KDE_IS_VERSION(4,7,0)
m_menuMessage->animatedHide();
#endif
// check that we have a "Play all" entry
if (targets.contains(0)) return true;
......@@ -179,8 +209,14 @@ bool DvdWizardMenu::isComplete() const
for (int i = m_view.target_list->count() - 1; i > 0; i--) {
// If there is a vob file entry and it has no button assigned, don't allow to go further
if (m_view.target_list->itemIcon(i).isNull() == false && !targets.contains(i)) {
#if KDE_IS_VERSION(4,7,0)
m_menuMessage->setText(i18n("No menu entry for %1", m_view.target_list->itemText(i)));
m_menuMessage->setMessageType(KMessageWidget::Warning);
m_menuMessage->animatedShow();
#else
m_view.error_message->setText(i18n("No menu entry for %1", m_view.target_list->itemText(i)));
m_view.error_message->setHidden(false);
#endif
return false;
}
}
......
......@@ -29,6 +29,11 @@
#include <QDomElement>
#include <KDebug>
#include <kdeversion.h>
#if KDE_IS_VERSION(4,7,0)
#include <KMessageWidget>
#endif
#include "ui_dvdwizardmenu_ui.h"
......@@ -149,6 +154,9 @@ private:
QGraphicsRectItem *m_safeRect;
int m_width;
int m_height;
#if KDE_IS_VERSION(4,7,0)
KMessageWidget *m_menuMessage;
#endif
private slots:
void buildButton();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment