LibrePCB Developers Documentation
workspacesettingsitem_themes.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_WORKSPACESETTINGSITEM_THEMES_H
21#define LIBREPCB_CORE_WORKSPACESETTINGSITEM_THEMES_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "theme.h"
28
29#include <QtCore>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35
36/*******************************************************************************
37 * Class WorkspaceSettingsItem_Themes
38 ******************************************************************************/
39
45 Q_OBJECT
46
47public:
48 // Constructors / Destructor
51 delete;
52 explicit WorkspaceSettingsItem_Themes(QObject* parent = nullptr) noexcept;
54
55 // Getters
56 const QMap<Uuid, Theme>& getAll() const noexcept { return mThemes; }
57 const Uuid& getActiveUuid() const noexcept { return mActiveUuid; }
58 const Theme& getActive() const noexcept { return mActiveTheme; }
59
60 // Setters
61 void setAll(const QMap<Uuid, Theme>& themes) noexcept;
62 void setActiveUuid(const Uuid& uuid) noexcept;
63
64 // Operator Overloadings
66 const WorkspaceSettingsItem_Themes& rhs) = delete;
67
68private: // Methods
72 virtual void restoreDefaultImpl() noexcept override;
73
77 void loadImpl(const SExpression& root) override;
78
82 void serializeImpl(SExpression& root) const override;
83
84 void addTheme(const Theme& theme) noexcept;
85 void updateActiveTheme() noexcept;
86
87private:
91};
92
93/*******************************************************************************
94 * End of File
95 ******************************************************************************/
96
97} // namespace librepcb
98
99#endif
The SExpression class.
Definition: sexpression.h:69
Theme class as used by librepcb::WorkspaceSettingsItem_Themes.
Definition: theme.h:44
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Implementation of librepcb::WorkspaceSettingsItem to store theme configurations.
Definition: workspacesettingsitem_themes.h:44
Uuid mActiveUuid
Definition: workspacesettingsitem_themes.h:89
virtual void restoreDefaultImpl() noexcept override
Restore default value.
Definition: workspacesettingsitem_themes.cpp:73
const Theme & getActive() const noexcept
Definition: workspacesettingsitem_themes.h:58
void loadImpl(const SExpression &root) override
Load value from S-Expression node.
Definition: workspacesettingsitem_themes.cpp:81
void setAll(const QMap< Uuid, Theme > &themes) noexcept
Definition: workspacesettingsitem_themes.cpp:52
void addTheme(const Theme &theme) noexcept
Definition: workspacesettingsitem_themes.cpp:108
WorkspaceSettingsItem_Themes & operator=(const WorkspaceSettingsItem_Themes &rhs)=delete
QMap< Uuid, Theme > mThemes
Definition: workspacesettingsitem_themes.h:88
Theme mActiveTheme
Definition: workspacesettingsitem_themes.h:90
void updateActiveTheme() noexcept
Definition: workspacesettingsitem_themes.cpp:112
void setActiveUuid(const Uuid &uuid) noexcept
Definition: workspacesettingsitem_themes.cpp:61
WorkspaceSettingsItem_Themes(const WorkspaceSettingsItem_Themes &other)=delete
void serializeImpl(SExpression &root) const override
Serialize the value into S-Expression node.
Definition: workspacesettingsitem_themes.cpp:99
const Uuid & getActiveUuid() const noexcept
Definition: workspacesettingsitem_themes.h:57
const QMap< Uuid, Theme > & getAll() const noexcept
Definition: workspacesettingsitem_themes.h:56
Base class for all workspace settings items.
Definition: workspacesettingsitem.h:49
Definition: occmodel.cpp:77