• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kgoldrunner

  • sources
  • kde-4.14
  • kdegames
  • kgoldrunner
  • src
kgrthemetypes.cpp
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright 2012 Ian Wadham <iandw.au@gmail.com> *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License as *
6  * published by the Free Software Foundation; either version 2 of *
7  * the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
16  ****************************************************************************/
17 
18 #include <QString>
19 #include <QFileInfo>
20 #include <QDir>
21 
22 #include "kgrthemetypes.h"
23 
24 // Helper: Find the absolute path of a file pointed to by the .desktop file.
25 QString absolutePath (const QString & path, const QString & relativePath)
26 {
27  const QFileInfo file (path);
28  const QDir dir = file.dir();
29  QString result = "";
30  // Add the directory part of "path" to "relativePath".
31  if (!relativePath.isEmpty() && QFileInfo(relativePath).isRelative()) {
32  result = dir.absoluteFilePath(relativePath);
33  }
34  return result;
35 }
36 
37 KGrActorsTheme::KGrActorsTheme(const QByteArray &identifier, QObject *parent)
38  :
39  KgTheme(identifier, parent)
40 {
41 }
42 
43 KGrActorsTheme::~KGrActorsTheme()
44 {
45 }
46 
47 bool KGrActorsTheme::readFromDesktopFile(const QString& path)
48 {
49  // Base-class call.
50  if (!KgTheme::readFromDesktopFile(path))
51  return false;
52 
53  // Customised behaviour: interprete "Actors" key as "FileName" for SVG file.
54  setGraphicsPath (absolutePath (path, customData("Actors")));
55  return true;
56 }
57 
58 KGrSetTheme::KGrSetTheme(const QByteArray &identifier, QObject *parent)
59  :
60  KgTheme(identifier, parent)
61 {
62 }
63 
64 KGrSetTheme::~KGrSetTheme()
65 {
66 }
67 
68 bool KGrSetTheme::readFromDesktopFile(const QString& path)
69 {
70  // Base-class call.
71  if (!KgTheme::readFromDesktopFile(path))
72  return false;
73 
74  // Customised behaviour: interprete "Set" key as "FileName" for SVG file.
75  setGraphicsPath (absolutePath (path, customData("Set")));
76  return true;
77 }
78 
79 #include "kgrthemetypes.moc"
KGrActorsTheme::KGrActorsTheme
Q_INVOKABLE KGrActorsTheme(const QByteArray &identifier, QObject *parent=0)
Definition: kgrthemetypes.cpp:37
KGrSetTheme::~KGrSetTheme
virtual ~KGrSetTheme()
Definition: kgrthemetypes.cpp:64
QByteArray
kgrthemetypes.h
QObject
absolutePath
QString absolutePath(const QString &path, const QString &relativePath)
Definition: kgrthemetypes.cpp:25
QString::isEmpty
bool isEmpty() const
QFileInfo::dir
QDir dir() const
QString
QFileInfo
QDir
KGrActorsTheme::readFromDesktopFile
bool readFromDesktopFile(const QString &path)
Definition: kgrthemetypes.cpp:47
QFileInfo::isRelative
bool isRelative() const
QDir::absoluteFilePath
QString absoluteFilePath(const QString &fileName) const
KGrActorsTheme::~KGrActorsTheme
virtual ~KGrActorsTheme()
Definition: kgrthemetypes.cpp:43
KgTheme
KGrSetTheme::readFromDesktopFile
bool readFromDesktopFile(const QString &path)
Definition: kgrthemetypes.cpp:68
KGrSetTheme::KGrSetTheme
Q_INVOKABLE KGrSetTheme(const QByteArray &identifier, QObject *parent=0)
Definition: kgrthemetypes.cpp:58
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:24 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kgoldrunner

Skip menu "kgoldrunner"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal