SVN_SILENT made messages (.desktop file)
[kdegames.git] / bovo / gui / theme.cc
blob99d8a25066c263ba0ab9dcd2abc35deccb6c6d76
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)
8 * any later version.
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 ********************************************************************/
22 // Selc include
23 #include "theme.h"
25 // KDE includes
26 #include <kconfig.h>
27 #include <kconfiggroup.h>
28 #include <kdesktopfile.h>
29 #include <kstandarddirs.h>
31 // KConfig XT includes
32 #include "settings.h"
34 namespace gui {
36 Theme::Theme() {
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") {
56 m_gridType = SvgGrid;
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 {
71 return m_comment;
74 qreal Theme::fill() const {
75 return m_fill;
78 QColor Theme::gridColor() const {
79 return m_gridColor;
82 GridType Theme::gridType() const {
83 return m_gridType;
86 int Theme::id() const {
87 return m_id;
90 QString Theme::name() const {
91 return m_name;
94 QString Theme::path() const {
95 return m_path;
98 QString Theme::svg() const {
99 return m_svg;
104 } /* namespace gui */