Fix several key binding message issues (missing/incorrect messages, incorrect...

Fix several key binding message issues (missing/incorrect messages, incorrect background highlight). Related to #916
parent fb8d5554
Pipeline #47365 failed with stage
in 9 minutes and 31 seconds
......@@ -148,6 +148,7 @@ sox_gain.xml
sox_phaser.xml
sox_stretch.xml
speed.xml
strobe.xml
swapchannels.xml
tcolor.xml
threshold.xml
......
......@@ -3114,7 +3114,7 @@ void MainWindow::showToolMessage()
{
QString message;
if (m_buttonSelectTool->isChecked()) {
message = i18n("<b>Shift</b> to create a selection rectangle, <b>Ctrl</b> to add an item to selection");
message = i18n("<b>Shift drag</b> for rubber-band selection, <b>Shift click</b> for multiple selection, <b>Ctrl drag</b> to pan");
} else if (m_buttonRazorTool->isChecked()) {
message = i18n("<b>Shift</b> to preview cut frame");
} else if (m_buttonSpacerTool->isChecked()) {
......
......@@ -66,12 +66,14 @@ QColor FlashLabel::color() const
}
StatusBarMessageLabel::StatusBarMessageLabel(QWidget *parent)
: FlashLabel(parent)
: QWidget(parent)
, m_minTextHeight(-1)
, m_queueSemaphore(1)
{
setMinimumHeight(KIconLoader::SizeSmall);
m_container = new FlashLabel(this);
auto *lay = new QHBoxLayout(this);
auto *lay2 = new QHBoxLayout(m_container);
m_pixmap = new QLabel(this);
m_pixmap->setAlignment(Qt::AlignCenter);
m_label = new QLabel(this);
......@@ -81,9 +83,10 @@ StatusBarMessageLabel::StatusBarMessageLabel(QWidget *parent)
m_keyMap->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
m_keyMap->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
m_progress = new QProgressBar(this);
lay->addWidget(m_pixmap);
lay->addWidget(m_label);
lay->addWidget(m_progress);
lay2->addWidget(m_pixmap);
lay2->addWidget(m_label);
lay2->addWidget(m_progress);
lay->addWidget(m_container);
QFrame* line = new QFrame(this);
......@@ -231,9 +234,9 @@ bool StatusBarMessageLabel::slotMessageTimeout()
}
}
QColor bgColor = KStatefulBrush(KColorScheme::Window, KColorScheme::NegativeBackground).brush(this).color();
QColor bgColor = KStatefulBrush(KColorScheme::Window, KColorScheme::NegativeBackground).brush(m_container).color();
const char *iconName = nullptr;
setColor(parentWidget()->palette().window().color());
m_container->setColor(m_container->palette().window().color());
switch (m_currentMessage.type) {
case ProcessingJobMessage:
iconName = "chronometer";
......@@ -247,11 +250,11 @@ bool StatusBarMessageLabel::slotMessageTimeout()
case InformationMessage: {
iconName = "dialog-information";
m_pixmap->setCursor(Qt::ArrowCursor);
QPropertyAnimation *anim = new QPropertyAnimation(this, "color", this);
QPropertyAnimation *anim = new QPropertyAnimation(m_container, "color", this);
anim->setDuration(3000);
anim->setEasingCurve(QEasingCurve::InOutQuad);
anim->setKeyValueAt(0.2, parentWidget()->palette().highlight().color());
anim->setEndValue(parentWidget()->palette().window().color());
anim->setKeyValueAt(0.2, m_container->palette().highlight().color());
anim->setEndValue(m_container->palette().window().color());
anim->start(QPropertyAnimation::DeleteWhenStopped);
break;
}
......@@ -259,10 +262,10 @@ bool StatusBarMessageLabel::slotMessageTimeout()
case ErrorMessage: {
iconName = "dialog-warning";
m_pixmap->setCursor(Qt::ArrowCursor);
QPropertyAnimation *anim = new QPropertyAnimation(this, "color", this);
QPropertyAnimation *anim = new QPropertyAnimation(m_container, "color", this);
anim->setStartValue(bgColor);
anim->setKeyValueAt(0.8, bgColor);
anim->setEndValue(parentWidget()->palette().window().color());
anim->setEndValue(m_container->palette().window().color());
anim->setEasingCurve(QEasingCurve::OutCubic);
anim->setDuration(4000);
anim->start(QPropertyAnimation::DeleteWhenStopped);
......@@ -271,7 +274,7 @@ bool StatusBarMessageLabel::slotMessageTimeout()
case MltError: {
iconName = "dialog-close";
m_pixmap->setCursor(Qt::PointingHandCursor);
QPropertyAnimation *anim = new QPropertyAnimation(this, "color", this);
QPropertyAnimation *anim = new QPropertyAnimation(m_container, "color", this);
anim->setStartValue(bgColor);
anim->setEndValue(bgColor);
anim->setEasingCurve(QEasingCurve::OutCubic);
......
......@@ -84,7 +84,7 @@ struct StatusBarMessageItem
* DolphinStatusBar::Error a dynamic color blending is done to get the
* attention from the user.
*/
class StatusBarMessageLabel : public FlashLabel
class StatusBarMessageLabel : public QWidget
{
Q_OBJECT
......@@ -127,6 +127,7 @@ private:
enum { BorderGap = 2 };
int m_minTextHeight;
FlashLabel *m_container;
QLabel *m_pixmap;
QLabel *m_label;
QLabel *m_keyMap;
......
......@@ -584,7 +584,7 @@ Rectangle {
initDrag(clipRoot, itemPos, clipRoot.clipId, clipRoot.modelStart, clipRoot.trackId, false)
var s = i18n("In:%1, Position:%2", timeline.simplifiedTC(clipRoot.inPoint),timeline.simplifiedTC(clipRoot.modelStart))
timeline.showToolTip(s)
timeline.showKeyBinding(i18n("<b>Ctrl</b> to change speed, <b>Double click</b> to mix with adjacent clip"))
timeline.showKeyBinding(i18n("<b>Ctrl drag</b> to change speed, <b>Double click</b> to mix with adjacent clip"))
}
}
onExited: {
......@@ -595,7 +595,9 @@ Rectangle {
} else {
clipRoot.showClipInfo()
}
timeline.showKeyBinding()
if (!fadeInMouseArea.containsMouse) {
timeline.showKeyBinding()
}
}
}
Rectangle {
......@@ -687,7 +689,9 @@ Rectangle {
initDrag(clipRoot, itemPos, clipRoot.clipId, clipRoot.modelStart, clipRoot.trackId, false)
var s = i18n("Out:%1, Position:%2", timeline.simplifiedTC(clipRoot.outPoint),timeline.simplifiedTC(clipRoot.modelStart + clipRoot.clipDuration))
timeline.showToolTip(s)
timeline.showKeyBinding(i18n("<b>Ctrl</b> to change speed, <b>Double click</b> to mix with adjacent clip"))
if (!fadeOutMouseArea.containsMouse) {
timeline.showKeyBinding(i18n("<b>Ctrl drag</b> to change speed, <b>Double click</b> to mix with adjacent clip"))
}
}
}
onExited: {
......@@ -703,7 +707,9 @@ Rectangle {
.arg(timeline.simplifiedTC(clipRoot.clipDuration)))
timeline.showToolTip(text)
}
timeline.showKeyBinding()
if (!fadeOutMouseArea.containsMouse) {
timeline.showKeyBinding()
}
}
}
/*ToolTip {
......@@ -1054,7 +1060,7 @@ Rectangle {
} else {
clipRoot.showClipInfo()
}
timeline.showKeyBinding(i18n("<b>Drag</b> to add a fade, <b>Double click</b> to add default duration fade"))
timeline.showKeyBinding(i18n("<b>Drag</b> to adjust fade, <b>Click</b> to add default duration fade"))
}
}
onExited: {
......@@ -1072,7 +1078,7 @@ Rectangle {
anchors.top: parent.top
anchors.right: clipRoot.fadeOut > 0 ? undefined : parent.right
anchors.horizontalCenter: clipRoot.fadeOut > 0 ? parent.horizontalCenter : undefined
width: fadeOutMouseArea.containsMouse || Drag.active ? parent.width : 5
width: fadeOutMouseArea.containsMouse || Drag.active ? parent.width : parent.width / 2
height: width
radius: width / 2
color: 'darkred'
......@@ -1097,7 +1103,7 @@ Rectangle {
// Fade in drag zone
id: fadeInMouseArea
anchors.left: container.left
anchors.leftMargin: clipRoot.fadeIn <= 0 ? 0 : (fadeInTriangle.width - width / 2)
anchors.leftMargin: clipRoot.fadeIn <= 0 ? 0 : (fadeInTriangle.width - width / 3)
anchors.top: parent.top
width: Math.min(root.baseUnit, container.height / 3)
height: width
......@@ -1149,7 +1155,7 @@ Rectangle {
} else {
clipRoot.showClipInfo()
}
timeline.showKeyBinding(i18n("<b>Drag</b> to add a fade, <b>Double click</b> to add default duration fade"))
timeline.showKeyBinding(i18n("<b>Drag</b> to adjust fade, <b>Click</b> to add default duration fade"))
}
}
onExited: {
......@@ -1167,7 +1173,7 @@ Rectangle {
anchors.top: parent.top
anchors.left: clipRoot.fadeIn > 0 ? undefined : parent.left
anchors.horizontalCenter: clipRoot.fadeIn > 0 ? parent.horizontalCenter : undefined
width: fadeInMouseArea.containsMouse || Drag.active ? parent.width : 5
width: fadeInMouseArea.containsMouse || Drag.active ? parent.width : parent.width / 3
height: width
radius: width / 2
color: 'green'
......
......@@ -319,8 +319,18 @@ Item {
}
}
}
onEntered: if (!pressed) trimIn.opacity = 1
onExited: trimIn.opacity = 0
onEntered: {
if (!pressed) {
trimIn.opacity = 1
timeline.showKeyBinding(i18n("<b>Drag</b> to resize"))
}
}
onExited: {
trimIn.opacity = 0
if (!mouseArea.containsMouse) {
timeline.showKeyBinding()
}
}
Rectangle {
id: trimIn
anchors.left: parent.left
......@@ -364,8 +374,18 @@ Item {
compositionRoot.trimmingOut(compositionRoot, newDuration, mouse)
}
}
onEntered: if (!pressed) trimOut.opacity = 1
onExited: trimOut.opacity = 0
onEntered: {
if (!pressed) {
trimIn.opacity = 1
timeline.showKeyBinding(i18n("<b>Drag</b> to resize"))
}
}
onExited: {
trimIn.opacity = 0
if (!mouseArea.containsMouse) {
timeline.showKeyBinding()
}
}
Rectangle {
id: trimOut
anchors.right: parent.right
......
......@@ -46,6 +46,10 @@ Item {
drag.minimumX: 0
onEntered: {
console.log('ENTERED SUBTITLE MOUSE AREA')
timeline.showKeyBinding(i18n("<b>Double click</b> to edit text"))
}
onExited: {
timeline.showKeyBinding()
}
onPressed: {
console.log('ENTERED ITEM CLCKD')
......@@ -203,9 +207,15 @@ Item {
onEntered: {
if (!pressed) {
trimIn.opacity = 1
timeline.showKeyBinding(i18n("<b>Drag</b> to resize"))
}
}
onExited: {
trimIn.opacity = 0
if (!subtitleClipArea.containsMouse) {
timeline.showKeyBinding()
}
}
onExited: trimIn.opacity = 0
Rectangle {
id: trimIn
......@@ -286,9 +296,15 @@ Item {
console.log('ENTER MOUSE END AREA')
if (!pressed) {
trimOut.opacity = 1
timeline.showKeyBinding(i18n("<b>Drag</b> to resize"))
}
}
onExited: {
trimOut.opacity = 0
if (!subtitleClipArea.containsMouse) {
timeline.showKeyBinding()
}
}
onExited: trimOut.opacity = 0
Rectangle {
id: trimOut
......
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