LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cmdprojectmetadataedit.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_PROJECT_CMDPROJECTMETADATAEDIT_H
21 #define LIBREPCB_PROJECT_CMDPROJECTMETADATAEDIT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../projectmetadata.h"
27 
29 
30 #include <QtCore>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 namespace project {
37 
38 /*******************************************************************************
39  * Class CmdProjectMetadataEdit
40  ******************************************************************************/
41 
45 class CmdProjectMetadataEdit final : public UndoCommand {
46 public:
47  // Constructors / Destructor
48  explicit CmdProjectMetadataEdit(ProjectMetadata& metadata) noexcept;
49  ~CmdProjectMetadataEdit() noexcept;
50 
51  // Setters
52  void setName(const ElementName& newName) noexcept;
53  void setAuthor(const QString& newAuthor) noexcept;
54  void setVersion(const QString& newVersion) noexcept;
55  void setAttributes(const AttributeList& attributes) noexcept;
56 
57 private:
58  // Private Methods
59 
61  bool performExecute() override;
62 
64  void performUndo() override;
65 
67  void performRedo() override;
68 
69  // Private Member Variables
70 
71  // General
73 
74  // Misc
77  QString mOldAuthor;
78  QString mNewAuthor;
79  QString mOldVersion;
80  QString mNewVersion;
83 };
84 
85 /*******************************************************************************
86  * End of File
87  ******************************************************************************/
88 
89 } // namespace project
90 } // namespace librepcb
91 
92 #endif // LIBREPCB_PROJECT_CMDPROJECTMETADATAEDIT_H
AttributeList mOldAttributes
Definition: cmdprojectmetadataedit.h:81
QString mNewAuthor
Definition: cmdprojectmetadataedit.h:78
CmdProjectMetadataEdit(ProjectMetadata &metadata) noexcept
Definition: cmdprojectmetadataedit.cpp:37
The ProjectMetadata class.
Definition: projectmetadata.h:45
void setAuthor(const QString &newAuthor) noexcept
Definition: cmdprojectmetadataedit.cpp:63
AttributeList mNewAttributes
Definition: cmdprojectmetadataedit.h:82
void performRedo() override
Redo the command.
Definition: cmdprojectmetadataedit.cpp:100
void setName(const ElementName &newName) noexcept
Definition: cmdprojectmetadataedit.cpp:58
void setVersion(const QString &newVersion) noexcept
Definition: cmdprojectmetadataedit.cpp:68
void setAttributes(const AttributeList &attributes) noexcept
Definition: cmdprojectmetadataedit.cpp:73
The CmdProjectMetadataEdit class.
Definition: cmdprojectmetadataedit.h:45
~CmdProjectMetadataEdit() noexcept
Definition: cmdprojectmetadataedit.cpp:51
ElementName mOldName
Definition: cmdprojectmetadataedit.h:75
QString mOldAuthor
Definition: cmdprojectmetadataedit.h:77
QString mOldVersion
Definition: cmdprojectmetadataedit.h:79
QString mNewVersion
Definition: cmdprojectmetadataedit.h:80
The UndoCommand class represents a command which you can undo/redo.
Definition: undocommand.h:52
ProjectMetadata & mMetadata
Definition: cmdprojectmetadataedit.h:72
void performUndo() override
Undo the command.
Definition: cmdprojectmetadataedit.cpp:93
ElementName mNewName
Definition: cmdprojectmetadataedit.h:76
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition: elementname.h:92
bool performExecute() override
Execute the command the first time.
Definition: cmdprojectmetadataedit.cpp:83