LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
boardusersettings.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_BOARDUSERSETTINGS_H
21 #define LIBREPCB_PROJECT_BOARDUSERSETTINGS_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 class SmartSExprFile;
37 class GraphicsLayerStackAppearanceSettings;
38 
39 namespace project {
40 
41 class Board;
42 
43 /*******************************************************************************
44  * Class BoardUserSettings
45  ******************************************************************************/
46 
50 class BoardUserSettings final : public QObject, public SerializableObject {
51  Q_OBJECT
52 
53 public:
54  // Constructors / Destructor
55  BoardUserSettings() = delete;
56  BoardUserSettings(const BoardUserSettings& other) = delete;
57  BoardUserSettings(Board& board, const BoardUserSettings& other) noexcept;
58  explicit BoardUserSettings(Board& board, bool restore, bool readOnly,
59  bool create);
60  ~BoardUserSettings() noexcept;
61 
62  // General Methods
63  bool save(bool toOriginal, QStringList& errors) noexcept;
64 
65  // Operator Overloadings
66  BoardUserSettings& operator=(const BoardUserSettings& rhs) = delete;
67 
68 private: // Methods
70  void serialize(SExpression& root) const override;
71 
72  // General
74 
75  // File "boards/<BOARDNAME>/settings.user.lp"
77  QScopedPointer<SmartSExprFile> mFile;
78 
79  QScopedPointer<GraphicsLayerStackAppearanceSettings> mLayerSettings;
80 };
81 
82 /*******************************************************************************
83  * End of File
84  ******************************************************************************/
85 
86 } // namespace project
87 } // namespace librepcb
88 
89 #endif // LIBREPCB_PROJECT_BOARDUSERSETTINGS_H
QScopedPointer< SmartSExprFile > mFile
Definition: boardusersettings.h:77
void serialize(SExpression &root) const override
Serialize the object into an existing S-Expression node.
Definition: boardusersettings.cpp:107
Board & mBoard
Definition: boardusersettings.h:73
BoardUserSettings & operator=(const BoardUserSettings &rhs)=delete
QScopedPointer< GraphicsLayerStackAppearanceSettings > mLayerSettings
Definition: boardusersettings.h:79
The SerializableObject class is the base class for all classes which need to be serializable/deserial...
Definition: serializableobject.h:46
bool save(bool toOriginal, QStringList &errors) noexcept
Definition: boardusersettings.cpp:89
~BoardUserSettings() noexcept
Definition: boardusersettings.cpp:82
The BoardUserSettings class.
Definition: boardusersettings.h:50
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:130
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:82
FilePath mFilepath
Definition: boardusersettings.h:76
The SExpression class.
Definition: sexpression.h:60