LibrePCB Developers Documentation
cmdassemblyvariantedit.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_CMDASSEMBLYVARIANTEDIT_H
21#define LIBREPCB_EDITOR_CMDASSEMBLYVARIANTEDIT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../cmd/cmdlistelementsswap.h"
27#include "../../undocommand.h"
28
30
31#include <QtCore>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38class Circuit;
39
40namespace editor {
41
42/*******************************************************************************
43 * Class CmdAssemblyVariantEdit
44 ******************************************************************************/
45
49class CmdAssemblyVariantEdit final : public UndoCommand {
50public:
51 // Constructors / Destructor
54 explicit CmdAssemblyVariantEdit(Circuit& circuit,
55 std::shared_ptr<AssemblyVariant> av) noexcept;
56 ~CmdAssemblyVariantEdit() noexcept;
57
58 // Setters
59 void setName(const FileProofName& value) noexcept;
60 void setDescription(const QString& value) noexcept;
61
62 // Operator Overloadings
63 CmdAssemblyVariantEdit& operator=(const CmdAssemblyVariantEdit& rhs) = delete;
64
65private: // Methods
67 bool performExecute() override;
68
70 void performUndo() override;
71
73 void performRedo() override;
74
75private: // Data
78
83};
84
85/*******************************************************************************
86 * Undo Commands
87 ******************************************************************************/
88
91 AssemblyVariant::Event>;
92
93/*******************************************************************************
94 * End of File
95 ******************************************************************************/
96
97} // namespace editor
98} // namespace librepcb
99
100#endif
The AssemblyVariant class.
Definition: assemblyvariant.h:45
The Circuit class represents all electrical connections in a project (drawn in the schematics)
Definition: circuit.h:70
The CmdAssemblyVariantEdit class.
Definition: cmdassemblyvariantedit.h:49
void performRedo() override
Redo the command.
Definition: cmdassemblyvariantedit.cpp:84
FileProofName mOldName
Definition: cmdassemblyvariantedit.h:79
CmdAssemblyVariantEdit(const CmdAssemblyVariantEdit &other)=delete
Circuit & mCircuit
Definition: cmdassemblyvariantedit.h:76
void performUndo() override
Undo the command.
Definition: cmdassemblyvariantedit.cpp:79
FileProofName mNewName
Definition: cmdassemblyvariantedit.h:80
std::shared_ptr< AssemblyVariant > mAssemblyVariant
Definition: cmdassemblyvariantedit.h:77
void setDescription(const QString &value) noexcept
Definition: cmdassemblyvariantedit.cpp:62
void setName(const FileProofName &value) noexcept
Definition: cmdassemblyvariantedit.cpp:57
QString mOldDescription
Definition: cmdassemblyvariantedit.h:81
~CmdAssemblyVariantEdit() noexcept
Definition: cmdassemblyvariantedit.cpp:50
bool performExecute() override
Execute the command the first time.
Definition: cmdassemblyvariantedit.cpp:71
QString mNewDescription
Definition: cmdassemblyvariantedit.h:82
The CmdListElementsSwap class.
Definition: cmdlistelementsswap.h:46
The UndoCommand class represents a command which you can undo/redo.
Definition: undocommand.h:46
Definition: occmodel.cpp:77
type_safe::constrained_type< QString, FileProofNameConstraint, FileProofNameVerifier > FileProofName
Definition: fileproofname.h:89
Definition: assemblyvariant.h:105