Show splash screen on Symbian.
[dorian] / mainwindow.cpp
index 278e578..72f14ef 100755 (executable)
@@ -1,7 +1,7 @@
 #include <QtGui>
+#include <QEvent>
 
 #ifdef Q_WS_MAEMO_5
-#   include <QtMaemo5/QMaemo5InformationBox>
 #   include <QtDBus>
 #   include <QtGui/QX11Info>
 #   include <X11/Xlib.h>
@@ -59,7 +59,7 @@ MainWindow::MainWindow(QWidget *parent):
     layout->addWidget(view);
 
     // Progress
-    progress = new Progress(central);
+    progress = new Progress(this);
 
     // Settings dialog
     settings = new QDialog(this);
@@ -118,10 +118,12 @@ MainWindow::MainWindow(QWidget *parent):
     connect(library, SIGNAL(upgrading(const QString &)),
             this, SLOT(onUpgrading(const QString &)));
     connect(library, SIGNAL(endUpgrade()), this, SLOT(onEndUpgrade()));
+#ifndef Q_OS_SYMBIAN
     connect(library, SIGNAL(beginLoad(int)), this, SLOT(onBeginLoad(int)));
     connect(library, SIGNAL(loading(const QString &)),
             this, SLOT(onLoading(const QString &)));
     connect(library, SIGNAL(endLoad()), this, SLOT(onEndLoad()));
+#endif
     library->upgrade();
     library->load();
 
@@ -162,21 +164,19 @@ MainWindow::MainWindow(QWidget *parent):
             this, SLOT(onSettingsChanged(const QString &)));
     settings->setValue("orientation", settings->value("orientation"));
     settings->setValue("lightson", settings->value("lightson"));
-    settings->setValue("usevolumekeys", settings->value("usevolumekeys"));
 
     // Handle book view buttons
     connect(nextButton, SIGNAL(triggered()), this, SLOT(goToNextPage()));
     connect(previousButton, SIGNAL(triggered()), this, SLOT(goToPreviousPage()));
 
+    // Adopt view, show window
+    showRegular();
+
 #ifdef DORIAN_TEST_MODEL
     (void)new ModelTest(Library::instance(), this);
 #endif
 }
 
-MainWindow::~MainWindow()
-{
-}
-
 void MainWindow::onCurrentBookChanged()
 {
     setCurrentBook(Library::instance()->nowReading());
@@ -317,10 +317,11 @@ void MainWindow::closeEvent(QCloseEvent *event)
 
 void MainWindow::onSettingsChanged(const QString &key)
 {
+    TRACE;
+    qDebug() << key;
 #if defined(Q_WS_MAEMO_5)
     if (key == "orientation") {
         QString value = Settings::instance()->value(key).toString();
-        qDebug() << "MainWindow::onSettingsChanged: orientation" << value;
         if (value == "portrait") {
             setAttribute(Qt::WA_Maemo5LandscapeOrientation, false);
             setAttribute(Qt::WA_Maemo5PortraitOrientation, true);
@@ -330,28 +331,18 @@ void MainWindow::onSettingsChanged(const QString &key)
         }
     } else if (key == "lightson") {
         bool enable = Settings::instance()->value(key, false).toBool();
-        qDebug() << "MainWindow::onSettingsChanged: lightson:" << enable;
         killTimer(preventBlankingTimer);
         if (enable) {
             preventBlankingTimer = startTimer(29 * 1000);
         }
-    } else if (key == "usevolumekeys") {
-        bool value = Settings::instance()->value(key).toBool();
-        qDebug() << "MainWindow::onSettingsChanged: usevolumekeys" << value;
-        grabZoomKeys(value);
-        fullScreenWindow->grabZoomKeys(value);
     }
-#else
-    Q_UNUSED(key);
 #endif // Q_WS_MAEMO_5
 }
 
 void MainWindow::onPartLoadStart()
 {
     TRACE;
-#ifdef Q_WS_MAEMO_5
-    setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true);
-#endif
+    Platform::showBusy(this, true);
 }
 
 void MainWindow::onPartLoadEnd(int index)
@@ -368,22 +359,14 @@ void MainWindow::onPartLoadEnd(int index)
             enableNext = true;
         }
     }
-#ifdef Q_WS_MAEMO_5
-    setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false);
-#endif // Q_WS_MAEMO_5
+    Platform::showBusy(this, false);
 }
 
 void MainWindow::onAddBookmark(const QString &note)
 {
     TRACE;
     view->addBookmark(note);
-#ifdef Q_WS_MAEMO_5
-    QMaemo5InformationBox::information(this,
-        tr("Bookmarked current position"), QMaemo5InformationBox::DefaultTimeout);
-#else
-    (void)QMessageBox::information(this, tr("Dorian"),
-        tr("Bookmarked current position"), QMessageBox::Ok);
-#endif // Q_WS_MAEMO_5}
+    Platform::information(tr("Bookmarked current position"), this);
 }
 
 void MainWindow::onGoToBookmark(int index)
@@ -477,7 +460,6 @@ void MainWindow::about()
     aboutDialog->show();
 }
 
-
 void MainWindow::goToNextPage()
 {
     nextButton->flash();
@@ -512,7 +494,6 @@ void MainWindow::onEndUpgrade()
     libraryProgress->reset();
 }
 
-
 void MainWindow::onBeginLoad(int total)
 {
     libraryProgress->setVisible(total > 0);
@@ -532,4 +513,3 @@ void MainWindow::onEndLoad()
     libraryProgress->hide();
     libraryProgress->reset();
 }
-