Disable QUrl > QString casting to fix broken urls

parent 5e64ab02
......@@ -22,6 +22,8 @@ include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
SET(CMAKE_CXX_FLAGS "-fPIC")
......
......@@ -1920,7 +1920,7 @@ void RenderWidget::setRenderStatus(const QString &dest, int status, const QStrin
emit openDvdWizard(item->text(1));
} else if (itemGroup == "websites") {
QString url = item->metadata();
if (!url.isEmpty()) new KRun(url, this);
if (!url.isEmpty()) new KRun(QUrl::fromLocalFile(url), this);
}
} else if (status == -2) {
// Rendering crashed
......
......@@ -605,7 +605,7 @@ void DocumentChecker::slotEditItem(QTreeWidgetItem *item, int)
if (t == TITLE_FONT_ELEMENT || t == Unknown) return;
//|| t == TITLE_IMAGE_ELEMENT) {
QUrl url = KUrlRequesterDialog::getUrl(item->text(1), m_dialog, i18n("Enter new location for file"));
QUrl url = KUrlRequesterDialog::getUrl(QUrl::fromLocalFile(item->text(1)), m_dialog, i18n("Enter new location for file"));
if (!url.isValid()) return;
item->setText(1, url.path());
if (QFile::exists(url.path())) {
......
......@@ -1309,7 +1309,7 @@ void KdenliveDoc::slotCreateTextClip(QString group, const QString &groupId, cons
QString titlesFolder = QDir::cleanPath(projectFolder().path() + QDir::separator() + "titles/");
QDir dir(projectFolder().path());
dir.mkdir("titles");
QPointer<TitleWidget> dia_ui = new TitleWidget(templatePath, m_timecode, titlesFolder, m_render, QApplication::activeWindow());
QPointer<TitleWidget> dia_ui = new TitleWidget(QUrl::fromLocalFile(templatePath), m_timecode, titlesFolder, m_render, QApplication::activeWindow());
if (dia_ui->exec() == QDialog::Accepted) {
m_clipManager->slotAddTextClipFile(i18n("Title clip"), dia_ui->duration(), dia_ui->xml().toString(), group, groupId);
setModified(true);
......
......@@ -570,11 +570,11 @@
</entry>
<entry name="default_profile" type="String">
<label>Default project format.</label>
<default>hdv_1080_50i</default>
<default>atsc_1080p_25</default>
</entry>
<entry name="current_profile" type="String">
<label>active project format.</label>
<default>hdv_1080_50i</default>
<default>atsc_1080p_25</default>
</entry>
<entry name="showdescriptioncolumn" type="Bool">
......
......@@ -94,7 +94,7 @@ int main(int argc, char *argv[])
QString mltPath = parser.value("mlt-path");
QUrl url;
if (parser.positionalArguments().count()) {
url = parser.positionalArguments().first();
url = QUrl::fromLocalFile(parser.positionalArguments().first());
}
window = new MainWindow(mltPath, url, clipsToLoad);
window->show();
......
......@@ -2713,7 +2713,7 @@ void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QS
if (scriptExport) {
//QString scriptsFolder = project->projectFolder().path(QUrl::AddTrailingSlash) + "scripts/";
QString path = m_renderWidget->getFreeScriptName(project->url());
QPointer<KUrlRequesterDialog> getUrl = new KUrlRequesterDialog(path, i18n("Create Render Script"), this);
QPointer<KUrlRequesterDialog> getUrl = new KUrlRequesterDialog(QUrl::fromLocalFile(path), i18n("Create Render Script"), this);
getUrl->urlRequester()->setMode(KFile::File);
if (getUrl->exec() == QDialog::Rejected) {
delete getUrl;
......
......@@ -50,7 +50,7 @@ void MltConnection::locateMeltAndProfilesPath(const QString& mltPath)
if (KdenliveSettings::rendererpath().isEmpty()) {
// Cannot find the MLT melt renderer, ask for location
QPointer<KUrlRequesterDialog> getUrl = new KUrlRequesterDialog(QString(),
QPointer<KUrlRequesterDialog> getUrl = new KUrlRequesterDialog(QUrl(),
i18n("Cannot find the melt program required for rendering (part of MLT)"),
pCore->window());
if (getUrl->exec() == QDialog::Rejected) {
......@@ -78,7 +78,7 @@ void MltConnection::locateMeltAndProfilesPath(const QString& mltPath)
}
if (profilesList.isEmpty()) {
// Cannot find the MLT profiles, ask for location
QPointer<KUrlRequesterDialog> getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(),
QPointer<KUrlRequesterDialog> getUrl = new KUrlRequesterDialog(QUrl::fromLocalFile(KdenliveSettings::mltpath()),
i18n("Cannot find your MLT profiles, please give the path"),
pCore->window());
getUrl->urlRequester()->setMode(KFile::Directory);
......
......@@ -529,15 +529,16 @@ void ClipManager::slotAddClipList(const QList<QUrl> &urls, const QMap <QString,
if (answer == KMessageBox::Cancel) continue;
else if (answer == KMessageBox::Yes) {
// Copy files to project folder
QString sourcesFolder = m_doc->projectFolder().path() + QDir::separator() + "clips/";
KIO::MkdirJob *mkdirJob = KIO::mkdir(sourcesFolder);
QDir sourcesFolder(m_doc->projectFolder().toLocalFile());
sourcesFolder.cd("clips");
KIO::MkdirJob *mkdirJob = KIO::mkdir(QUrl::fromLocalFile(sourcesFolder.absolutePath()));
KJobWidgets::setWindow(mkdirJob, QApplication::activeWindow());
if (!mkdirJob->exec()) {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Cannot create directory %1", sourcesFolder));
KMessageBox::sorry(QApplication::activeWindow(), i18n("Cannot create directory %1", sourcesFolder.absolutePath()));
continue;
}
//KIO::filesize_t m_requestedSize;
KIO::CopyJob *copyjob = KIO::copy (file, QUrl(sourcesFolder));
KIO::CopyJob *copyjob = KIO::copy(file, QUrl::fromLocalFile(sourcesFolder.absolutePath()));
//TODO: for some reason, passing metadata does not work...
copyjob->addMetaData("group", data.value("group"));
copyjob->addMetaData("groupId", data.value("groupId"));
......
......@@ -125,7 +125,7 @@ void ClipPropertiesManager::showClipPropertiesDialog(DocClipBase* clip)
// we are editing an external file, asked if we want to detach from that file or save the result to that title file.
if (KMessageBox::questionYesNo(pCore->window(), i18n("You are editing an external title clip (%1). Do you want to save your changes to the title file or save the changes for this project only?", path), i18n("Save Title"), KGuiItem(i18n("Save to title file")), KGuiItem(i18n("Save in project only"))) == KMessageBox::Yes) {
// save to external file
dia_ui->saveTitle(path);
dia_ui->saveTitle(QUrl::fromLocalFile(path));
} else {
newprops.insert("resource", QString());
}
......
......@@ -51,7 +51,7 @@ ClipTranscode::ClipTranscode(const QStringList &urls, const QString &params, con
QString fileName = m_urls.first(); //.section('.', 0, -1);
QString newFile = params.section(' ', -1).replace("%1", fileName);
QUrl dest(newFile);
source_url->setUrl(m_urls.first());
source_url->setUrl(QUrl::fromLocalFile(m_urls.first()));
dest_url->setMode(KFile::File);
dest_url->setUrl(dest);
dest_url->setMode(KFile::File);//OperationMode(KFileDialog::Saving);
......@@ -124,7 +124,7 @@ void ClipTranscode::slotStartTransCode()
QString params = ffmpeg_params->toPlainText().simplified();
if (!m_urls.isEmpty() && urls_list->count() > 0) {
// We are processing multiple clips
source_url->setUrl(m_urls.takeFirst());
source_url->setUrl(QUrl::fromLocalFile(m_urls.takeFirst()));
destination = dest_url->url().path() + QDir::separator() + source_url->url().fileName();
QList<QListWidgetItem *> matching = urls_list->findItems(source_url->url().path(), Qt::MatchExactly);
if (matching.count() > 0) {
......
......@@ -736,8 +736,8 @@ bool ArchiveWidget::processProjectFile()
QString src = EffectsList::property(e, "resource");
if (!src.isEmpty()) {
if (!src.startsWith('/')) src.prepend(root);
QUrl srcUrl(src);
QUrl dest = m_replacementList.value(src);
QUrl srcUrl = QUrl::fromLocalFile(src);
QUrl dest = m_replacementList.value(srcUrl);
if (!dest.isEmpty()) EffectsList::setProperty(e, "resource", dest.path());
}
}
......@@ -754,8 +754,8 @@ bool ArchiveWidget::processProjectFile()
src = EffectsList::property(e, attribute);
if (!src.isEmpty()) {
if (!src.startsWith('/')) src.prepend(root);
QUrl srcUrl(src);
QUrl dest = m_replacementList.value(src);
QUrl srcUrl = QUrl::fromLocalFile(src);
QUrl dest = m_replacementList.value(srcUrl);
if (!dest.isEmpty()) EffectsList::setProperty(e, attribute, dest.path());
}
}
......
......@@ -270,11 +270,14 @@ void ProjectSettings::slotDeleteProxies()
void ProjectSettings::slotUpdateFiles(bool cacheOnly)
{
KIO::DirectorySizeJob *job = KIO::directorySize(project_folder->url().path() + QDir::separator() + "thumbs/");
QDir folder(project_folder->url().path());
folder.cd("thumbs");
KIO::DirectorySizeJob *job = KIO::directorySize(QUrl::fromLocalFile(folder.absolutePath()));
job->exec();
thumbs_count->setText(QString::number(job->totalFiles()));
thumbs_size->setText(KIO::convertSize(job->totalSize()));
job = KIO::directorySize(project_folder->url().path() + QDir::separator() + "proxy/");
folder.cd("../proxy");
job = KIO::directorySize(QUrl::fromLocalFile(folder.absolutePath()));
job->exec();
proxy_count->setText(QString::number(job->totalFiles()));
proxy_size->setText(KIO::convertSize(job->totalSize()));
......@@ -610,7 +613,7 @@ void ProjectSettings::slotExportToText()
return;
}
xmlf.close();
KIO::FileCopyJob *copyjob = KIO::file_copy(tmpfile.fileName(), QUrl(savePath));
KIO::FileCopyJob *copyjob = KIO::file_copy(QUrl::fromLocalFile(tmpfile.fileName()), QUrl::fromLocalFile(savePath));
copyjob->exec();
}
......
......@@ -73,7 +73,7 @@ SlideshowClip::SlideshowClip(const Timecode &tc, QWidget * parent) :
m_view.clip_duration->setInputMask(m_timecode.mask());
m_view.luma_duration->setInputMask(m_timecode.mask());
m_view.luma_duration->setText(m_timecode.getTimecodeFromFrames(int(ceil(m_timecode.fps()))));
m_view.folder_url->setUrl(QDir::homePath());
m_view.folder_url->setUrl(QUrl::fromLocalFile(QDir::homePath()));
m_view.clip_duration_format->addItem(i18n("hh:mm:ss:ff"));
m_view.clip_duration_format->addItem(i18n("Frames"));
......
......@@ -1631,7 +1631,7 @@ void ProjectList::slotAddClip(const QString &url, const QString &groupName, cons
{
//qDebug()<<"// Adding clip: "<<url;
QList <QUrl> list;
list.append(url);
list.append(QUrl::fromLocalFile(url));
slotAddClip(list, groupName, groupId);
}
......@@ -1656,7 +1656,7 @@ void ProjectList::slotAddClip(const QList <QUrl> &givenList, const QString &grou
l->addStretch(5);
f->setLayout(l);
QString clipFolder = m_doc->getDocumentProperty("QFileDialogClipFolder");
if (clipFolder.isEmpty()) clipFolder = QDir::homePath();
if (clipFolder.isEmpty()) clipFolder = QDir::homePath();
QPointer<QFileDialog> d = new QFileDialog(QApplication::activeWindow(), i18n("Open Clips"), clipFolder, dialogFilter);
//TODO: KF5, how to add a custom widget to file dialog
/*QGridLayout *layout = (QGridLayout*)d->layout();
......@@ -1675,7 +1675,7 @@ void ProjectList::slotAddClip(const QList <QUrl> &givenList, const QString &grou
if (item.mimetype().startsWith(QLatin1String("image"))) {
// import as sequence if we found more than one image in the sequence
QStringList list;
QString pattern = SlideshowClip::selectedPath(url.path(), false, QString(), &list);
QString pattern = SlideshowClip::selectedPath(url, false, QString(), &list);
int count = list.count();
if (count > 1) {
delete d;
......@@ -2702,7 +2702,7 @@ void ProjectList::slotAddOrUpdateSequence(const QString &frameName)
{
QString fileName = QUrl(frameName).fileName().section('_', 0, -2);
QStringList list;
QString pattern = SlideshowClip::selectedPath(frameName, false, QString(), &list);
QString pattern = SlideshowClip::selectedPath(QUrl::fromLocalFile(frameName), false, QString(), &list);
int count = list.count();
if (count > 1) {
const QList <DocClipBase *> existing = m_doc->clipManager()->getClipByResource(pattern);
......
......@@ -90,7 +90,7 @@ void ProjectManager::newFile(bool showProjectSettings, bool force)
}
m_fileRevert->setEnabled(false);
QString profileName = KdenliveSettings::default_profile();
QUrl projectFolder = KdenliveSettings::defaultprojectfolder();
QUrl projectFolder = QUrl::fromLocalFile(KdenliveSettings::defaultprojectfolder());
QMap <QString, QString> documentProperties;
QMap <QString, QString> documentMetadata;
QPoint projectTracks(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks());
......@@ -367,7 +367,7 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
progressDialog.setValue(0);
bool openBackup;
KdenliveDoc *doc = new KdenliveDoc(stale ? QUrl(stale->fileName()) : url, KdenliveSettings::defaultprojectfolder(), pCore->window()->m_commandStack, KdenliveSettings::default_profile(), QMap <QString, QString> (), QMap <QString, QString> (), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), pCore->monitorManager()->projectMonitor()->render, m_notesPlugin, &openBackup, pCore->window(), &progressDialog);
KdenliveDoc *doc = new KdenliveDoc(stale ? QUrl(stale->fileName()) : url, QUrl::fromLocalFile(KdenliveSettings::defaultprojectfolder()), pCore->window()->m_commandStack, KdenliveSettings::default_profile(), QMap <QString, QString> (), QMap <QString, QString> (), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), pCore->monitorManager()->projectMonitor()->render, m_notesPlugin, &openBackup, pCore->window(), &progressDialog);
progressDialog.setValue(1);
progressDialog.setMaximum(4);
......
......@@ -606,8 +606,8 @@ void StopmotionWidget::sequenceNameChanged(const QString& name)
button_addsequence->setEnabled(false);
} else {
// Check if we are editing an existing sequence
QString pattern = SlideshowClip::selectedPath(getPathForFrame(0, sequence_name->currentText()), false, QString(), &m_filesList);
m_sequenceFrame = m_filesList.isEmpty() ? 0 : SlideshowClip::getFrameNumberFromPath(m_filesList.last()) + 1;
QString pattern = SlideshowClip::selectedPath(QUrl::fromLocalFile(getPathForFrame(0, sequence_name->currentText())), false, QString(), &m_filesList);
m_sequenceFrame = m_filesList.isEmpty() ? 0 : SlideshowClip::getFrameNumberFromPath(QUrl::fromLocalFile(m_filesList.last())) + 1;
if (!m_filesList.isEmpty()) {
m_sequenceName = sequence_name->currentText();
connect(this, SIGNAL(doCreateThumbs(QImage,int)), this, SLOT(slotCreateThumbs(QImage,int)));
......@@ -679,7 +679,7 @@ void StopmotionWidget::slotPrepareThumbs()
if (m_filesList.isEmpty())
return;
QString path = m_filesList.takeFirst();
emit doCreateThumbs(QImage(path), SlideshowClip::getFrameNumberFromPath(path));
emit doCreateThumbs(QImage(path), SlideshowClip::getFrameNumberFromPath(QUrl::fromLocalFile(path)));
}
......@@ -757,7 +757,7 @@ void StopmotionWidget::slotPlayPreview(bool animate)
else frame_list->setCurrentRow(frame_list->count() - KdenliveSettings::sm_framesplayback());
QTimer::singleShot(200, this, SLOT(slotAnimate()));
} else {
SlideshowClip::selectedPath(getPathForFrame(0, sequence_name->currentText()), false, QString(), &m_animationList);
SlideshowClip::selectedPath(QUrl::fromLocalFile(getPathForFrame(0, sequence_name->currentText())), false, QString(), &m_animationList);
if (KdenliveSettings::sm_framesplayback() > 0) {
// only play the last x frames
while (m_animationList.count() > KdenliveSettings::sm_framesplayback() + 1) {
......
......@@ -453,7 +453,7 @@ void TrackView::parseDocument(const QDomDocument &doc)
else
message = i18n("Your project file was modified by Kdenlive.\nTo make sure you don't lose data, a backup copy called %1 was created.", backupFile);
KIO::FileCopyJob *copyjob = KIO::file_copy(m_doc->url().path(), QUrl(backupFile));
KIO::FileCopyJob *copyjob = KIO::file_copy(m_doc->url(), QUrl::fromLocalFile(backupFile));
if (copyjob->exec())
KMessageBox::information(this, message);
else
......
......@@ -308,7 +308,7 @@ bool TitleDocument::saveDocument(const QUrl &url, QGraphicsRectItem* startv, QGr
return false;
}
xmlf.close();
KIO::FileCopyJob *copyjob = KIO::file_copy(tmpfile.fileName(), url);
KIO::FileCopyJob *copyjob = KIO::file_copy(QUrl::fromLocalFile(tmpfile.fileName()), url);
return copyjob->exec();
}
......
......@@ -537,15 +537,14 @@ void TitleWidget::refreshTitleTemplates()
filters << "*.kdenlivetitle" ;
titletemplates.clear();
QStringList titleTemplates = QStandardPaths::locateAll(QStandardPaths::DataLocation, "titles");
foreach(const QString & folder, titleTemplates) {
QStringList filesnames = QDir(folder).entryList(filters, QDir::Files);
foreach(const QString & folderpath, titleTemplates) {
QDir folder(folderpath);
QStringList filesnames = folder.entryList(filters, QDir::Files);
foreach(const QString & fname, filesnames) {
//titlenamelist.append(fname);
//titlefiles.append(QUrl(folder).path(QUrl::AddTrailingSlash) + fname);
TitleTemplate t;
t.name = fname;
t.file = QUrl(folder).path() + QDir::separator() + fname;
t.icon = QIcon(KThumb::getImage(t.file, 0, 60, 60));
t.file = folder.absoluteFilePath(fname);
t.icon = QIcon(KThumb::getImage(QUrl::fromLocalFile(t.file), 0, 60, 60));
titletemplates.append(t);
}
}
......@@ -560,7 +559,7 @@ void TitleWidget::templateIndexChanged(int index)
if (KMessageBox::questionYesNo(this, i18n("Do you really want to load a new template? Changes in this title will be lost!")) == KMessageBox::No)
return;
}
loadTitle(item);
loadTitle(QUrl::fromLocalFile(item));
// mbt 1607: Add property to distinguish between unchanged template titles and user titles.
// Text of unchanged template titles should be selected when clicked.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment