Commit a4b4c526 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Move key binding info on the left, context item info on the right, show key info for project bin.

Related to #916
parent 8c73dd92
Pipeline #47570 passed with stage
in 10 minutes and 27 seconds
......@@ -541,6 +541,18 @@ void MyListView::focusInEvent(QFocusEvent *event)
}
}
void MyListView::enterEvent(QEvent *event)
{
QListView::enterEvent(event);
pCore->window()->setWidgetKeyBinding(i18n("<b>Double click</b> to add a file to the project"));
}
void MyListView::leaveEvent(QEvent *event)
{
QListView::leaveEvent(event);
pCore->window()->setWidgetKeyBinding();
}
void MyListView::mousePressEvent(QMouseEvent *event)
{
QListView::mousePressEvent(event);
......@@ -559,10 +571,10 @@ void MyListView::mousePressEvent(QMouseEvent *event)
void MyListView::mouseMoveEvent(QMouseEvent *event)
{
if (KdenliveSettings::hoverPreview()) {
QModelIndex index = indexAt(event->pos());
if (index.isValid()) {
QAbstractItemDelegate *del = itemDelegate(index);
QModelIndex index = indexAt(event->pos());
if (index.isValid()) {
QAbstractItemDelegate *del = itemDelegate(index);
if (KdenliveSettings::hoverPreview()) {
if (del) {
auto delegate = static_cast<BinListItemDelegate *>(del);
QRect vRect = visualRect(index);
......@@ -572,6 +584,9 @@ void MyListView::mouseMoveEvent(QMouseEvent *event)
qDebug()<<"<<< NO DELEGATE!!!";
}
}
pCore->window()->showKeyBinding(i18n("F2 to rename selected item"));
} else {
pCore->window()->showKeyBinding();
}
QListView::mouseMoveEvent(event);
}
......@@ -606,6 +621,18 @@ void MyTreeView::focusInEvent(QFocusEvent *event)
}
}
void MyTreeView::enterEvent(QEvent *event)
{
QTreeView::enterEvent(event);
pCore->window()->setWidgetKeyBinding(i18n("<b>Double click</b> to add a file to the project"));
}
void MyTreeView::leaveEvent(QEvent *event)
{
QTreeView::leaveEvent(event);
pCore->window()->setWidgetKeyBinding();
}
void MyTreeView::mouseMoveEvent(QMouseEvent *event)
{
bool dragged = false;
......@@ -614,12 +641,17 @@ void MyTreeView::mouseMoveEvent(QMouseEvent *event)
if (distance >= QApplication::startDragDistance()) {
dragged = performDrag();
}
} else if (KdenliveSettings::hoverPreview()) {
} else {
QModelIndex index = indexAt(event->pos());
if (index.isValid()) {
QAbstractItemDelegate *del = itemDelegate(index);
int frame = static_cast<BinItemDelegate *>(del)->getFrame(index, event->pos().x());
emit displayBinFrame(index, frame);
if (KdenliveSettings::hoverPreview()) {
QAbstractItemDelegate *del = itemDelegate(index);
int frame = static_cast<BinItemDelegate *>(del)->getFrame(index, event->pos().x());
emit displayBinFrame(index, frame);
}
pCore->window()->showKeyBinding(i18n("F2 to rename selected item"));
} else {
pCore->window()->showKeyBinding();
}
}
if (!dragged) {
......@@ -845,6 +877,7 @@ Bin::Bin(std::shared_ptr<ProjectItemModel> model, QWidget *parent)
, m_iconSize(160, 90)
, m_propertiesPanel(nullptr)
, m_blankThumb()
, m_clipWidget()
, m_filterGroup(this)
, m_filterRateGroup(this)
, m_filterTypeGroup(this)
......@@ -852,7 +885,6 @@ Bin::Bin(std::shared_ptr<ProjectItemModel> model, QWidget *parent)
, m_gainedFocus(false)
, m_audioDuration(0)
, m_processedAudio(0)
, m_clipWidget()
{
m_layout = new QVBoxLayout(this);
......
......@@ -80,8 +80,11 @@ public:
protected:
void mousePressEvent(QMouseEvent *event) override;
void focusInEvent(QFocusEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void focusInEvent(QFocusEvent *event) override;
void enterEvent(QEvent *event) override;
void leaveEvent(QEvent *event) override;
signals:
void focusView();
void updateDragMode(PlaylistState::ClipState type);
......@@ -104,6 +107,8 @@ protected:
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void focusInEvent(QFocusEvent *event) override;
void enterEvent(QEvent *event) override;
void leaveEvent(QEvent *event) override;
protected slots:
void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint) override;
......
......@@ -1296,13 +1296,10 @@ void MainWindow::setupActions()
int small = style()->pixelMetric(QStyle::PM_SmallIconSize);
statusBar()->setMaximumHeight(2 * small);
m_messageLabel = new StatusBarMessageLabel(this);
m_messageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
m_messageLabel->setSizePolicy(QSizePolicy::MinimumExpanding, 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);
statusBar()->addWidget(spacer, 1);
statusBar()->addWidget(m_messageLabel, 10);
statusBar()->addPermanentWidget(toolbar);
toolbar->setIconSize(QSize(small, small));
toolbar->layout()->setContentsMargins(0, 0, 0, 0);
......@@ -3129,9 +3126,9 @@ void MainWindow::showToolMessage()
m_messageLabel->setKeyMap(message);
}
void MainWindow::clearToolMessage()
void MainWindow::setWidgetKeyBinding(const QString &mess)
{
m_messageLabel->setKeyMap(QString());
m_messageLabel->setKeyMap(mess);
}
void MainWindow::showKeyBinding(const QString &text)
......
......@@ -149,10 +149,10 @@ public:
/** @brief Show current tool key combination in status bar */
void showToolMessage();
/** @brief Hide the current tool key combination in status bar */
void clearToolMessage();
/** @brief Show the widget's default key binding message */
void setWidgetKeyBinding(const QString &text = QString());
/** @brief Show a key binding in status bar */
void showKeyBinding(const QString &text);
void showKeyBinding(const QString &text = QString());
protected:
/** @brief Closes the window.
......
......@@ -71,6 +71,7 @@ StatusBarMessageLabel::StatusBarMessageLabel(QWidget *parent)
, m_queueSemaphore(1)
{
setMinimumHeight(KIconLoader::SizeSmall);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
m_container = new FlashLabel(this);
auto *lay = new QHBoxLayout(this);
auto *lay2 = new QHBoxLayout(m_container);
......@@ -86,14 +87,11 @@ StatusBarMessageLabel::StatusBarMessageLabel(QWidget *parent)
lay2->addWidget(m_pixmap);
lay2->addWidget(m_label);
lay2->addWidget(m_progress);
lay->addWidget(m_container);
QFrame* line = new QFrame(this);
line->setFrameShape(QFrame::VLine);
line->setFrameShadow(QFrame::Sunken);
lay->addWidget(line);
lay->addWidget(m_keyMap);
auto *spacer = new QSpacerItem(1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
lay->addItem(spacer);
lay->addWidget(m_container);
setLayout(lay);
m_progress->setVisible(false);
lay->setContentsMargins(BorderGap, 0, 2 * BorderGap, 0);
......
......@@ -4121,7 +4121,7 @@ void TimelineController::showTimelineToolInfo(bool show) const
if (show) {
pCore->window()->showToolMessage();
} else {
pCore->window()->clearToolMessage();
pCore->window()->setWidgetKeyBinding();
}
}
......
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