Commit 9b637050 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix editing external app path from Kdenlive settings, try to fix launching app on MacOS

parent dbde3c7a
Pipeline #204934 passed with stage
in 11 minutes and 10 seconds
......@@ -4027,7 +4027,7 @@ void Bin::slotOpenClipExtern()
}
}
if (!KdenliveSettings::defaultimageapp().isEmpty()) {
QProcess::startDetached(KdenliveSettings::defaultimageapp(), {clip->url()});
openExternalApp(KdenliveSettings::defaultimageapp(), clip->url());
} else {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Please set a default application to open image files"));
}
......@@ -4040,7 +4040,7 @@ void Bin::slotOpenClipExtern()
}
}
if (!KdenliveSettings::defaultaudioapp().isEmpty()) {
QProcess::startDetached(KdenliveSettings::defaultaudioapp(), {clip->url()});
openExternalApp(KdenliveSettings::defaultaudioapp(), clip->url());
} else {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Please set a default application to open audio files"));
}
......@@ -4053,7 +4053,7 @@ void Bin::slotOpenClipExtern()
}
}
if (!KdenliveSettings::glaxnimatePath().isEmpty()) {
QProcess::startDetached(KdenliveSettings::glaxnimatePath(), {clip->url()});
openExternalApp(KdenliveSettings::glaxnimatePath(), clip->url());
} else {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Please set a path for the Glaxnimate application"));
}
......@@ -4063,6 +4063,17 @@ void Bin::slotOpenClipExtern()
}
}
void Bin::openExternalApp(QString appPath, QString url)
{
QStringList args;
#if defined(Q_OS_MACOS)
appPath.prepend(QStringLiteral("open "));
args << QStringLiteral("--args");
#endif
args << url;
QProcess::startDetached(appPath, args);
}
void Bin::updateTimecodeFormat()
{
emit refreshTimeCode();
......
......@@ -581,6 +581,8 @@ private:
void showBinInfo();
/** @brief Find all clip Ids that have a specific tag. */
const QList<QString> getAllClipsWithTag(const QString &tag);
/** @brief Open a file using an external app. */
void openExternalApp(const QString appPath, const QString url);
signals:
void itemUpdated(std::shared_ptr<AbstractProjectItem>);
......
......@@ -834,7 +834,7 @@ void KdenliveSettingsDialog::slotEditAudioApplication()
{
QUrl url = KUrlRequesterDialog::getUrl(QUrl::fromLocalFile(KdenliveSettings::defaultaudioapp()), this, i18n("Enter path to the audio editing application"));
if (!url.isEmpty()) {
KdenliveSettings::setDefaultaudioapp(url.toLocalFile());
m_configEnv.kcfg_defaultaudioapp->setText(url.toLocalFile());
}
}
......@@ -842,7 +842,7 @@ void KdenliveSettingsDialog::slotEditImageApplication()
{
QUrl url = KUrlRequesterDialog::getUrl(QUrl::fromLocalFile(KdenliveSettings::defaultimageapp()), this, i18n("Enter path to the image editing application"));
if (!url.isEmpty()) {
KdenliveSettings::setDefaultimageapp(url.toLocalFile());
m_configEnv.kcfg_defaultimageapp->setText(url.toLocalFile());
}
}
......@@ -850,7 +850,7 @@ void KdenliveSettingsDialog::slotEditGlaxnimateApplication()
{
QUrl url = KUrlRequesterDialog::getUrl(QUrl::fromLocalFile(KdenliveSettings::glaxnimatePath()), this, i18n("Enter path to the Glaxnimate application"));
if (!url.isEmpty()) {
KdenliveSettings::setGlaxnimatePath(url.toLocalFile());
m_configEnv.kcfg_glaxnimatePath->setText(url.toLocalFile());
}
}
......
Supports Markdown
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