1 /***************************************************************************
2 * Copyright (C) 2011 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
21 #ifndef ARCHIVEWIDGET_H
22 #define ARCHIVEWIDGET_H
25 #include "ui_archivewidget_ui.h"
26 #include "docclipbase.h"
28 #include <kio/global.h>
32 #include <KIO/CopyJob>
33 #include <KTemporaryFile>
39 * @class ArchiveWidget
40 * @brief A widget allowing to archive a project (copy all project files to a new location)
41 * @author Jean-Baptiste Mardelle
44 class ArchiveWidget : public QDialog, public Ui::ArchiveWidget_UI
49 ArchiveWidget(QString projectName, QDomDocument doc, QList <DocClipBase*> list, QStringList luma_list, QWidget * parent = 0);
50 // Constructor for extracting widget
51 ArchiveWidget(const KUrl &url, QWidget * parent = 0);
54 QString extractedProjectFile();
57 void slotCheckSpace();
58 bool slotStartArchiving(bool firstPass = true);
59 void slotArchivingFinished(KJob *job = NULL);
60 void slotArchivingProgress(KJob *, qulonglong);
61 virtual void done ( int r );
64 void slotArchivingProgress(int);
65 void slotArchivingFinished(bool result);
66 void slotStartExtracting();
68 void slotExtractingFinished();
69 void slotExtractProgress();
70 void slotGotProgress(KJob*);
71 void openArchiveForExtraction();
72 void slotDisplayMessage(const QString &icon, const QString &text);
75 virtual void closeEvent ( QCloseEvent * e );
78 KIO::filesize_t m_requestedSize;
79 KIO::CopyJob *m_copyJob;
80 QMap <KUrl, KUrl> m_duplicateFiles;
81 QMap <KUrl, KUrl> m_replacementList;
84 KTemporaryFile *m_temp;
86 QFuture<void> m_archiveThread;
87 QStringList m_foldersList;
88 QMap <QString, QString> m_filesList;
91 QString m_projectName;
92 QTimer *m_progressTimer;
93 KArchive *m_extractArchive;
95 /** @brief Generate tree widget subitems from a string list of urls. */
96 void generateItems(QTreeWidgetItem *parentItem, QStringList items);
97 /** @brief Replace urls in project file. */
98 bool processProjectFile();
101 void archivingFinished(bool);
102 void archiveProgress(int);
103 void extractingFinished();
104 void showMessage(const QString &, const QString &);