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_CORE_WORKSPACESETTINGS_H
21 #define LIBREPCB_CORE_WORKSPACESETTINGS_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../exceptions.h"
27 #include "../types/lengthunit.h"
32 
33 #include <QtCore>
34 
35 /*******************************************************************************
36  * Namespace / Forward Declarations
37  ******************************************************************************/
38 namespace librepcb {
39 
40 class SExpression;
41 class Version;
42 
43 /*******************************************************************************
44  * Class WorkspaceSettings
45  ******************************************************************************/
46 
60 class WorkspaceSettings final : public QObject {
61  Q_OBJECT
62 
63 public:
64  // Constructors / Destructor
65  WorkspaceSettings(const WorkspaceSettings& other) = delete;
66  explicit WorkspaceSettings(QObject* parent = nullptr);
67  ~WorkspaceSettings() noexcept;
68 
75  void load(const SExpression& node, const Version& fileFormat);
76 
80  void restoreDefaults() noexcept;
81 
88 
89  // Operator Overloadings
90  WorkspaceSettings& operator=(const WorkspaceSettings& rhs) = delete;
91 
92 private: // Methods
98  QList<WorkspaceSettingsItem*> getAllItems() const noexcept;
99 
100 private: // Data
124  QMap<QString, SExpression> mFileContent;
125 
130 
131 public:
132  // All settings item objects below. The order is not relevant for saving,
133  // it should be ordered logically.
134  //
135  // Note: Generally we don't make member variables public, but in this case
136  // it would create a lot of boilerplate to wrap all objects with
137  // both const- and non-const methods, and it's totally safe to access
138  // them directly.
139 
148 
157 
164 
171 
178 
191 
200 
210 
224 
238 
251 
263 
270 
282 };
283 
284 /*******************************************************************************
285  * End of File
286  ******************************************************************************/
287 
288 } // namespace librepcb
289 
290 #endif
WorkspaceSettingsItem_GenericValueList< QStringList > libraryLocaleOrder
Preferred library locales (like "de_CH") in the right order.
Definition: workspacesettings.h:190
The Version class represents a version number in the format "1.42.7".
Definition: version.h:58
bool mUpgradeRequired
Whether mFileContent needs to be upgraded or not.
Definition: workspacesettings.h:129
Implementation of librepcb::WorkspaceSettingsItem to store theme configurations.
Definition: workspacesettingsitem_themes.h:44
WorkspaceSettingsItem_GenericValueList< QSet< QString > > dismissedMessages
Dismissed messages.
Definition: workspacesettings.h:281
void restoreDefaults() noexcept
Reset all settings to their default value.
Definition: workspacesettings.cpp:95
QMap< QString, SExpression > mFileContent
Settings nodes loaded by load()
Definition: workspacesettings.h:124
Definition: occmodel.cpp:76
WorkspaceSettingsItem_Themes themes
Themes.
Definition: workspacesettings.h:269
WorkspaceSettingsItem_GenericValue< uint > projectAutosaveIntervalSeconds
Project autosave interval [seconds] (0 = autosave disabled)
Definition: workspacesettings.h:170
Container for all workspace related settings.
Definition: workspacesettings.h:60
QList< WorkspaceSettingsItem * > getAllItems() const noexcept
Get all librepcb::WorkspaceSettingsItem objects.
Definition: workspacesettings.cpp:127
SExpression serialize()
Serialize settings to librepcb::SExpression.
Definition: workspacesettings.cpp:102
WorkspaceSettingsItem_GenericValue< QString > userName
User name.
Definition: workspacesettings.h:147
void load(const SExpression &node, const Version &fileFormat)
Load settings from file.
Definition: workspacesettings.cpp:74
WorkspaceSettingsItem_GenericValueList< QStringList > externalPdfReaderCommands
Custom command(s) to be used for opening PDF files.
Definition: workspacesettings.h:250
WorkspaceSettingsItem_GenericValue< QString > applicationLocale
The application&#39;s locale (e.g. "en_US")
Definition: workspacesettings.h:156
WorkspaceSettings(const WorkspaceSettings &other)=delete
WorkspaceSettingsItem_GenericValue< bool > useOpenGl
Use OpenGL hardware acceleration.
Definition: workspacesettings.h:177
WorkspaceSettings & operator=(const WorkspaceSettings &rhs)=delete
WorkspaceSettingsItem_GenericValueList< QStringList > externalWebBrowserCommands
Custom command(s) to be used for opening web URLs.
Definition: workspacesettings.h:223
WorkspaceSettingsItem_GenericValueList< QList< QUrl > > apiEndpoints
The list of API endpoint URLs in the right order.
Definition: workspacesettings.h:209
WorkspaceSettingsItem_GenericValueList< QStringList > externalFileManagerCommands
Custom command(s) to be used for opening directories.
Definition: workspacesettings.h:237
WorkspaceSettingsItem_GenericValueList< QStringList > libraryNormOrder
Preferred library norms (like "DIN EN 81346") in the right order.
Definition: workspacesettings.h:199
WorkspaceSettingsItem_GenericValue< LengthUnit > defaultLengthUnit
The application&#39;s default length unit.
Definition: workspacesettings.h:163
WorkspaceSettingsItem_KeyboardShortcuts keyboardShortcuts
Keyboard shortcuts.
Definition: workspacesettings.h:262
Implementation of librepcb::WorkspaceSettingsItem to store keyboard shortcuts settings.
Definition: workspacesettingsitem_keyboardshortcuts.h:43
The SExpression class.
Definition: sexpression.h:66
~WorkspaceSettings() noexcept
Definition: workspacesettings.cpp:67