Don't try to initialise the library model until after the grouping settings have been read from the config. Fixes issue 3005

This commit is contained in:
David Sansome 2012-06-16 20:54:08 +01:00
parent b9bb449651
commit 21fbd40f9f
4 changed files with 8 additions and 16 deletions

View File

@ -101,7 +101,6 @@ Application::Application(QObject* parent)
#endif
library_->Init();
library_->StartThreads();
DoInAMinuteOrSo(database_, SLOT(DoBackup()));
}

View File

@ -135,12 +135,6 @@ void Library::Init() {
backend_->LoadDirectoriesAsync();
}
void Library::StartThreads() {
Q_ASSERT(watcher_);
model_->Init();
}
void Library::IncrementalScan() {
watcher_->IncrementalScanAsync();
}

View File

@ -43,7 +43,6 @@ class Library : public QObject {
static const char* kFtsTable;
void Init();
void StartThreads();
LibraryBackend* backend() const { return backend_; }
LibraryModel* model() const { return model_; }

View File

@ -95,6 +95,14 @@ LibraryModel::LibraryModel(LibraryBackend* backend, Application* app,
no_cover_icon_pretty_ = QPixmap(":nocover.png").scaled(
kPrettyCoverSize, kPrettyCoverSize,
Qt::KeepAspectRatio, Qt::SmoothTransformation);
connect(backend_, SIGNAL(SongsDiscovered(SongList)), SLOT(SongsDiscovered(SongList)));
connect(backend_, SIGNAL(SongsDeleted(SongList)), SLOT(SongsDeleted(SongList)));
connect(backend_, SIGNAL(SongsStatisticsChanged(SongList)), SLOT(SongsStatisticsChanged(SongList)));
connect(backend_, SIGNAL(DatabaseReset()), SLOT(Reset()));
connect(backend_, SIGNAL(TotalSongCountUpdated(int)), SLOT(TotalSongCountUpdatedSlot(int)));
backend_->UpdateTotalSongCountAsync();
}
LibraryModel::~LibraryModel() {
@ -116,14 +124,6 @@ void LibraryModel::set_show_dividers(bool show_dividers) {
}
void LibraryModel::Init(bool async) {
connect(backend_, SIGNAL(SongsDiscovered(SongList)), SLOT(SongsDiscovered(SongList)));
connect(backend_, SIGNAL(SongsDeleted(SongList)), SLOT(SongsDeleted(SongList)));
connect(backend_, SIGNAL(SongsStatisticsChanged(SongList)), SLOT(SongsStatisticsChanged(SongList)));
connect(backend_, SIGNAL(DatabaseReset()), SLOT(Reset()));
connect(backend_, SIGNAL(TotalSongCountUpdated(int)), SLOT(TotalSongCountUpdatedSlot(int)));
backend_->UpdateTotalSongCountAsync();
if (async) {
// Show a loading indicator in the model.
LibraryItem* loading = new LibraryItem(LibraryItem::Type_LoadingIndicator, root_);