Small Symbian improvements.
[dorian] / platform.cpp
1 #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
2 #include <unistd.h>
3 #endif
4
5 #include <QDir>
6 #include <QtGui>
7
8 #include "platform.h"
9
10 #if defined(Q_OS_WIN32) || defined(Q_OS_SYMBIAN)
11 #   define DORIAN_BASE "dorian"
12 #else
13 #   define DORIAN_BASE ".dorian"
14 #endif
15
16 #ifdef Q_WS_MAC
17 #   define DORIAN_ICON_PREFIX ":/icons/mac/"
18 #else
19 #   define DORIAN_ICON_PREFIX ":/icons/"
20 #endif
21
22 QString Platform::dbPath()
23 {
24     QString base(QDir::home().absoluteFilePath(DORIAN_BASE));
25     return QDir(base).absoluteFilePath("books.db");
26 }
27
28 QString Platform::icon(const QString &name)
29 {
30     return QString(DORIAN_ICON_PREFIX) + name + ".png";
31 }
32
33 void Platform::restart(char *argv[])
34 {
35 #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
36     extern char **environ;
37     execve(argv[0], argv, environ);
38 #else
39     Q_UNUSED(argv);
40 #endif
41 }