From: Akos Polster Date: Fri, 8 Oct 2010 22:45:44 +0000 (+0200) Subject: Add some platform helpers. X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=ab12e26d07ddb568b83a4115e2cab297524a7037;p=dorian Add some platform helpers. --- diff --git a/platform.cpp b/platform.cpp new file mode 100644 index 0000000..d93c63d --- /dev/null +++ b/platform.cpp @@ -0,0 +1,26 @@ +#include + +#include "platform.h" + +#if defined(Q_OS_WIN32) || defined(Q_OS_SYMBIAN) +# define DORIAN_BASE "dorian" +#else +# define DORIAN_BASE ".dorian" +#endif + +#ifdef Q_WS_MAC +# define DORIAN_ICON_PREFIX ":/icons/mac/" +#else +# define DORIAN_ICON_PREFIX ":/icons/" +#endif + +QString Platform::dbPath() +{ + QString base(QDir::home().absoluteFilePath(DORIAN_BASE)); + return QDir(base).absoluteFilePath("books.db"); +} + +QString Platform::icon(const QString &name) +{ + return QString(DORIAN_ICON_PREFIX) + name + ".png"; +} diff --git a/platform.h b/platform.h new file mode 100644 index 0000000..b10d17e --- /dev/null +++ b/platform.h @@ -0,0 +1,13 @@ +#ifndef PLATFORM_H +#define PLATFORM_H + +#include + +class Platform +{ +public: + static QString dbPath(); + static QString icon(const QString &name); +}; + +#endif // PLATFORM_H