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

Switch failed operation messages to ErrorMessage for better visibility

parent 26d74467
Pipeline #47790 passed with stage
in 10 minutes and 41 seconds
......@@ -163,7 +163,7 @@ void KeyframeView::slotRemoveKeyframe(QVector<int> positions)
{
if (m_model->singleKeyframe()) {
// Don't allow zero keyframe
pCore->displayMessage(i18n("Cannot remove the last keyframe"), MessageType::InformationMessage, 500);
pCore->displayMessage(i18n("Cannot remove the last keyframe"), MessageType::ErrorMessage, 500);
return;
}
int offset = pCore->getItemIn(m_model->getOwnerId());
......
......@@ -3075,7 +3075,7 @@ void Bin::slotItemDropped(const QStringList &ids, const QModelIndex &parent)
}
}
if (moveCommand->childCount() == 0) {
pCore->displayMessage(i18n("No valid clip to insert"), MessageType::InformationMessage, 500);
pCore->displayMessage(i18n("No valid clip to insert"), MessageType::ErrorMessage, 500);
} else {
m_doc->commandStack()->push(moveCommand);
}
......@@ -3099,7 +3099,7 @@ void Bin::slotAddEffect(QString id, const QStringList &effectData)
return;
}
}
pCore->displayMessage(i18n("Select a clip to apply an effect"), MessageType::InformationMessage, 500);
pCore->displayMessage(i18n("Select a clip to apply an effect"), MessageType::ErrorMessage, 500);
}
void Bin::slotEffectDropped(const QStringList &effectData, const QModelIndex &parent)
......@@ -3133,7 +3133,7 @@ void Bin::slotEffectDropped(const QStringList &effectData, const QModelIndex &pa
res = std::static_pointer_cast<ProjectClip>(parentItem)->addEffect(effectData.constFirst());
}
if (!res) {
pCore->displayMessage(i18n("Cannot add effect to clip"), MessageType::InformationMessage);
pCore->displayMessage(i18n("Cannot add effect to clip"), MessageType::ErrorMessage);
} else {
m_proxyModel->selectionModel()->clearSelection();
const QModelIndex id = m_itemModel->index(row, 0, parentIndex);
......@@ -3179,14 +3179,14 @@ void Bin::slotTagDropped(const QString &tag, const QModelIndex &parent)
return;
}
}
pCore->displayMessage(i18n("Select a clip to add a tag"), MessageType::InformationMessage);
pCore->displayMessage(i18n("Select a clip to add a tag"), MessageType::ErrorMessage);
}
void Bin::switchTag(const QString &tag, bool add)
{
const QModelIndexList indexes = m_proxyModel->selectionModel()->selectedIndexes();
if (indexes.isEmpty()) {
pCore->displayMessage(i18n("Select a clip to add a tag"), MessageType::InformationMessage);
pCore->displayMessage(i18n("Select a clip to add a tag"), MessageType::ErrorMessage);
}
// Check for folders
QList <QString> allClips;
......
......@@ -343,7 +343,7 @@ bool EffectStackModel::fromXml(const QDomElement &effectsXml, Fun &undo, Fun &re
continue;
}
if (EffectsRepository::get()->isUnique(effectId) && hasEffect(effectId)) {
pCore->displayMessage(i18n("Effect %1 cannot be added twice.", EffectsRepository::get()->getName(effectId)), InformationMessage);
pCore->displayMessage(i18n("Effect %1 cannot be added twice.", EffectsRepository::get()->getName(effectId)), ErrorMessage);
return false;
}
bool effectEnabled = true;
......@@ -428,7 +428,7 @@ bool EffectStackModel::copyEffect(const std::shared_ptr<AbstractEffectItem> &sou
std::shared_ptr<EffectItemModel> sourceEffect = std::static_pointer_cast<EffectItemModel>(sourceItem);
const QString effectId = sourceEffect->getAssetId();
if (EffectsRepository::get()->isUnique(effectId) && hasEffect(effectId)) {
pCore->displayMessage(i18n("Effect %1 cannot be added twice.", EffectsRepository::get()->getName(effectId)), InformationMessage);
pCore->displayMessage(i18n("Effect %1 cannot be added twice.", EffectsRepository::get()->getName(effectId)), ErrorMessage);
return false;
}
bool enabled = sourceEffect->isEnabled();
......@@ -481,7 +481,7 @@ bool EffectStackModel::appendEffect(const QString &effectId, bool makeCurrent)
{
QWriteLocker locker(&m_lock);
if (EffectsRepository::get()->isUnique(effectId) && hasEffect(effectId)) {
pCore->displayMessage(i18n("Effect %1 cannot be added twice.", EffectsRepository::get()->getName(effectId)), InformationMessage);
pCore->displayMessage(i18n("Effect %1 cannot be added twice.", EffectsRepository::get()->getName(effectId)), ErrorMessage);
return false;
}
std::unordered_set<int> previousFadeIn = m_fadeIns;
......@@ -1000,7 +1000,7 @@ void EffectStackModel::importEffects(const std::weak_ptr<Mlt::Service> &service,
}
const QString effectId = qstrdup(filter->get("kdenlive_id"));
if (EffectsRepository::get()->isUnique(effectId) && hasEffect(effectId)) {
pCore->displayMessage(i18n("Effect %1 cannot be added twice.", EffectsRepository::get()->getName(effectId)), InformationMessage);
pCore->displayMessage(i18n("Effect %1 cannot be added twice.", EffectsRepository::get()->getName(effectId)), ErrorMessage);
continue;
}
if (filter->get_int("disable") == 0) {
......
......@@ -177,7 +177,7 @@ void EffectStackView::dropEvent(QDropEvent *event)
}
}
if (!added) {
pCore->displayMessage(i18n("Cannot add effect to clip"), InformationMessage);
pCore->displayMessage(i18n("Cannot add effect to clip"), ErrorMessage);
} else {
m_scrollTimer.start();
}
......
......@@ -1633,7 +1633,7 @@ void GLWidget::switchPlay(bool play, double speed)
bool GLWidget::playZone(bool loop)
{
if (!m_producer || m_proxy->zoneOut() <= m_proxy->zoneIn()) {
pCore->displayMessage(i18n("Select a zone to play"), InformationMessage, 500);
pCore->displayMessage(i18n("Select a zone to play"), ErrorMessage, 500);
return false;
}
m_producer->seek(m_proxy->zoneIn());
......@@ -1669,7 +1669,7 @@ bool GLWidget::restartConsumer()
bool GLWidget::loopClip(QPoint inOut)
{
if (!m_producer || inOut.y() <= inOut.x()) {
pCore->displayMessage(i18n("Select a clip to play"), InformationMessage, 500);
pCore->displayMessage(i18n("Select a clip to play"), ErrorMessage, 500);
return false;
}
m_loopIn = inOut.x();
......
......@@ -191,7 +191,7 @@ void NotesWidget::assignProjectNote()
if (!anchors.isEmpty()) {
emit reAssign(anchors, anchorPoints);
} else {
pCore->displayMessage(i18n("Select some timecodes to reassign"), InformationMessage);
pCore->displayMessage(i18n("Select some timecodes to reassign"), ErrorMessage);
}
}
......@@ -202,7 +202,7 @@ void NotesWidget::createMarkers()
if (!anchors.isEmpty()) {
createMarker(anchors);
} else {
pCore->displayMessage(i18n("Select some timecodes to create markers"), InformationMessage);
pCore->displayMessage(i18n("Select some timecodes to create markers"), ErrorMessage);
}
}
......
......@@ -74,7 +74,7 @@ void NotesPlugin::slotInsertTimecode()
QString position = pCore->timecode().getTimecodeFromFrames(frames);
const QString binId = pCore->monitorManager()->clipMonitor()->activeClipId();
if (binId.isEmpty()) {
pCore->displayMessage(i18n("Cannot add note, no clip selected in project bin"), InformationMessage);
pCore->displayMessage(i18n("Cannot add note, no clip selected in project bin"), ErrorMessage);
return;
}
QString clipName = pCore->bin()->getBinClipName(binId);
......@@ -92,7 +92,7 @@ void NotesPlugin::slotReAssign(QStringList anchors, QList <QPoint> points)
int ix = 0;
if (points.count() != anchors.count()) {
// Something is wrong, abort
pCore->displayMessage(i18n("Cannot perform assign"), InformationMessage);
pCore->displayMessage(i18n("Cannot perform assign"), ErrorMessage);
return;
}
for (const QString & a : anchors) {
......
......@@ -285,7 +285,7 @@ bool TimelineFunctions::requestClipCutAll(std::shared_ptr<TimelineItemModel> tim
}
if (affectedTracks.isEmpty()) {
pCore->displayMessage(i18n("All tracks are locked"), InformationMessage, 500);
pCore->displayMessage(i18n("All tracks are locked"), ErrorMessage, 500);
return false;
}
......@@ -307,7 +307,7 @@ bool TimelineFunctions::requestClipCutAll(std::shared_ptr<TimelineItemModel> tim
}
if (!count) {
pCore->displayMessage(i18n("No clips to cut"), InformationMessage);
pCore->displayMessage(i18n("No clips to cut"), ErrorMessage);
} else {
pCore->pushUndo(undo, redo, i18n("Cut all clips"));
}
......@@ -447,7 +447,7 @@ bool TimelineFunctions::insertZone(const std::shared_ptr<TimelineItemModel> &tim
if (res) {
pCore->pushUndo(undo, redo, overwrite ? i18n("Overwrite zone") : i18n("Insert zone"));
} else {
pCore->displayMessage(i18n("Could not insert zone"), InformationMessage);
pCore->displayMessage(i18n("Could not insert zone"), ErrorMessage);
undo();
}
return res;
......@@ -480,7 +480,7 @@ bool TimelineFunctions::insertZone(const std::shared_ptr<TimelineItemModel> &tim
}
}
if (affectedTracks.isEmpty()) {
pCore->displayMessage(i18n("Please activate a track by clicking on a track's label"), InformationMessage);
pCore->displayMessage(i18n("Please activate a track by clicking on a track's label"), ErrorMessage);
return false;
}
result = breakAffectedGroups(timeline, affectedTracks, QPoint(insertFrame, insertFrame + (zone.y() - zone.x())), undo, redo);
......@@ -950,7 +950,7 @@ QStringList TimelineFunctions::enableMultitrackView(const std::shared_ptr<Timeli
videoTracks.push_back(tid);
}
if (videoTracks.size() < 2) {
pCore->displayMessage(i18n("Cannot enable multitrack view on a single track"), InformationMessage);
pCore->displayMessage(i18n("Cannot enable multitrack view on a single track"), ErrorMessage);
}
// First, dis/enable track compositing
QScopedPointer<Mlt::Service> service(timeline->m_tractor->field());
......@@ -1413,7 +1413,7 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim
qDebug() << " / / READING CLIPS FROM CLIPBOARD";
} else {
semaphore.release(1);
pCore->displayMessage(i18n("No valid data in clipboard"), InformationMessage, 500);
pCore->displayMessage(i18n("No valid data in clipboard"), ErrorMessage, 500);
return false;
}
const QString docId = copiedItems.documentElement().attribute(QStringLiteral("documentid"));
......@@ -1439,7 +1439,7 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim
QDomElement prod = clips.at(i).toElement();
int trackPos = prod.attribute(QStringLiteral("track")).toInt();
if (trackPos < 0) {
pCore->displayMessage(i18n("Not enough tracks to paste clipboard"), InformationMessage, 500);
pCore->displayMessage(i18n("Not enough tracks to paste clipboard"), ErrorMessage, 500);
semaphore.release(1);
return false;
}
......@@ -1497,7 +1497,7 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim
int requestedVideoTracks = videoTracks.isEmpty() ? 0 : videoTracks.last() - videoTracks.first() + 1;
int requestedAudioTracks = audioTracks.isEmpty() ? 0 : audioTracks.last() - audioTracks.first() + 1;
if (requestedVideoTracks > projectTracks.second.size() || requestedAudioTracks > projectTracks.first.size()) {
pCore->displayMessage(i18n("Not enough tracks to paste clipboard"), InformationMessage, 500);
pCore->displayMessage(i18n("Not enough tracks to paste clipboard"), ErrorMessage, 500);
semaphore.release(1);
return false;
}
......@@ -1526,7 +1526,7 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim
if (requestedAudioTracks > 0 && projectTracks.first.size() <= (projectTracks.second.indexOf(trackId) + topAudioOffset)) {
int updatedPos = projectTracks.first.size() - topAudioOffset - 1;
if (updatedPos < 0 || updatedPos >= projectTracks.second.size()) {
pCore->displayMessage(i18n("Not enough tracks to paste clipboard"), InformationMessage, 500);
pCore->displayMessage(i18n("Not enough tracks to paste clipboard"), ErrorMessage, 500);
semaphore.release(1);
return false;
}
......@@ -1557,7 +1557,7 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim
for (int tk : qAsConst(videoTracks)) {
int newPos = masterIx + tk - masterSourceTrack;
if (newPos < 0 || newPos >= projectTracks.second.size()) {
pCore->displayMessage(i18n("Not enough tracks to paste clipboard"), InformationMessage, 500);
pCore->displayMessage(i18n("Not enough tracks to paste clipboard"), ErrorMessage, 500);
semaphore.release(1);
return false;
}
......@@ -1591,7 +1591,7 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim
}
int offsetId = oldPos + audioOffset;
if (offsetId < 0 || offsetId >= projectTracks.first.size()) {
pCore->displayMessage(i18n("Not enough tracks to paste clipboard"), InformationMessage, 500);
pCore->displayMessage(i18n("Not enough tracks to paste clipboard"), ErrorMessage, 500);
semaphore.release(1);
return false;
}
......@@ -1661,7 +1661,7 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim
clipsImported = true;
bool insert = pCore->projectItemModel()->requestAddBinClip(clipId, currentProd, folderId, undo, redo, callBack);
if (!insert) {
pCore->displayMessage(i18n("Could not add bin clip"), InformationMessage, 500);
pCore->displayMessage(i18n("Could not add bin clip"), ErrorMessage, 500);
undo();
semaphore.release(1);
return false;
......@@ -1705,7 +1705,7 @@ bool TimelineFunctions::pasteTimelineClips(const std::shared_ptr<TimelineItemMod
int curTrackId = tracksMap.value(prod.attribute(QStringLiteral("track")).toInt());
if (!timeline->isTrack(curTrackId)) {
// Something is broken
pCore->displayMessage(i18n("Not enough tracks to paste clipboard"), InformationMessage, 500);
pCore->displayMessage(i18n("Not enough tracks to paste clipboard"), ErrorMessage, 500);
timeline_undo();
semaphore.release(1);
return false;
......@@ -1721,7 +1721,7 @@ bool TimelineFunctions::pasteTimelineClips(const std::shared_ptr<TimelineItemMod
bool created = timeline->requestClipCreation(originalId, newId, timeline->getTrackById_const(curTrackId)->trackType(), audioStream, speed, warp_pitch, timeline_undo, timeline_redo);
if (!created) {
// Something is broken
pCore->displayMessage(i18n("Could not paste items in timeline"), InformationMessage, 500);
pCore->displayMessage(i18n("Could not paste items in timeline"), ErrorMessage, 500);
timeline_undo();
semaphore.release(1);
return false;
......@@ -1781,7 +1781,7 @@ bool TimelineFunctions::pasteTimelineClips(const std::shared_ptr<TimelineItemMod
}
if (!res) {
timeline_undo();
pCore->displayMessage(i18n("Could not paste items in timeline"), InformationMessage, 500);
pCore->displayMessage(i18n("Could not paste items in timeline"), ErrorMessage, 500);
semaphore.release(1);
return false;
}
......
......@@ -798,9 +798,10 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
bool TimelineModel::mixClip(int idToMove, int delta)
{
int selectedTrack = -1;
qDebug()<<"==== REQUEST CLIP MIX STEP 1";
std::unordered_set<int> initialSelection = getCurrentSelection();
if (idToMove == -1 && initialSelection.empty()) {
pCore->displayMessage(i18n("Select a clip to apply the mix"), InformationMessage, 500);
pCore->displayMessage(i18n("Select a clip to apply the mix"), ErrorMessage, 500);
return false;
}
std::pair<int, int> clipsToMix;
......@@ -884,12 +885,12 @@ bool TimelineModel::mixClip(int idToMove, int delta)
break;
}
}
if (noSpaceInClip > 0) {
pCore->displayMessage(i18n("Not enough frames at clip %1 to apply the mix", noSpaceInClip == 1 ? i18n("start") : i18n("end")), ErrorMessage, 500);
return false;
}
if (idToMove == -1 || !isClip(idToMove)) {
if (noSpaceInClip > 0) {
pCore->displayMessage(i18n("Not enough frames at clip %1 to apply the mix", noSpaceInClip == 1 ? i18n("start") : i18n("end")), InformationMessage, 500);
} else {
pCore->displayMessage(i18n("Select a clip to apply the mix"), InformationMessage, 500);
}
pCore->displayMessage(i18n("Select a clip to apply the mix"), ErrorMessage, 500);
return false;
}
......@@ -1511,7 +1512,7 @@ bool TimelineModel::requestClipInsertion(const QString &binClipId, int trackId,
}
}
if (useTargets && allowedTracks.isEmpty()) {
pCore->displayMessage(i18n("No available track for insert operation"), InformationMessage, 500);
pCore->displayMessage(i18n("No available track for insert operation"), ErrorMessage, 500);
return false;
}
bool result = requestClipInsertion(binClipId, trackId, position, id, logUndo, refreshView, useTargets, undo, redo, allowedTracks);
......@@ -2869,7 +2870,7 @@ bool TimelineModel::removeMix(int cid)
if (res) {
PUSH_UNDO(undo, redo, i18n("Remove mix"));
} else {
pCore->displayMessage(i18n("Removing mix failed"), InformationMessage, 500);
pCore->displayMessage(i18n("Removing mix failed"), ErrorMessage, 500);
}
return res;
}
......@@ -3430,7 +3431,7 @@ bool TimelineModel::requestTrackDeletion(int trackId, Fun &undo, Fun &redo)
{
Q_ASSERT(isTrack(trackId));
if (m_allTracks.size() < 2) {
pCore->displayMessage(i18n("Cannot delete last track in timeline"), InformationMessage, 500);
pCore->displayMessage(i18n("Cannot delete last track in timeline"), ErrorMessage, 500);
return false;
}
// Discard running jobs
......@@ -3663,7 +3664,7 @@ bool TimelineModel::addTrackEffect(int trackId, const QString &effectId)
Q_ASSERT(m_iteratorTable.count(trackId) > 0);
if ((*m_iteratorTable.at(trackId))->addEffect(effectId) == false) {
QString effectName = EffectsRepository::get()->getName(effectId);
pCore->displayMessage(i18n("Cannot add effect %1 to selected track", effectName), InformationMessage, 500);
pCore->displayMessage(i18n("Cannot add effect %1 to selected track", effectName), ErrorMessage, 500);
return false;
}
return true;
......@@ -3678,7 +3679,7 @@ bool TimelineModel::copyTrackEffect(int trackId, const QString &sourceId)
int itemRow = source.at(2).toInt();
std::shared_ptr<EffectStackModel> effectStack = pCore->getItemEffectStack(itemType, itemId);
if ((*m_iteratorTable.at(trackId))->copyEffect(effectStack, itemRow) == false) {
pCore->displayMessage(i18n("Cannot paste effect to selected track"), InformationMessage, 500);
pCore->displayMessage(i18n("Cannot paste effect to selected track"), ErrorMessage, 500);
return false;
}
return true;
......@@ -3696,7 +3697,7 @@ bool TimelineModel::addClipEffect(int clipId, const QString &effectId, bool noti
bool result = m_allClips.at(clipId)->addEffect(effectId);
if (!result && notify) {
QString effectName = EffectsRepository::get()->getName(effectId);
pCore->displayMessage(i18n("Cannot add effect %1 to selected clip", effectName), InformationMessage, 500);
pCore->displayMessage(i18n("Cannot add effect %1 to selected clip", effectName), ErrorMessage, 500);
}
return result;
}
......
......@@ -1648,7 +1648,7 @@ bool TrackModel::requestClipMix(std::pair<int, int> clipIds, int mixDuration, bo
// check if we have enough frames, or limit duration
int leftFrames = secondClip->getIn();
if (leftFrames < 3) {
pCore->displayMessage(i18n("Not enough frames at clip %1 to apply the mix", i18n("start")), InformationMessage, 500);
pCore->displayMessage(i18n("Not enough frames at clip %1 to apply the mix", i18n("start")), ErrorMessage, 500);
return false;
}
if (leftFrames < mixDuration / 2) {
......
This diff is collapsed.
......@@ -279,7 +279,7 @@ void TimelineWidget::showTargetMenu(int tid)
return;
}
if (m_proxy->clipTargets() < 2 || !model()->isAudioTrack(tid)) {
pCore->displayMessage(i18n("No available stream"), MessageType::InformationMessage);
pCore->displayMessage(i18n("No available stream"), MessageType::ErrorMessage);
return;
}
QVariant returnedValue;
......
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