LibrePCB Developers Documentation
cmdpackagemodeledit.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_EDITOR_CMDPACKAGEMODELEDIT_H
21#define LIBREPCB_EDITOR_CMDPACKAGEMODELEDIT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../cmd/cmdlistelementsswap.h"
27
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class Package;
38
39namespace editor {
40
41/*******************************************************************************
42 * Class CmdPackageModelEdit
43 ******************************************************************************/
44
49public:
50 // Constructors / Destructor
53 explicit CmdPackageModelEdit(Package& package, PackageModel& model) noexcept;
54 virtual ~CmdPackageModelEdit() noexcept;
55
56 // Setters
57 void setName(const ElementName& name) noexcept;
58 void setStepContent(const QByteArray& content) noexcept;
59
60 // Operator Overloadings
61 CmdPackageModelEdit& operator=(const CmdPackageModelEdit& rhs) = delete;
62
63protected: // Methods
65 virtual bool performExecute() override;
66
68 virtual void performUndo() override;
69
71 virtual void performRedo() override;
72
73private: // Data
76
79 QByteArray mOldStepContent;
80 QByteArray mNewStepContent;
81};
82
83/*******************************************************************************
84 * Undo Commands
85 ******************************************************************************/
86
89 PackageModel::Event>;
90
91/*******************************************************************************
92 * End of File
93 ******************************************************************************/
94
95} // namespace editor
96} // namespace librepcb
97
98#endif
The Package class represents a package of a component (including footprint and 3D model)
Definition: package.h:59
Represents a 3D model of a librepcb::Package.
Definition: packagemodel.h:43
The CmdListElementsSwap class.
Definition: cmdlistelementsswap.h:46
The CmdPackageModelEdit class.
Definition: cmdpackagemodeledit.h:48
virtual void performRedo() override
Redo the command.
Definition: cmdpackagemodeledit.cpp:95
void setName(const ElementName &name) noexcept
Definition: cmdpackagemodeledit.cpp:57
QByteArray mOldStepContent
Definition: cmdpackagemodeledit.h:79
virtual ~CmdPackageModelEdit() noexcept
Definition: cmdpackagemodeledit.cpp:50
PackageModel & mModel
Definition: cmdpackagemodeledit.h:75
CmdPackageModelEdit(const CmdPackageModelEdit &other)=delete
virtual void performUndo() override
Undo the command.
Definition: cmdpackagemodeledit.cpp:84
void setStepContent(const QByteArray &content) noexcept
Definition: cmdpackagemodeledit.cpp:62
Package & mPackage
Definition: cmdpackagemodeledit.h:74
ElementName mNewName
Definition: cmdpackagemodeledit.h:78
ElementName mOldName
Definition: cmdpackagemodeledit.h:77
QByteArray mNewStepContent
Definition: cmdpackagemodeledit.h:80
virtual bool performExecute() override
Execute the command the first time.
Definition: cmdpackagemodeledit.cpp:71
The UndoCommand class represents a command which you can undo/redo.
Definition: undocommand.h:46
Definition: occmodel.cpp:77
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition: elementname.h:84
Definition: packagemodel.h:95