LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
projectsettings.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_PROJECTSETTINGS_H
21 #define LIBREPCB_PROJECT_PROJECTSETTINGS_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 namespace project {
36 
37 class Project;
38 
39 /*******************************************************************************
40  * Class ProjectSettings
41  ******************************************************************************/
42 
46 class ProjectSettings final : public QObject, public SerializableObject {
47  Q_OBJECT
48 
49 public:
50  // Constructors / Destructor
51  explicit ProjectSettings(Project& project, bool create);
52  ~ProjectSettings() noexcept;
53 
54  // Getters: General
55  Project& getProject() const noexcept { return mProject; }
56 
57  // Getters: Settings
58  const QStringList& getLocaleOrder() const noexcept { return mLocaleOrder; }
59  const QStringList& getNormOrder() const noexcept { return mNormOrder; }
60 
61  // Setters: Settings
62  void setLocaleOrder(const QStringList& locales) noexcept {
63  mLocaleOrder = locales;
64  }
65  void setNormOrder(const QStringList& norms) noexcept { mNormOrder = norms; }
66 
67  // General Methods
68  void restoreDefaults() noexcept;
69  void triggerSettingsChanged() noexcept;
70  void save();
71 
72 signals:
73 
74  void settingsChanged();
75 
76 private:
77  // make some methods inaccessible...
79  ProjectSettings(const ProjectSettings& other);
80  ProjectSettings& operator=(const ProjectSettings& rhs);
81 
82  // Private Methods
83 
85  void serialize(SExpression& root) const override;
86 
87  // General
89 
90  // All Settings
91  QStringList
93  QStringList mNormOrder;
94 };
95 
96 /*******************************************************************************
97  * End of File
98  ******************************************************************************/
99 
100 } // namespace project
101 } // namespace librepcb
102 
103 #endif // LIBREPCB_PROJECT_PROJECTSETTINGS_H
QStringList mNormOrder
the list of norms in the right order
Definition: projectsettings.h:93
const QStringList & getNormOrder() const noexcept
Definition: projectsettings.h:59
void save()
Definition: projectsettings.cpp:91
const QStringList & getLocaleOrder() const noexcept
Definition: projectsettings.h:58
The ProjectSettings class.
Definition: projectsettings.h:46
void triggerSettingsChanged() noexcept
Definition: projectsettings.cpp:87
The Project class represents a whole (opened) project with all its content.
Definition: project.h:79
void setLocaleOrder(const QStringList &locales) noexcept
Definition: projectsettings.h:62
The SerializableObject class is the base class for all classes which need to be serializable/deserial...
Definition: serializableobject.h:43
void setNormOrder(const QStringList &norms) noexcept
Definition: projectsettings.h:65
QStringList mLocaleOrder
The list of locales (like "de_CH") in the right order.
Definition: projectsettings.h:92
Project & getProject() const noexcept
Definition: projectsettings.h:55
~ProjectSettings() noexcept
Definition: projectsettings.cpp:75
Project & mProject
a reference to the Project object (from the ctor)
Definition: projectsettings.h:88
void serialize(SExpression &root) const override
Serialize the object into an existing S-Expression node.
Definition: projectsettings.cpp:102
The SExpression class.
Definition: sexpression.h:57
void restoreDefaults() noexcept
Definition: projectsettings.cpp:82