.
[dorian] / platform.cpp
index 24ceed9..ee7f5d9 100644 (file)
@@ -1,5 +1,6 @@
 #include <QtGlobal>
 #include <QDir>
+#include <QtGui>
 
 #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
 #   include <unistd.h>
@@ -33,6 +34,22 @@ static const char *DORIAN_VERSION =
 #   include <QMessageBox>
 #endif
 
+static Platform *theInstance;
+
+Platform *Platform::instance()
+{
+    if (!theInstance) {
+        theInstance = new Platform();
+    }
+    return theInstance;
+}
+
+void Platform::close()
+{
+    delete theInstance;
+    theInstance = 0;
+}
+
 QString Platform::dbPath()
 {
     QString base(QDir::home().absoluteFilePath(DORIAN_BASE));
@@ -66,7 +83,14 @@ QString Platform::version()
 
 QString Platform::downloadDir()
 {
+#ifdef Q_OS_SYMBIAN
+    if (QDir("E:/").exists()) {
+        return "E:/Books";
+    }
+    return "C:/Books";
+#else
     return QDir::home().absoluteFilePath("Books");
+#endif
 }
 
 QString Platform::defaultFont()
@@ -107,3 +131,17 @@ QString Platform::traceFileName()
 {
     return QDir::home().absoluteFilePath(DORIAN_LOG);
 }
+
+int Platform::defaultZoom()
+{
+    return 150;
+}
+
+QString Platform::defaultOrientation()
+{
+#ifdef Q_OS_SYMBIAN
+    return QString("portrait");
+#else
+    return QString("landscape");
+#endif
+}