[app] BooksShelf now automatically moves itself to the main thread
So does BooksBook
This commit is contained in:
parent
ca38e3cd92
commit
2082fbc09d
1 changed files with 3 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015-2017 Jolla Ltd.
|
* Copyright (C) 2015-2018 Jolla Ltd.
|
||||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
* Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
|
||||||
*
|
*
|
||||||
* You may use this file under the terms of the BSD license as follows:
|
* You may use this file under the terms of the BSD license as follows:
|
||||||
*
|
*
|
||||||
|
@ -184,14 +184,12 @@ void BooksShelf::LoadTask::performTask()
|
||||||
}
|
}
|
||||||
folderPath += info.fileName();
|
folderPath += info.fileName();
|
||||||
BooksShelf* newShelf = new BooksShelf(iStorage, folderPath);
|
BooksShelf* newShelf = new BooksShelf(iStorage, folderPath);
|
||||||
newShelf->moveToThread(thread());
|
|
||||||
iItems.append(newShelf);
|
iItems.append(newShelf);
|
||||||
} else {
|
} else {
|
||||||
shared_ptr<Book> book = BooksUtil::bookFromFile(path);
|
shared_ptr<Book> book = BooksUtil::bookFromFile(path);
|
||||||
if (!book.isNull()) {
|
if (!book.isNull()) {
|
||||||
BooksBook* newBook = new BooksBook(iStorage,
|
BooksBook* newBook = new BooksBook(iStorage,
|
||||||
iRelativePath, book);
|
iRelativePath, book);
|
||||||
newBook->moveToThread(thread());
|
|
||||||
iItems.append(newBook);
|
iItems.append(newBook);
|
||||||
HDEBUG("[" << iItems.size() << "]" <<
|
HDEBUG("[" << iItems.size() << "]" <<
|
||||||
qPrintable(newBook->fileName()) <<
|
qPrintable(newBook->fileName()) <<
|
||||||
|
@ -516,6 +514,7 @@ void BooksShelf::init()
|
||||||
#if QT_VERSION < 0x050000
|
#if QT_VERSION < 0x050000
|
||||||
setRoleNames(roleNames());
|
setRoleNames(roleNames());
|
||||||
#endif
|
#endif
|
||||||
|
moveToThread(qApp->thread());
|
||||||
connect(BooksStorageManager::instance(),
|
connect(BooksStorageManager::instance(),
|
||||||
SIGNAL(storageReplaced(BooksStorage,BooksStorage)),
|
SIGNAL(storageReplaced(BooksStorage,BooksStorage)),
|
||||||
SLOT(onStorageReplaced(BooksStorage,BooksStorage)));
|
SLOT(onStorageReplaced(BooksStorage,BooksStorage)));
|
||||||
|
|
Loading…
Reference in a new issue