#include <KDebug>
#include <KApplication>
#include <kio/directorysizejob.h>
+#if KDE_IS_VERSION(4,7,0)
+#include <KMessageWidget>
+#endif
#include <QTreeWidget>
#include <QtConcurrentRun>
m_doc(doc),
m_abortArchive(false),
m_extractMode(false),
- m_extractArchive(NULL)
+ m_extractArchive(NULL),
+ m_missingClips(0)
{
setAttribute(Qt::WA_DeleteOnClose);
setupUi(this);
texts->setIcon(0, KIcon("text-plain"));
texts->setData(0, Qt::UserRole, "texts");
texts->setExpanded(false);
+ QTreeWidgetItem *playlists = new QTreeWidgetItem(files_list, QStringList() << i18n("Playlist clips"));
+ playlists->setIcon(0, KIcon("video-mlt-playlist"));
+ playlists->setData(0, Qt::UserRole, "playlist");
+ playlists->setExpanded(false);
QTreeWidgetItem *others = new QTreeWidgetItem(files_list, QStringList() << i18n("Other clips"));
others->setIcon(0, KIcon("unknown"));
others->setData(0, Qt::UserRole, "others");
QStringList videoUrls;
QStringList imageUrls;
QStringList otherUrls;
+ QStringList playlistUrls;
QStringList proxyUrls;
for (int i = 0; i < list.count(); i++) {
imageUrls << imagefiles;
allFonts << fonts;
} else if (t == PLAYLIST) {
+ playlistUrls << clip->fileURL().path();
QStringList files = ProjectSettings::extractPlaylistUrls(clip->fileURL().path());
otherUrls << files;
}
generateItems(videos, videoUrls);
generateItems(images, imageUrls);
generateItems(slideshows, slideUrls);
+ generateItems(playlists, playlistUrls);
generateItems(others, otherUrls);
generateItems(proxies, proxyUrls);
allFonts.removeDuplicates();
+#if KDE_IS_VERSION(4,7,0)
+ m_infoMessage = new KMessageWidget(this);
+ QVBoxLayout *s = static_cast <QVBoxLayout*> (layout());
+ s->insertWidget(5, m_infoMessage);
+ m_infoMessage->setCloseButtonVisible(false);
+ m_infoMessage->setWordWrap(true);
+ m_infoMessage->hide();
+#endif
+
+ // missing clips, warn user
+ if (m_missingClips > 0) {
+ QString infoText = i18np("You have %1 missing clip in your project.", "You have %1 missing clips in your project.", m_missingClips);
+#if KDE_IS_VERSION(4,7,0)
+ m_infoMessage->setMessageType(KMessageWidget::Warning);
+ m_infoMessage->setText(infoText);
+ m_infoMessage->animatedShow();
+#else
+ KMessageBox::sorry(this, infoText);
+#endif
+ }
+
//TODO: fonts
// Hide unused categories, add item count
buttonBox->button(QDialogButtonBox::Apply)->setText(i18n("Archive"));
connect(buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(slotStartArchiving()));
buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
-
+
slotCheckSpace();
}
archive_url->setUrl(KUrl(QDir::homePath()));
buttonBox->button(QDialogButtonBox::Apply)->setText(i18n("Extract"));
connect(buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(slotStartExtracting()));
- buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
+ buttonBox->button(QDialogButtonBox::Apply)->setEnabled(true);
adjustSize();
m_archiveThread = QtConcurrent::run(this, &ArchiveWidget::openArchiveForExtraction);
}
}
void ArchiveWidget::slotDisplayMessage(const QString &icon, const QString &text)
-{
+{
icon_info->setPixmap(KIcon(icon).pixmap(16, 16));
text_info->setText(text);
}
+void ArchiveWidget::slotJobResult(bool success, const QString &text)
+{
+#if KDE_IS_VERSION(4,7,0)
+ m_infoMessage->setMessageType(success ? KMessageWidget::Positive : KMessageWidget::Warning);
+ m_infoMessage->setText(text);
+ m_infoMessage->animatedShow();
+#else
+ if (success) icon_info->setPixmap(KIcon("dialog-ok").pixmap(16, 16));
+ else icon_info->setPixmap(KIcon("dialog-close").pixmap(16, 16));
+ text_info->setText(text);
+#endif
+}
+
void ArchiveWidget::openArchiveForExtraction()
{
emit showMessage("system-run", i18n("Opening archive..."));
item->setData(0, Qt::UserRole, fileName);
}
if (!isSlideshow) {
- m_requestedSize += QFileInfo(file).size();
+ qint64 fileSize = QFileInfo(file).size();
+ if (fileSize <= 0) {
+ item->setIcon(0, KIcon("edit-delete"));
+ m_missingClips++;
+ }
+ else m_requestedSize += fileSize;
filesList << fileName;
}
}
// Archiving finished
progressBar->setValue(100);
if (processProjectFile()) {
- slotDisplayMessage("dialog-ok", i18n("Project was successfully archived."));
+ slotJobResult(true, i18n("Project was successfully archived."));
}
else {
- slotDisplayMessage("dialog-close", i18n("There was an error processing project file"));
+ slotJobResult(false, i18n("There was an error processing project file"));
}
} else processProjectFile();
}
else {
m_copyJob = NULL;
- slotDisplayMessage("dialog-close", i18n("There was an error while copying the files: %1", job->errorString()));
+ slotJobResult(false, i18n("There was an error while copying the files: %1", job->errorString()));
}
if (!compressed_archive->isChecked()) {
buttonBox->button(QDialogButtonBox::Apply)->setText(i18n("Archive"));
void ArchiveWidget::slotArchivingFinished(bool result)
{
if (result) {
- slotDisplayMessage("dialog-ok", i18n("Project was successfully archived."));
+ slotJobResult(true, i18n("Project was successfully archived."));
+ buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
}
else {
- slotDisplayMessage("dialog-close", i18n("There was an error processing project file"));
+ slotJobResult(false, i18n("There was an error processing project file"));
}
progressBar->setValue(100);
buttonBox->button(QDialogButtonBox::Apply)->setText(i18n("Archive"));
QTreeWidgetItem *texts = new QTreeWidgetItem(files_list, QStringList() << i18n("Text clips"));
texts->setIcon(0, KIcon("text-plain"));
texts->setExpanded(true);
+ QTreeWidgetItem *playlists = new QTreeWidgetItem(files_list, QStringList() << i18n("Playlist clips"));
+ playlists->setIcon(0, KIcon("video-mlt-playlist"));
+ playlists->setExpanded(true);
QTreeWidgetItem *others = new QTreeWidgetItem(files_list, QStringList() << i18n("Other clips"));
others->setIcon(0, KIcon("unknown"));
others->setExpanded(true);
case IMAGE:
new QTreeWidgetItem(images, QStringList() << clip->fileURL().path());
break;
+ case PLAYLIST:
+ new QTreeWidgetItem(playlists, QStringList() << clip->fileURL().path());
+ break;
case UNKNOWN:
new QTreeWidgetItem(others, QStringList() << clip->fileURL().path());
break;
QString type = EffectsList::property(e, "mlt_service");
if (type != "colour") {
QString url = EffectsList::property(e, "resource");
+ if (type == "framebuffer") {
+ url = url.section('?', 0, 0);
+ }
if (!url.isEmpty()) {
if (!url.startsWith('/')) url.prepend(root);
if (url.section('.', 0, -2).endsWith("/.all")) {
<rect>
<x>0</x>
<y>0</y>
- <width>263</width>
- <height>197</height>
+ <width>266</width>
+ <height>219</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="2">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string/>
<property name="flat">
<bool>true</bool>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <property name="margin">
- <number>0</number>
- </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
</layout>
</widget>
</item>
- <item row="1" column="0" colspan="2">
+ <item>
<widget class="QCheckBox" name="compressed_archive">
<property name="text">
<string>Compressed archive</string>
</property>
</widget>
</item>
- <item row="2" column="0" colspan="2">
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="icon_info">
<property name="sizePolicy">
</item>
</layout>
</item>
- <item row="3" column="0" colspan="2">
+ <item>
<widget class="QLabel" name="project_files">
<property name="text">
<string/>
</property>
</widget>
</item>
- <item row="4" column="0" colspan="2">
+ <item>
<widget class="QTreeWidget" name="files_list">
<property name="alternatingRowColors">
<bool>true</bool>
</column>
</widget>
</item>
- <item row="5" column="0">
- <widget class="QProgressBar" name="progressBar">
- <property name="value">
- <number>0</number>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Apply|QDialogButtonBox::Close</set>
- </property>
- </widget>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QProgressBar" name="progressBar">
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Apply|QDialogButtonBox::Close</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</widget>