widgets/smconfig_ui.ui
widgets/bezierspline_ui.ui
widgets/monitoreditwidget_ui.ui
+ widgets/archivewidget_ui.ui
)
set(kdenlive_SRCS
simplekeyframes/simpletimelinewidget.cpp
simplekeyframes/simplekeyframewidget.cpp
noteswidget.cpp
+ archivewidget.cpp
)
add_definitions(${KDE4_DEFINITIONS})
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2011 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+
+#include "archivewidget.h"
+#include "titlewidget.h"
+
+#include <KLocale>
+#include <KDiskFreeSpaceInfo>
+#include <KUrlRequester>
+#include <KFileDialog>
+
+#include <KDebug>
+#include <QListWidget>
+#include "projectsettings.h"
+
+
+ArchiveWidget::ArchiveWidget(QList <DocClipBase*> list, QStringList lumas, QWidget * parent) :
+ QDialog(parent),
+ m_requestedSize(0),
+ m_copyJob(NULL)
+{
+ setupUi(this);
+ setWindowTitle(i18n("Archive Project"));
+ archive_url->setUrl(KUrl(QDir::homePath()));
+ connect(archive_url, SIGNAL(textChanged (const QString &)), this, SLOT(slotCheckSpace()));
+
+ // process all files
+ QStringList allFonts;
+ foreach(const QString & file, lumas) {
+ kDebug()<<"LUMA: "<<file;
+ files_list->addItem(file);
+ m_requestedSize += QFileInfo(file).size();
+ }
+
+ for (int i = 0; i < list.count(); i++) {
+ DocClipBase *clip = list.at(i);
+ if (clip->clipType() == SLIDESHOW) {
+ QStringList subfiles = ProjectSettings::extractSlideshowUrls(clip->fileURL());
+ foreach(const QString & file, subfiles) {
+ kDebug()<<"SLIDE: "<<file;
+ files_list->addItem(file);
+ m_requestedSize += QFileInfo(file).size();
+ }
+ } else if (!clip->fileURL().isEmpty()) {
+ files_list->addItem(clip->fileURL().path());
+ m_requestedSize += QFileInfo(clip->fileURL().path()).size();
+ }
+ if (clip->clipType() == TEXT) {
+ QStringList imagefiles = TitleWidget::extractImageList(clip->getProperty("xmldata"));
+ QStringList fonts = TitleWidget::extractFontList(clip->getProperty("xmldata"));
+ foreach(const QString & file, imagefiles) {
+ kDebug()<<"TXT IMAGE: "<<file;
+ files_list->addItem(file);
+ m_requestedSize += QFileInfo(file).size();
+ }
+ allFonts << fonts;
+ } else if (clip->clipType() == PLAYLIST) {
+ QStringList files = ProjectSettings::extractPlaylistUrls(clip->fileURL().path());
+ foreach(const QString & file, files) {
+ kDebug()<<"PLAYLIST: "<<file;
+ files_list->addItem(file);
+ m_requestedSize += QFileInfo(file).size();
+ }
+ }
+ }
+#if QT_VERSION >= 0x040500
+ allFonts.removeDuplicates();
+#endif
+ project_files->setText(i18n("%1 files to archive, requires %2", files_list->count(), KIO::convertSize(m_requestedSize)));
+ buttonBox->button(QDialogButtonBox::Apply)->setText(i18n("Archive"));
+ connect(buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(slotStartArchiving()));
+ buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
+
+ slotCheckSpace();
+}
+
+ArchiveWidget::~ArchiveWidget()
+{
+}
+
+void ArchiveWidget::slotCheckSpace()
+{
+ KDiskFreeSpaceInfo inf = KDiskFreeSpaceInfo::freeSpaceInfo( archive_url->url().path());
+ KIO::filesize_t freeSize = inf.available();;
+ if (freeSize > m_requestedSize) {
+ // everything is ok
+ buttonBox->button(QDialogButtonBox::Apply)->setEnabled(true);
+ icon_info->setPixmap(KIcon("dialog-ok").pixmap(16, 16));
+ text_info->setText(i18n("Available space on drive: %1", KIO::convertSize(freeSize)));
+ }
+ else {
+ buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
+ icon_info->setPixmap(KIcon("dialog-close").pixmap(16, 16));
+ text_info->setText(i18n("Not enough space on drive, free space: %1", KIO::convertSize(freeSize)));
+ }
+}
+
+void ArchiveWidget::slotStartArchiving()
+{
+ if (m_copyJob) {
+ // archiving in progress, abort
+ m_copyJob->kill(KJob::EmitResult);
+ return;
+ }
+ KUrl::List files;
+ for (int i = 0; i < files_list->count(); i++) {
+ if (files_list->item(i))
+ files << KUrl(files_list->item(i)->text());
+ }
+
+ progressBar->setValue(0);
+ buttonBox->button(QDialogButtonBox::Apply)->setText(i18n("Abort"));
+ m_copyJob = KIO::copy (files, archive_url->url(), KIO::HideProgressInfo);
+ connect(m_copyJob, SIGNAL(result(KJob *)), this, SLOT(slotArchivingFinished(KJob *)));
+ connect(m_copyJob, SIGNAL(processedSize(KJob *, qulonglong)), this, SLOT(slotArchivingProgress(KJob *, qulonglong)));
+}
+
+void ArchiveWidget::slotArchivingFinished(KJob *job)
+{
+ progressBar->setValue(100);
+ buttonBox->button(QDialogButtonBox::Apply)->setText(i18n("Archive"));
+ if (job->error() == 0) text_info->setText(i18n("Project was successfully archived."));
+ else {
+ icon_info->setPixmap(KIcon("dialog-close").pixmap(16, 16));
+ text_info->setText(i18n("There was an error while copying the files: %1", job->errorString()));
+ }
+ m_copyJob = NULL;
+}
+
+void ArchiveWidget::slotArchivingProgress(KJob *, qulonglong size)
+{
+ progressBar->setValue((int) 100 * size / m_requestedSize);
+}
+
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2011 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+
+#ifndef ARCHIVEWIDGET_H
+#define ARCHIVEWIDGET_H
+
+
+#include "ui_archivewidget_ui.h"
+#include "docclipbase.h"
+
+#include <KDialog>
+#include <kio/global.h>
+#include <QLabel>
+#include <QList>
+#include <KIO/Job>
+#include <KIO/CopyJob>
+
+class KJob;
+
+/**
+ * @class ArchiveWidget
+ * @brief A widget allowing to archive a project (copy all project files to a new location)
+ * @author Jean-Baptiste Mardelle
+ */
+
+class ArchiveWidget : public QDialog, public Ui::ArchiveWidget_UI
+{
+ Q_OBJECT
+
+public:
+ ArchiveWidget(QList <DocClipBase*> list, QStringList lumas, QWidget * parent = 0);
+ ~ArchiveWidget();
+
+private slots:
+ void slotCheckSpace();
+ void slotStartArchiving();
+ void slotArchivingFinished(KJob *job);
+ void slotArchivingProgress(KJob *, qulonglong);
+
+private:
+ KIO::filesize_t m_requestedSize;
+ KIO::CopyJob *m_copyJob;
+
+signals:
+
+};
+
+
+#endif
+
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<gui name="kdenlive" version="60">
+<gui name="kdenlive" version="61">
<ToolBar name="extraToolBar" >
<text>Extra Toolbar</text>
<Action name="project_render" />
<Menu name="file" >
<Action name="dvd_wizard" />
<Action name="transcode_clip" />
+ <Action name="archive_project" />
</Menu>
<Menu name="edit" >
#include "colorscopes/histogram.h"
#include "audiospectrum.h"
#include "spectrogram.h"
+#include "archivewidget.h"
#include <KApplication>
#include <KAction>
collection.addAction("transcode_clip", transcodeClip);
connect(transcodeClip, SIGNAL(triggered(bool)), this, SLOT(slotTranscodeClip()));
+ KAction *archiveProject = new KAction(KIcon("file-save"), i18n("Archive Project"), this);
+ collection.addAction("archive_project", archiveProject);
+ connect(archiveProject, SIGNAL(triggered(bool)), this, SLOT(slotArchiveProject()));
+
+
KAction *markIn = collection.addAction("mark_in");
markIn->setText(i18n("Set Zone In"));
markIn->setShortcut(Qt::Key_I);
m_notesWidget->insertHtml("<a href=\"" + QString::number(frames) + "\">" + position + "</a> ");
}
+void MainWindow::slotArchiveProject()
+{
+ QList <DocClipBase*> list = m_projectList->documentClipList();
+ ArchiveWidget *d = new ArchiveWidget(list, m_activeTimeline->projectView()->extractTransitionsLumas(), this);
+ d->exec();
+}
+
+
#include "mainwindow.moc"
#ifdef DEBUG_MAINW
void slotMaximizeCurrent(bool show);
void slotTranscode(KUrl::List urls = KUrl::List());
void slotTranscodeClip();
+ /** @brief Archive project: creates a copy of the project file with all clips in a new folder. */
+ void slotArchiveProject();
void slotSetDocumentRenderProfile(QMap <QString, QString> props);
void slotPrepareRendering(bool scriptExport, bool zoneOnly, const QString &chapterFile);
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ArchiveWidget_UI</class>
+ <widget class="QDialog" name="ArchiveWidget_UI">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>320</width>
+ <height>220</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0" colspan="2">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Archive folder</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KUrlRequester" name="archive_url">
+ <property name="mode">
+ <set>KFile::Directory</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="icon_info">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="text_info">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QLabel" name="project_files">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2">
+ <widget class="QListWidget" name="files_list"/>
+ </item>
+ <item row="4" column="0">
+ <widget class="QProgressBar" name="progressBar">
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ <item row="4" 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>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KUrlRequester</class>
+ <extends>QFrame</extends>
+ <header>kurlrequester.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>ArchiveWidget_UI</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>ArchiveWidget_UI</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>