LibrePCB Developers Documentation
cmdcomponentinstanceedit.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_CMDCOMPONENTINSTANCEEDIT_H
21#define LIBREPCB_EDITOR_CMDCOMPONENTINSTANCEEDIT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../undocommand.h"
27
31
32#include <QtCore>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class Circuit;
40class Component;
41class ComponentInstance;
42class ComponentSymbolVariant;
43
44namespace editor {
45
46/*******************************************************************************
47 * Class CmdComponentInstanceEdit
48 ******************************************************************************/
49
54public:
55 // Constructors / Destructor
56 CmdComponentInstanceEdit(Circuit& circuit, ComponentInstance& cmp) noexcept;
58
59 // Setters
60 void setName(const CircuitIdentifier& name) noexcept;
61 void setValue(const QString& value) noexcept;
62 void setAttributes(const AttributeList& attributes) noexcept;
63 void setAssemblyOptions(const ComponentAssemblyOptionList& options) noexcept;
64
65private:
66 // Private Methods
67
69 bool performExecute() override;
70
72 void performUndo() override;
73
75 void performRedo() override;
76
77 // Private Member Variables
78
79 // Attributes from the constructor
82
83 // Misc
86 QString mOldValue;
87 QString mNewValue;
92};
93
94/*******************************************************************************
95 * End of File
96 ******************************************************************************/
97
98} // namespace editor
99} // namespace librepcb
100
101#endif
The Circuit class represents all electrical connections in a project (drawn in the schematics)
Definition: circuit.h:70
The ComponentInstance class.
Definition: componentinstance.h:54
The CmdComponentInstanceEdit class.
Definition: cmdcomponentinstanceedit.h:53
void performRedo() override
Redo the command.
Definition: cmdcomponentinstanceedit.cpp:105
void setAssemblyOptions(const ComponentAssemblyOptionList &options) noexcept
Definition: cmdcomponentinstanceedit.cpp:78
AttributeList mNewAttributes
Definition: cmdcomponentinstanceedit.h:89
Circuit & mCircuit
Definition: cmdcomponentinstanceedit.h:80
CircuitIdentifier mOldName
Definition: cmdcomponentinstanceedit.h:84
AttributeList mOldAttributes
Definition: cmdcomponentinstanceedit.h:88
void setValue(const QString &value) noexcept
Definition: cmdcomponentinstanceedit.cpp:67
ComponentInstance & mComponentInstance
Definition: cmdcomponentinstanceedit.h:81
void performUndo() override
Undo the command.
Definition: cmdcomponentinstanceedit.cpp:98
ComponentAssemblyOptionList mOldAssemblyOptions
Definition: cmdcomponentinstanceedit.h:90
ComponentAssemblyOptionList mNewAssemblyOptions
Definition: cmdcomponentinstanceedit.h:91
QString mNewValue
Definition: cmdcomponentinstanceedit.h:87
~CmdComponentInstanceEdit() noexcept
Definition: cmdcomponentinstanceedit.cpp:55
void setName(const CircuitIdentifier &name) noexcept
Definition: cmdcomponentinstanceedit.cpp:62
QString mOldValue
Definition: cmdcomponentinstanceedit.h:86
void setAttributes(const AttributeList &attributes) noexcept
Definition: cmdcomponentinstanceedit.cpp:72
bool performExecute() override
Execute the command the first time.
Definition: cmdcomponentinstanceedit.cpp:88
CmdComponentInstanceEdit(Circuit &circuit, ComponentInstance &cmp) noexcept
Definition: cmdcomponentinstanceedit.cpp:40
CircuitIdentifier mNewName
Definition: cmdcomponentinstanceedit.h:85
The UndoCommand class represents a command which you can undo/redo.
Definition: undocommand.h:46
Definition: occmodel.cpp:77
type_safe::constrained_type< QString, CircuitIdentifierConstraint, CircuitIdentifierVerifier > CircuitIdentifier
Definition: circuitidentifier.h:96