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

Display info message when trying to add effect and no clip selected

parent 4d1fe0d8
......@@ -331,3 +331,8 @@ void Core::pushUndo(QUndoCommand *command)
{
currentDoc()->commandStack()->push(command);
}
void Core::displayMessage(const QString &message, MessageType type, int timeout)
{
m_mainWindow->displayMessage(message, type, timeout);
}
......@@ -13,6 +13,7 @@ the Free Software Foundation, either version 3 of the License, or
#include "kdenlivecore_export.h"
#include "undohelper.hpp"
#include "definitions.h"
#include <QObject>
#include <QTabWidget>
#include <QUrl>
......@@ -127,6 +128,8 @@ public:
Note that if you class permits and requires it, you should use the macro PUSH_UNDO instead*/
void pushUndo(const Fun &undo, const Fun &redo, const QString &text);
void pushUndo(QUndoCommand *command);
/** @brief display a user info/warning message in statusbar */
void displayMessage(const QString &message, MessageType type, int timeout);
private:
explicit Core();
......
......@@ -658,9 +658,6 @@ void MainWindow::slotThemeChanged(const QString &theme)
if (m_projectMonitor) {
m_projectMonitor->setPalette(plt);
}
if (m_messageLabel) {
m_messageLabel->updatePalette();
}
if (pCore->projectManager() && pCore->projectManager()->currentTimeline()) {
pCore->projectManager()->currentTimeline()->updatePalette();
}
......
......@@ -31,6 +31,7 @@
#include <QDialog>
#include <QDialogButtonBox>
#include <QPropertyAnimation>
#include <QHBoxLayout>
#include <QLabel>
#include <QMouseEvent>
......@@ -79,9 +80,7 @@ StatusBarMessageLabel::StatusBarMessageLabel(QWidget *parent)
lay->addWidget(m_progress);
setLayout(lay);
m_progress->setVisible(false);
lay->setContentsMargins(BorderGap, 0, BorderGap, 0);
m_animation.setTargetObject(this);
m_animation.setPropertyName("color");
lay->setContentsMargins(BorderGap, 0, 2 * BorderGap, 0);
m_queueTimer.setSingleShot(true);
connect(&m_queueTimer, &QTimer::timeout, this, &StatusBarMessageLabel::slotMessageTimeout);
connect(m_label, &QLabel::linkActivated, this, &StatusBarMessageLabel::slotShowJobLog);
......@@ -91,12 +90,6 @@ StatusBarMessageLabel::~StatusBarMessageLabel()
{
}
void StatusBarMessageLabel::updatePalette()
{
m_animation.setKeyValueAt(1, parentWidget()->palette().window().color());
setColor(parentWidget()->palette().window().color());
}
void StatusBarMessageLabel::mousePressEvent(QMouseEvent *event)
{
QWidget::mousePressEvent(event);
......@@ -213,9 +206,6 @@ bool StatusBarMessageLabel::slotMessageTimeout()
QColor bgColor =
KStatefulBrush(KColorScheme::Window, KColorScheme::NegativeBackground, KSharedConfig::openConfig(KdenliveSettings::colortheme())).brush(this).color();
const char *iconName = nullptr;
if (m_animation.state() == QAbstractAnimation::Running) {
m_animation.stop();
}
setColor(parentWidget()->palette().window().color());
switch (m_currentMessage.type) {
case ProcessingJobMessage:
......@@ -227,31 +217,41 @@ bool StatusBarMessageLabel::slotMessageTimeout()
m_pixmap->setCursor(Qt::ArrowCursor);
break;
case InformationMessage:
case InformationMessage: {
iconName = "dialog-information";
m_pixmap->setCursor(Qt::ArrowCursor);
QPropertyAnimation *anim = new QPropertyAnimation(this, "color", this);
anim->setDuration(1500);
anim->setEasingCurve(QEasingCurve::InOutQuad);
anim->setKeyValueAt(0.2, parentWidget()->palette().highlight().color());
anim->setEndValue(parentWidget()->palette().window().color());
anim->start(QPropertyAnimation::DeleteWhenStopped);
break;
}
case ErrorMessage:
case ErrorMessage: {
iconName = "dialog-warning";
m_pixmap->setCursor(Qt::ArrowCursor);
m_animation.setKeyValueAt(0, bgColor);
m_animation.setKeyValueAt(0.8, bgColor);
m_animation.setKeyValueAt(1, parentWidget()->palette().window().color());
m_animation.setEasingCurve(QEasingCurve::OutCubic);
m_animation.setDuration(4000);
m_animation.start();
QPropertyAnimation *anim = new QPropertyAnimation(this, "color", this);
anim->setStartValue(bgColor);
anim->setKeyValueAt(0.8, bgColor);
anim->setEndValue(parentWidget()->palette().window().color());
anim->setEasingCurve(QEasingCurve::OutCubic);
anim->setDuration(4000);
anim->start(QPropertyAnimation::DeleteWhenStopped);
break;
case MltError:
}
case MltError: {
iconName = "dialog-close";
m_pixmap->setCursor(Qt::PointingHandCursor);
m_animation.setKeyValueAt(0, bgColor);
m_animation.setKeyValueAt(1, bgColor);
m_animation.setDuration(1000);
m_animation.start();
QPropertyAnimation *anim = new QPropertyAnimation(this, "color", this);
anim->setStartValue(bgColor);
anim->setEndValue(bgColor);
anim->setEasingCurve(QEasingCurve::OutCubic);
anim->setDuration(1500);
anim->start(QPropertyAnimation::DeleteWhenStopped);
break;
}
case DefaultMessage:
m_pixmap->setCursor(Qt::ArrowCursor);
default:
......
......@@ -27,7 +27,6 @@
#include <QColor>
#include <QLabel>
#include <QList>
#include <QPropertyAnimation>
#include <QSemaphore>
#include <QTimer>
#include <QWidget>
......@@ -91,7 +90,6 @@ class StatusBarMessageLabel : public FlashLabel
public:
explicit StatusBarMessageLabel(QWidget *parent);
virtual ~StatusBarMessageLabel();
void updatePalette();
protected:
// void paintEvent(QPaintEvent* event);
......@@ -129,7 +127,6 @@ private:
QProgressBar *m_progress;
QTimerWithTime m_queueTimer;
QSemaphore m_queueSemaphore;
QPropertyAnimation m_animation;
QList<StatusBarMessageItem> m_messageQueue;
StatusBarMessageItem m_currentMessage;
};
......
......@@ -376,6 +376,8 @@ void TimelineController::addAsset(const QVariantMap data)
for (int id : m_selection.selectedClips) {
m_model->addClipEffect(id, effect);
}
} else {
pCore->displayMessage(i18n("Select a clip to apply an effect"), InformationMessage, 500);
}
}
......
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