LibrePCB Developers Documentation
cmdlibraryedit.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_CMDLIBRARYEDIT_H
21#define LIBREPCB_EDITOR_CMDLIBRARYEDIT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36namespace editor {
37
38/*******************************************************************************
39 * Class CmdLibraryEdit
40 ******************************************************************************/
41
46public:
47 // Constructors / Destructor
48 CmdLibraryEdit() = delete;
49 CmdLibraryEdit(const CmdLibraryEdit& other) = delete;
50 explicit CmdLibraryEdit(Library& library) noexcept;
51 virtual ~CmdLibraryEdit() noexcept;
52
53 // Setters
54 void setUrl(const QUrl& url) noexcept;
55 void setDependencies(const QSet<Uuid>& deps) noexcept;
56 void setIcon(const QByteArray& png) noexcept;
57 void setManufacturer(const SimpleString& value) noexcept;
58
59 // Operator Overloadings
60 CmdLibraryEdit& operator=(const CmdLibraryEdit& rhs) = delete;
61
62protected: // Methods
64 virtual bool performExecute() override;
65
67 virtual void performUndo() override;
68
70 virtual void performRedo() override;
71
72private: // Data
74
75 QUrl mOldUrl;
76 QUrl mNewUrl;
79 QByteArray mOldIcon;
80 QByteArray mNewIcon;
83};
84
85/*******************************************************************************
86 * End of File
87 ******************************************************************************/
88
89} // namespace editor
90} // namespace librepcb
91
92#endif
The Library class represents a library directory.
Definition: library.h:46
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The CmdLibraryBaseElementEdit class.
Definition: cmdlibrarybaseelementedit.h:45
The CmdLibraryEdit class.
Definition: cmdlibraryedit.h:45
void setIcon(const QByteArray &png) noexcept
Definition: cmdlibraryedit.cpp:67
virtual void performRedo() override
Redo the command.
Definition: cmdlibraryedit.cpp:98
void setManufacturer(const SimpleString &value) noexcept
Definition: cmdlibraryedit.cpp:72
void setUrl(const QUrl &url) noexcept
Definition: cmdlibraryedit.cpp:57
void setDependencies(const QSet< Uuid > &deps) noexcept
Definition: cmdlibraryedit.cpp:62
Library & mLibrary
Definition: cmdlibraryedit.h:73
QUrl mNewUrl
Definition: cmdlibraryedit.h:76
virtual void performUndo() override
Undo the command.
Definition: cmdlibraryedit.cpp:90
virtual ~CmdLibraryEdit() noexcept
Definition: cmdlibraryedit.cpp:50
QSet< Uuid > mNewDependencies
Definition: cmdlibraryedit.h:78
QUrl mOldUrl
Definition: cmdlibraryedit.h:75
SimpleString mNewManufacturer
Definition: cmdlibraryedit.h:82
QByteArray mNewIcon
Definition: cmdlibraryedit.h:80
CmdLibraryEdit(const CmdLibraryEdit &other)=delete
QByteArray mOldIcon
Definition: cmdlibraryedit.h:79
SimpleString mOldManufacturer
Definition: cmdlibraryedit.h:81
virtual bool performExecute() override
Execute the command the first time.
Definition: cmdlibraryedit.cpp:81
QSet< Uuid > mOldDependencies
Definition: cmdlibraryedit.h:77
Definition: occmodel.cpp:77
type_safe::constrained_type< QString, SimpleStringConstraint, SimpleStringVerifier > SimpleString
Definition: simplestring.h:80