LibrePCB Developers Documentation
Loading...
Searching...
No Matches
cmdimageadd.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_CMDIMAGEADD_H
21#define LIBREPCB_EDITOR_CMDIMAGEADD_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../undocommand.h"
27
29
30#include <QtCore>
31
32#include <memory>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class TransactionalDirectory;
40
41namespace editor {
42
43/*******************************************************************************
44 * Class CmdImageAdd
45 ******************************************************************************/
46
50class CmdImageAdd final : public UndoCommand {
51public:
52 // Constructors / Destructor
53 CmdImageAdd() = delete;
54 CmdImageAdd(const CmdImageAdd& other) = delete;
55
67 std::shared_ptr<Image> image,
68 const QByteArray& fileContent) noexcept;
69 ~CmdImageAdd() noexcept;
70
71 // Operator Overloadings
72 CmdImageAdd& operator=(const CmdImageAdd& rhs) = delete;
73
74private: // Methods
76 bool performExecute() override;
77
79 void performUndo() override;
80
82 void performRedo() override;
83
84private: // Data
87 std::shared_ptr<Image> mImage;
88 const QByteArray mFileContent;
89};
90
91/*******************************************************************************
92 * End of File
93 ******************************************************************************/
94
95} // namespace editor
96} // namespace librepcb
97
98#endif
The Image class.
Definition image.h:49
Helper class to access a subdirectory of TransactionalFileSystem.
Definition transactionaldirectory.h:51
The CmdImageAdd class.
Definition cmdimageadd.h:50
void performRedo() override
Redo the command.
Definition cmdimageadd.cpp:83
ImageList & mList
Definition cmdimageadd.h:85
std::shared_ptr< Image > mImage
Definition cmdimageadd.h:87
void performUndo() override
Undo the command.
Definition cmdimageadd.cpp:76
TransactionalDirectory & mDirectory
Definition cmdimageadd.h:86
~CmdImageAdd() noexcept
Definition cmdimageadd.cpp:49
CmdImageAdd(const CmdImageAdd &other)=delete
bool performExecute() override
Execute the command the first time.
Definition cmdimageadd.cpp:56
const QByteArray mFileContent
Definition cmdimageadd.h:88
The UndoCommand class represents a command which you can undo/redo.
Definition undocommand.h:46
Definition occmodel.cpp:77
Definition uuid.h:186