Commit 45838cf1 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Cleanup statusbar messaging system.

Add warning about using a development version
Nicer progress bar for audio thumbs
parent 9dbbcd7f
......@@ -323,6 +323,8 @@ Bin::Bin(QWidget* parent) :
, m_blankThumb()
, m_invalidClipDialog(NULL)
, m_gainedFocus(false)
, m_audioDuration(0)
, m_processedAudio(0)
{
m_layout = new QVBoxLayout(this);
......@@ -505,23 +507,31 @@ QDockWidget *Bin::clipPropertiesDock()
return m_propertiesDock;
}
void Bin::slotAbortAudioThumb(const QString &id)
void Bin::slotAbortAudioThumb(const QString &id, long duration)
{
if (!m_audioThumbsThread.isRunning()) return;
QMutexLocker aMutex(&m_audioThumbMutex);
m_audioThumbsList.removeAll(id);
if (m_audioThumbsList.removeAll(id) > 0)
m_audioDuration -= duration;
}
void Bin::requestAudioThumbs(const QString &id)
void Bin::requestAudioThumbs(const QString &id, long duration)
{
if (!m_audioThumbsList.contains(id) && m_processingAudioThumb != id) {
m_audioThumbMutex.lock();
m_audioThumbsList.append(id);
m_audioDuration += duration;
m_audioThumbMutex.unlock();
processAudioThumbs();
}
}
void Bin::doUpdateThumbsProgress(long ms)
{
int progress = (m_processedAudio + ms) * 100 / m_audioDuration;
emitMessage(i18n("Creating audio thumbnails"), progress, ProcessingJobMessage);
}
void Bin::processAudioThumbs()
{
if (m_audioThumbsThread.isRunning()) return;
......@@ -536,6 +546,10 @@ void Bin::abortAudioThumbs()
if (clip) clip->abortAudioThumbs();
}
m_audioThumbMutex.lock();
foreach(const QString &id, m_audioThumbsList) {
ProjectClip *clip = m_rootFolder->clip(id);
if (clip) clip->setJobStatus(AbstractClipJob::THUMBJOB, JobDone, 0);
}
m_audioThumbsList.clear();
m_audioThumbMutex.unlock();
m_audioThumbsThread.waitForFinished();
......@@ -545,20 +559,26 @@ void Bin::slotCreateAudioThumbs()
{
int max = m_audioThumbsList.count();
int count = 0;
m_processedAudio = 0;
while (!m_audioThumbsList.isEmpty()) {
m_audioThumbMutex.lock();
max = qMax(max, m_audioThumbsList.count());
m_processingAudioThumb = m_audioThumbsList.takeFirst();
count++;
m_audioThumbMutex.unlock();
emitMessage(i18n("Creating audio thumbnails") + QString(" (%1/%2)").arg(count).arg(max), ProcessingJobMessage);
//emitMessage(i18n("Creating audio thumbnails"), (count - 1) * 100 / max, ProcessingJobMessage);
ProjectClip *clip = m_rootFolder->clip(m_processingAudioThumb);
if (clip) clip->slotCreateAudioThumbs();
if (clip) {
clip->slotCreateAudioThumbs();
m_processedAudio += clip->duration().ms();
}
}
m_audioThumbMutex.lock();
m_processingAudioThumb.clear();
m_processedAudio = 0;
m_audioDuration = 0;
m_audioThumbMutex.unlock();
emitMessage(i18n("Audio thumbnails done"), OperationCompletedMessage);
emitMessage(i18n("Audio thumbnails done"), 100, OperationCompletedMessage);
}
bool Bin::eventFilter(QObject *obj, QEvent *event)
......@@ -847,7 +867,7 @@ void Bin::slotLocateClip()
qDebug()<<" / / "+url.toString();
} else {
if(!exists){
emitMessage(i18n("Couldn't locate ") + QString(" ("+url.toString()+")"), ErrorMessage);
emitMessage(i18n("Couldn't locate ") + QString(" ("+url.toString()+")"), 100, ErrorMessage);
}
return;
}
......@@ -3018,9 +3038,9 @@ void Bin::slotResetInfoMessage()
}
}
void Bin::emitMessage(const QString &text, MessageType type)
void Bin::emitMessage(const QString &text, int progress, MessageType type)
{
emit displayMessage(text, type);
emit displayMessage(text, progress, type);
}
void Bin::slotCreateAudioThumb(const QString &id)
......
......@@ -282,23 +282,21 @@ public:
int jobProgress = index.data(AbstractProjectItem::JobProgress).toInt();
if (jobProgress > 0 || jobProgress == JobWaiting) {
// Draw job progress bar
QColor color = option.palette.alternateBase().color();
int progressWidth = option.fontMetrics.averageCharWidth() * 8;
int progressHeight = option.fontMetrics.ascent() / 4;
QRect progress(r1.x() + 1, opt.rect.bottom() - progressHeight - 2, progressWidth , progressHeight);
painter->setPen(Qt::NoPen);
color.setAlpha(180);
painter->setBrush(QBrush(color));
QRect progress(r1.x() + 1, opt.rect.bottom() - 12, r1.width() / 2, 8);
painter->drawRect(progress);
painter->setBrush(option.palette.text());
painter->setBrush(Qt::darkGray);
if (jobProgress > 0) {
progress.adjust(1, 1, 0, -1);
progress.setWidth((progress.width() - 4) * jobProgress / 100);
painter->drawRect(progress);
painter->drawRoundedRect(progress, 2, 2);
painter->setBrush(option.state & QStyle::State_Selected ? option.palette.text() : option.palette.highlight());
progress.setWidth((progressWidth - 2) * jobProgress / 100);
painter->drawRoundedRect(progress, 2, 2);
} else if (jobProgress == JobWaiting) {
// Draw kind of a pause icon
progress.adjust(1, 1, 0, -1);
progress.setWidth(2);
progress.setWidth(3);
painter->drawRect(progress);
progress.moveLeft(progress.right() + 2);
progress.moveLeft(progress.right() + 3);
painter->drawRect(progress);
}
} else if (jobProgress == JobCrashed) {
......@@ -496,13 +494,13 @@ public:
/** @brief Returns current project's folder for storing items. */
QUrl projectFolder() const;
/** @brief Display a message about an operation in status bar. */
void emitMessage(const QString &, MessageType);
void emitMessage(const QString &, int, MessageType);
void rebuildMenu();
void refreshIcons();
/** @brief Update status of disable effects action (when loading a document). */
void setBinEffectsDisabledStatus(bool disabled);
void requestAudioThumbs(const QString &id);
void requestAudioThumbs(const QString &id, long duration);
/** @brief Proxy status for the project changed, update. */
void refreshProxySettings();
/** @brief A clip is ready, update its info panel if displayed. */
......@@ -617,7 +615,7 @@ public slots:
/** @brief Request audio thumbnail for clip with id */
void slotCreateAudioThumb(const QString &id);
/** @brief Abort audio thumbnail for clip with id */
void slotAbortAudioThumb(const QString &id);
void slotAbortAudioThumb(const QString &id, long duration);
/** @brief Add extra data to a clip. */
void slotAddClipExtraData(const QString &id, const QString &key, const QString &data = QString(), QUndoCommand *groupCommand = 0);
void slotUpdateClipProperties(const QString &id, QMap <QString, QString> properties, bool refreshPropertiesPanel);
......@@ -635,6 +633,7 @@ public slots:
/** @brief Select a clip in the Bin from its id. */
void selectClipById(const QString &id, int frame = -1, const QPoint &zone = QPoint());
void slotAddClipToProject(QUrl url);
void doUpdateThumbsProgress(long ms);
protected:
void contextMenuEvent(QContextMenuEvent *event);
......@@ -699,6 +698,10 @@ private:
QStringList m_audioThumbsList;
QString m_processingAudioThumb;
QMutex m_audioThumbMutex;
/** @brief Total number of milliseconds to process for audio thumbnails */
long m_audioDuration;
/** @brief Total number of milliseconds already processed for audio thumbnails */
long m_processedAudio;
/** @brief Indicates whether audio thumbnail creation is running. */
QFuture<void> m_audioThumbsThread;
void showClipProperties(ProjectClip *clip, bool forceRefresh = false);
......@@ -727,7 +730,7 @@ signals:
/** @brief Request updating of the effect stack if currently displayed. */
void masterClipUpdated(ClipController *, Monitor *);
void displayBinMessage(const QString &, KMessageWidget::MessageType);
void displayMessage(const QString &, MessageType);
void displayMessage(const QString &, int, MessageType);
void requesteInvalidRemoval(const QString &, QUrl, const QString &);
/** @brief Markers changed, refresh panel. */
void refreshPanelMarkers();
......
......@@ -65,6 +65,7 @@ ProjectClip::ProjectClip(const QString &id, QIcon thumb, ClipController *control
setParent(parent);
connect(this, &ProjectClip::updateJobStatus, this, &ProjectClip::setJobStatus);
bin()->loadSubClips(id, m_controller->getPropertiesFromPrefix(QStringLiteral("kdenlive:clipzone.")));
connect(this, &ProjectClip::updateThumbProgress, bin(), &Bin::doUpdateThumbsProgress);
createAudioThumbs();
}
......@@ -95,6 +96,7 @@ ProjectClip::ProjectClip(const QDomElement& description, QIcon thumb, ProjectFol
else m_name = i18n("Untitled");
connect(this, &ProjectClip::updateJobStatus, this, &ProjectClip::setJobStatus);
setParent(parent);
connect(this, &ProjectClip::updateThumbProgress, bin(), &Bin::doUpdateThumbsProgress);
}
......@@ -102,7 +104,7 @@ ProjectClip::~ProjectClip()
{
// controller is deleted in bincontroller
abortAudioThumbs();
bin()->slotAbortAudioThumb(m_id);
bin()->slotAbortAudioThumb(m_id, duration().ms());
QMutexLocker audioLock(&m_audioMutex);
m_thumbMutex.lock();
m_requestedThumbs.clear();
......@@ -365,7 +367,8 @@ bool ProjectClip::setProducer(ClipController *controller, bool replaceProducer)
void ProjectClip::createAudioThumbs()
{
if (KdenliveSettings::audiothumbnails() && (m_type == AV || m_type == Audio || m_type == Playlist)) {
bin()->requestAudioThumbs(m_id);
bin()->requestAudioThumbs(m_id, duration().ms());
emit updateJobStatus(AbstractClipJob::THUMBJOB, JobWaiting, 0);
}
}
......@@ -670,7 +673,7 @@ void ProjectClip::setJobStatus(int jobType, int status, int progress, const QStr
m_jobProgress = status;
if ((status == JobAborted || status == JobCrashed || status == JobDone) && !statusMessage.isEmpty()) {
m_jobMessage = statusMessage;
bin()->emitMessage(statusMessage, OperationCompletedMessage);
bin()->emitMessage(statusMessage, 100, OperationCompletedMessage);
}
}
bin()->emitItemUpdated(this);
......@@ -1002,6 +1005,7 @@ void ProjectClip::slotCreateAudioThumbs()
}
}
if (audioLevels.size() > 0) {
emit updateJobStatus(AbstractClipJob::THUMBJOB, JobDone, 0);
updateAudioThumbnail(audioLevels);
return;
}
......@@ -1012,7 +1016,7 @@ void ProjectClip::slotCreateAudioThumbs()
for (int i = 0; i < channels; i++) {
QTemporaryFile *channelTmpfile = new QTemporaryFile;
if (!channelTmpfile->open()) {
bin()->emitMessage(i18n("Cannot create temporary file, check disk space and permissions"), ErrorMessage);
bin()->emitMessage(i18n("Cannot create temporary file, check disk space and permissions"), 100, ErrorMessage);
return;
}
channelTmpfile->close();
......@@ -1053,7 +1057,6 @@ void ProjectClip::slotCreateAudioThumbs()
args << QStringLiteral("-map") << QStringLiteral("[0:%1]").arg(i) << QStringLiteral("-c:a") << QStringLiteral("pcm_s16le") << QStringLiteral("-y") << QStringLiteral("-f") << QStringLiteral("data")<< channelFiles[i]->fileName();
}
}
emit updateJobStatus(AbstractClipJob::THUMBJOB, JobWaiting, 0);
QProcess audioThumbsProcess;
connect(this, SIGNAL(doAbortAudioThumbs()), &audioThumbsProcess, SLOT(kill()), Qt::DirectConnection);
connect(&audioThumbsProcess, &QProcess::readyReadStandardOutput, this, &ProjectClip::updateFfmpegProgress);
......@@ -1084,7 +1087,7 @@ void ProjectClip::slotCreateAudioThumbs()
if (res.isEmpty() || res.size() != dataSize) {
// Something went wrong, abort
emit updateJobStatus(AbstractClipJob::THUMBJOB, JobDone, 0);
bin()->emitMessage(i18n("Error reading audio thumbnail"), ErrorMessage);
bin()->emitMessage(i18n("Error reading audio thumbnail"), 100, ErrorMessage);
return;
}
rawChannels << (const qint16*) res.constData();
......@@ -1118,7 +1121,7 @@ void ProjectClip::slotCreateAudioThumbs()
if (steps) channelsData[k] /= steps;
audioLevels << channelsData[k] * factor;
}
int p = 50 + (i * 50 / lengthInFrames);
int p = 80 + (i * 20 / lengthInFrames);
if (p != progress) {
emit updateJobStatus(AbstractClipJob::THUMBJOB, JobWorking, p);
progress = p;
......@@ -1127,7 +1130,7 @@ void ProjectClip::slotCreateAudioThumbs()
}
jobFinished = true;
} else {
bin()->emitMessage(i18n("Failed to create FFmpeg audio thumbnails, using MLT"), ErrorMessage);
bin()->emitMessage(i18n("Failed to create FFmpeg audio thumbnails, using MLT"), 100, ErrorMessage);
}
}
if (!jobFinished && !m_abortAudioThumb) {
......@@ -1219,7 +1222,11 @@ void ProjectClip::updateFfmpegProgress()
foreach(const QString & data, lines) {
if (data.startsWith(QStringLiteral("out_time_ms"))) {
long ms = data.section(QLatin1Char('='), 1).toLong();
emit updateJobStatus(AbstractClipJob::THUMBJOB, JobWorking, (int) (ms / duration().ms() / 20));
// Update clip progressbar
emit updateJobStatus(AbstractClipJob::THUMBJOB, JobWorking, ms / duration().ms() * 0.08);
// Update general statusbar progressbar
emit updateThumbProgress(ms/1000);
break;
}
}
}
......
......@@ -268,6 +268,7 @@ signals:
void loadPropertiesPanel();
/** @brief Terminate running audio proxy job. */
void doAbortAudioThumbs();
void updateThumbProgress(long);
};
#endif
......@@ -247,7 +247,6 @@ private slots:
signals:
void resetProjectList();
void progressInfo(const QString &, int);
/** @brief Informs that the document status has been changed.
*
......
......@@ -239,6 +239,7 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
m_projectMonitor(NULL),
m_recMonitor(NULL),
m_renderWidget(NULL),
m_messageLabel(NULL),
m_themeInitialized(false),
m_isDarkTheme(false)
{
......@@ -367,7 +368,6 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
//TODO deprecated, replace with Bin methods if necessary
/*connect(m_projectList, SIGNAL(loadingIsOver()), this, SLOT(slotElapsedTime()));
connect(m_projectList, SIGNAL(displayMessage(QString,int,MessageType)), this, SLOT(slotGotProgressInfo(QString,int,MessageType)));
connect(m_projectList, SIGNAL(updateRenderStatus()), this, SLOT(slotCheckRenderStatus()));
connect(m_projectList, SIGNAL(updateProfile(QString)), this, SLOT(slotUpdateProjectProfile(QString)));
connect(m_projectList, SIGNAL(refreshClip(QString,bool)), pCore->monitorManager(), SLOT(slotRefreshCurrentMonitor(QString)));
......@@ -410,7 +410,7 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
connect(m_effectStack, SIGNAL(removeMasterEffect(QString,QDomElement)), pCore->bin(), SLOT(slotDeleteEffect(QString,QDomElement)));
connect(m_effectStack, SIGNAL(changeEffectPosition(QString,const QList <int>,int)), pCore->bin(), SLOT(slotMoveEffect(QString,const QList <int>,int)));
connect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
connect(m_effectStack, SIGNAL(displayMessage(QString,int)), this, SLOT(slotGotProgressInfo(QString,int)));
connect(m_effectStack, SIGNAL(displayMessage(QString,int)), m_messageLabel, SLOT(setMessage(QString,int)));
m_effectStackDock = addDock(i18n("Properties"), QStringLiteral("effect_stack"), m_effectStack);
m_effectList = new EffectsListView();
......@@ -701,7 +701,8 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
new JogManager(this);
#endif
scmanager->slotCheckActiveScopes();
//KMessageBox::information(this, "Warning, development version for testing only. we are currently working on core functionnalities,\ndo not save any project or your project files might be corrupted.");
//TODO: remove for release
m_messageLabel->setMessage("This is an untested development version. Always backup your data", 100, MltError);
}
void MainWindow::slotThemeChanged(const QString &theme)
......@@ -721,25 +722,14 @@ void MainWindow::slotThemeChanged(const QString &theme)
if (m_transitionList) m_transitionList->updatePalette();
if (m_clipMonitor) m_clipMonitor->setPalette(plt);
if (m_projectMonitor) m_projectMonitor->setPalette(plt);
setStatusBarStyleSheet(plt);
if (m_messageLabel)
m_messageLabel->updatePalette();
if (pCore->projectManager() && pCore->projectManager()->currentTimeline()) {
pCore->projectManager()->currentTimeline()->updatePalette();
}
if (m_timelineArea) {
m_timelineArea->setPalette(plt);
}
/*if (statusBar()) {
const QObjectList children = statusBar()->children();
foreach(QObject * child, children) {
if (child->isWidgetType())
((QWidget*)child)->setPalette(plt);
const QObjectList subchildren = child->children();
foreach(QObject * subchild, subchildren) {
if (subchild->isWidgetType())
((QWidget*)subchild)->setPalette(plt);
}
}
}*/
#if KXMLGUI_VERSION_MINOR < 23 && KXMLGUI_VERSION_MAJOR == 5
// Not required anymore with auto colored icons since KF5 5.23
......@@ -981,12 +971,6 @@ QAction *MainWindow::addAction(const QString &name, const QString &text, const Q
void MainWindow::setupActions()
{
m_statusProgressBar = new QProgressBar(this);
m_statusProgressBar->setMinimum(0);
m_statusProgressBar->setMaximum(100);
m_statusProgressBar->setMaximumWidth(150);
m_statusProgressBar->setVisible(false);
//create edit mode buttons
m_normalEditTool = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-normal-edit")), i18n("Normal mode"), this);
m_normalEditTool->setShortcut(i18nc("Normal editing", "n"));
......@@ -1146,7 +1130,6 @@ void MainWindow::setupActions()
toolbar->setMovable(false);
toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
setStatusBarStyleSheet(palette());
/*QString styleBorderless = QStringLiteral("QToolButton { border-width: 0px;margin: 1px 3px 0px;padding: 0px;}");*/
toolbar->addAction(m_buttonAutomaticSplitAudio);
toolbar->addAction(m_buttonVideoThumbs);
......@@ -1179,14 +1162,16 @@ void MainWindow::setupActions()
actionWidget->setMaximumWidth(max);
actionWidget->setMaximumHeight(max - 4);*/
int small = style()->pixelMetric(QStyle::PM_SmallIconSize);
statusBar()->setMaximumHeight(2 * small);
m_messageLabel = new StatusBarMessageLabel(this);
m_messageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
statusBar()->addWidget(m_messageLabel, 10);
statusBar()->addWidget(m_statusProgressBar, 0);
statusBar()->addWidget(m_messageLabel, 0);
QWidget *spacer = new QWidget(this);
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
statusBar()->addWidget(spacer, 1);
statusBar()->addPermanentWidget(toolbar);
int small = style()->pixelMetric(QStyle::PM_SmallIconSize);
statusBar()->setMaximumHeight(2 * small);
toolbar->setIconSize(QSize(small , small));
toolbar->layout()->setContentsMargins(0, 0, 0, 0);
statusBar()->setContentsMargins(0, 0, 0, 0);
......@@ -1532,18 +1517,6 @@ void MainWindow::setupActions()
}
}
void MainWindow::setStatusBarStyleSheet(const QPalette &p)
{
return;
KColorScheme scheme(p.currentColorGroup(), KColorScheme::Window, KSharedConfig::openConfig(KdenliveSettings::colortheme()));
QColor buttonBg = scheme.background(KColorScheme::LinkBackground).color();
QColor buttonBord = scheme.foreground(KColorScheme::LinkText).color();
QColor buttonBord2 = scheme.shade(KColorScheme::LightShade);
statusBar()->setStyleSheet(QStringLiteral("QStatusBar QLabel {font-size:%1pt;} QStatusBar::item { border: 0px; font-size:%1pt;padding:0px; }").arg(statusBar()->font().pointSize()));
QString style1 = QStringLiteral("QToolBar { border: 0px } QToolButton { border-style: inset; border:1px solid transparent;border-radius: 3px;margin: 0px 3px;padding: 0px;} QToolButton#timecode {padding-right:10px;} QToolButton:hover { background: %3;border-style: inset; border:1px solid %3;border-radius: 3px;} QToolButton:checked { background-color: %1; border-style: inset; border:1px solid %2;border-radius: 3px;}").arg(buttonBg.name(), buttonBord.name(), buttonBord2.name());
statusBar()->setStyleSheet(style1);
}
void MainWindow::saveOptions()
{
KdenliveSettings::self()->save();
......@@ -1807,8 +1780,8 @@ void MainWindow::connectDocument()
connect(trackView->projectView(), SIGNAL(zoomOut()), this, SLOT(slotZoomOut()));
connect(trackView, SIGNAL(setZoom(int)), this, SLOT(slotSetZoom(int)));
connect(trackView->projectView(), SIGNAL(displayMessage(QString,MessageType)), m_messageLabel, SLOT(setMessage(QString,MessageType)));
connect(pCore->bin(), SIGNAL(clipNameChanged(QString)), trackView->projectView(), SLOT(clipNameChanged(QString)));
connect(pCore->bin(), SIGNAL(displayMessage(QString,MessageType)), m_messageLabel, SLOT(setMessage(QString,MessageType)));
connect(pCore->bin(), SIGNAL(clipNameChanged(QString)), trackView->projectView(), SLOT(clipNameChanged(QString)));
connect(pCore->bin(), SIGNAL(displayMessage(QString,int,MessageType)), m_messageLabel, SLOT(setMessage(QString,int,MessageType)));
connect(trackView->projectView(), SIGNAL(showClipFrame(const QString&,int)), pCore->bin(), SLOT(selectClipById(const QString&,int)));
connect(trackView->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay()));
......@@ -2093,7 +2066,7 @@ void MainWindow::slotAddClipMarker()
pos = m_clipMonitor->position();
}
if (!clip) {
m_messageLabel->setMessage(i18n("Cannot find clip to add marker"), ErrorMessage);
m_messageLabel->setMessage(i18n("Cannot find clip to add marker"), 100, ErrorMessage);
return;
}
QString id = clip->clipId();
......@@ -2125,7 +2098,7 @@ void MainWindow::slotDeleteClipMarker(bool allowGuideDeletion)
pos = m_clipMonitor->position();
}
if (!clip) {
m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), 100, ErrorMessage);
return;
}
......@@ -2135,7 +2108,7 @@ void MainWindow::slotDeleteClipMarker(bool allowGuideDeletion)
if (allowGuideDeletion && m_projectMonitor->isActive()) {
slotDeleteGuide();
}
else m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
else m_messageLabel->setMessage(i18n("No marker found at cursor time"), 100, ErrorMessage);
return;
}
pCore->bin()->deleteClipMarker(comment, id, pos);
......@@ -2155,7 +2128,7 @@ void MainWindow::slotDeleteAllClipMarkers()
clip = m_clipMonitor->currentController();
}
if (!clip) {
m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), 100, ErrorMessage);
return;
}
pCore->bin()->deleteAllClipMarkers(clip->clipId());
......@@ -2178,14 +2151,14 @@ void MainWindow::slotEditClipMarker()
pos = m_clipMonitor->position();
}
if (!clip) {
m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), 100, ErrorMessage);
return;
}
QString id = clip->clipId();
CommentedTime oldMarker = clip->markerAt(pos);
if (oldMarker == CommentedTime()) {
m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
m_messageLabel->setMessage(i18n("No marker found at cursor time"), 100, ErrorMessage);
return;
}
......@@ -2214,7 +2187,7 @@ void MainWindow::slotAddMarkerGuideQuickly()
GenTime pos = m_clipMonitor->position();
if (!clip) {
m_messageLabel->setMessage(i18n("Cannot find clip to add marker"), ErrorMessage);
m_messageLabel->setMessage(i18n("Cannot find clip to add marker"), 100, ErrorMessage);
return;
}
//TODO: allow user to set default marker category
......@@ -2474,7 +2447,7 @@ void MainWindow::slotAddVideoEffect(QAction *result)
if (!effect.isNull()) {
slotAddEffect(effect);
} else {
m_messageLabel->setMessage(i18n("Cannot find effect %1 / %2", info.at(0), info.at(1)), ErrorMessage);
m_messageLabel->setMessage(i18n("Cannot find effect %1 / %2", info.at(0), info.at(1)), 100, ErrorMessage);
}
}
......@@ -2537,23 +2510,13 @@ void MainWindow::slotUpdateZoomSliderToolTip(int zoomlevel)
void MainWindow::slotGotProgressInfo(const QString &message, int progress, MessageType type)
{
if (type == DefaultMessage) {
m_statusProgressBar->setValue(progress);
}
m_messageLabel->setMessage(progress < 100 ? message : QString(), type);
if (progress >= 0) {
if (type == DefaultMessage) {
m_statusProgressBar->setVisible(progress < 100);
}
} else {
m_statusProgressBar->setVisible(false);
}
m_messageLabel->setMessage(message, progress, type);
}
void MainWindow::customEvent(QEvent* e)
{
if (e->type() == QEvent::User)
m_messageLabel->setMessage(static_cast <MltErrorEvent *>(e)->message(), MltError);
m_messageLabel->setMessage(static_cast <MltErrorEvent *>(e)->message(), 100, MltError);
}
void MainWindow::slotTimelineClipSelected(ClipItem* item, bool reloadStack, bool raise)
......@@ -2658,7 +2621,7 @@ void MainWindow::slotSetTool(ProjectTool tool)
message = i18n("Shift + click to create a selection rectangle, Ctrl + click to add an item to selection");
break;
}
m_messageLabel->setMessage(message, InformationMessage);
m_messageLabel->setMessage(message, 100, InformationMessage);
pCore->projectManager()->currentTimeline()->projectView()->setTool(tool);
}
}
......@@ -3088,7 +3051,7 @@ void MainWindow::slotTranscode(const QStringList &urls)
return;
}
if (urls.isEmpty()) {
m_messageLabel->setMessage(i18n("No clip to transcode"), ErrorMessage);
m_messageLabel->setMessage(i18n("No clip to transcode"), 100, ErrorMessage);
return;
}
ClipTranscode *d = new ClipTranscode(urls, params, QStringList(), desc);
......@@ -3345,12 +3308,12 @@ void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QS
// Do save scenelist
QFile file(plPath);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
m_messageLabel->setMessage(i18n("Cannot write to file %1", plPath), ErrorMessage);
m_messageLabel->setMessage(i18n("Cannot write to file %1", plPath), 100, ErrorMessage);
return;
}
file.write(docList.at(i).toString().toUtf8());
if (file.error() != QFile::NoError) {
m_messageLabel->setMessage(i18n("Cannot write to file %1", plPath), ErrorMessage);
m_messageLabel->setMessage(i18n("Cannot write to file %1", plPath), 100, ErrorMessage);
file.close();
return;
}
......@@ -3499,7 +3462,7 @@ void MainWindow::slotArchiveProject()
QDomDocument doc = pCore->projectManager()->current()->xmlSceneList(m_projectMonitor->sceneList());
QPointer<ArchiveWidget> d = new ArchiveWidget(pCore->projectManager()->current()->url().fileName(), doc, list, pCore->projectManager()->currentTimeline()->projectView()->extractTransitionsLumas(), this);
if (d->exec()) {
m_messageLabel->setMessage(i18n("Archiving project"), OperationCompletedMessage);
m_messageLabel->setMessage(i18n("Archiving project"), 100, OperationCompletedMessage);
}
delete d;
}
......
......@@ -23,7 +23,6 @@
#include <QDockWidget>
#include <QUndoView>
#include <QProgressBar>
#include <QEvent>
#include <QShortcut>
#include <QMap>
......@@ -133,7 +132,6 @@ public:
QUndoGroup *m_commandStack;
EffectStackView2 *m_effectStack;
QUndoView *m_undoView;
StatusBarMessageLabel *m_messageLabel;
/** @brief holds info about whether movit is available on this system */
bool m_gpuAllowed;
int m_exitCode;
......@@ -164,7 +162,6 @@ protected:
virtual void saveNewToolbarConfig();
private:
QProgressBar *m_statusProgressBar;
/** @brief Sets up all the actions and attaches them to the collection. */
void setupActions();
......@@ -219,7 +216,7 @@ private:
QShortcut* m_shortcutRemoveFocus;
RenderWidget *m_renderWidget;
StatusBarMessageLabel *m_messageLabel;
QList <QAction *>m_transitions;
QAction *m_buttonAudioThumbs;
QAction *m_buttonVideoThumbs;
......@@ -266,8 +263,6 @@ private: