File indexing completed on 2024-04-28 08:43:29

0001 /*
0002     SPDX-FileCopyrightText: 2015 Jean-Baptiste Mardelle <jb@kdenlive.org>
0003 
0004 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QMap>
0010 #include <QUndoCommand>
0011 
0012 class Bin;
0013 
0014 class MoveBinClipCommand : public QUndoCommand
0015 {
0016 public:
0017     explicit MoveBinClipCommand(Bin *bin, QString clipId, QString oldParentId, QString newParentId, QUndoCommand *parent = nullptr);
0018     void undo() override;
0019     void redo() override;
0020 
0021 private:
0022     Bin *m_bin;
0023     QString m_clipId;
0024     QString m_oldParentId;
0025     QString m_newParentId;
0026 };
0027 
0028 class MoveBinFolderCommand : public QUndoCommand
0029 {
0030 public:
0031     explicit MoveBinFolderCommand(Bin *bin, QString clipId, QString oldParentId, QString newParentId, QUndoCommand *parent = nullptr);
0032     void undo() override;
0033     void redo() override;
0034 
0035 private:
0036     Bin *m_bin;
0037     QString m_clipId;
0038     QString m_oldParentId;
0039     QString m_newParentId;
0040 };
0041 
0042 class RenameBinSubClipCommand : public QUndoCommand
0043 {
0044 public:
0045     explicit RenameBinSubClipCommand(Bin *bin, QString clipId, QString newName, QString oldName, int in, int out, QUndoCommand *parent = nullptr);
0046     void undo() override;
0047     void redo() override;
0048 
0049 private:
0050     Bin *m_bin;
0051     QString m_clipId;
0052     QString m_oldName;
0053     QString m_newName;
0054     int m_in;
0055     int m_out;
0056 };
0057 
0058 class EditClipCommand : public QUndoCommand
0059 {
0060 public:
0061     EditClipCommand(Bin *bin, QString id, QMap<QString, QString> oldparams, QMap<QString, QString> newparams, bool doIt, QUndoCommand *parent = nullptr);
0062     void undo() override;
0063     void redo() override;
0064 
0065 private:
0066     Bin *m_bin;
0067     QMap<QString, QString> m_oldparams;
0068     QMap<QString, QString> m_newparams;
0069     QString m_id;
0070     /** @brief Should this command be executed on first redo ? TODO: we should refactor the code to get rid of this and always execute actions through the
0071      *command system.
0072      *. */
0073     bool m_doIt;
0074     /** @brief This value is true is this is the first time we execute the command, false otherwise. This allows us to refresh the properties panel
0075      * only on the later executions of the command, since on the first execution, the properties panel already contains the correct info. */
0076     bool m_firstExec;
0077 };