Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
6fe13d98
Commit
6fe13d98
authored
Nov 25, 2022
by
Jean-Baptiste Mardelle
Browse files
Show error message when failing to edit clip with external app
parent
fe4ffc18
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/bin/bin.cpp
View file @
6fe13d98
...
...
@@ -4111,6 +4111,7 @@ void Bin::slotOpenClipExtern()
if
(
!
clip
)
{
return
;
}
QString
errorString
;
switch
(
clip
->
clipType
())
{
case
ClipType
::
Text
:
case
ClipType
::
TextTemplate
:
...
...
@@ -4128,7 +4129,7 @@ void Bin::slotOpenClipExtern()
}
}
if
(
!
KdenliveSettings
::
defaultimageapp
().
isEmpty
())
{
pCore
->
openExternalApp
(
KdenliveSettings
::
defaultimageapp
(),
{
clip
->
url
()});
errorString
=
pCore
->
openExternalApp
(
KdenliveSettings
::
defaultimageapp
(),
{
clip
->
url
()});
}
else
{
KMessageBox
::
error
(
QApplication
::
activeWindow
(),
i18n
(
"Please set a default application to open image files"
));
}
...
...
@@ -4145,7 +4146,7 @@ void Bin::slotOpenClipExtern()
}
}
if
(
!
KdenliveSettings
::
defaultaudioapp
().
isEmpty
())
{
pCore
->
openExternalApp
(
KdenliveSettings
::
defaultaudioapp
(),
{
clip
->
url
()});
errorString
=
pCore
->
openExternalApp
(
KdenliveSettings
::
defaultaudioapp
(),
{
clip
->
url
()});
}
else
{
KMessageBox
::
error
(
QApplication
::
activeWindow
(),
i18n
(
"Please set a default application to open audio files"
));
}
...
...
@@ -4156,6 +4157,9 @@ void Bin::slotOpenClipExtern()
default:
break
;
}
if
(
!
errorString
.
isEmpty
())
{
KMessageBox
::
detailedError
(
QApplication
::
activeWindow
(),
i18n
(
"Cannot open file %1"
,
clip
->
url
()),
errorString
);
}
}
/*
...
...
src/core.cpp
View file @
6fe13d98
...
...
@@ -261,20 +261,27 @@ void Core::buildLumaThumbs(const QStringList &values)
}
}
QString
Core
::
openExternalApp
(
const
QString
&
appPath
,
QStringList
args
)
QString
Core
::
openExternalApp
(
QString
appPath
,
QStringList
args
)
{
QProcess
process
;
if
(
QFileInfo
(
appPath
).
isRelative
())
{
QString
updatedPath
=
QStandardPaths
::
findExecutable
(
appPath
);
if
(
updatedPath
.
isEmpty
())
{
return
i18n
(
"Cannot open file %1"
,
appPath
);
}
appPath
=
updatedPath
;
}
#if defined(Q_OS_MACOS)
args
.
prepend
(
QStringLiteral
(
"--args"
));
args
.
prepend
(
appPath
);
args
.
prepend
(
QStringLiteral
(
"-a"
));
if
(
!
process
.
startDetached
(
QStringLiteral
(
"open"
),
args
))
{
return
process
.
errorString
();
}
return
QString
();
process
.
setProgram
(
"open"
);
#else
process
.
setProgram
(
appPath
);
#endif
process
.
setArguments
(
args
);
qDebug
()
<<
"Starting external app"
<<
appPath
<<
"with arguments"
<<
args
;
if
(
!
process
.
startDetached
(
appPath
,
args
))
{
if
(
!
process
.
startDetached
())
{
return
process
.
errorString
();
}
return
QString
();
...
...
src/core.h
View file @
6fe13d98
...
...
@@ -102,7 +102,7 @@ public:
MainWindow
*
window
();
/** @brief Open a file using an external app. */
QString
openExternalApp
(
const
QString
&
appPath
,
const
QStringList
args
);
QString
openExternalApp
(
QString
appPath
,
const
QStringList
args
);
/** @brief Returns a pointer to the project manager. */
ProjectManager
*
projectManager
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment