Add line to indicate resize handle and focus of timeline.

Related to #593
parent 067917f7
......@@ -226,6 +226,25 @@ void MainWindow::init()
ctnLay->setSpacing(0);
ctnLay->setContentsMargins(0, 0, 0, 0);
m_timelineToolBarContainer->setLayout(ctnLay);
QFrame *topFrame = new QFrame(this);
topFrame->setFrameShape(QFrame::HLine);
topFrame->setFixedHeight(1);
topFrame->setLineWidth(1);
connect(this, &MainWindow::focusTimeline, [topFrame](bool focus, bool highlight) {
if (focus) {
KColorScheme scheme(QApplication::palette().currentColorGroup(), KColorScheme::Tooltip);
if (highlight) {
QColor col = scheme.decoration(KColorScheme::HoverColor).color();
topFrame->setStyleSheet(QString("QFrame {border: 1px solid rgba(%1,%2,%3,70)}").arg(col.red()).arg(col.green()).arg(col.blue()));
} else {
QColor col = scheme.decoration(KColorScheme::FocusColor).color();
topFrame->setStyleSheet(QString("QFrame {border: 1px solid rgba(%1,%2,%3,100)}").arg(col.red()).arg(col.green()).arg(col.blue()));
}
} else {
topFrame->setStyleSheet(QString());
}
});
ctnLay->addWidget(topFrame);
ctnLay->addWidget(m_timelineToolBar);
KSharedConfigPtr config = KSharedConfig::openConfig();
KConfigGroup mainConfig(config, QStringLiteral("MainWindow"));
......
......@@ -503,6 +503,7 @@ signals:
void adjustAssetPanelRange(int itemId, int in, int out);
/** @brief Enable or disable the undo stack. For example undo/redo should not be enabled when dragging a clip in timeline or we risk corruption. */
void enableUndo(bool enable);
bool focusTimeline(bool focus, bool highlight);
};
#endif
......@@ -556,7 +556,7 @@ void Monitor::setupMenu(QMenu *goMenu, QMenu *overlayMenu, QAction *playZone, QA
// TODO: add save zone to timeline monitor when fixed
m_contextMenu->addMenu(m_markerMenu);
if (m_id == Kdenlive::ClipMonitor) {
m_contextMenu->addAction(QIcon::fromTheme(QStringLiteral("document-save")), i18n("Save zone"), this, SLOT(slotSaveZone()));
//m_contextMenu->addAction(QIcon::fromTheme(QStringLiteral("document-save")), i18n("Save zone"), this, SLOT(slotSaveZone()));
QAction *extractZone =
m_configMenu->addAction(QIcon::fromTheme(QStringLiteral("document-new")), i18n("Extract Zone"), this, SLOT(slotExtractCurrentZone()));
m_contextMenu->addAction(extractZone);
......
......@@ -71,6 +71,7 @@ TimelineWidget::TimelineWidget(QWidget *parent)
setFocusPolicy(Qt::StrongFocus);
m_favEffects = new QMenu(i18n("Insert an effect..."), this);
m_favCompositions = new QMenu(i18n("Insert a composition..."), this);
installEventFilter(this);
}
TimelineWidget::~TimelineWidget()
......@@ -400,3 +401,30 @@ void TimelineWidget::endDrag()
QMetaObject::invokeMethod(rootObject(), "endBinDrag");
}
}
bool TimelineWidget::eventFilter(QObject *object, QEvent *event)
{
switch(event->type()) {
case QEvent::Enter:
if (!hasFocus()) {
pCore->window()->focusTimeline(true, true);
}
break;
case QEvent::Leave:
if (!hasFocus()) {
pCore->window()->focusTimeline(false, true);
}
break;
case QEvent::FocusOut:
pCore->window()->focusTimeline(false, false);
break;
case QEvent::FocusIn:
pCore->window()->focusTimeline(true, false);
break;
default:
break;
}
return QQuickWidget::eventFilter(object, event);
}
......@@ -58,6 +58,7 @@ public:
protected:
void mousePressEvent(QMouseEvent *event) override;
bool eventFilter(QObject *object, QEvent *event) override;
public slots:
void slotChangeZoom(int value, bool zoomOnMouse);
......
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