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
ae243e27
Commit
ae243e27
authored
Nov 27, 2019
by
Jean-Baptiste Mardelle
Browse files
Cleanup status bar messaging system an display audio align progress.
Fixes #432
parent
f11408fe
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/bin/bin.cpp
View file @
ae243e27
...
...
@@ -701,7 +701,6 @@ Bin::Bin(std::shared_ptr<ProjectItemModel> model, QWidget *parent)
connect
(
m_itemModel
.
get
(),
&
ProjectItemModel
::
refreshPanel
,
this
,
&
Bin
::
refreshPanel
);
connect
(
m_itemModel
.
get
(),
&
ProjectItemModel
::
refreshClip
,
this
,
&
Bin
::
refreshClip
);
connect
(
m_itemModel
.
get
(),
&
ProjectItemModel
::
emitMessage
,
this
,
&
Bin
::
emitMessage
);
connect
(
m_itemModel
.
get
(),
static_cast
<
void
(
ProjectItemModel
::*
)(
const
QStringList
&
,
const
QModelIndex
&
)
>
(
&
ProjectItemModel
::
itemDropped
),
this
,
static_cast
<
void
(
Bin
::*
)(
const
QStringList
&
,
const
QModelIndex
&
)
>
(
&
Bin
::
slotItemDropped
));
...
...
@@ -1113,7 +1112,7 @@ void Bin::slotLocateClip()
qCDebug
(
KDENLIVE_LOG
)
<<
" / / "
+
url
.
toString
();
}
else
{
if
(
!
exists
)
{
emit
Message
(
i18n
(
"Could not locate %1"
,
url
.
toString
()),
100
,
ErrorMessage
);
pCore
->
display
Message
(
i18n
(
"Could not locate %1"
,
url
.
toString
()),
ErrorMessage
,
300
);
}
return
;
}
...
...
@@ -2864,10 +2863,6 @@ void Bin::slotResetInfoMessage()
}
}
void
Bin
::
emitMessage
(
const
QString
&
text
,
int
progress
,
MessageType
type
)
{
emit
displayMessage
(
text
,
progress
,
type
);
}
void
Bin
::
slotSetSorting
()
{
...
...
src/bin/bin.h
View file @
ae243e27
...
...
@@ -232,8 +232,6 @@ public:
void
editMasterEffect
(
const
std
::
shared_ptr
<
AbstractProjectItem
>
&
clip
);
/** @brief An effect setting was changed, update stack if displayed. */
void
updateMasterEffect
(
ClipController
*
ctl
);
/** @brief Display a message about an operation in status bar. */
void
emitMessage
(
const
QString
&
,
int
,
MessageType
);
void
rebuildMenu
();
void
refreshIcons
();
...
...
@@ -459,7 +457,6 @@ signals:
/** @brief Request that the given clip is displayed in the clip monitor */
void
requestClipShow
(
std
::
shared_ptr
<
ProjectClip
>
);
void
displayBinMessage
(
const
QString
&
,
KMessageWidget
::
MessageType
);
void
displayMessage
(
const
QString
&
,
int
,
MessageType
);
void
requesteInvalidRemoval
(
const
QString
&
,
const
QString
&
,
const
QString
&
);
/** @brief Analysis data changed, refresh panel. */
void
updateAnalysisData
(
const
QString
&
);
...
...
src/core.cpp
View file @
ae243e27
...
...
@@ -562,7 +562,11 @@ void Core::pushUndo(QUndoCommand *command)
void
Core
::
displayMessage
(
const
QString
&
message
,
MessageType
type
,
int
timeout
)
{
if
(
m_mainWindow
)
{
m_mainWindow
->
displayMessage
(
message
,
type
,
timeout
);
if
(
type
==
ProcessingJobMessage
||
type
==
OperationCompletedMessage
)
{
m_mainWindow
->
displayProgressMessage
(
message
,
type
,
timeout
);
}
else
{
m_mainWindow
->
displayMessage
(
message
,
type
,
timeout
);
}
}
else
{
qDebug
()
<<
message
;
}
...
...
src/doc/kdenlivedoc.cpp
View file @
ae243e27
...
...
@@ -200,13 +200,13 @@ KdenliveDoc::KdenliveDoc(const QUrl &url, QString projectFolder, QUndoGroup *und
}
}
else
{
qCDebug
(
KDENLIVE_LOG
)
<<
" // / processing file open: validate"
;
p
arent
->
slotGotProgressInfo
(
i18n
(
"Validating"
)
,
100
);
p
Core
->
displayMessage
(
i18n
(
"Validating"
),
OperationCompletedMessage
,
100
);
qApp
->
processEvents
();
DocumentValidator
validator
(
m_document
,
url
);
success
=
validator
.
isProject
();
if
(
!
success
)
{
// It is not a project file
p
arent
->
slotGotProgressInfo
(
i18n
(
"File %1 is not a Kdenlive project file"
,
m_url
.
toLocalFile
()),
100
);
p
Core
->
displayMessage
(
i18n
(
"File %1 is not a Kdenlive project file"
,
m_url
.
toLocalFile
()),
OperationCompletedMessage
,
100
);
if
(
KMessageBox
::
warningContinueCancel
(
parent
,
i18n
(
"File %1 is not a valid project file.
\n
Do you want to open a backup file?"
,
m_url
.
toLocalFile
()),
i18n
(
"Error opening file"
),
KGuiItem
(
i18n
(
"Open Backup"
)))
==
KMessageBox
::
Continue
)
{
...
...
src/lib/audio/audioCorrelation.cpp
View file @
ae243e27
...
...
@@ -40,7 +40,7 @@ AudioCorrelation::~AudioCorrelation()
void
AudioCorrelation
::
slotAnnounceEnvelope
()
{
emit
displayMessage
(
i18n
(
"Audio analysis finished"
),
OperationCompletedMessage
,
5
00
);
emit
displayMessage
(
i18n
(
"Audio analysis finished"
),
OperationCompletedMessage
,
3
00
);
}
void
AudioCorrelation
::
addChild
(
AudioEnvelope
*
envelope
)
...
...
src/lib/audio/audioEnvelope.cpp
View file @
ae243e27
...
...
@@ -17,9 +17,11 @@
#include <QImage>
#include <QTime>
#include <QtConcurrent>
#include <KLocalizedString>
#include <algorithm>
#include <cmath>
#include <memory>
AudioEnvelope
::
AudioEnvelope
(
const
QString
&
binId
,
int
clipId
,
size_t
offset
,
size_t
length
,
size_t
startPos
)
:
m_offset
(
offset
)
,
m_clipId
(
clipId
)
...
...
@@ -107,7 +109,8 @@ AudioEnvelope::AudioSummary AudioEnvelope::loadAndNormalizeEnvelope() const
QTime
t
;
t
.
start
();
m_producer
->
seek
(
0
);
for
(
size_t
i
=
0
;
i
<
summary
.
audioAmplitudes
.
size
();
++
i
)
{
size_t
max
=
summary
.
audioAmplitudes
.
size
();
for
(
size_t
i
=
0
;
i
<
max
;
++
i
)
{
std
::
unique_ptr
<
Mlt
::
Frame
>
frame
(
m_producer
->
get_frame
((
int
)
i
));
qint64
position
=
mlt_frame_get_position
(
frame
->
get_frame
());
int
samples
=
mlt_sample_calculator
(
m_producer
->
get_fps
(),
samplingRate
,
position
);
...
...
@@ -117,6 +120,7 @@ AudioEnvelope::AudioSummary AudioEnvelope::loadAndNormalizeEnvelope() const
for
(
int
k
=
0
;
k
<
samples
;
++
k
)
{
summary
.
audioAmplitudes
[
i
]
+=
abs
(
data
[
k
]);
}
pCore
->
displayMessage
(
i18n
(
"Processing data analysis"
),
ProcessingJobMessage
,
(
int
)
(
100
*
i
/
max
));
}
qCDebug
(
KDENLIVE_LOG
)
<<
"Calculating the envelope ("
<<
m_envelopeSize
<<
" frames) took "
<<
t
.
elapsed
()
<<
" ms."
;
qCDebug
(
KDENLIVE_LOG
)
<<
"Normalizing envelope ..."
;
...
...
@@ -125,10 +129,11 @@ AudioEnvelope::AudioSummary AudioEnvelope::loadAndNormalizeEnvelope() const
// Normalize the envelope.
summary
.
amplitudeMax
=
0
;
for
(
size_t
i
=
0
;
i
<
summary
.
audioAmplitudes
.
size
()
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
max
;
++
i
)
{
summary
.
audioAmplitudes
[
i
]
-=
meanBeforeNormalization
;
summary
.
amplitudeMax
=
std
::
max
(
summary
.
amplitudeMax
,
qAbs
(
summary
.
audioAmplitudes
[
i
]));
}
pCore
->
displayMessage
(
i18n
(
"Audio analysis finished"
),
OperationCompletedMessage
,
300
);
return
summary
;
}
...
...
src/mainwindow.cpp
View file @
ae243e27
...
...
@@ -851,7 +851,7 @@ void MainWindow::slotConnectMonitors()
}
void
MainWindow
::
createSplitOverlay
(
std
::
shared_ptr
<
Mlt
::
Filter
>
filter
)
{
{
if
(
m_assetPanel
->
effectStackOwner
().
first
==
ObjectType
::
TimelineClip
)
{
getMainTimeline
()
->
controller
()
->
createSplitOverlay
(
m_assetPanel
->
effectStackOwner
().
second
,
filter
);
m_projectMonitor
->
activateSplit
();
...
...
@@ -1133,6 +1133,7 @@ void MainWindow::setupActions()
m_messageLabel
=
new
StatusBarMessageLabel
(
this
);
m_messageLabel
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
MinimumExpanding
);
connect
(
this
,
&
MainWindow
::
displayMessage
,
m_messageLabel
,
&
StatusBarMessageLabel
::
setMessage
);
connect
(
this
,
&
MainWindow
::
displayProgressMessage
,
m_messageLabel
,
&
StatusBarMessageLabel
::
setProgressMessage
);
statusBar
()
->
addWidget
(
m_messageLabel
,
0
);
QWidget
*
spacer
=
new
QWidget
(
this
);
spacer
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Preferred
);
...
...
@@ -2019,7 +2020,6 @@ void MainWindow::connectDocument()
connect
(
m_projectMonitor
,
SIGNAL
(
zoneUpdated
(
QPoint
)),
project
,
SLOT
(
setModified
()));
connect
(
m_clipMonitor
,
SIGNAL
(
zoneUpdated
(
QPoint
)),
project
,
SLOT
(
setModified
()));
connect
(
project
,
&
KdenliveDoc
::
docModified
,
this
,
&
MainWindow
::
slotUpdateDocumentState
);
connect
(
pCore
->
bin
(),
SIGNAL
(
displayMessage
(
QString
,
int
,
MessageType
)),
m_messageLabel
,
SLOT
(
setProgressMessage
(
QString
,
int
,
MessageType
)));
if
(
m_renderWidget
)
{
slotCheckRenderStatus
();
...
...
@@ -2682,11 +2682,6 @@ void MainWindow::slotUpdateZoomSliderToolTip(int zoomlevel)
m_zoomSlider
->
setToolTip
(
i18n
(
"Zoom Level: %1/%2"
,
max
-
zoomlevel
,
max
));
}
void
MainWindow
::
slotGotProgressInfo
(
const
QString
&
message
,
int
progress
,
MessageType
type
)
{
m_messageLabel
->
setProgressMessage
(
message
,
progress
,
type
);
}
void
MainWindow
::
customEvent
(
QEvent
*
e
)
{
if
(
e
->
type
()
==
QEvent
::
User
)
{
...
...
src/mainwindow.h
View file @
ae243e27
...
...
@@ -252,7 +252,6 @@ private:
void
updateActionsToolTip
();
public
slots
:
void
slotGotProgressInfo
(
const
QString
&
message
,
int
progress
,
MessageType
type
=
DefaultMessage
);
void
slotReloadEffects
(
const
QStringList
&
paths
);
Q_SCRIPTABLE
void
setRenderingProgress
(
const
QString
&
url
,
int
progress
);
Q_SCRIPTABLE
void
setRenderingFinished
(
const
QString
&
url
,
int
status
,
const
QString
&
error
);
...
...
@@ -481,6 +480,7 @@ signals:
void
setPreviewProgress
(
int
);
void
setRenderProgress
(
int
);
void
displayMessage
(
const
QString
&
,
MessageType
,
int
);
void
displayProgressMessage
(
const
QString
&
,
MessageType
,
int
);
/** @brief Project profile changed, update render widget accordingly. */
void
updateRenderWidgetProfile
();
/** @brief Clear asset view if itemId is displayed. */
...
...
src/project/projectmanager.cpp
View file @
ae243e27
...
...
@@ -491,7 +491,7 @@ void ProjectManager::openFile(const QUrl &url)
if
(
checkForBackupFile
(
url
))
{
return
;
}
pCore
->
window
()
->
slotGotProgressInfo
(
i18n
(
"Opening file %1"
,
url
.
toLocalFile
()),
100
,
Information
Message
);
pCore
->
displayMessage
(
i18n
(
"Opening file %1"
,
url
.
toLocalFile
()),
OperationCompleted
Message
,
100
);
doOpenFile
(
url
,
nullptr
);
}
...
...
@@ -558,7 +558,7 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
m_project
->
getDocumentProperty
(
QStringLiteral
(
"disablepreview"
)).
toInt
());
emit
docOpened
(
m_project
);
pCore
->
window
()
->
slotGotProgressInfo
(
QString
()
,
100
);
pCore
->
displayMessage
(
QString
(),
OperationCompletedMessage
,
100
);
if
(
openBackup
)
{
slotOpenBackup
(
url
);
}
...
...
@@ -805,13 +805,13 @@ void ProjectManager::moveProjectData(const QString &src, const QString &dest)
void
ProjectManager
::
slotMoveProgress
(
KJob
*
,
unsigned
long
progress
)
{
pCore
->
window
()
->
slotGotProgressInfo
(
i18n
(
"Moving project folder"
),
static_cast
<
int
>
(
progress
)
,
ProcessingJobMessage
);
pCore
->
displayMessage
(
i18n
(
"Moving project folder"
),
ProcessingJobMessage
,
static_cast
<
int
>
(
progress
));
}
void
ProjectManager
::
slotMoveFinished
(
KJob
*
job
)
{
if
(
job
->
error
()
==
0
)
{
pCore
->
window
()
->
slotGotProgressInfo
(
QString
(),
100
,
Information
Message
);
pCore
->
displayMessage
(
QString
(),
OperationCompleted
Message
,
100
);
auto
*
copyJob
=
static_cast
<
KIO
::
CopyJob
*>
(
job
);
QString
newFolder
=
copyJob
->
destUrl
().
toLocalFile
();
// Check if project folder is inside document folder, in which case, paths will be relative
...
...
src/statusbarmessagelabel.cpp
View file @
ae243e27
...
...
@@ -96,7 +96,7 @@ void StatusBarMessageLabel::mousePressEvent(QMouseEvent *event)
}
}
void
StatusBarMessageLabel
::
setProgressMessage
(
const
QString
&
text
,
int
progress
,
MessageType
type
,
int
timeoutMS
)
void
StatusBarMessageLabel
::
setProgressMessage
(
const
QString
&
text
,
MessageType
type
,
int
progress
)
{
if
(
type
==
ProcessingJobMessage
)
{
m_progress
->
setValue
(
progress
);
...
...
@@ -107,7 +107,7 @@ void StatusBarMessageLabel::setProgressMessage(const QString &text, int progress
if
(
text
==
m_currentMessage
.
text
)
{
return
;
}
setMessage
(
text
,
type
,
timeoutMS
);
setMessage
(
text
,
type
,
0
);
}
void
StatusBarMessageLabel
::
setMessage
(
const
QString
&
text
,
MessageType
type
,
int
timeoutMS
)
...
...
@@ -122,7 +122,7 @@ void StatusBarMessageLabel::setMessage(const QString &text, MessageType type, in
m_queueSemaphore
.
acquire
();
if
(
!
m_messageQueue
.
contains
(
item
))
{
if
(
item
.
type
==
ErrorMessage
||
item
.
type
==
MltError
||
item
.
type
==
ProcessingJobMessage
)
{
if
(
item
.
type
==
ErrorMessage
||
item
.
type
==
MltError
||
item
.
type
==
ProcessingJobMessage
||
item
.
type
==
OperationCompletedMessage
)
{
qCDebug
(
KDENLIVE_LOG
)
<<
item
.
text
;
// Put the new error message at first place and immediately show it
...
...
src/statusbarmessagelabel.h
View file @
ae243e27
...
...
@@ -98,7 +98,7 @@ protected:
void
resizeEvent
(
QResizeEvent
*
event
)
override
;
public
slots
:
void
setProgressMessage
(
const
QString
&
text
,
int
progress
=
100
,
MessageType
type
=
ProcessingJobMessage
,
int
timeoutMS
=
0
);
void
setProgressMessage
(
const
QString
&
text
,
MessageType
type
=
ProcessingJobMessage
,
int
progress
=
10
0
);
void
setMessage
(
const
QString
&
text
,
MessageType
type
=
DefaultMessage
,
int
timeoutMS
=
0
);
private
slots
:
...
...
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