Symbian fixes: full screen mode, dialog softkeys.
[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 static const char *DORIAN_VERSION =
23 #include "pkg/version.txt"
24 ;
25
26 QString Platform::dbPath()
27 {
28     QString base(QDir::home().absoluteFilePath(DORIAN_BASE));
29     return QDir(base).absoluteFilePath("books.db");
30 }
31
32 QString Platform::icon(const QString &name)
33 {
34     return QString(DORIAN_ICON_PREFIX) + name + ".png";
35 }
36
37 void Platform::restart(char *argv[])
38 {
39 #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
40     extern char **environ;
41     execve(argv[0], argv, environ);
42 #else
43     Q_UNUSED(argv);
44 #endif
45 }
46
47 QString Platform::version()
48 {
49     return QString(DORIAN_VERSION);
50 }
51
52 QString Platform::downloadDir()
53 {
54     return QDir::home().absoluteFilePath("Books");
55 }