Skip to content
GitLab
Menu
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
ba9ea12d
Commit
ba9ea12d
authored
Feb 07, 2021
by
Jean-Baptiste Mardelle
Browse files
Fix compilation with KF5 < 5.71
parent
a391cdff
Pipeline
#50098
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/dialogs/speechdialog.cpp
View file @
ba9ea12d
...
...
@@ -29,6 +29,7 @@
#include "mlt++/MltTractor.h"
#include "mlt++/MltConsumer.h"
#include <kio_version.h>
#include <QFontDatabase>
#include <QDir>
#include <QProcess>
...
...
@@ -38,7 +39,9 @@
#include <KZip>
#include <KTar>
#include <KIO/FileCopyJob>
#if KIO_VERSION > QT_VERSION_CHECK(5, 70, 0)
#include <KIO/OpenUrlJob>
#endif
#include <KIO/JobUiDelegate>
#include <KArchiveDirectory>
#include <KMessageWidget>
...
...
@@ -61,11 +64,13 @@ SpeechDialog::SpeechDialog(const std::shared_ptr<TimelineItemModel> &timeline, Q
});
connect
(
dict_info
,
&
KMessageWidget
::
linkActivated
,
[
&
](
const
QString
&
contents
)
{
qDebug
()
<<
"=== LINK CLICKED: "
<<
contents
;
#if KIO_VERSION > QT_VERSION_CHECK(5, 70, 0)
auto
*
job
=
new
KIO
::
OpenUrlJob
(
QUrl
(
contents
));
job
->
setUiDelegate
(
new
KIO
::
JobUiDelegate
(
KJobUiDelegate
::
AutoHandlingEnabled
,
this
));
// methods like setRunExecutables, setSuggestedFilename, setEnableExternalBrowser, setFollowRedirections
// exist in both classes
job
->
start
();
#endif
});
//TODO: check for the python scripts vosk and srt
...
...
@@ -76,7 +81,10 @@ void SpeechDialog::slotProcessSpeech(const std::shared_ptr<TimelineItemModel> &t
{
QString
pyExec
=
QStandardPaths
::
findExecutable
(
QStringLiteral
(
"python3"
));
if
(
pyExec
.
isEmpty
())
{
//TODO
speech_info
->
setMessageType
(
KMessageWidget
::
Warning
);
speech_info
->
setText
(
i18n
(
"Cannot find python3, please install it on your system."
));
speech_info
->
animatedShow
();
return
;
}
speech_info
->
setMessageType
(
KMessageWidget
::
Information
);
speech_info
->
setText
(
i18n
(
"Starting audio export"
));
...
...
@@ -85,9 +93,9 @@ void SpeechDialog::slotProcessSpeech(const std::shared_ptr<TimelineItemModel> &t
QString
sceneList
;
QString
speech
;
QString
audio
;
QTemporaryFile
tmpPlaylist
(
QDir
::
tempPath
(
)
+
QStringLiteral
(
"
/
XXXXXX.mlt"
));
QTemporaryFile
tmpSpeech
(
QDir
::
tempPath
(
)
+
QStringLiteral
(
"
/
XXXXXX.srt"
));
QTemporaryFile
tmpAudio
(
QDir
::
tempPath
(
)
+
QStringLiteral
(
"
/
XXXXXX.wav"
));
QTemporaryFile
tmpPlaylist
(
QDir
::
temp
().
absoluteFile
Path
(
QStringLiteral
(
"XXXXXX.mlt"
))
)
;
QTemporaryFile
tmpSpeech
(
QDir
::
temp
().
absoluteFile
Path
(
QStringLiteral
(
"XXXXXX.srt"
))
)
;
QTemporaryFile
tmpAudio
(
QDir
::
temp
().
absoluteFile
Path
(
QStringLiteral
(
"XXXXXX.wav"
))
)
;
if
(
tmpPlaylist
.
open
())
{
sceneList
=
tmpPlaylist
.
fileName
();
}
...
...
@@ -126,6 +134,12 @@ void SpeechDialog::slotProcessSpeech(const std::shared_ptr<TimelineItemModel> &t
qDebug
()
<<
"=== STARTING RENDER D"
;
QString
language
=
language_box
->
currentText
();
QString
speechScript
=
QStandardPaths
::
locate
(
QStandardPaths
::
AppDataLocation
,
QStringLiteral
(
"scripts/speech.py"
));
if
(
speechScript
.
isEmpty
())
{
speech_info
->
setMessageType
(
KMessageWidget
::
Warning
);
speech_info
->
setText
(
i18n
(
"The speech script was not found, check your install."
));
speech_info
->
animatedShow
();
return
;
}
qDebug
()
<<
"=== RUNNING SPEECH ANALYSIS: "
<<
speechScript
;
QProcess
speechJob
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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