LibrePCB Developers Documentation
Loading...
Searching...
No Matches
parteditor.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_PARTEDITOR_H
21#define LIBREPCB_EDITOR_PARTEDITOR_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "appwindow.h"
27
28#include <QtCore>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34
35class Part;
36
37namespace editor {
38
39class AttributeListModel;
40class UndoCommand;
41class UndoStack;
42
43/*******************************************************************************
44 * Class PartEditor
45 ******************************************************************************/
46
50class PartEditor final : public QObject {
51 Q_OBJECT
52
53public:
54 // Constructors / Destructor
55 PartEditor() = delete;
56 PartEditor(const PartEditor& other) = delete;
57 explicit PartEditor(std::shared_ptr<Part> part, UndoStack* stack,
58 QObject* parent = nullptr) noexcept;
59 ~PartEditor() noexcept;
60
61 // General Methods
62 ui::PartData getUiData() const;
63 void setUiData(const ui::PartData& data, bool allowEmpty) noexcept;
64 void apply();
65
66 // Operator Overloadings
67 PartEditor& operator=(const PartEditor& rhs) = delete;
68
69private:
70 void execCmd(UndoCommand* cmd);
71
72private:
73 std::shared_ptr<Part> mPart;
75
77};
78
79/*******************************************************************************
80 * End of File
81 ******************************************************************************/
82
83} // namespace editor
84} // namespace librepcb
85
86#endif
The Part class.
Definition part.h:46
The AttributeListModel class.
Definition attributelistmodel.h:49
The PartEditor class.
Definition parteditor.h:50
PartEditor(const PartEditor &other)=delete
void execCmd(UndoCommand *cmd)
Definition parteditor.cpp:100
ui::PartData getUiData() const
Definition parteditor.cpp:62
std::shared_ptr< AttributeListModel > mAttributes
Definition parteditor.h:76
void apply()
Definition parteditor.cpp:92
QPointer< UndoStack > mUndoStack
Definition parteditor.h:74
std::shared_ptr< Part > mPart
Definition parteditor.h:73
void setUiData(const ui::PartData &data, bool allowEmpty) noexcept
Definition parteditor.cpp:71
The UndoCommand class represents a command which you can undo/redo.
Definition undocommand.h:46
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition undostack.h:106
Definition occmodel.cpp:77
Definition uuid.h:186