X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fdvdwizardvob.cpp;h=a9dbfc67ebd0dddd3ba794bf8fb9063f853ac9fd;hb=982e28b36ad958735f227c4fb29dcbe447f1abb0;hp=2e8797add0bb55f3bfe342296bc269c172226ef5;hpb=5972b11e71d08b5bfdd92fb97cb3ad864f3970fd;p=kdenlive diff --git a/src/dvdwizardvob.cpp b/src/dvdwizardvob.cpp index 2e8797ad..a9dbfc67 100644 --- a/src/dvdwizardvob.cpp +++ b/src/dvdwizardvob.cpp @@ -17,39 +17,65 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ +#include "dvdwizardvob.h" + #include #include +#include +#include -#include "dvdwizardvob.h" +#include -DvdWizardVob::DvdWizardVob(QWidget *parent): QWizardPage(parent) { +DvdWizardVob::DvdWizardVob(QWidget *parent) : + QWizardPage(parent) +{ m_view.setupUi(this); m_view.intro_vob->setEnabled(false); m_view.vob_1->setFilter("video/mpeg"); m_view.intro_vob->setFilter("video/mpeg"); connect(m_view.use_intro, SIGNAL(toggled(bool)), m_view.intro_vob, SLOT(setEnabled(bool))); connect(m_view.vob_1, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckVobList(const QString &))); + if (KStandardDirs::findExe("dvdauthor").isEmpty()) m_errorMessage.append(i18n("Program %1 is required for the DVD wizard.", i18n("dvdauthor"))); + if (KStandardDirs::findExe("mkisofs").isEmpty()) m_errorMessage.append(i18n("Program %1 is required for the DVD wizard.", i18n("mkisofs"))); + if (m_errorMessage.isEmpty()) m_view.error_message->setVisible(false); + else m_view.error_message->setText(m_errorMessage); +#if KDE_IS_VERSION(4,2,0) + m_capacityBar = new KCapacityBar(KCapacityBar::DrawTextInline, this); + QHBoxLayout *layout = new QHBoxLayout; + layout->addWidget(m_capacityBar); + m_view.size_box->setLayout(layout); +#else + m_view.size_box->setHidden(true); +#endif } -DvdWizardVob::~DvdWizardVob() { +DvdWizardVob::~DvdWizardVob() +{ QList allUrls = m_view.vob_list->findChildren(); qDeleteAll(allUrls); +#if KDE_IS_VERSION(4,2,0) + delete m_capacityBar; +#endif } // virtual -bool DvdWizardVob::isComplete() const { +bool DvdWizardVob::isComplete() const +{ + if (!m_view.error_message->text().isEmpty()) return false; if (m_view.vob_1->url().path().isEmpty()) return false; if (QFile::exists(m_view.vob_1->url().path())) return true; return false; } -void DvdWizardVob::setUrl(const QString &url) { +void DvdWizardVob::setUrl(const QString &url) +{ m_view.vob_1->setPath(url); } -QStringList DvdWizardVob::selectedUrls() const { +QStringList DvdWizardVob::selectedUrls() const +{ QStringList result; QList allUrls = m_view.vob_list->findChildren(); for (int i = 0; i < allUrls.count(); i++) { @@ -57,9 +83,17 @@ QStringList DvdWizardVob::selectedUrls() const { result.append(allUrls.at(i)->url().path()); } } + return result; +} + +QString DvdWizardVob::introMovie() const +{ + if (!m_view.use_intro->isChecked()) return QString(); + return m_view.intro_vob->url().path(); } -void DvdWizardVob::slotCheckVobList(const QString &text) { +void DvdWizardVob::slotCheckVobList(const QString &text) +{ emit completeChanged(); QList allUrls = m_view.vob_list->findChildren(); int count = allUrls.count(); @@ -74,8 +108,7 @@ void DvdWizardVob::slotCheckVobList(const QString &text) { } else if (text.isEmpty()) { if (allUrls.at(count - 1)->url().path().isEmpty() && allUrls.at(count - 2)->url().path().isEmpty()) { // The last 2 urlrequesters are empty, remove last one - KUrlRequester *vob = allUrls.takeLast(); - delete vob; + delete allUrls.takeLast(); } } else { if (allUrls.at(count - 1)->url().path().isEmpty()) return; @@ -84,5 +117,16 @@ void DvdWizardVob::slotCheckVobList(const QString &text) { m_view.vob_list->layout()->addWidget(vob); connect(vob, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckVobList(const QString &))); } + qint64 maxSize = (qint64) 47000 * 100000; + qint64 totalSize = 0; + for (int i = 0; i < allUrls.count(); i++) { + QFile f(allUrls.at(i)->url().path()); + totalSize += f.size(); + } + +#if KDE_IS_VERSION(4,2,0) + m_capacityBar->setValue(100 * totalSize / maxSize); + m_capacityBar->setText(KIO::convertSize(totalSize)); +#endif }