Change tab icon & font when document was modified

svn path=/branches/KDE4/; revision=2054
parent 024a8b00
...@@ -455,11 +455,13 @@ void CustomTrackView::slotAddEffect(QDomElement effect, GenTime pos, int track) ...@@ -455,11 +455,13 @@ void CustomTrackView::slotAddEffect(QDomElement effect, GenTime pos, int track)
m_commandStack->push(command); m_commandStack->push(command);
} }
} }
m_document->setModified(true);
} }
void CustomTrackView::slotDeleteEffect(ClipItem *clip, QDomElement effect) { void CustomTrackView::slotDeleteEffect(ClipItem *clip, QDomElement effect) {
AddEffectCommand *command = new AddEffectCommand(this, m_tracksCount - clip->track(), clip->startPos(), effect, false); AddEffectCommand *command = new AddEffectCommand(this, m_tracksCount - clip->track(), clip->startPos(), effect, false);
m_commandStack->push(command); m_commandStack->push(command);
m_document->setModified(true);
} }
void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement effect) { void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement effect) {
...@@ -471,6 +473,7 @@ void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement effect) { ...@@ -471,6 +473,7 @@ void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement effect) {
m_document->renderer()->mltRemoveEffect(track, pos, index); m_document->renderer()->mltRemoveEffect(track, pos, index);
} else m_document->renderer()->mltEditEffect(m_tracksCount - clip->track(), clip->startPos(), effectParams); } else m_document->renderer()->mltEditEffect(m_tracksCount - clip->track(), clip->startPos(), effectParams);
} }
m_document->setModified(true);
} }
void CustomTrackView::slotChangeEffectState(ClipItem *clip, QDomElement effect, bool disable) { void CustomTrackView::slotChangeEffectState(ClipItem *clip, QDomElement effect, bool disable) {
...@@ -478,6 +481,7 @@ void CustomTrackView::slotChangeEffectState(ClipItem *clip, QDomElement effect, ...@@ -478,6 +481,7 @@ void CustomTrackView::slotChangeEffectState(ClipItem *clip, QDomElement effect,
effect.setAttribute("disabled", disable); effect.setAttribute("disabled", disable);
EditEffectCommand *command = new EditEffectCommand(this, m_tracksCount - clip->track(), clip->startPos(), oldEffect, effect, true); EditEffectCommand *command = new EditEffectCommand(this, m_tracksCount - clip->track(), clip->startPos(), oldEffect, effect, true);
m_commandStack->push(command); m_commandStack->push(command);
m_document->setModified(true);
} }
void CustomTrackView::slotUpdateClipEffect(ClipItem *clip, QDomElement oldeffect, QDomElement effect) { void CustomTrackView::slotUpdateClipEffect(ClipItem *clip, QDomElement oldeffect, QDomElement effect) {
...@@ -526,6 +530,7 @@ void CustomTrackView::dropEvent(QDropEvent * event) { ...@@ -526,6 +530,7 @@ void CustomTrackView::dropEvent(QDropEvent * event) {
m_document->updateClip(m_dropItem->baseClip()->getId()); m_document->updateClip(m_dropItem->baseClip()->getId());
// kDebug()<<"IIIIIIIIIIIIIIIIIIIIIIII TRAX CNT: "<<m_tracksCount<<", DROP: "<<m_dropItem->track(); // kDebug()<<"IIIIIIIIIIIIIIIIIIIIIIII TRAX CNT: "<<m_tracksCount<<", DROP: "<<m_dropItem->track();
m_document->renderer()->mltInsertClip(m_tracksCount - m_dropItem->track(), m_dropItem->startPos(), m_dropItem->xml()); m_document->renderer()->mltInsertClip(m_tracksCount - m_dropItem->track(), m_dropItem->startPos(), m_dropItem->xml());
m_document->setModified(true);
} else QGraphicsView::dropEvent(event); } else QGraphicsView::dropEvent(event);
m_dropItem = NULL; m_dropItem = NULL;
} }
...@@ -627,6 +632,7 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event) { ...@@ -627,6 +632,7 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event) {
m_commandStack->push(command); m_commandStack->push(command);
m_document->renderer()->doRefresh(); m_document->renderer()->doRefresh();
} }
m_document->setModified(true);
m_operationMode = NONE; m_operationMode = NONE;
m_dragItem = NULL; m_dragItem = NULL;
} }
......
...@@ -259,7 +259,12 @@ KUrl KdenliveDoc::url() const { ...@@ -259,7 +259,12 @@ KUrl KdenliveDoc::url() const {
void KdenliveDoc::setUrl(KUrl url) { void KdenliveDoc::setUrl(KUrl url) {
m_url = url; m_url = url;
m_modified = false; }
void KdenliveDoc::setModified(bool mod) {
if (mod == m_modified) return;
m_modified = mod;
emit docModified(m_modified);
} }
QString KdenliveDoc::description() const { QString KdenliveDoc::description() const {
...@@ -279,6 +284,7 @@ void KdenliveDoc::addClip(const QDomElement &elem, const int clipId) { ...@@ -279,6 +284,7 @@ void KdenliveDoc::addClip(const QDomElement &elem, const int clipId) {
void KdenliveDoc::deleteProjectClip(const uint clipId) { void KdenliveDoc::deleteProjectClip(const uint clipId) {
emit deletTimelineClip(clipId); emit deletTimelineClip(clipId);
m_clipManager->slotDeleteClip(clipId); m_clipManager->slotDeleteClip(clipId);
setModified(true);
} }
void KdenliveDoc::deleteClip(const uint clipId) { void KdenliveDoc::deleteClip(const uint clipId) {
...@@ -289,6 +295,7 @@ void KdenliveDoc::deleteClip(const uint clipId) { ...@@ -289,6 +295,7 @@ void KdenliveDoc::deleteClip(const uint clipId) {
void KdenliveDoc::slotAddClipFile(const KUrl url, const QString group) { void KdenliveDoc::slotAddClipFile(const KUrl url, const QString group) {
kDebug() << "///////// DOCUM, ADD CLP: " << url; kDebug() << "///////// DOCUM, ADD CLP: " << url;
m_clipManager->slotAddClipFile(url, group); m_clipManager->slotAddClipFile(url, group);
setModified(true);
} }
DocClipBase *KdenliveDoc::getBaseClip(int clipId) { DocClipBase *KdenliveDoc::getBaseClip(int clipId) {
...@@ -297,6 +304,7 @@ DocClipBase *KdenliveDoc::getBaseClip(int clipId) { ...@@ -297,6 +304,7 @@ DocClipBase *KdenliveDoc::getBaseClip(int clipId) {
void KdenliveDoc::slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group) { void KdenliveDoc::slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group) {
m_clipManager->slotAddColorClipFile(name, color, duration, group); m_clipManager->slotAddColorClipFile(name, color, duration, group);
setModified(true);
} }
#include "kdenlivedoc.moc" #include "kdenlivedoc.moc"
......
...@@ -74,6 +74,8 @@ Q_OBJECT public: ...@@ -74,6 +74,8 @@ Q_OBJECT public:
void setUrl(KUrl url); void setUrl(KUrl url);
QDomElement documentInfoXml(); QDomElement documentInfoXml();
void setProfilePath(QString path); void setProfilePath(QString path);
/** Set to true if document needs saving, false otherwise */
void setModified(bool mod);
private: private:
KUrl m_url; KUrl m_url;
...@@ -100,6 +102,8 @@ signals: ...@@ -100,6 +102,8 @@ signals:
void updateClipDisplay(int); void updateClipDisplay(int);
void deletTimelineClip(int); void deletTimelineClip(int);
void thumbsProgress(KUrl, int); void thumbsProgress(KUrl, int);
/** emited when the document state has been modified (= needs saving or not) */
void docModified(bool);
}; };
#endif #endif
...@@ -376,6 +376,7 @@ void MainWindow::saveFileAs(const QString &outputFileName) { ...@@ -376,6 +376,7 @@ void MainWindow::saveFileAs(const QString &outputFileName) {
setCaption(m_activeDocument->description()); setCaption(m_activeDocument->description());
m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description()); m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), m_activeDocument->url().path()); m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), m_activeDocument->url().path());
m_activeDocument->setModified(false);
} }
void MainWindow::saveFileAs() { void MainWindow::saveFileAs() {
...@@ -536,6 +537,16 @@ void MainWindow::slotUpdateMousePosition(int pos) { ...@@ -536,6 +537,16 @@ void MainWindow::slotUpdateMousePosition(int pos) {
} }
} }
void MainWindow::slotUpdateDocumentState(bool modified) {
if (modified) {
m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Link));
m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("document-save"));
} else {
m_timelineArea->setTabTextColor(m_timelineArea->currentIndex(), palette().color(QPalette::Text));
m_timelineArea->setTabIcon(m_timelineArea->currentIndex(), KIcon("kdenlive"));
}
}
void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //changed void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //changed
//m_projectMonitor->stop(); //m_projectMonitor->stop();
kDebug() << "/////////////////// CONNECTING DOC TO PROJECT VIEW ////////////////"; kDebug() << "/////////////////// CONNECTING DOC TO PROJECT VIEW ////////////////";
...@@ -551,6 +562,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha ...@@ -551,6 +562,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
disconnect(m_activeDocument, SIGNAL(deletTimelineClip(int)), m_activeTimeline, SLOT(slotDeleteClip(int))); disconnect(m_activeDocument, SIGNAL(deletTimelineClip(int)), m_activeTimeline, SLOT(slotDeleteClip(int)));
disconnect(m_activeDocument, SIGNAL(thumbsProgress(KUrl, int)), this, SLOT(slotGotProgressInfo(KUrl, int))); disconnect(m_activeDocument, SIGNAL(thumbsProgress(KUrl, int)), this, SLOT(slotGotProgressInfo(KUrl, int)));
disconnect(m_activeTimeline, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*))); disconnect(m_activeTimeline, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
disconnect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement))); disconnect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
disconnect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement))); disconnect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
disconnect(effectStack, SIGNAL(changeEffectState(ClipItem*, QDomElement, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, QDomElement, bool))); disconnect(effectStack, SIGNAL(changeEffectState(ClipItem*, QDomElement, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, QDomElement, bool)));
...@@ -573,6 +585,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha ...@@ -573,6 +585,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
connect(doc, SIGNAL(updateClipDisplay(int)), m_projectList, SLOT(slotUpdateClip(int))); connect(doc, SIGNAL(updateClipDisplay(int)), m_projectList, SLOT(slotUpdateClip(int)));
connect(doc, SIGNAL(deletTimelineClip(int)), trackView, SLOT(slotDeleteClip(int))); connect(doc, SIGNAL(deletTimelineClip(int)), trackView, SLOT(slotDeleteClip(int)));
connect(doc, SIGNAL(thumbsProgress(KUrl, int)), this, SLOT(slotGotProgressInfo(KUrl, int))); connect(doc, SIGNAL(thumbsProgress(KUrl, int)), this, SLOT(slotGotProgressInfo(KUrl, int)));
connect(doc, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
connect(trackView, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*))); connect(trackView, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
connect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement))); connect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
......
...@@ -135,6 +135,7 @@ private slots: ...@@ -135,6 +135,7 @@ private slots:
void slotRenderProject(); void slotRenderProject();
void slotDoRender(const QString &dest, const QString &render, const QStringList &avformat_args, bool zoneOnly, bool playAfter); void slotDoRender(const QString &dest, const QString &render, const QStringList &avformat_args, bool zoneOnly, bool playAfter);
void slotFullScreen(); void slotFullScreen();
void slotUpdateDocumentState(bool modified);
}; };
#endif #endif
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