1 /*******************************************************************
3 * This file is part of the KDE project "Bovo"
5 * Bovo is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * Bovo is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Bovo; see the file COPYING. If not, write to
17 * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
20 ********************************************************************/
27 #include <kconfiggroup.h>
28 #include <kdesktopfile.h>
29 #include <kstandarddirs.h>
31 // KConfig XT includes
39 Theme::Theme(const QString
& path
, const int id
)
40 : m_id(id
), m_path(path
) {
41 QString themePath
= QString("themes/%1/").arg(m_path
);
42 themePath
= KStandardDirs::locate("appdata", themePath
);
43 QString themerc
= themePath
+ "themerc";
44 KDesktopFile
themeConfig(themerc
);
45 m_name
= themeConfig
.readName();
46 m_comment
= themeConfig
.readComment();
48 KConfig
config(themerc
);
49 KConfigGroup
configGroup(&config
, "Config");
50 m_backgroundColor
= configGroup
.readEntry("BackgroundColor", "white");
51 m_fill
= configGroup
.readEntry("Fill", 0.75);
52 m_gridColor
= configGroup
.readEntry("GridColor", "black");
54 QString gridTypeStr
= configGroup
.readEntry("GridType", "svg");
55 if (gridTypeStr
== "svg") {
57 } else if (gridTypeStr
== "gomoku") {
58 m_gridType
= GomokuGrid
;
59 } else if (gridTypeStr
== "squares") {
60 m_gridType
= SquaresGrid
;
63 m_svg
= themePath
+ configGroup
.readEntry("Svg", "theme.svg");
66 QColor
Theme::backgroundColor() const {
67 return m_backgroundColor
;
70 QString
Theme::comment() const {
74 qreal
Theme::fill() const {
78 QColor
Theme::gridColor() const {
82 GridType
Theme::gridType() const {
86 int Theme::id() const {
90 QString
Theme::name() const {
94 QString
Theme::path() const {
98 QString
Theme::svg() const {
104 } /* namespace gui */