valentina/src/app/puzzle/undocommands/vpundocommand.h

82 lines
2.4 KiB
C
Raw Normal View History

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>
2022-02-18 16:57:41 +01:00
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
2021-08-17 17:49:28 +02:00
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-19 15:09:38 +02:00
AddSheet = 6,
RemoveSheet = 7,
2022-02-18 16:57:41 +01:00
ZValueMovePiece = 8,
ZValueMovePieces = 9,
2021-08-17 17:49:28 +02:00
};
2022-02-18 16:57:41 +01:00
} // namespace ML
2021-08-17 17:49:28 +02:00
2022-02-18 16:57:41 +01:00
Q_DECLARE_LOGGING_CATEGORY(vpUndo) // NOLINT
2021-08-17 17:49:28 +02:00
class VPUndoCommand : public QObject, public QUndoCommand
{
2022-02-18 16:57:41 +01:00
Q_OBJECT // NOLINT
2021-08-17 17:49:28 +02:00
public:
2022-02-18 16:57:41 +01:00
explicit VPUndoCommand(QUndoCommand *parent = nullptr);
2021-08-19 11:36:39 +02:00
explicit VPUndoCommand(bool allowMerge = false, QUndoCommand *parent = nullptr);
2022-02-18 16:57:41 +01:00
~VPUndoCommand() override =default;
2021-08-17 17:49:28 +02:00
2021-08-19 11:36:39 +02:00
auto AllowMerge() const -> bool;
2021-08-17 17:49:28 +02:00
private:
2022-02-18 16:57:41 +01:00
Q_DISABLE_COPY_MOVE(VPUndoCommand) // NOLINT
bool m_allowMerge{false};
2021-08-17 17:49:28 +02:00
};
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