LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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_LIBRARY_CMDLIBRARYEDIT_H
21 #define LIBREPCB_LIBRARY_CMDLIBRARYEDIT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../library.h"
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 namespace library {
36 
37 /*******************************************************************************
38  * Class CmdLibraryEdit
39  ******************************************************************************/
40 
45 public:
46  // Constructors / Destructor
47  CmdLibraryEdit() = delete;
48  CmdLibraryEdit(const CmdLibraryEdit& other) = delete;
49  explicit CmdLibraryEdit(Library& library) noexcept;
50  virtual ~CmdLibraryEdit() noexcept;
51 
52  // Setters
53  void setUrl(const QUrl& url) noexcept;
54  void setDependencies(const QSet<Uuid>& deps) noexcept;
55  void setIcon(const QByteArray& png) noexcept;
56 
57  // Operator Overloadings
58  CmdLibraryEdit& operator=(const CmdLibraryEdit& rhs) = delete;
59 
60 protected: // Methods
62  virtual bool performExecute() override;
63 
65  virtual void performUndo() override;
66 
68  virtual void performRedo() override;
69 
70 private: // Data
72 
73  QUrl mOldUrl;
74  QUrl mNewUrl;
75  QSet<Uuid> mOldDependencies;
76  QSet<Uuid> mNewDependencies;
77  QByteArray mOldIcon;
78  QByteArray mNewIcon;
79 };
80 
81 /*******************************************************************************
82  * End of File
83  ******************************************************************************/
84 
85 } // namespace library
86 } // namespace librepcb
87 
88 #endif // LIBREPCB_LIBRARY_CMDLIBRARYEDIT_H
CmdLibraryEdit & operator=(const CmdLibraryEdit &rhs)=delete
The CmdLibraryEdit class.
Definition: cmdlibraryedit.h:44
QUrl mNewUrl
Definition: cmdlibraryedit.h:74
void setDependencies(const QSet< Uuid > &deps) noexcept
Definition: cmdlibraryedit.cpp:60
void setIcon(const QByteArray &png) noexcept
Definition: cmdlibraryedit.cpp:65
The Library class represents a library directory.
Definition: library.h:49
QSet< Uuid > mNewDependencies
Definition: cmdlibraryedit.h:76
QUrl mOldUrl
Definition: cmdlibraryedit.h:73
QByteArray mOldIcon
Definition: cmdlibraryedit.h:77
virtual void performUndo() override
Undo the command.
Definition: cmdlibraryedit.cpp:82
The CmdLibraryBaseElementEdit class.
Definition: cmdlibrarybaseelementedit.h:45
void setUrl(const QUrl &url) noexcept
Definition: cmdlibraryedit.cpp:55
Library & mLibrary
Definition: cmdlibraryedit.h:71
QSet< Uuid > mOldDependencies
Definition: cmdlibraryedit.h:75
virtual bool performExecute() override
Execute the command the first time.
Definition: cmdlibraryedit.cpp:74
virtual void performRedo() override
Redo the command.
Definition: cmdlibraryedit.cpp:89
virtual ~CmdLibraryEdit() noexcept
Definition: cmdlibraryedit.cpp:48
QByteArray mNewIcon
Definition: cmdlibraryedit.h:78