LibrePCB Developers Documentation
workspacesettings.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_WORKSPACESETTINGS_H
21 #define LIBREPCB_WORKSPACESETTINGS_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
28 
32 
33 #include <QtCore>
34 
35 /*******************************************************************************
36  * Namespace / Forward Declarations
37  ******************************************************************************/
38 namespace librepcb {
39 namespace workspace {
40 
41 /*******************************************************************************
42  * Class WorkspaceSettings
43  ******************************************************************************/
44 
58 class WorkspaceSettings final : public QObject, public SerializableObject {
59  Q_OBJECT
60 
61 public:
62  // Constructors / Destructor
63  WorkspaceSettings() = delete;
64  WorkspaceSettings(const WorkspaceSettings& other) = delete;
65  explicit WorkspaceSettings(const FilePath& fp, QObject* parent = nullptr);
66  ~WorkspaceSettings() noexcept;
67 
71  void restoreDefaults() noexcept;
72 
76  void saveToFile() const;
77 
78  // Operator Overloadings
79  WorkspaceSettings& operator=(const WorkspaceSettings& rhs) = delete;
80 
81 private: // Methods
87  QList<WorkspaceSettingsItem*> getAllItems() const noexcept;
88 
90  void serialize(SExpression& root) const override;
91 
92 private: // Data
94 
95 public:
96  // All settings item objects below, in the same order as they are safed in
97  // the settings file.
98  //
99  // Note: Generally we don't make member variables public, but in this case
100  // it would create a lot of boilerplate to wrap all objects with
101  // both const- and non-const methods, and it's totally safe to access
102  // them directly.
103 
112 
121 
128 
135 
142 
155 
164 
174 };
175 
176 /*******************************************************************************
177  * End of File
178  ******************************************************************************/
179 
180 } // namespace workspace
181 } // namespace librepcb
182 
183 #endif // LIBREPCB_WORKSPACESETTINGS_H
FilePath mFilePath
path to the "settings.lp" file
Definition: workspacesettings.h:93
Definition: alignment.cpp:30
QList< WorkspaceSettingsItem * > getAllItems() const noexcept
Get all librepcb::workspace::WorkspaceSettingsItem objects.
Definition: workspacesettings.cpp:94
WorkspaceSettingsItem_GenericValue< LengthUnit > defaultLengthUnit
The application&#39;s default length unit.
Definition: workspacesettings.h:127
WorkspaceSettingsItem_GenericValue< QString > userName
User name.
Definition: workspacesettings.h:111
WorkspaceSettings & operator=(const WorkspaceSettings &rhs)=delete
The SerializableObject class is the base class for all classes which need to be serializable/deserial...
Definition: serializableobject.h:43
WorkspaceSettingsItem_GenericValueList< QList< QUrl > > repositoryUrls
The list of API repository URLs in the right order.
Definition: workspacesettings.h:173
void serialize(SExpression &root) const override
Serialize the object into an existing S-Expression node.
Definition: workspacesettings.cpp:98
WorkspaceSettingsItem_GenericValueList< QStringList > libraryLocaleOrder
Preferred library locales (like "de_CH") in the right order.
Definition: workspacesettings.h:154
void restoreDefaults() noexcept
Reset all settings to their default value.
Definition: workspacesettings.cpp:79
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:127
WorkspaceSettingsItem_GenericValue< QString > applicationLocale
The application&#39;s locale (e.g. "en_US")
Definition: workspacesettings.h:120
WorkspaceSettingsItem_GenericValue< bool > useOpenGl
Use OpenGL hardware acceleration.
Definition: workspacesettings.h:141
WorkspaceSettingsItem_GenericValue< uint > projectAutosaveIntervalSeconds
Project autosave interval [seconds] (0 = autosave disabled)
Definition: workspacesettings.h:134
WorkspaceSettingsItem_GenericValueList< QStringList > libraryNormOrder
Preferred library norms (like "DIN EN 81346") in the right order.
Definition: workspacesettings.h:163
Container for all workspace related settings.
Definition: workspacesettings.h:58
The SExpression class.
Definition: sexpression.h:57
~WorkspaceSettings() noexcept
Definition: workspacesettings.cpp:72
void saveToFile() const
Save all settings to the file.
Definition: workspacesettings.cpp:85