Commit fc3e17ec authored by Ian Wadham's avatar Ian Wadham
Browse files

Add documentation, remove debug lines, tidy up comments and code layout.

svn path=/branches/work/kgoldrunner-qgv/; revision=1298062
parent bb018b1e
...@@ -19,16 +19,14 @@ ...@@ -19,16 +19,14 @@
#include <QFileInfo> #include <QFileInfo>
#include <QDir> #include <QDir>
#include <QDebug>
#include "kgrthemetypes.h" #include "kgrthemetypes.h"
// Helper: finds the absolute path of a file pointed to by the .desktop file. // Helper: Find the absolute path of a file pointed to by the .desktop file.
QString absolutePath (const QString & path, const QString & relativePath) QString absolutePath (const QString & path, const QString & relativePath)
{ {
const QFileInfo file (path); const QFileInfo file (path);
const QDir dir = file.dir(); const QDir dir = file.dir();
QString result = ""; QString result = "";
// Add the directory part of "path" to "relativePath". // Add the directory part of "path" to "relativePath".
if (!relativePath.isEmpty() && QFileInfo(relativePath).isRelative()) { if (!relativePath.isEmpty() && QFileInfo(relativePath).isRelative()) {
result = dir.absoluteFilePath(relativePath); result = dir.absoluteFilePath(relativePath);
...@@ -40,23 +38,19 @@ KGrActorsTheme::KGrActorsTheme(const QByteArray &identifier, QObject *parent) ...@@ -40,23 +38,19 @@ KGrActorsTheme::KGrActorsTheme(const QByteArray &identifier, QObject *parent)
: :
KgTheme(identifier, parent) KgTheme(identifier, parent)
{ {
qDebug() << "KGrActorsTheme constructor";
} }
KGrActorsTheme::~KGrActorsTheme() KGrActorsTheme::~KGrActorsTheme()
{ {
qDebug() << "KGrActorsTheme destructor";
} }
bool KGrActorsTheme::readFromDesktopFile(const QString& path) bool KGrActorsTheme::readFromDesktopFile(const QString& path)
{ {
qDebug() << "KGrActorsTheme::readFromDesktopFile" << path; // Base-class call.
// Base class call.
if (!KgTheme::readFromDesktopFile(path)) if (!KgTheme::readFromDesktopFile(path))
return false; return false;
// Customised behaviour: interprete "Actors" key as "FileName" for SVG file. // Customised behaviour: interprete "Actors" key as "FileName" for SVG file.
qDebug() << "Calling setGraphicsPath" << absolutePath (path, customData("Actors"));
setGraphicsPath (absolutePath (path, customData("Actors"))); setGraphicsPath (absolutePath (path, customData("Actors")));
return true; return true;
} }
...@@ -65,23 +59,19 @@ KGrSetTheme::KGrSetTheme(const QByteArray &identifier, QObject *parent) ...@@ -65,23 +59,19 @@ KGrSetTheme::KGrSetTheme(const QByteArray &identifier, QObject *parent)
: :
KgTheme(identifier, parent) KgTheme(identifier, parent)
{ {
qDebug() << "KGrSetTheme constructor";
} }
KGrSetTheme::~KGrSetTheme() KGrSetTheme::~KGrSetTheme()
{ {
qDebug() << "KGrSetTheme destructor";
} }
bool KGrSetTheme::readFromDesktopFile(const QString& path) bool KGrSetTheme::readFromDesktopFile(const QString& path)
{ {
qDebug() << "KGrSetTheme::readFromDesktopFile" << path; // Base-class call.
// Base class call.
if (!KgTheme::readFromDesktopFile(path)) if (!KgTheme::readFromDesktopFile(path))
return false; return false;
// Customised behaviour: interprete "Set" key as "FileName" for SVG file. // Customised behaviour: interprete "Set" key as "FileName" for SVG file.
qDebug() << "Calling setGraphicsPath" << absolutePath (path, customData("Set"));
setGraphicsPath (absolutePath (path, customData("Set"))); setGraphicsPath (absolutePath (path, customData("Set")));
return true; return true;
} }
......
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
#include <KgTheme> #include <KgTheme>
/**
* Class to locate KGoldrunner's "Actors" SVG files: derived from KgTheme.
*/
class KGrActorsTheme : public KgTheme class KGrActorsTheme : public KgTheme
{ {
Q_OBJECT Q_OBJECT
...@@ -27,9 +30,18 @@ public: ...@@ -27,9 +30,18 @@ public:
Q_INVOKABLE KGrActorsTheme(const QByteArray &identifier, QObject *parent=0); Q_INVOKABLE KGrActorsTheme(const QByteArray &identifier, QObject *parent=0);
virtual ~KGrActorsTheme(); virtual ~KGrActorsTheme();
/*
* Re-defined from KgTheme. Finds a SVG file with config name "Actors".
*
* @param path The full path of the theme's .desktop file.
*/
bool readFromDesktopFile(const QString& path); bool readFromDesktopFile(const QString& path);
}; };
/**
* Class to locate KGoldrunner's "Set" SVG files: derived from KgTheme.
*/
class KGrSetTheme : public KgTheme class KGrSetTheme : public KgTheme
{ {
Q_OBJECT Q_OBJECT
...@@ -37,6 +49,11 @@ public: ...@@ -37,6 +49,11 @@ public:
Q_INVOKABLE KGrSetTheme(const QByteArray &identifier, QObject *parent=0); Q_INVOKABLE KGrSetTheme(const QByteArray &identifier, QObject *parent=0);
virtual ~KGrSetTheme(); virtual ~KGrSetTheme();
/*
* Re-defined from KgTheme. Finds a SVG file with config name "Set".
*
* @param path The full path of the theme's .desktop file.
*/
bool readFromDesktopFile(const QString& path); bool readFromDesktopFile(const QString& path);
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment