Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

* Improve visibility of audio/video only drag icons in clip monitor

* Display clip name over monitor for a few seconds
parent e1c658d7
Pipeline #10016 passed with stage
in 26 minutes and 4 seconds
......@@ -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()->setClipHasAV(controller->hasAudioAndVideo());
m_glMonitor->getControllerProxy()->setClipProperties(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()->setClipHasAV(false);
m_glMonitor->getControllerProxy()->setClipProperties(false, QString());
}
if (slotActivateMonitor()) {
start();
......
......@@ -292,13 +292,16 @@ QString MonitorProxy::toTimecode(int frames) const
return KdenliveSettings::frametimecode() ? QString::number(frames) : q->frameToTime(frames);
}
bool MonitorProxy::clipHasAV() const
void MonitorProxy::setClipProperties(bool hasAV, const QString clipName)
{
return m_hasAV;
}
void MonitorProxy::setClipHasAV(bool hasAV)
{
m_hasAV = hasAV;
emit clipHasAVChanged();
if (m_hasAV != hasAV) {
m_hasAV = hasAV;
emit clipHasAVChanged();
}
if (clipName == clipName) {
m_clipName.clear();
emit clipNameChanged();
}
m_clipName = clipName;
emit clipNameChanged();
}
......@@ -42,7 +42,12 @@ class MonitorProxy : public QObject
Q_PROPERTY(int rulerHeight READ rulerHeight NOTIFY rulerHeightChanged)
Q_PROPERTY(QString markerComment READ markerComment NOTIFY markerCommentChanged)
Q_PROPERTY(int overlayType READ overlayType WRITE setOverlayType NOTIFY overlayTypeChanged)
Q_PROPERTY(bool clipHasAV READ clipHasAV NOTIFY clipHasAVChanged)
/** @brief: Returns true if current clip in monitor has Audio and Video
* */
Q_PROPERTY(bool clipHasAV MEMBER m_hasAV NOTIFY clipHasAVChanged)
/** @brief: Contains the name of clip currently displayed in monitor
* */
Q_PROPERTY(QString clipName MEMBER m_clipName NOTIFY clipNameChanged)
public:
MonitorProxy(GLWidget *parent);
......@@ -54,9 +59,6 @@ public:
int rulerHeight() const;
int overlayType() const;
void setOverlayType(int ix);
/** brief: Returns true if current clip in monitor has Audio and Video
* */
bool clipHasAV() const;
QString markerComment() const;
Q_INVOKABLE void requestSeekPosition(int pos);
/** brief: Returns seek position or consumer position when not seeking
......@@ -83,7 +85,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 setClipHasAV(bool hasAV);
void setClipProperties(bool hasAV, const QString clipName);
signals:
void positionChanged();
......@@ -102,6 +104,7 @@ signals:
void addRemoveKeyframe();
void seekToKeyframe();
void clipHasAVChanged();
void clipNameChanged();
private:
GLWidget *q;
......@@ -111,6 +114,7 @@ private:
int m_zoneOut;
bool m_hasAV;
QString m_markerComment;
QString m_clipName;
};
#endif
......@@ -26,6 +26,7 @@ Item {
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
property int mouseRulerPos: 0
......@@ -50,6 +51,11 @@ Item {
onWidthChanged: {
clipMonitorRuler.updateRuler()
}
onClipNameChanged: {
// Animate clip name
clipNameLabel.opacity = 1
showAnimate.restart()
}
function updatePalette() {
clipMonitorRuler.forceRepaint()
......@@ -63,6 +69,37 @@ Item {
}
root.overlayType = controller.overlayType
}
Label {
id: clipNameLabel
font: fixedFont
anchors {
top: parent.top
horizontalCenter: parent.horizontalCenter
}
color: "white"
text: clipName
background: Rectangle {
color: "#222277"
}
opacity: 0
visible: clipName != ""
height: marker.height
width: textMetricsName.width + 10
padding:10
horizontalAlignment: TextInput.AlignHCenter
TextMetrics {
id: textMetricsName
font: clipNameLabel.font
text: clipNameLabel.text
}
SequentialAnimation {
id: showAnimate
running: false
NumberAnimation { target: clipNameLabel; duration: 3000 }
NumberAnimation { target: clipNameLabel; property: "opacity"; to: 0; duration: 1000 }
}
}
MouseArea {
id: barOverArea
hoverEnabled: true
......@@ -123,7 +160,7 @@ Item {
QmlAudioThumb {
id: audioThumb
objectName: "audiothumb"
property bool stateVisible: (barOverArea.mouseY >= root.height * 0.7 || dragOverArea.containsMouse || clipMonitorRuler.containsMouse)
property bool stateVisible: (barOverArea.mouseY >= root.height * 0.7 || clipMonitorRuler.containsMouse)
anchors {
left: parent.left
bottom: parent.bottom
......@@ -254,46 +291,60 @@ Item {
maximumLength: 20
}
}
MouseArea {
id: dragOverArea
hoverEnabled: true
acceptedButtons: Qt.LeftButton
x: 0
width: parent.width
height: 2 * audioDragButton.height
y: parent.height - height
propagateComposedEvents: true
onPressed: {
// First found child is the Column
var clickedChild = childAt(mouseX,mouseY) ? childAt(mouseX,mouseY).childAt(mouseX,mouseY).childAt(mouseX,mouseY) : ""
if (clickedChild == audioDragButton) {
dragType = 1
} else if (clickedChild == videoDragButton) {
dragType = 2
} else {
dragType = 0
}
mouse.accepted = false
}
Rectangle {
x: 5
width: childrenRect.width
height: childrenRect.height
color: Qt.rgba(activePalette.window.r, activePalette.window.g, activePalette.window.b, 0.5)
radius: 4
visible: root.hasAV && dragOverArea.containsMouse
Rectangle {
// Audio or video only drag zone
x: 5
y: parent.height - height - 5
width: childrenRect.width
height: childrenRect.height
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
Row {
ToolButton {
id: videoDragButton
icon.name: "kdenlive-show-video"
enabled: false
}
ToolButton {
id: audioDragButton
icon.name: "audio-volume-medium"
enabled: false
}
}
id: dragRow
ToolButton {
id: videoDragButton
icon.name: "kdenlive-show-video"
MouseArea {
id: dragVideoArea
hoverEnabled: true
acceptedButtons: Qt.LeftButton
anchors.fill: parent
propagateComposedEvents: true
cursorShape: Qt.PointingHand
onPressed: {
parent.enabled = false
mouse.accepted = false
dragType = 2
}
onExited: {
parent.enabled = true
parent.clicked()
}
}
}
ToolButton {
id: audioDragButton
icon.name: "audio-volume-medium"
MouseArea {
id: dragAudioArea
hoverEnabled: true
acceptedButtons: Qt.LeftButton
anchors.fill: parent
propagateComposedEvents: true
cursorShape: Qt.PointingHand
onPressed: {
parent.enabled = false
mouse.accepted = false
dragType = 1
}
onExited: {
parent.enabled = true
}
}
}
}
}
}
......
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