- // Handle settings changes
- Settings *settings = Settings::instance();
- connect(settings, SIGNAL(valueChanged(const QString &)),
- this, SLOT(onSettingsChanged(const QString &)));
- settings->setValue("orientation", settings->value("orientation"));
- settings->setValue("lightson", settings->value("lightson"));
-
- // Handle loading chapters
- connect(view, SIGNAL(chapterLoadStart(int)),
- this, SLOT(onChapterLoadStart()));
- connect(view, SIGNAL(chapterLoadEnd(int)),
- this, SLOT(onChapterLoadEnd(int)));
-
- // Shadow window for full screen
- fullScreenWindow = new FullScreenWindow(this);
- connect(fullScreenWindow, SIGNAL(restore()), this, SLOT(showRegular()));
-
- // Create thread for finding books in directories
- bookFinder = new BookFinder();
- connect(bookFinder, SIGNAL(add(const QString &)),
- this, SLOT(onAddBook(const QString &)));
- connect(bookFinder, SIGNAL(remove(const QString &)),
- this, SLOT(onRemoveBook(const QString &)));
- bookFinder->moveToThread(&bookFinderThread);
- bookFinderThread.start();
- qRegisterMetaType<QStringList>("QStringList");
-
- bool ret = QMetaObject::invokeMethod(
- bookFinder,
- "find",
- Q_ARG(QStringList, QStringList(QString("/home/polster/Books"))),
- Q_ARG(QStringList, library->bookPaths()));
- t.trace(QString("Invoking BookFinder::find ") + (ret?"succeeded":"failed"));
-
-#ifdef DORIAN_TEST_MODEL
- (void)new ModelTest(Library::instance(), this);
-#endif
-}
-
-MainWindow::~MainWindow()
-{
- bookFinderThread.quit();
- bookFinderThread.wait();
- delete bookFinder;