From: Akos Polster Date: Mon, 13 Jun 2011 13:56:18 +0000 (+0200) Subject: Even more Symbian improvements. Work around softkey visibility bug. X-Git-Url: http://git.maemo.org/git/?p=dorian;a=commitdiff_plain;h=feae7f4f9eed323a80b0fc83cc152723cf867089 Even more Symbian improvements. Work around softkey visibility bug. --- diff --git a/adopterwindow.cpp b/adopterwindow.cpp index a1f369b..7ec642d 100644 --- a/adopterwindow.cpp +++ b/adopterwindow.cpp @@ -172,7 +172,8 @@ void AdopterWindow::leaveEvent(QEvent *event) void AdopterWindow::keyPressEvent(QKeyEvent *event) { - TRACE; + Trace t("AdopterWindow::keyPressEvent"); + switch (event->key()) { case Qt::Key_PageDown: #ifdef Q_WS_MAEMO_5 diff --git a/adopterwindow.h b/adopterwindow.h index 7420d2c..26c08cb 100644 --- a/adopterwindow.h +++ b/adopterwindow.h @@ -12,7 +12,7 @@ class TranslucentButton; /** * A toplevel window that can adopt a BookView and other children. - * On Maemo, it can also grab the volume keys. + * On some platforms, it can also grab the volume keys. */ class AdopterWindow: public MainBase { @@ -51,14 +51,15 @@ protected: /** * Handle show events. - * On Symbian, volume keys can only be grabbed, if the window is shown. + * On Symbian, volume keys can only be grabbed, when the window is shown. + * So we do it from here. */ void showEvent(QShowEvent *event); /** Handle resize event: Restore reading position. */ void resizeEvent(QResizeEvent *event); - /** Handle close event. */ + /** Handle close event: Save reading position. */ void closeEvent(QCloseEvent *event); /** Handle leave event: Save reading position. */ diff --git a/fullscreenwindow.cpp b/fullscreenwindow.cpp index 1ffbd7b..27ac731 100644 --- a/fullscreenwindow.cpp +++ b/fullscreenwindow.cpp @@ -35,15 +35,23 @@ FullScreenWindow::FullScreenWindow(QWidget *parent): AdopterWindow(parent) void FullScreenWindow::showEvent(QShowEvent *e) { Trace t("FullScreenWindow::showEvent"); - AdopterWindow::showEvent(e); + qDebug() << "Softkeys visible?" + << (windowFlags() & Qt::WindowSoftkeysVisibleHint); placeChildren(); + AdopterWindow::showEvent(e); } void FullScreenWindow::resizeEvent(QResizeEvent *e) { Trace t("FullScreenWindow::resizeEvent"); - AdopterWindow::resizeEvent(e); placeChildren(); + AdopterWindow::resizeEvent(e); +} + +void FullScreenWindow::closeEvent(QCloseEvent *e) +{ + Trace t("FullscreenWindow::closeEvent"); + AdopterWindow::closeEvent(e); } void FullScreenWindow::placeChildren() diff --git a/fullscreenwindow.h b/fullscreenwindow.h index d91408c..0a84e54 100644 --- a/fullscreenwindow.h +++ b/fullscreenwindow.h @@ -18,7 +18,7 @@ class FullScreenWindow: public AdopterWindow Q_OBJECT public: - explicit FullScreenWindow(QWidget *parent); + explicit FullScreenWindow(QWidget *parent = 0); /** * Adopt children. @@ -39,6 +39,9 @@ protected: /** Handle show event. */ void showEvent(QShowEvent *e); + /** Handle close event. */ + void closeEvent(QCloseEvent *e); + protected slots: /** Re-align adopted child windows. */ void placeChildren(); diff --git a/mainwindow.cpp b/mainwindow.cpp index 82fde67..8694cd2 100755 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -43,10 +43,6 @@ MainWindow::MainWindow(QWidget *parent): setAttribute(Qt::WA_Maemo5StackedWindow, true); #endif -#ifndef Q_OS_SYMBIAN - setWindowTitle("Dorian"); -#endif - // Central widget. Must be an intermediate, because the book view widget // might be re-parented later QFrame *central = new QFrame(this); @@ -122,7 +118,7 @@ MainWindow::MainWindow(QWidget *parent): connect(view, SIGNAL(progress(qreal)), prog, SLOT(setProgress(qreal))); // Shadow window for full screen reading - fullScreenWindow = new FullScreenWindow(this); + fullScreenWindow = new FullScreenWindow(); connect(fullScreenWindow, SIGNAL(restore()), this, SLOT(showRegular())); // Handle settings changes @@ -138,6 +134,11 @@ MainWindow::MainWindow(QWidget *parent): #endif } +MainWindow::~MainWindow() +{ + delete fullScreenWindow; +} + void MainWindow::initialize() { TRACE; @@ -199,7 +200,7 @@ void MainWindow::showBig() leaveBookView(); fullScreenWindow->takeBookView(view, prog, prev, next); -#ifdef Q_WS_MAEMO_5 +#if defined(Q_WS_MAEMO_5) fullScreenWindow->raise(); #else hide(); diff --git a/mainwindow.h b/mainwindow.h index 1f50c41..c33f33b 100755 --- a/mainwindow.h +++ b/mainwindow.h @@ -22,6 +22,7 @@ class MainWindow: public AdopterWindow public: MainWindow(QWidget *parent = 0); + ~MainWindow(); void initialize(); public slots: diff --git a/model/book.cpp b/model/book.cpp index 7516665..ca6f912 100644 --- a/model/book.cpp +++ b/model/book.cpp @@ -82,7 +82,7 @@ void Book::peek() void Book::close() { - TRACE; + Trace t("Book::close"); content.clear(); parts.clear(); QDir::setCurrent(QDir::rootPath());