ALways overlay audio waveform in monitor for audio clips

parent c827054d
Pipeline #10022 passed with stage
in 19 minutes and 17 seconds
......@@ -1762,7 +1762,7 @@ void GLWidget::setAudioThumb(int channels, const QList <double>&audioCache)
if (!audioThumbDisplay) return;
QImage img(width(), height() / 6, QImage::Format_ARGB32_Premultiplied);
QImage img(width(), height() / 2, QImage::Format_ARGB32_Premultiplied);
img.fill(Qt::transparent);
if (!audioCache.isEmpty() && channels > 0) {
......
......@@ -1388,14 +1388,14 @@ void Monitor::slotOpenClip(const std::shared_ptr<ProjectClip> &controller, int i
m_audioMeterWidget->audioChannels = controller->audioInfo() ? controller->audioInfo()->channels() : 0;
m_glMonitor->setAudioThumb(controller->audioChannels(), controller->audioFrameCache);
m_controller->getMarkerModel()->registerSnapModel(m_snaps);
m_glMonitor->getControllerProxy()->setClipProperties(controller->hasAudioAndVideo(), controller->clipName());
m_glMonitor->getControllerProxy()->setClipProperties(controller->clipType(), controller->hasAudioAndVideo(), controller->clipName());
// hasEffects = controller->hasEffects();
} else {
loadQmlScene(MonitorSceneDefault);
m_glMonitor->setProducer(nullptr, isActive());
m_glMonitor->setAudioThumb();
m_audioMeterWidget->audioChannels = 0;
m_glMonitor->getControllerProxy()->setClipProperties(false, QString());
m_glMonitor->getControllerProxy()->setClipProperties(ClipType::Unknown, false, QString());
}
if (slotActivateMonitor()) {
start();
......
......@@ -21,7 +21,6 @@
#include "monitorproxy.h"
#include "core.h"
#include "definitions.h"
#include "doc/kthumb.h"
#include "glwidget.h"
#include "kdenlivesettings.h"
......@@ -292,7 +291,7 @@ QString MonitorProxy::toTimecode(int frames) const
return KdenliveSettings::frametimecode() ? QString::number(frames) : q->frameToTime(frames);
}
void MonitorProxy::setClipProperties(bool hasAV, const QString clipName)
void MonitorProxy::setClipProperties(ClipType::ProducerType type, bool hasAV, const QString clipName)
{
if (m_hasAV != hasAV) {
m_hasAV = hasAV;
......@@ -304,4 +303,6 @@ void MonitorProxy::setClipProperties(bool hasAV, const QString clipName)
}
m_clipName = clipName;
emit clipNameChanged();
m_clipType = type;
emit clipTypeChanged();
}
......@@ -26,6 +26,7 @@
#ifndef MONITORPROXY_H
#define MONITORPROXY_H
#include "definitions.h"
#include <QImage>
#include <QObject>
......@@ -48,6 +49,9 @@ class MonitorProxy : public QObject
/** @brief: Contains the name of clip currently displayed in monitor
* */
Q_PROPERTY(QString clipName MEMBER m_clipName NOTIFY clipNameChanged)
/** @brief: Contains the name of clip currently displayed in monitor
* */
Q_PROPERTY(int clipType MEMBER m_clipType NOTIFY clipTypeChanged)
public:
MonitorProxy(GLWidget *parent);
......@@ -85,7 +89,7 @@ public:
QImage extractFrame(int frame_position, const QString &path = QString(), int width = -1, int height = -1, bool useSourceProfile = false);
Q_INVOKABLE QString toTimecode(int frames) const;
Q_INVOKABLE double fps() const;
void setClipProperties(bool hasAV, const QString clipName);
void setClipProperties(ClipType::ProducerType type, bool hasAV, const QString clipName);
signals:
void positionChanged();
......@@ -105,6 +109,7 @@ signals:
void seekToKeyframe();
void clipHasAVChanged();
void clipNameChanged();
void clipTypeChanged();
private:
GLWidget *q;
......@@ -115,6 +120,7 @@ private:
bool m_hasAV;
QString m_markerComment;
QString m_clipName;
int m_clipType;
};
#endif
......@@ -3,6 +3,7 @@ import QtQuick.Window 2.2
import Kdenlive.Controls 1.0
import QtQuick 2.6
import AudioThumb 1.0
import com.enums 1.0
Item {
id: root
......@@ -13,6 +14,7 @@ Item {
// default size, but scalable by user
height: 300; width: 400
property string markerText
property int itemType: 0
property point profile
property double zoom
property double scalex
......@@ -25,7 +27,6 @@ Item {
property bool showSafezone
property bool showAudiothumb
property bool showToolbar: false
property bool hasAV: controller.clipHasAV
property string clipName: controller.clipName
property real baseUnit: fontMetrics.font.pixelSize * 0.8
property int duration: 300
......@@ -160,20 +161,20 @@ Item {
QmlAudioThumb {
id: audioThumb
objectName: "audiothumb"
property bool stateVisible: (barOverArea.mouseY >= root.height * 0.7 || clipMonitorRuler.containsMouse)
property bool stateVisible: (clipMonitorRuler.containsMouse || barOverArea.mouseY >= root.height * 0.7)
anchors {
left: parent.left
bottom: parent.bottom
}
height: parent.height / 6
height: controller.clipType == ProducerType.Audio ? parent.height : parent.height / 6
//font.pixelSize * 3
width: parent.width
visible: root.showAudiothumb
states: [
State { when: audioThumb.stateVisible;
State { when: audioThumb.stateVisible || controller.clipType == ProducerType.Audio;
PropertyChanges { target: audioThumb; opacity: 1.0 } },
State { when: !audioThumb.stateVisible;
State { when: !audioThumb.stateVisible && controller.clipType != ProducerType.Audio;
PropertyChanges { target: audioThumb; opacity: 0.0 } }
]
transitions: [ Transition {
......@@ -291,7 +292,7 @@ Item {
maximumLength: 20
}
}
Rectangle {
// Audio or video only drag zone
x: 5
......@@ -301,7 +302,7 @@ Item {
color: Qt.rgba(activePalette.highlight.r, activePalette.highlight.g, activePalette.highlight.b, 0.7)
radius: 4
opacity: (dragAudioArea.containsMouse || dragVideoArea.containsMouse /*|| dragOverArea.pressed */|| (barOverArea.containsMouse && barOverArea.mouseY >= y)) ? 1 : 0
visible: root.hasAV
visible: controller.clipHasAV
Row {
id: dragRow
ToolButton {
......
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