LibrePCB Developers Documentation
themecolor.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_THEMECOLOR_H
21#define LIBREPCB_CORE_THEMECOLOR_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../serialization/sexpression.h"
27
28#include <QtCore>
29#include <QtGui>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35
36/*******************************************************************************
37 * Class ThemeColor
38 ******************************************************************************/
39
43class ThemeColor final {
44public:
45 // Constructors / Destructor
46 ThemeColor() = delete;
47 ThemeColor(const QString& identifier, const char* category, const char* name,
48 const QString& nameSuffix, const QColor& primary,
49 const QColor& secondary) noexcept;
50 ThemeColor(const ThemeColor& other) noexcept;
51 ~ThemeColor() noexcept;
52
53 // Getters
54 const QString& getIdentifier() const noexcept { return mIdentifier; }
55 QString getCategoryTr() const noexcept;
56 QString getNameTr() const noexcept;
57 const QColor& getPrimaryColor() const noexcept { return mPrimary; }
58 const QColor& getSecondaryColor() const noexcept { return mSecondary; }
59 bool isEdited() const noexcept { return mEdited; }
60
61 // Setters
62 void setPrimaryColor(const QColor& color) noexcept;
63 void setSecondaryColor(const QColor& color) noexcept;
64
65 // General Methods
66 void load(const SExpression& root);
67 std::unique_ptr<SExpression> serialize() const;
68
69 // Operator Overloadings
70 bool operator==(const ThemeColor& rhs) const noexcept;
71 bool operator!=(const ThemeColor& rhs) const noexcept {
72 return !(*this == rhs);
73 }
74 ThemeColor& operator=(const ThemeColor& rhs) noexcept;
75
76private: // Data
77 QString mIdentifier;
78 const char* mCategoryNoTr;
79 const char* mNameNoTr;
80 QString mNameSuffix;
81 QColor mPrimary;
82 QColor mSecondary;
83 bool mEdited;
84};
85
86/*******************************************************************************
87 * End of File
88 ******************************************************************************/
89
90} // namespace librepcb
91
92#endif
The SExpression class.
Definition: sexpression.h:69
Color settings as used by librepcb::Theme.
Definition: themecolor.h:43
QString getNameTr() const noexcept
Definition: themecolor.cpp:71
const char * mCategoryNoTr
Definition: themecolor.h:78
QString mIdentifier
Definition: themecolor.h:77
QColor mPrimary
Definition: themecolor.h:81
bool isEdited() const noexcept
Definition: themecolor.h:59
void setSecondaryColor(const QColor &color) noexcept
Definition: themecolor.cpp:88
void setPrimaryColor(const QColor &color) noexcept
Definition: themecolor.cpp:81
std::unique_ptr< SExpression > serialize() const
Definition: themecolor.cpp:113
void load(const SExpression &root)
Definition: themecolor.cpp:99
QColor mSecondary
Null if not applicable.
Definition: themecolor.h:82
bool mEdited
Definition: themecolor.h:83
bool operator==(const ThemeColor &rhs) const noexcept
Definition: themecolor.cpp:126
bool operator!=(const ThemeColor &rhs) const noexcept
Definition: themecolor.h:71
const QColor & getPrimaryColor() const noexcept
Definition: themecolor.h:57
const QColor & getSecondaryColor() const noexcept
Definition: themecolor.h:58
QString getCategoryTr() const noexcept
Definition: themecolor.cpp:65
QString mNameSuffix
Definition: themecolor.h:80
const QString & getIdentifier() const noexcept
Definition: themecolor.h:54
ThemeColor & operator=(const ThemeColor &rhs) noexcept
Definition: themecolor.cpp:134
~ThemeColor() noexcept
Definition: themecolor.cpp:58
const char * mNameNoTr
Definition: themecolor.h:79
Definition: occmodel.cpp:77