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  ******************************************************************************/
34 namespace librepcb {
35 
36 /*******************************************************************************
37  * Class ThemeColor
38  ******************************************************************************/
39 
43 class ThemeColor final {
44 public:
45  // Constructors / Destructor
46  ThemeColor() = delete;
47  ThemeColor(const QString& identifier, const QString& categoryTr,
48  const QString& nameTr, 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  const QString& getCategoryTr() const noexcept { return mCategoryTr; }
56  const QString& getNameTr() const noexcept { return mNameTr; }
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 
76 private: // Data
77  QString mIdentifier;
78  QString mCategoryTr;
79  QString mNameTr;
80  QColor mPrimary;
81  QColor mSecondary;
82  bool mEdited;
83 };
84 
85 /*******************************************************************************
86  * End of File
87  ******************************************************************************/
88 
89 } // namespace librepcb
90 
91 #endif
bool operator==(const ThemeColor &rhs) const noexcept
Definition: themecolor.cpp:108
bool mEdited
Definition: themecolor.h:82
const QString & getCategoryTr() const noexcept
Definition: themecolor.h:55
QString mIdentifier
Definition: themecolor.h:77
Definition: occmodel.cpp:77
void setPrimaryColor(const QColor &color) noexcept
Definition: themecolor.cpp:63
std::unique_ptr< SExpression > serialize() const
Definition: themecolor.cpp:95
~ThemeColor() noexcept
Definition: themecolor.cpp:56
const QString & getNameTr() const noexcept
Definition: themecolor.h:56
QColor mSecondary
Null if not applicable.
Definition: themecolor.h:81
const QColor & getPrimaryColor() const noexcept
Definition: themecolor.h:57
QColor mPrimary
Definition: themecolor.h:80
bool isEdited() const noexcept
Definition: themecolor.h:59
Color settings as used by librepcb::Theme.
Definition: themecolor.h:43
bool operator!=(const ThemeColor &rhs) const noexcept
Definition: themecolor.h:71
QString mCategoryTr
Definition: themecolor.h:78
const QColor & getSecondaryColor() const noexcept
Definition: themecolor.h:58
ThemeColor & operator=(const ThemeColor &rhs) noexcept
Definition: themecolor.cpp:116
QString mNameTr
Definition: themecolor.h:79
void setSecondaryColor(const QColor &color) noexcept
Definition: themecolor.cpp:70
void load(const SExpression &root)
Definition: themecolor.cpp:81
The SExpression class.
Definition: sexpression.h:69
const QString & getIdentifier() const noexcept
Definition: themecolor.h:54