Commit 0f367c64 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Move away from QUrl, use toLocalFile() instead of path() when requested

parent d9bd1c56
......@@ -485,7 +485,7 @@ Bin::Bin(QWidget* parent) :
connect(m_infoMessage, SIGNAL(messageClosing()), this, SLOT(slotResetInfoMessage()));
//m_infoMessage->setWordWrap(true);
m_infoMessage->hide();
connect(this, SIGNAL(requesteInvalidRemoval(QString,QUrl,QString)), this, SLOT(slotQueryRemoval(QString,QUrl,QString)));
connect(this, SIGNAL(requesteInvalidRemoval(QString,QString,QString)), this, SLOT(slotQueryRemoval(QString,QString,QString)));
connect(this, &Bin::refreshAudioThumbs, this, &Bin::doRefreshAudioThumbs);
connect(this, SIGNAL(displayBinMessage(QString,KMessageWidget::MessageType)), this, SLOT(doDisplayMessage(QString,KMessageWidget::MessageType)));
}
......@@ -761,7 +761,7 @@ void Bin::deleteClip(const QString &id)
}
m_jobManager->discardJobs(id);
ClipType type = clip->clipType();
QString url = clip->url().toLocalFile();
QString url = clip->url();
clip->setClipStatus(AbstractProjectItem::StatusDeleting);
AbstractProjectItem *parent = clip->parent();
parent->removeChild(clip);
......@@ -890,7 +890,7 @@ void Bin::slotReloadClip()
emit openClip(NULL);
if (currentItem->clipType() == Playlist) {
//Check if a clip inside playlist is missing
QString path = currentItem->url().path();
QString path = currentItem->url();
QFile f(path);
QDomDocument doc;
doc.setContent(&f, false);
......@@ -933,7 +933,7 @@ void Bin::slotLocateClip()
AbstractProjectItem *item = static_cast<AbstractProjectItem*>(m_proxyModel->mapToSource(ix).internalPointer());
ProjectClip *currentItem = qobject_cast<ProjectClip*>(item);
if (currentItem) {
QUrl url = currentItem->url().adjusted(QUrl::RemoveFilename);
QUrl url = QUrl::fromLocalFile(currentItem->url()).adjusted(QUrl::RemoveFilename);
bool exists = QFile(url.toLocalFile()).exists();
if (currentItem->hasUrl() && exists) {
QDesktopServices::openUrl(url);
......@@ -2564,7 +2564,7 @@ void Bin::slotItemDropped(const QList<QUrl>&urls, const QModelIndex &parent)
if (type.inherits(QStringLiteral("inode/directory"))) {
// user dropped a folder, import its files
clipsToAdd.removeAll(file);
QDir dir(file.path());
QDir dir(file.toLocalFile());
QStringList result = dir.entryList(QDir::Files);
QList <QUrl> folderFiles;
foreach(const QString & path, result) {
......@@ -2586,17 +2586,17 @@ void Bin::slotItemDropped(const QList<QUrl>&urls, const QModelIndex &parent)
}
}
void Bin::slotExpandUrl(ItemInfo info, QUrl url, QUndoCommand *command)
void Bin::slotExpandUrl(ItemInfo info, const QString &url, QUndoCommand *command)
{
QStringList folderInfo;
// Create folder to hold imported clips
QString folderName = url.fileName().section(QLatin1Char('.'), 0, 0);
QString folderName = QFileInfo(url).fileName().section(QLatin1Char('.'), 0, 0);
QString folderId = QString::number(getFreeFolderId());
new AddBinFolderCommand(this, folderId, folderName.isEmpty() ? i18n("Folder") : folderName, m_rootFolder->clipId(), false, command);
// Parse playlist clips
QDomDocument doc;
QFile file(url.path());
QFile file(url);
doc.setContent(&file, false);
file.close();
bool invalid = false;
......@@ -2606,12 +2606,12 @@ void Bin::slotExpandUrl(ItemInfo info, QUrl url, QUndoCommand *command)
QDomNodeList producers = doc.documentElement().elementsByTagName("producer");
QDomNodeList tracks = doc.documentElement().elementsByTagName("track");
if (invalid || producers.isEmpty()) {
doDisplayMessage(i18n("Playlist clip %1 is invalid.", url.fileName()), KMessageWidget::Warning);
doDisplayMessage(i18n("Playlist clip %1 is invalid.", QFileInfo(url).fileName()), KMessageWidget::Warning);
delete command;
return;
}
if (tracks.count() > pCore->projectManager()->currentTimeline()->visibleTracksCount() + 1) {
doDisplayMessage(i18n("Playlist clip %1 has too many tracks (%2) to be imported. Add new tracks to your project.", url.fileName(), tracks.count()), KMessageWidget::Warning);
doDisplayMessage(i18n("Playlist clip %1 has too many tracks (%2) to be imported. Add new tracks to your project.", QFileInfo(url).fileName(), tracks.count()), KMessageWidget::Warning);
delete command;
return;
}
......@@ -2868,7 +2868,7 @@ void Bin::slotStartFilterJob(const ItemInfo &info, const QString&id, QMap <QStri
if (!clip) return;
QMap <QString, QString> producerParams = QMap <QString, QString> ();
producerParams.insert(QStringLiteral("producer"), clip->url().path());
producerParams.insert(QStringLiteral("producer"), clip->url());
if (info.cropDuration != GenTime()) {
producerParams.insert(QStringLiteral("in"), QString::number((int) info.cropStart.frames(m_doc->fps())));
producerParams.insert(QStringLiteral("out"), QString::number((int) (info.cropStart + info.cropDuration).frames(m_doc->fps())));
......@@ -2901,13 +2901,13 @@ void Bin::slotOpenClip()
if (KdenliveSettings::defaultimageapp().isEmpty())
KMessageBox::sorry(QApplication::activeWindow(), i18n("Please set a default application to open images in the Settings dialog"));
else
QProcess::startDetached(KdenliveSettings::defaultimageapp(), QStringList() << clip->url().path());
QProcess::startDetached(KdenliveSettings::defaultimageapp(), QStringList() << clip->url());
break;
case Audio:
if (KdenliveSettings::defaultaudioapp().isEmpty())
KMessageBox::sorry(QApplication::activeWindow(), i18n("Please set a default application to open audio files in the Settings dialog"));
else
QProcess::startDetached(KdenliveSettings::defaultaudioapp(), QStringList() << clip->url().path());
QProcess::startDetached(KdenliveSettings::defaultaudioapp(), QStringList() << clip->url());
break;
default:
break;
......@@ -3313,10 +3313,10 @@ void Bin::slotShowDescColumn(bool show)
}
}
void Bin::slotQueryRemoval(const QString &id, QUrl url, const QString &errorMessage)
void Bin::slotQueryRemoval(const QString &id, const QString &url, const QString &errorMessage)
{
if (m_invalidClipDialog) {
if (!url.isEmpty()) m_invalidClipDialog->addClip(id, url.toLocalFile());
if (!url.isEmpty()) m_invalidClipDialog->addClip(id, url);
return;
}
QString message = i18n("Clip is invalid, will be removed from project.");
......@@ -3324,7 +3324,7 @@ void Bin::slotQueryRemoval(const QString &id, QUrl url, const QString &errorMess
message.append("\n" + errorMessage);
}
m_invalidClipDialog = new InvalidDialog(i18n("Invalid clip"), message, true, this);
m_invalidClipDialog->addClip(id, url.toLocalFile());
m_invalidClipDialog->addClip(id, url);
int result = m_invalidClipDialog->exec();
if (result == QDialog::Accepted) {
QStringList ids = m_invalidClipDialog->getIds();
......@@ -3372,7 +3372,8 @@ void Bin::updateTimelineProducers(const QString &id, QMap <QString, QString> pas
void Bin::showSlideshowWidget(ProjectClip *clip)
{
QString folder = clip->url().adjusted(QUrl::RemoveFilename).path();
QString folder = QFileInfo(clip->url()).absolutePath();
qDebug()<<" ** * CLIP ABS PATH: "<<clip->url()<<" = "<<folder;
SlideshowClip *dia = new SlideshowClip(m_doc->timecode(), folder, clip, this);
if (dia->exec() == QDialog::Accepted) {
// edit clip properties
......
......@@ -570,7 +570,7 @@ private slots:
/** @brief Reset all text and log data from info message widget. */
void slotResetInfoMessage();
/** @brief Show dialog prompting for removal of invalid clips. */
void slotQueryRemoval(const QString &id, QUrl url, const QString &errorMessage);
void slotQueryRemoval(const QString &id, const QString &url, const QString &errorMessage);
/** @brief Request display of current clip in monitor. */
void slotOpenCurrent();
void slotZoomView(bool zoomIn);
......@@ -645,7 +645,7 @@ public slots:
void slotEffectDropped(QString id, QDomElement);
/** @brief Request current frame from project monitor. */
void slotGetCurrentProjectImage(bool request);
void slotExpandUrl(ItemInfo info, QUrl url, QUndoCommand *command);
void slotExpandUrl(ItemInfo info, const QString &url, QUndoCommand *command);
void abortAudioThumbs();
/** @brief Abort all ongoing operations to prepare close. */
void abortOperations();
......@@ -753,7 +753,7 @@ signals:
void masterClipUpdated(ClipController *, Monitor *);
void displayBinMessage(const QString &, KMessageWidget::MessageType);
void displayMessage(const QString &, int, MessageType);
void requesteInvalidRemoval(const QString &, QUrl, const QString &);
void requesteInvalidRemoval(const QString &, const QString &, const QString &);
/** @brief Markers changed, refresh panel. */
void refreshPanelMarkers();
/** @brief Analysis data changed, refresh panel. */
......
......@@ -86,13 +86,13 @@ ProjectClip::ProjectClip(const QDomElement& description, QIcon thumb, ProjectFol
m_thumbnail = KoIconUtils::themedIcon(QStringLiteral("audio-x-generic"));
}
}
m_temporaryUrl = QUrl::fromLocalFile(getXmlProperty(description, QStringLiteral("resource")));
m_temporaryUrl = getXmlProperty(description, QStringLiteral("resource"));
QString clipName = getXmlProperty(description, QStringLiteral("kdenlive:clipname"));
if (!clipName.isEmpty()) {
m_name = clipName;
}
else if (m_temporaryUrl.isValid()) {
m_name = m_temporaryUrl.fileName();
else if (!m_temporaryUrl.isEmpty()) {
m_name = QFileInfo(m_temporaryUrl).fileName();
}
else m_name = i18n("Untitled");
connect(this, &ProjectClip::updateJobStatus, this, &ProjectClip::setJobStatus);
......@@ -123,7 +123,7 @@ void ProjectClip::abortAudioThumbs()
QString ProjectClip::getToolTip() const
{
return url().toLocalFile();
return url();
}
QString ProjectClip::getXmlProperty(const QDomElement &producer, const QString &propertyName, const QString &defaultValue)
......@@ -238,11 +238,11 @@ ProjectClip* ProjectClip::clipAt(int ix)
bool ProjectClip::hasUrl() const
{
if (m_controller && (m_type != Color) && (m_type != Unknown)) return (m_controller->clipUrl().isValid());
if (m_controller && (m_type != Color) && (m_type != Unknown)) return (!m_controller->clipUrl().isEmpty());
return false;
}
QUrl ProjectClip::url() const
const QString ProjectClip::url() const
{
if (m_controller) return m_controller->clipUrl();
return m_temporaryUrl;
......@@ -297,7 +297,7 @@ QDomElement ProjectClip::toXml(QDomDocument& document, bool includeMeta)
// We only have very basic infos, like id and url, pass them
QDomElement prod = document.createElement(QStringLiteral("producer"));
prod.setAttribute(QStringLiteral("id"), m_id);
EffectsList::setProperty(prod, QStringLiteral("resource"), m_temporaryUrl.toLocalFile());
EffectsList::setProperty(prod, QStringLiteral("resource"), m_temporaryUrl);
if (m_type != Unknown) {
prod.setAttribute(QStringLiteral("type"), (int) m_type);
}
......@@ -535,7 +535,7 @@ const QString ProjectClip::getFileHash() const
QByteArray fileHash;
switch (m_type) {
case SlideShow:
fileData = m_controller ? m_controller->clipUrl().toLocalFile().toUtf8() : m_temporaryUrl.toLocalFile().toUtf8();
fileData = m_controller ? m_controller->clipUrl().toUtf8() : m_temporaryUrl.toUtf8();
fileHash = QCryptographicHash::hash(fileData, QCryptographicHash::Md5);
break;
case Text:
......@@ -551,7 +551,7 @@ const QString ProjectClip::getFileHash() const
fileHash = QCryptographicHash::hash(fileData, QCryptographicHash::Md5);
break;
default:
QFile file(m_controller ? m_controller->clipUrl().toLocalFile() : m_temporaryUrl.toLocalFile());
QFile file(m_controller ? m_controller->clipUrl() : m_temporaryUrl);
if (file.open(QIODevice::ReadOnly)) { // write size and hash only if resource points to a file
/*
* 1 MB = 1 second per 450 files (or faster)
......@@ -633,7 +633,7 @@ void ProjectClip::setProperties(QMap <QString, QString> properties, bool refresh
}
else {
// A proxy was requested, make sure to keep original url
setProducerProperty(QStringLiteral("kdenlive:originalurl"), url().toLocalFile());
setProducerProperty(QStringLiteral("kdenlive:originalurl"), url());
bin()->startJob(m_id, AbstractClipJob::PROXYJOB);
}
}
......@@ -858,7 +858,7 @@ void ProjectClip::doExtractIntra()
pos = m_intraThumbs.takeFirst();
m_intraThumbMutex.unlock();
if (pos >= max) pos = max - 1;
const QString path = url().toLocalFile() + '_' + QString::number(pos);
const QString path = url() + '_' + QString::number(pos);
QImage img = bin()->findCachedPixmap(path);
if (!img.isNull()) {
// Cache already contains image
......@@ -909,7 +909,7 @@ void ProjectClip::doExtractImage()
continue;
}
if (pos >= max) pos = max - 1;
const QString path = url().toLocalFile() + '_' + QString::number(pos);
const QString path = url() + '_' + QString::number(pos);
QImage img = bin()->findCachedPixmap(path);
if (!img.isNull()) {
emit thumbReady(pos, img);
......@@ -1314,7 +1314,7 @@ const QString ProjectClip::geometryWithOffset(const QString &data, int offset)
QImage ProjectClip::findCachedThumb(int pos)
{
const QString path = url().toLocalFile() + '_' + QString::number(pos);
const QString path = url() + '_' + QString::number(pos);
return bin()->findCachedPixmap(path);
}
......
......@@ -100,7 +100,7 @@ public:
bool hasUrl() const;
/** @brief Returns the clip's url. */
QUrl url() const;
const QString url() const;
/** @brief Returns whether this clip has a limited duration or whether it is resizable ad infinitum. */
virtual bool hasLimitedDuration() const;
......@@ -236,7 +236,7 @@ private:
/** @brief Generate and store file hash if not available. */
const QString getFileHash() const;
/** @brief Store clip url temporarily while the clip controller has not been created. */
QUrl m_temporaryUrl;
QString m_temporaryUrl;
ClipType m_type;
Mlt::Producer *m_thumbsProducer;
QMutex m_producerMutex;
......
......@@ -48,8 +48,8 @@ ManageCapturesDialog::ManageCapturesDialog(const QList<QUrl> &files, QWidget * p
file.setDelayedMimeTypes(true);
text << KIO::convertSize(file.size());
QTreeWidgetItem *item = new QTreeWidgetItem(m_view.treeWidget, text);
item->setData(0, Qt::UserRole, url.path());
item->setToolTip(0, url.path());
item->setData(0, Qt::UserRole, url.toLocalFile());
item->setToolTip(0, url.toLocalFile());
item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
item->setCheckState(0, Qt::Checked);
}
......
......@@ -231,7 +231,7 @@ void ClipCreationDialog::createSlideshowClip(KdenliveDoc *doc, QStringList group
if (dia->exec() == QDialog::Accepted) {
// Ready, create xml
KRecentDirs::add(QStringLiteral(":KdenliveSlideShowFolder"), QUrl::fromLocalFile(dia->selectedPath()).adjusted(QUrl::RemoveFilename).path());
KRecentDirs::add(QStringLiteral(":KdenliveSlideShowFolder"), QUrl::fromLocalFile(dia->selectedPath()).adjusted(QUrl::RemoveFilename).toLocalFile());
QDomDocument xml;
QDomElement prod = xml.createElement(QStringLiteral("producer"));
xml.appendChild(prod);
......@@ -445,7 +445,7 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QList<QUrl>
} else if (type.inherits(QStringLiteral("application/x-kdenlivetitle"))) {
// opening a title file
QDomDocument txtdoc(QStringLiteral("titledocument"));
QFile txtfile(file.path());
QFile txtfile(file.toLocalFile());
if (txtfile.open(QIODevice::ReadOnly) && txtdoc.setContent(&txtfile)) {
txtfile.close();
prod.setAttribute(QStringLiteral("type"), (int) Text);
......@@ -534,7 +534,7 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, QStringList groupI
KdenliveSettings::setAutoimagetransparency(c->isChecked());
list = fileWidget->selectedUrls();
if (!list.isEmpty()) {
KRecentDirs::add(QStringLiteral(":KdenliveClipFolder"), list.first().adjusted(QUrl::RemoveFilename).path());
KRecentDirs::add(QStringLiteral(":KdenliveClipFolder"), list.first().adjusted(QUrl::RemoveFilename).toLocalFile());
}
if (b->isChecked() && list.count() == 1) {
// Check for image sequence
......
......@@ -707,12 +707,12 @@ void KdenliveSettingsDialog::updateSettings()
updateCapturePath = true;
}
if (m_configProject.projecturl->url().path() != KdenliveSettings::defaultprojectfolder()) {
KdenliveSettings::setDefaultprojectfolder(m_configProject.projecturl->url().path());
if (m_configProject.projecturl->url().toLocalFile() != KdenliveSettings::defaultprojectfolder()) {
KdenliveSettings::setDefaultprojectfolder(m_configProject.projecturl->url().toLocalFile());
}
if (m_configEnv.capturefolderurl->url().path() != KdenliveSettings::capturefolder()) {
KdenliveSettings::setCapturefolder(m_configEnv.capturefolderurl->url().path());
if (m_configEnv.capturefolderurl->url().toLocalFile() != KdenliveSettings::capturefolder()) {
KdenliveSettings::setCapturefolder(m_configEnv.capturefolderurl->url().toLocalFile());
updateCapturePath = true;
}
......@@ -722,8 +722,8 @@ void KdenliveSettingsDialog::updateSettings()
updateLibrary = true;
}
if (m_configEnv.libraryfolderurl->url().path() != KdenliveSettings::libraryfolder()) {
KdenliveSettings::setLibraryfolder(m_configEnv.libraryfolderurl->url().path());
if (m_configEnv.libraryfolderurl->url().toLocalFile() != KdenliveSettings::libraryfolder()) {
KdenliveSettings::setLibraryfolder(m_configEnv.libraryfolderurl->url().toLocalFile());
if (!KdenliveSettings::librarytodefaultfolder()) {
updateLibrary = true;
}
......
......@@ -760,7 +760,7 @@ void KdenliveDoc::moveProjectData(const QString &/*src*/, const QString &dest)
ClipController *clip = list.at(i);
if (clip->clipType() == Text) {
// the image for title clip must be moved
QUrl oldUrl = clip->clipUrl();
QUrl oldUrl = QUrl::fromLocalFile(clip->clipUrl());
if (!oldUrl.isEmpty()) {
QUrl newUrl = QUrl::fromLocalFile(dest + QStringLiteral("/titles/") + oldUrl.fileName());
KIO::Job *job = KIO::copy(oldUrl, newUrl);
......@@ -1321,7 +1321,7 @@ void KdenliveDoc::slotProxyCurrentItem(bool doProxy, QList<ProjectClip *> clipLi
}
if (!pCore->binController()->hasClip(item->clipId())) {
// Force clip reload
newProps.insert(QStringLiteral("resource"), item->url().toLocalFile());
newProps.insert(QStringLiteral("resource"), item->url());
}
}
new EditClipCommand(pCore->bin(), item->clipId(), oldProps, newProps, true, masterCommand);
......@@ -1340,14 +1340,14 @@ void KdenliveDoc::slotProxyCurrentItem(bool doProxy, QList<ProjectClip *> clipLi
//TODO put all file watching stuff in own class
void KdenliveDoc::watchFile(const QUrl &url)
void KdenliveDoc::watchFile(const QString &url)
{
m_fileWatcher.addFile(url.toLocalFile());
m_fileWatcher.addFile(url);
}
void KdenliveDoc::slotClipModified(const QString &path)
{
QStringList ids = pCore->binController()->getBinIdsByResource(QUrl::fromLocalFile(path));
QStringList ids = pCore->binController()->getBinIdsByResource(QFileInfo(path));
foreach (const QString &id, ids) {
if (!m_modifiedClips.contains(id)) {
pCore->bin()->setWaitingStatus(id);
......@@ -1361,7 +1361,7 @@ void KdenliveDoc::slotClipModified(const QString &path)
void KdenliveDoc::slotClipMissing(const QString &path)
{
qDebug() << "// CLIP: " << path << " WAS MISSING";
QStringList ids = pCore->binController()->getBinIdsByResource(QUrl::fromLocalFile(path));
QStringList ids = pCore->binController()->getBinIdsByResource(QFileInfo(path));
//TODO handle missing clips by replacing producer with an invalid producer
/*foreach (const QString &id, ids) {
emit missingClip(id);
......
......@@ -143,7 +143,7 @@ public:
/** @brief Get frame size of the renderer (profile)*/
const QSize getRenderSize() const;
/** @brief Add url to the file watcher so that we monitor changes */
void watchFile(const QUrl &url);
void watchFile(const QString &url);
/** @brief Get all document properties that need to be saved */
QMap <QString, QString> documentProperties();
bool useProxy() const;
......
......@@ -43,7 +43,7 @@ QPixmap KThumb::getImage(const QUrl &url, int frame, int width, int height)
}
QPixmap pix(width, height);
if (!url.isValid()) return pix;
Mlt::Producer *producer = new Mlt::Producer(profile, url.path().toUtf8().constData());
Mlt::Producer *producer = new Mlt::Producer(profile, url.toLocalFile().toUtf8().constData());
pix = QPixmap::fromImage(getFrame(producer, frame, width, height));
delete producer;
return pix;
......
......@@ -182,11 +182,11 @@ void DvdWizard::slotPageChanged(int page)
void DvdWizard::generateDvd()
{
m_isoMessage->animatedHide();
QDir dir(m_status.tmp_folder->url().path() + "DVD/");
QDir dir(m_status.tmp_folder->url().toLocalFile() + "DVD/");
if (!dir.exists()) dir.mkpath(dir.absolutePath());
if (!dir.exists()) {
// We failed creating tmp DVD directory
KMessageBox::sorry(this, i18n("Cannot create temporary directory %1", m_status.tmp_folder->url().path() + "DVD"));
KMessageBox::sorry(this, i18n("Cannot create temporary directory %1", m_status.tmp_folder->url().toLocalFile() + "DVD"));
return;
}
......@@ -195,42 +195,42 @@ void DvdWizard::generateDvd()
m_status.menu_file->clear();
m_status.dvd_file->clear();
m_selectedImage.setFileTemplate(m_status.tmp_folder->url().path() + QStringLiteral("XXXXXX.png"));
m_selectedLetterImage.setFileTemplate(m_status.tmp_folder->url().path() + QStringLiteral("XXXXXX.png"));
m_highlightedImage.setFileTemplate(m_status.tmp_folder->url().path() + QStringLiteral("XXXXXX.png"));
m_highlightedLetterImage.setFileTemplate(m_status.tmp_folder->url().path() + QStringLiteral("XXXXXX.png"));
m_selectedImage.setFileTemplate(m_status.tmp_folder->url().toLocalFile() + QStringLiteral("XXXXXX.png"));
m_selectedLetterImage.setFileTemplate(m_status.tmp_folder->url().toLocalFile() + QStringLiteral("XXXXXX.png"));
m_highlightedImage.setFileTemplate(m_status.tmp_folder->url().toLocalFile() + QStringLiteral("XXXXXX.png"));
m_highlightedLetterImage.setFileTemplate(m_status.tmp_folder->url().toLocalFile() + QStringLiteral("XXXXXX.png"));
m_selectedImage.open();
m_selectedLetterImage.open();
m_highlightedImage.open();
m_highlightedLetterImage.open();
m_menuImageBackground.setFileTemplate(m_status.tmp_folder->url().path() + QStringLiteral("XXXXXX.png"));
m_menuImageBackground.setFileTemplate(m_status.tmp_folder->url().toLocalFile() + QStringLiteral("XXXXXX.png"));
m_menuImageBackground.setAutoRemove(false);
m_menuImageBackground.open();
m_menuVideo.setFileTemplate(m_status.tmp_folder->url().path() + QStringLiteral("XXXXXX.vob"));
m_menuVideo.setFileTemplate(m_status.tmp_folder->url().toLocalFile() + QStringLiteral("XXXXXX.vob"));
m_menuVideo.open();
m_menuFinalVideo.setFileTemplate(m_status.tmp_folder->url().path() + QStringLiteral("XXXXXX.vob"));
m_menuFinalVideo.setFileTemplate(m_status.tmp_folder->url().toLocalFile() + QStringLiteral("XXXXXX.vob"));
m_menuFinalVideo.open();
m_letterboxMovie.close();
m_letterboxMovie.setFileTemplate(m_status.tmp_folder->url().path() + QStringLiteral("XXXXXX.mpg"));
m_letterboxMovie.setFileTemplate(m_status.tmp_folder->url().toLocalFile() + QStringLiteral("XXXXXX.mpg"));
m_letterboxMovie.setAutoRemove(false);
m_letterboxMovie.open();
m_menuFile.close();
m_menuFile.setFileTemplate(m_status.tmp_folder->url().path() + QStringLiteral("XXXXXX.xml"));
m_menuFile.setFileTemplate(m_status.tmp_folder->url().toLocalFile() + QStringLiteral("XXXXXX.xml"));
m_menuFile.setAutoRemove(false);
m_menuFile.open();
m_menuVobFile.close();
m_menuVobFile.setFileTemplate(m_status.tmp_folder->url().path() + QStringLiteral("XXXXXX.mpg"));
m_menuVobFile.setFileTemplate(m_status.tmp_folder->url().toLocalFile() + QStringLiteral("XXXXXX.mpg"));
m_menuVobFile.setAutoRemove(false);
m_menuVobFile.open();
m_authorFile.close();
m_authorFile.setFileTemplate(m_status.tmp_folder->url().path() + QStringLiteral("XXXXXX.xml"));
m_authorFile.setFileTemplate(m_status.tmp_folder->url().toLocalFile() + QStringLiteral("XXXXXX.xml"));
m_authorFile.setAutoRemove(false);
m_authorFile.open();
......@@ -489,7 +489,7 @@ void DvdWizard::processDvdauthor(const QString &menuMovieUrl, const QMap <QStrin
authitem->setIcon(QIcon::fromTheme(QStringLiteral("system-run")));
QDomDocument dvddoc;
QDomElement auth = dvddoc.createElement(QStringLiteral("dvdauthor"));
auth.setAttribute(QStringLiteral("dest"), m_status.tmp_folder->url().path() + "DVD");
auth.setAttribute(QStringLiteral("dest"), m_status.tmp_folder->url().toLocalFile() + "DVD");
dvddoc.appendChild(auth);
QDomElement vmgm = dvddoc.createElement(QStringLiteral("vmgm"));
auth.appendChild(vmgm);
......@@ -734,7 +734,7 @@ void DvdWizard::slotRenderFinished(int exitCode, QProcess::ExitStatus status)
m_dvdauthor = NULL;
// Check if DVD structure has the necessary info
if (!QFile::exists(m_status.tmp_folder->url().path() + "/DVD/VIDEO_TS/VIDEO_TS.IFO")) {
if (!QFile::exists(m_status.tmp_folder->url().toLocalFile() + "/DVD/VIDEO_TS/VIDEO_TS.IFO")) {
errorMessage(i18n("DVD structure broken"));
m_status.error_log->append(m_creationLog + "<a name=\"result\" /><br /><strong>" + i18n("DVD structure broken"));
m_status.error_log->scrollToAnchor(QStringLiteral("result"));
......@@ -751,7 +751,7 @@ void DvdWizard::slotRenderFinished(int exitCode, QProcess::ExitStatus status)
}
authitem->setIcon(QIcon::fromTheme(QStringLiteral("dialog-ok")));
QStringList args;
args << QStringLiteral("-dvd-video") << QStringLiteral("-v") << QStringLiteral("-o") << m_status.iso_image->url().path() << m_status.tmp_folder->url().path() + QDir::separator() + "DVD";
args << QStringLiteral("-dvd-video") << QStringLiteral("-v") << QStringLiteral("-o") << m_status.iso_image->url().toLocalFile() << m_status.tmp_folder->url().toLocalFile() + QDir::separator() + "DVD";
if (m_mkiso) {
m_mkiso->blockSignals(true);
......@@ -810,7 +810,7 @@ void DvdWizard::slotIsoFinished(int exitCode, QProcess::ExitStatus status)
m_status.button_abort->setEnabled(false);
// Check if DVD iso is ok
QFile iso(m_status.iso_image->url().path());
QFile iso(m_status.iso_image->url().toLocalFile());
if (!iso.exists() || iso.size() == 0) {
if (iso.exists()) {
iso.remove();
......@@ -827,24 +827,24 @@ void DvdWizard::slotIsoFinished(int exitCode, QProcess::ExitStatus status)
}
isoitem->setIcon(QIcon::fromTheme(QStringLiteral("dialog-ok")));
//qDebug() << "ISO IMAGE " << m_status.iso_image->url().path() << " Successfully created";
//qDebug() << "ISO IMAGE " << m_status.iso_image->url().toLocalFile() << " Successfully created";
cleanup();
//qDebug() << m_creationLog;
infoMessage(i18n("DVD ISO image %1 successfully created.", m_status.iso_image->url().path()));
infoMessage(i18n("DVD ISO image %1 successfully created.", m_status.iso_image->url().toLocalFile()));
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->append("<a name=\"result\" /><strong>" + i18n("DVD ISO image %1 successfully created.", m_status.iso_image->url().toLocalFile()) + "</strong>");
m_status.error_log->scrollToAnchor(QStringLiteral("result"));
m_status.button_preview->setEnabled(true);
m_status.button_burn->setEnabled(true);
m_status.error_box->setHidden(false);
//KMessageBox::information(this, i18n("DVD ISO image %1 successfully created.", m_status.iso_image->url().path()));
//KMessageBox::information(this, i18n("DVD ISO image %1 successfully created.", m_status.iso_image->url().toLocalFile()));
}
void DvdWizard::cleanup()
{
QDir dir(m_status.tmp_folder->url().path() + QDir::separator() + "DVD");
QDir dir(m_status.tmp_folder->url().toLocalFile() + QDir::separator() + "DVD");
// Try to make sure we delete the correct directory
if (dir.exists() && dir.dirName() == QLatin1String("DVD")) dir.removeRecursively();
}
......@@ -864,7 +864,7 @@ void DvdWizard::slotPreview()
if (exec.isEmpty()) {
KMessageBox::sorry(this, i18n("Previewing requires one of these applications (%1)", programNames.join(",")));
}
else QProcess::startDetached(exec, QStringList() << "dvd://" + m_status.iso_image->url().path());
else QProcess::startDetached(exec, QStringList() << "dvd://" + m_status.iso_image->url().toLocalFile());
}
void DvdWizard::slotBurn()
......@@ -872,8 +872,8 @@ void DvdWizard::slotBurn()
QAction *action = qobject_cast<QAction *>(sender());
QString exec = action->data().toString();
QStringList args;
if (exec.endsWith(QLatin1String("k3b"))) args << QStringLiteral("--image") << m_status.iso_image->url().path();
else args << "--image=" + m_status.iso_image->url().path();
if (exec.endsWith(QLatin1String("k3b"))) args << QStringLiteral("--image") << m_status.iso_image->url().toLocalFile();
else args << "--image=" + m_status.iso_image->url().toLocalFile();
QProcess::startDetached(exec, args);
}
......@@ -885,10 +885,10 @@ void DvdWizard::slotGenerate()
for (int i = 0; i < m_status.job_progress->count(); ++i)
m_status.job_progress->item(i)->setIcon(QIcon());
QString warnMessage;
if (QFile::exists(m_status.tmp_folder->url().path() + "DVD"))
warnMessage.append(i18n("Folder %1 already exists. Overwrite?\n", m_status.tmp_folder->url().path() + "DVD"));
if (QFile::exists(m_status.iso_image->url().path()))
warnMessage.append(i18n("Image file %1 already exists. Overwrite?", m_status.iso_image->url().path()));
if (QFile::exists(m_status.tmp_folder->url().toLocalFile() + "DVD"))
warnMessage.append(i18n("Folder %1 already exists. Overwrite?\n", m_status.tmp_folder->url().toLocalFile() + "DVD"));
if (QFile::exists(m_status.iso_image->url().toLocalFile()))
warnMessage.append(i18n("Image file %1 already exists. Overwrite?", m_status.iso_image->url().toLocalFile()));