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

start informing user when there is an error in MLT operation, add option to reopen last project

svn path=/branches/KDE4/; revision=2281
parent f718b68b
......@@ -631,10 +631,15 @@ void CustomTrackView::dragEnterEvent(QDragEnterEvent * event) {
void CustomTrackView::slotRefreshEffects(ClipItem *clip) {
int track = m_tracksList.count() - clip->track();
GenTime pos = clip->startPos();
m_document->renderer()->mltRemoveEffect(track, pos, "-1", false);
if (!m_document->renderer()->mltRemoveEffect(track, pos, "-1", false)) {
emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
return;
}
bool success = true;
for (int i = 0; i < clip->effectsCount(); i++) {
m_document->renderer()->mltAddEffect(track, pos, clip->getEffectArgs(clip->effectAt(i)), false);
if (!m_document->renderer()->mltAddEffect(track, pos, clip->getEffectArgs(clip->effectAt(i)), false)) success = false;
}
if (!success) emit displayMessage(i18n("Problem adding effect to clip"), ErrorMessage);
m_document->renderer()->doRefresh();
}
......@@ -642,14 +647,19 @@ void CustomTrackView::addEffect(int track, GenTime pos, QDomElement effect) {
ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()) + 1, m_tracksList.count() - track);
if (clip) {
QMap <QString, QString> effectParams = clip->addEffect(effect);
m_document->renderer()->mltAddEffect(track, pos, effectParams);
if (!m_document->renderer()->mltAddEffect(track, pos, effectParams))
emit displayMessage(i18n("Problem adding effect to clip"), ErrorMessage);
emit clipItemSelected(clip);
}
else emit displayMessage(i18n("Cannot find clip to add effect"), ErrorMessage);
}
void CustomTrackView::deleteEffect(int track, GenTime pos, QDomElement effect) {
QString index = effect.attribute("kdenlive_ix");
m_document->renderer()->mltRemoveEffect(track, pos, index);
if (!m_document->renderer()->mltRemoveEffect(track, pos, index)) {
emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
return;
}
ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()) + 1, m_tracksList.count() - track);
if (clip) {
clip->deleteEffect(index);
......@@ -689,8 +699,10 @@ void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement effect) {
QMap <QString, QString> effectParams = clip->getEffectArgs(effect);
if (effectParams.value("disabled") == "1") {
QString index = effectParams.value("kdenlive_ix");
m_document->renderer()->mltRemoveEffect(track, pos, index);
} else m_document->renderer()->mltEditEffect(m_tracksList.count() - clip->track(), clip->startPos(), effectParams);
if (!m_document->renderer()->mltRemoveEffect(track, pos, index))
emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
} else if (!m_document->renderer()->mltEditEffect(m_tracksList.count() - clip->track(), clip->startPos(), effectParams))
emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
}
m_document->setModified(true);
}
......@@ -1291,7 +1303,8 @@ void CustomTrackView::updateClipFade(ClipItem * item, bool updateFadeOut) {
EffectsList::setParameter(oldeffect, "in", QString::number(start));
EffectsList::setParameter(oldeffect, "out", QString::number(end));
QMap <QString, QString> effectParams = item->getEffectArgs(oldeffect);
m_document->renderer()->mltEditEffect(m_tracksList.count() - item->track(), item->startPos(), effectParams);
if (!m_document->renderer()->mltEditEffect(m_tracksList.count() - item->track(), item->startPos(), effectParams))
emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
}
} else {
int start = item->fadeOut();
......@@ -1304,7 +1317,8 @@ void CustomTrackView::updateClipFade(ClipItem * item, bool updateFadeOut) {
EffectsList::setParameter(oldeffect, "in", QString::number(start));
EffectsList::setParameter(oldeffect, "out", QString::number(end));
QMap <QString, QString> effectParams = item->getEffectArgs(oldeffect);
m_document->renderer()->mltEditEffect(m_tracksList.count() - item->track(), item->startPos(), effectParams);
if (m_document->renderer()->mltEditEffect(m_tracksList.count() - item->track(), item->startPos(), effectParams))
emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
}
}
}
......
......@@ -4,6 +4,11 @@
<kcfg>
<kcfgfile/>
<group name="misc">
<entry name="openlastproject" type="Bool">
<label>Open last project on startup.</label>
<default>false</default>
</entry>
<entry name="color_duration" type="String">
<label>Default color clip duration.</label>
<default>00:00:05:00</default>
......
......@@ -248,7 +248,13 @@ MainWindow::MainWindow(QWidget *parent)
slotConnectMonitors();
setAutoSaveSettings();
newFile();
if (KdenliveSettings::openlastproject()) {
KSharedConfigPtr config = KGlobal::config();
QString Lastproject = config->group("Recent Files").readPathEntry("File1", QString());
openFile(KUrl(Lastproject));
} else newFile();
activateShuttleDevice();
}
......
......@@ -1096,10 +1096,10 @@ void Render::mltRemoveClip(int track, GenTime position) {
m_isBlocked = false;
}
void Render::mltRemoveEffect(int track, GenTime position, QString index, bool doRefresh) {
bool Render::mltRemoveEffect(int track, GenTime position, QString index, bool doRefresh) {
Mlt::Service service(m_mltProducer->parent().get_service());
bool success = false;
Mlt::Tractor tractor(service);
Mlt::Producer trackProducer(tractor.track(track));
Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
......@@ -1107,7 +1107,7 @@ void Render::mltRemoveEffect(int track, GenTime position, QString index, bool do
Mlt::Producer *clip = trackPlaylist.get_clip_at((int) position.frames(m_fps));
if (!clip) {
kDebug() << " / / / CANNOT FIND CLIP TO REMOVE EFFECT";
return;
return success;
}
Mlt::Service clipService(clip->get_service());
// if (tag.startsWith("ladspa")) tag = "ladspa";
......@@ -1116,17 +1116,18 @@ void Render::mltRemoveEffect(int track, GenTime position, QString index, bool do
Mlt::Filter *filter = clipService.filter(ct);
while (filter) {
if (index == "-1" || filter->get("kdenlive_ix") == index) {// && filter->get("kdenlive_id") == id) {
clipService.detach(*filter);
if (clipService.detach(*filter) == 0) success = true;
kDebug() << " / / / DLEETED EFFECT: " << ct;
} else ct++;
filter = clipService.filter(ct);
}
m_isBlocked = false;
if (doRefresh) refresh();
return success;
}
void Render::mltAddEffect(int track, GenTime position, QMap <QString, QString> args, bool doRefresh) {
bool Render::mltAddEffect(int track, GenTime position, QMap <QString, QString> args, bool doRefresh) {
Mlt::Service service(m_mltProducer->parent().get_service());
......@@ -1136,8 +1137,7 @@ void Render::mltAddEffect(int track, GenTime position, QMap <QString, QString> a
Mlt::Producer *clip = trackPlaylist.get_clip_at((int) position.frames(m_fps));
if (!clip) {
kDebug() << "********** CANNOT FIND CLIP TO APPLY EFFECT-----------";
return;
return false;
}
Mlt::Service clipService(clip->get_service());
m_isBlocked = true;
......@@ -1200,7 +1200,7 @@ void Render::mltAddEffect(int track, GenTime position, QMap <QString, QString> a
else {
kDebug() << "filter is NULL";
m_isBlocked = false;
return;
return false;
}
for (it = args.begin(); it != args.end(); ++it) {
......@@ -1217,17 +1217,18 @@ void Render::mltAddEffect(int track, GenTime position, QMap <QString, QString> a
delete[] filterTag;
m_isBlocked = false;
if (doRefresh) refresh();
return true;
}
void Render::mltEditEffect(int track, GenTime position, QMap <QString, QString> args) {
bool Render::mltEditEffect(int track, GenTime position, QMap <QString, QString> args) {
QString index = args.value("kdenlive_ix");
QString tag = args.value("tag");
QMap<QString, QString>::Iterator it = args.begin();
if (!args.value("keyframes").isEmpty() || /*it.key().startsWith("#") || */tag.startsWith("ladspa") || tag == "sox" || tag == "autotrack_rectangle") {
// This is a keyframe effect, to edit it, we remove it and re-add it.
mltRemoveEffect(track, position, index);
mltAddEffect(track, position, args);
return;
bool success = mltRemoveEffect(track, position, index);
if (success) success = mltAddEffect(track, position, args);
return success;
}
// create filter
......@@ -1240,7 +1241,7 @@ void Render::mltEditEffect(int track, GenTime position, QMap <QString, QString>
Mlt::Producer *clip = trackPlaylist.get_clip_at((int) position.frames(m_fps));
if (!clip) {
kDebug() << "WARINIG, CANNOT FIND CLIP ON track: " << track << ", AT POS: " << position.frames(m_fps);
return;
return false;
}
Mlt::Service clipService(clip->get_service());
m_isBlocked = true;
......@@ -1254,7 +1255,6 @@ void Render::mltEditEffect(int track, GenTime position, QMap <QString, QString>
filter = clipService.filter(ct);
}
if (!filter) {
kDebug() << "WARINIG, FILTER FOR EDITING NOT FOUND, ADDING IT!!!!!";
// filter was not found, it was probably a disabled filter, so add it to the correct place...
......@@ -1268,14 +1268,14 @@ void Render::mltEditEffect(int track, GenTime position, QMap <QString, QString>
} else ct++;
filter = clipService.filter(ct);
}
mltAddEffect(track, position, args);
bool success = mltAddEffect(track, position, args);
for (int i = 0; i < filtersList.count(); i++) {
clipService.attach(*(filtersList.at(i)));
}
m_isBlocked = false;
return;
return success;
}
for (it = args.begin(); it != args.end(); ++it) {
......@@ -1288,6 +1288,7 @@ void Render::mltEditEffect(int track, GenTime position, QMap <QString, QString>
}
m_isBlocked = false;
refresh();
return true;
}
void Render::mltMoveEffect(int track, GenTime position, int oldPos, int newPos) {
......
......@@ -157,9 +157,9 @@ Q_OBJECT public:
bool mltMoveClip(int startTrack, int endTrack, GenTime pos, GenTime moveStart);
bool mltMoveClip(int startTrack, int endTrack, int pos, int moveStart);
void mltRemoveClip(int track, GenTime position);
void mltRemoveEffect(int track, GenTime position, QString index, bool doRefresh = true);
void mltAddEffect(int track, GenTime position, QMap <QString, QString> args, bool doRefresh = true);
void mltEditEffect(int track, GenTime position, QMap <QString, QString> args);
bool mltRemoveEffect(int track, GenTime position, QString index, bool doRefresh = true);
bool mltAddEffect(int track, GenTime position, QMap <QString, QString> args, bool doRefresh = true);
bool mltEditEffect(int track, GenTime position, QMap <QString, QString> args);
void mltMoveEffect(int track, GenTime position, int oldPos, int newPos);
void mltChangeTrackState(int track, bool mute, bool blind);
void mltMoveTransition(QString type, int startTrack, int newTrack, int newTransitionTrack, GenTime oldIn, GenTime oldOut, GenTime newIn, GenTime newOut);
......
......@@ -6,11 +6,11 @@
<x>0</x>
<y>0</y>
<width>369</width>
<height>245</height>
<height>258</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4" >
<item row="0" column="0" >
<item row="1" column="0" >
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Default Durations</string>
......@@ -50,7 +50,7 @@
</layout>
</widget>
</item>
<item row="1" column="0" >
<item row="2" column="0" >
<widget class="QGroupBox" name="properties" >
<property name="title" >
<string>Default Profile</string>
......@@ -136,7 +136,7 @@
</layout>
</widget>
</item>
<item row="2" column="0" >
<item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
......@@ -149,6 +149,13 @@
</property>
</spacer>
</item>
<item row="0" column="0" >
<widget class="QCheckBox" name="kcfg_openlastproject" >
<property name="text" >
<string>Open last project on startup</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
......
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