Commit e48eeaef authored by Nicolas Carion's avatar Nicolas Carion

Save modifications to guide on modifications and not only import

parent 4655eb0f
......@@ -44,6 +44,7 @@ MarkerListModel::MarkerListModel(const QString &clipId, std::weak_ptr<DocUndoSta
, m_clipId(clipId)
, m_lock(QReadWriteLock::Recursive)
{
setup();
}
MarkerListModel::MarkerListModel(std::weak_ptr<DocUndoStack> undo_stack, QObject *parent)
......@@ -52,6 +53,20 @@ MarkerListModel::MarkerListModel(std::weak_ptr<DocUndoStack> undo_stack, QObject
, m_guide(true)
, m_lock(QReadWriteLock::Recursive)
{
setup();
}
void MarkerListModel::setup()
{
// We connect the signals of the abstractitemmodel to a more generic one.
connect(this, &MarkerListModel::columnsMoved, this, &MarkerListModel::modelChanged);
connect(this, &MarkerListModel::columnsRemoved, this, &MarkerListModel::modelChanged);
connect(this, &MarkerListModel::columnsInserted, this, &MarkerListModel::modelChanged);
connect(this, &MarkerListModel::rowsMoved, this, &MarkerListModel::modelChanged);
connect(this, &MarkerListModel::rowsRemoved, this, &MarkerListModel::modelChanged);
connect(this, &MarkerListModel::rowsInserted, this, &MarkerListModel::modelChanged);
connect(this, &MarkerListModel::modelReset, this, &MarkerListModel::modelChanged);
connect(this, &MarkerListModel::dataChanged, this, &MarkerListModel::modelChanged);
}
bool MarkerListModel::addMarker(GenTime pos, const QString &comment, int type, Fun &undo, Fun &redo)
......@@ -397,7 +412,6 @@ bool MarkerListModel::importFromJson(const QString &data, bool ignoreConflicts,
if (pushUndo) {
PUSH_UNDO(undo, redo, m_guide ? i18n("Import guides") : i18n("Import markers"));
}
emit dataImported();
return true;
}
......
......@@ -150,6 +150,8 @@ protected:
/** @brief Helper function that retrieves a pointer to the markermodel, given whether it's a guide model and its clipId*/
static std::shared_ptr<MarkerListModel> getModel(bool guide, const QString &clipId);
/* @brief Connects the signals of this object */
void setup();
private:
std::weak_ptr<DocUndoStack> m_undoStack;
......@@ -162,7 +164,7 @@ private:
std::vector<std::weak_ptr<SnapModel>> m_registeredSnaps;
signals:
void dataImported();
void modelChanged();
public:
// this is to enable for range loops
......
......@@ -82,7 +82,7 @@ KdenliveDoc::KdenliveDoc(const QUrl &url, const QString &projectFolder, QUndoGro
{
m_commandStack = std::make_shared<DocUndoStack>(undoGroup);
m_guideModel.reset(new MarkerListModel(m_commandStack, this));
connect(m_guideModel.get(), &MarkerListModel::dataImported, this, &KdenliveDoc::guidesChanged);
connect(m_guideModel.get(), &MarkerListModel::modelChanged, this, &KdenliveDoc::guidesChanged);
m_clipManager = new ClipManager(this);
connect(m_clipManager, SIGNAL(displayMessage(QString, int)), parent, SLOT(slotGotProgressInfo(QString, int)));
......
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