void FullScreenWindow::showFullScreen()
{
- TRACE;
+ Trace t("FullScreenWindow::showFullScreen");
AdopterWindow::showFullScreen();
- restoreButton->flash(3000);
+ placeChildren();
}
void FullScreenWindow::resizeEvent(QResizeEvent *e)
{
+ Trace t("FullScreenWindow::resizeEvent");
+ QTimer::singleShot(100, this, SLOT(placeChildren()));
+ AdopterWindow::resizeEvent(e);
+}
+
+void FullScreenWindow::takeChildren(BookView *view,
+ Progress *prog,
+ TranslucentButton *previous,
+ TranslucentButton *next)
+{
TRACE;
+ progress = prog;
+ previousButton = previous;
+ nextButton = next;
+ QList<QWidget *> otherChildren;
+ otherChildren << progress << previousButton << nextButton;
+ AdopterWindow::takeChildren(view, otherChildren);
+}
+
+void FullScreenWindow::placeChildren()
+{
+ Trace t("FullScreenWindow::placeChildren");
QRect screen = QApplication::desktop()->screenGeometry();
int w = screen.width();
if (hasChild(progress)) {
progress->setGeometry(0, h - progress->thickness(),
w, progress->thickness());
+ qDebug() << "Screen (FullScreenWindow::resizeEvent)" << w << "x" << h;
+ qDebug() << "Progress (FullScreenWindow::resizeEvent)"
+ << progress->geometry();
}
if (hasChild(previousButton)) {
previousButton->setGeometry(
}
restoreButton->flash(3000);
- AdopterWindow::resizeEvent(e);
-}
-
-void FullScreenWindow::takeChildren(BookView *view,
- Progress *prog,
- TranslucentButton *previous,
- TranslucentButton *next)
-{
- TRACE;
- progress = prog;
- previousButton = previous;
- nextButton = next;
- QList<QWidget *> otherChildren;
- otherChildren << progress << previousButton << nextButton;
- AdopterWindow::takeChildren(view, otherChildren);
}
setCentralWidget(central);
// Book view
- view = new BookView(central);
+ view = new BookView(this);
view->show();
layout->addWidget(view);
otherChildren << progress << previousButton << nextButton;
takeChildren(view, otherChildren);
+#if 0
+
// Adjust geometry of decorations
QRect geo = geometry();
- qDebug() << geo;
+ qDebug() << "MainWindow (MainWindow::showRegular)" << geo;
+ qDebug() << "BookView (MainWindow::showRegular)" << view->geometry();
int y = geo.height() - progress->thickness();
#if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN)
bool hasToolBar = false;
#endif // Q_WS_MAEMO_5
qDebug() << "previousButton geometry" << previousButton->geometry();
+#endif
+
fullScreenWindow->hide();
show();
#if defined(Q_OS_SYMBIAN)
activateWindow();
#endif
- progress->flash();
- nextButton->flash();
- previousButton->flash();
}
void MainWindow::showBig()
leaveChildren();
fullScreenWindow->takeChildren(view, progress, previousButton, nextButton);
+#if 0
+
// Adjust geometry of decorations
QRect screen = QApplication::desktop()->screenGeometry();
int y = screen.height() - progress->thickness();
previousButton->setGeometry(0, screen.height() - TranslucentButton::pixels,
TranslucentButton::pixels, TranslucentButton::pixels);
-#ifdef Q_OS_SYMBIAN
- hide();
#endif
+
+// #ifdef Q_OS_SYMBIAN
+ hide();
+// #endif
+
fullScreenWindow->showFullScreen();
#ifdef Q_OS_SYMBIAN
fullScreenWindow->activateWindow();
#endif
- progress->flash();
- nextButton->flash();
- previousButton->flash();
}
void MainWindow::setCurrentBook(const QModelIndex ¤t)
void MainWindow::resizeEvent(QResizeEvent *e)
{
- TRACE;
+ Trace t("MainWindow::resizeEvent");
+#ifdef Q_OS_SYMBIAN
+ // Tool bar is only useful in portrait mode
+ bool isPortrait =
+ (QApplication::desktop()->width() < QApplication::desktop()->height());
+ toolBar->setVisible(isPortrait);
+#endif
+ QTimer::singleShot(100, this, SLOT(placeChildren()));
+ AdopterWindow::resizeEvent(e);
+}
+
+void MainWindow::placeChildren()
+{
+ Trace t("MainWindow::placeChildren");
int toolBarHeight = 0;
#ifdef Q_OS_SYMBIAN
// Tool bar is only useful in portrait mode
- bool isPortrait = (e->size().width() < e->size().height());
- toolBar->setVisible(isPortrait);
+ bool isPortrait =
+ (QApplication::desktop()->width() < QApplication::desktop()->height());
+ // toolBar->setVisible(isPortrait);
+
+ // Work around Symbian bug: If there is no tool bar, increase decorator
+ // widgets' Y coordinates
if (!isPortrait) {
toolBarHeight = toolBar->height();
}
#endif // Q_OS_SYMBIAN
- if (bookView) {
- qDebug() << "BookView geometry" << bookView->geometry();
- QRect geo = bookView->geometry();
+ if (hasChild(view)) {
+ QRect geo = centralWidget()->geometry();
+ qDebug() << "centralWidget (MainWindow::resizeEvent)" << geo;
+#ifdef Q_OS_SYMBIAN
+ // FIXME: When returning from full screen in landscape mode,
+ // the central widget's height is miscalculated on Symbian.
+ // My apologies for this kludge
+ if (geo.height() == 288) {
+ geo.setHeight(223);
+ }
+#endif // Q_OS_SYMBIAN
progress->setGeometry(geo.x(),
geo.y() + geo.height() - progress->thickness() + toolBarHeight,
geo.width(), progress->thickness());
nextButton->setGeometry(
geo.x() + geo.width() - TranslucentButton::pixels,
geo.y(), TranslucentButton::pixels, TranslucentButton::pixels);
+ progress->flash();
+ previousButton->flash();
+ nextButton->flash();
+ qDebug() << "Progress (MainWindow::resizeEvent)"
+ << progress->geometry();
}
- QMainWindow::resizeEvent(e);
+
}
void MainWindow::about()