Add splash screen on Maemo, too. Switch to new splash pixmap. Fix bug
[dorian] / platform.cpp
index ac25039..1681638 100644 (file)
@@ -26,6 +26,8 @@
 #   define DORIAN_ICON_PREFIX ":/icons/mac/"
 #elif defined(Q_OS_SYMBIAN)
 #   define DORIAN_ICON_PREFIX ":/icons/symbian/"
+#elif defined(Q_WS_MAEMO_5)
+#   define DORIAN_ICON_PREFIX ":/icons/maemo/"
 #else
 #   define DORIAN_ICON_PREFIX ":/icons/"
 #endif
@@ -64,13 +66,13 @@ QString Platform::dbPath()
     return QDir(base).absoluteFilePath("books.db");
 }
 
-QString Platform::icon(const QString &name)
+QString Platform::icon(const QString &name, const QString &extension)
 {
-    QString iconName = QString(DORIAN_ICON_PREFIX) + name + ".png";
+    QString iconName = QString(DORIAN_ICON_PREFIX) + name + extension;
     if (QFile(iconName).exists()) {
         return iconName;
     } else {
-        return QString(":/icons/") + name + ".png";
+        return QString(":/icons/") + name + extension;
     }
 }
 
@@ -187,3 +189,41 @@ void Platform::setOrientation(QWidget *widget, const QString &orientation)
 #endif
     }
 }
+
+int Platform::softKeyHeight()
+{
+#if defined(Q_OS_SYMBIAN)
+    return 62;
+#else
+    return 0;
+#endif
+}
+
+int Platform::toolBarIconHeight()
+{
+#if defined(Q_OS_SYMBIAN)
+    return 60;
+#elif defined(Q_WS_X11)  && !defined(Q_WS_MAEMO_5)
+    return 40;
+#else
+    return 0;
+#endif
+}
+
+QSize Platform::size()
+{
+    return QApplication::desktop()->geometry().size();
+}
+
+QSize Platform::availableSize()
+{
+    QSize s = QApplication::desktop()->availableGeometry().size();
+#if defined(Q_OS_SYMBIAN)
+    // Work around a Qt bug on Symbian which sometimes forgets to reduce the
+    // available height by the soft key area height
+    if (s.height() == 548) {
+        s.setHeight(s.height() - softKeyHeight());
+    }
+#endif
+    return s;
+}