Commit 720226cf authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Improve tooltip on mix enter/exit/resize, display number of selected clips and...

Improve tooltip on mix enter/exit/resize, display number of selected clips and duration in status bar
parent 1f6d28ac
Pipeline #151711 skipped
......@@ -794,6 +794,13 @@ int Core::undoIndex() const
return m_projectManager->undoStack()->index();
}
void Core::displaySelectionMessage(const QString &message)
{
if (m_mainWindow) {
emit m_mainWindow->displaySelectionMessage(message);
}
}
void Core::displayMessage(const QString &message, MessageType type, int timeout)
{
if (m_mainWindow) {
......
......@@ -174,6 +174,8 @@ public:
void pushUndo(QUndoCommand *command);
/** @brief display a user info/warning message in statusbar */
void displayMessage(const QString &message, MessageType type, int timeout = -1);
/** @brief display timeline selection info in statusbar */
void displaySelectionMessage(const QString &message);
/** @brief Clear asset view if itemId is displayed. */
void clearAssetPanel(int itemId);
/** @brief Returns the effectstack of a given bin clip. */
......
......@@ -1351,6 +1351,7 @@ void MainWindow::setupActions()
m_messageLabel = new StatusBarMessageLabel(this);
m_messageLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
connect(this, &MainWindow::displayMessage, m_messageLabel, &StatusBarMessageLabel::setMessage);
connect(this, &MainWindow::displaySelectionMessage, m_messageLabel, &StatusBarMessageLabel::setSelectionMessage);
connect(this, &MainWindow::displayProgressMessage, m_messageLabel, &StatusBarMessageLabel::setProgressMessage);
statusBar()->addWidget(m_messageLabel, 10);
statusBar()->addPermanentWidget(toolbar);
......
......@@ -576,6 +576,7 @@ signals:
void setPreviewProgress(int);
void setRenderProgress(int);
void displayMessage(const QString &, MessageType, int);
void displaySelectionMessage(const QString &);
void displayProgressMessage(const QString &, MessageType, int);
/** @brief Project profile changed, update render widget accordingly. */
void updateRenderWidgetProfile();
......
......@@ -66,6 +66,9 @@ StatusBarMessageLabel::StatusBarMessageLabel(QWidget *parent)
auto *lay2 = new QHBoxLayout(m_container);
m_pixmap = new QLabel(this);
m_pixmap->setAlignment(Qt::AlignCenter);
m_selectionLabel = new QLabel(this);
m_selectionLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
m_selectionLabel->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
m_label = new QLabel(this);
m_label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
m_label->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
......@@ -73,6 +76,7 @@ StatusBarMessageLabel::StatusBarMessageLabel(QWidget *parent)
m_keyMap->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
m_keyMap->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
m_progress = new QProgressBar(this);
lay2->addWidget(m_selectionLabel);
lay2->addWidget(m_pixmap);
lay2->addWidget(m_label);
lay2->addWidget(m_progress);
......@@ -128,6 +132,11 @@ void StatusBarMessageLabel::setProgressMessage(const QString &text, MessageType
setMessage(text, type, 0);
}
void StatusBarMessageLabel::setSelectionMessage(const QString &text)
{
m_selectionLabel->setText(text);
}
void StatusBarMessageLabel::setMessage(const QString &text, MessageType type, int timeoutMS)
{
if (type == TooltipMessage) {
......
......@@ -90,6 +90,7 @@ protected:
public slots:
void setProgressMessage(const QString &text, MessageType type = ProcessingJobMessage, int progress = 100);
void setMessage(const QString &text, MessageType type = DefaultMessage, int timeoutMS = 0);
void setSelectionMessage(const QString &text);
/** @brief Display a key binding info in status bar */
void setKeyMap(const QString &text);
/** @brief Display a temporary key binding info in status bar, revert to default one if text is empty */
......@@ -116,6 +117,7 @@ private:
int m_minTextHeight;
FlashLabel *m_container;
QLabel *m_selectionLabel;
QLabel *m_pixmap;
QLabel *m_label;
QLabel *m_keyMap;
......
......@@ -428,6 +428,11 @@ Rectangle {
onPressed: {
controller.requestMixSelection(clipRoot.clipId);
}
onEntered: {
var text = i18n("Mix duration: %1, Cut at: %2".arg(timeline.simplifiedTC(clipRoot.mixDuration))
.arg(timeline.simplifiedTC(clipRoot.mixDuration - clipRoot.mixCut)))
timeline.showToolTip(text)
}
}
Rectangle {
id: mixCutPos
......@@ -484,6 +489,13 @@ Rectangle {
if (currentFrame != previousMix) {
parent.width = currentFrame * clipRoot.timeScale
sizeChanged = true
if (currentFrame > previousMix) {
timeline.showToolTip(i18n("+%1, Mix duration: %2", timeline.simplifiedTC(currentFrame - previousMix), timeline.simplifiedTC(currentFrame)))
} else {
timeline.showToolTip(i18n("-%1, Mix duration: %2", timeline.simplifiedTC(previousMix - currentFrame), timeline.simplifiedTC(currentFrame)))
}
} else {
timeline.showToolTip(i18n("Mix duration: %1", timeline.simplifiedTC(currentFrame)))
}
if (x < mixCutPos.x) {
// This will delete the mix
......@@ -496,13 +508,17 @@ Rectangle {
onEntered: {
if (!pressed) {
mixOut.color = 'red'
timeline.showToolTip(i18n("Mix:%1", timeline.simplifiedTC(clipRoot.mixDuration)))
timeline.showToolTip(i18n("Mix duration: %1", timeline.simplifiedTC(clipRoot.mixDuration)))
}
}
onExited: {
if (!pressed) {
mixOut.color = itemBorder.border.color
timeline.showToolTip()
if (!mouseArea.containsMouse) {
timeline.showToolTip()
} else {
clipRoot.showClipInfo()
}
}
}
Rectangle {
......
......@@ -3752,11 +3752,13 @@ void TimelineController::updateClipActions()
emit showItemEffectStack(QString(), nullptr, QSize(), false);
pCore->timeRemapWidget()->selectedClip(-1);
emit showSubtitle(-1);
pCore->displaySelectionMessage(QString());
return;
}
std::shared_ptr<ClipModel> clip(nullptr);
int item = *m_model->getCurrentSelection().begin();
int selectionSize = m_model->getCurrentSelection().size();
std::unordered_set<int>selectedItems = m_model->getCurrentSelection();
int item = *selectedItems.begin();
int selectionSize = selectedItems.size();
if (selectionSize == 1) {
if (m_model->isClip(item) || m_model->isComposition(item)) {
showAsset(item);
......@@ -3764,6 +3766,21 @@ void TimelineController::updateClipActions()
} else if (m_model->isSubTitle(item)) {
emit showSubtitle(item);
}
pCore->displaySelectionMessage(QString());
} else {
int min = -1;
int max = -1;
for (const auto &id : selectedItems) {
int itemPos = m_model->getItemPosition(id);
int itemOut = itemPos + m_model->getItemPlaytime(id);
if (min == -1 || itemPos < min) {
min = itemPos;
}
if (max == -1 || itemOut > max) {
max = itemOut;
}
}
pCore->displaySelectionMessage(i18n("%1 items selected (%2) |", selectionSize, simplifiedTC(max - min)));
}
if (m_model->isClip(item)) {
clip = m_model->getClipPtr(item);
......
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