#include "fullscreenwindow.h"
#include "trace.h"
#include "bookfinder.h"
+#include "progress.h"
#ifdef DORIAN_TEST_MODEL
#include "modeltest.h"
# define ICON_PREFIX ":/icons/"
#endif
+const int PROGRESS_HEIGHT = 17;
+
MainWindow::MainWindow(QWidget *parent):
QMainWindow(parent), view(0), preventBlankingTimer(-1)
{
view->show();
layout->addWidget(view);
+ // Progress
+ progress = new Progress(central);
+
// Tool bar
setUnifiedTitleAndToolBarOnMac(true);
settings = new QDialog(this);
connect(view, SIGNAL(chapterLoadEnd(int)),
this, SLOT(onChapterLoadEnd(int)));
+ // Handle progress
+ connect(view, SIGNAL(progress(qreal)), progress, SLOT(setProgress(qreal)));
+
// Shadow window for full screen
fullScreenWindow = new FullScreenWindow(this);
connect(fullScreenWindow, SIGNAL(restore()), this, SLOT(showRegular()));
bookFinder->moveToThread(&bookFinderThread);
bookFinderThread.start();
-#if 0
- bool ret = QMetaObject::invokeMethod(
- bookFinder,
- "find",
- Q_ARG(QStringList, QStringList(QString("/Users/polster/Books"))),
- Q_ARG(QStringList, library->bookPaths()));
- t.trace(QString("Invoking BookFinder::find ") + (ret?"succeeded":"failed"));
-#endif
-
#ifdef DORIAN_TEST_MODEL
(void)new ModelTest(Library::instance(), this);
#endif
fullScreenWindow->hide();
fullScreenWindow->leaveChild();
view->setParent(centralWidget());
+ progress->setParent(centralWidget());
+ progress->setGeometry(0, 0, geometry().width(), PROGRESS_HEIGHT);
centralWidget()->layout()->addWidget(view);
+ progress->flash();
}
void MainWindow::showBig()
{
Trace t("MainWindow::showBig");
centralWidget()->layout()->removeWidget(view);
+ progress->setParent(fullScreenWindow);
+ progress->setGeometry(0, 0, QApplication::desktop()->screenGeometry().width(),
+ PROGRESS_HEIGHT);
fullScreenWindow->takeChild(view);
fullScreenWindow->showFullScreen();
+ progress->flash();
}
void MainWindow::setCurrentBook(const QModelIndex ¤t)
Trace::trace("MainWindow::timerEvent: Prevent display blanking");
}
}
+
+void MainWindow::resizeEvent(QResizeEvent *e)
+{
+ progress->setGeometry(QRect(0, 0, e->size().width(), PROGRESS_HEIGHT));
+ QMainWindow::resizeEvent(e);
+}