2021-08-17 17:49:28 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vpundocommand.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 16 8, 2021
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentina project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2021 Valentina project
|
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
|
|
|
**
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
#ifndef VPUNDOCOMMAND_H
|
|
|
|
#define VPUNDOCOMMAND_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QUndoCommand>
|
|
|
|
#include <QLoggingCategory>
|
|
|
|
|
|
|
|
namespace ML
|
|
|
|
{
|
|
|
|
enum class UndoCommand: qint8
|
|
|
|
{
|
|
|
|
MovePiece = 0,
|
2021-08-18 19:33:47 +02:00
|
|
|
MovePieces = 1,
|
|
|
|
RotatePiece = 2,
|
|
|
|
RotatePieces = 3,
|
2021-08-19 11:36:39 +02:00
|
|
|
MoveOrigin = 4,
|
2021-08-19 14:13:54 +02:00
|
|
|
MoveOnSheet = 5,
|
2021-08-17 17:49:28 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
Q_DECLARE_LOGGING_CATEGORY(vpUndo)
|
|
|
|
|
|
|
|
class VPUndoCommand : public QObject, public QUndoCommand
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2021-08-19 11:36:39 +02:00
|
|
|
explicit VPUndoCommand(bool allowMerge = false, QUndoCommand *parent = nullptr);
|
2021-08-17 17:49:28 +02:00
|
|
|
virtual ~VPUndoCommand() =default;
|
|
|
|
|
2021-08-19 11:36:39 +02:00
|
|
|
auto AllowMerge() const -> bool;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool m_allowMerge;
|
|
|
|
|
2021-08-17 17:49:28 +02:00
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(VPUndoCommand)
|
|
|
|
};
|
|
|
|
|
2021-08-19 11:36:39 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline auto VPUndoCommand::AllowMerge() const -> bool
|
|
|
|
{
|
|
|
|
return m_allowMerge;
|
|
|
|
}
|
|
|
|
|
2021-08-17 17:49:28 +02:00
|
|
|
#endif // VPUNDOCOMMAND_H
|