diff options
author | Uwe Klotz <uwe_klotz@web.de> | 2017-06-06 22:50:40 +0200 |
---|---|---|
committer | Uwe Klotz <uwe_klotz@web.de> | 2017-06-12 07:30:17 +0200 |
commit | ad48f8b5557b5be894840953f7233a5c5131cec8 (patch) | |
tree | 5cfab6627bcfa3dc19d05f40e512c2cf39a2ec14 /src/library/library.cpp | |
parent | 97e802fbc1a688ebb6ba7c3e74e0429fb1bc3ef9 (diff) |
Reuse SqlStorage interface for TrackCollection
Diffstat (limited to 'src/library/library.cpp')
-rw-r--r-- | src/library/library.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/library/library.cpp b/src/library/library.cpp index 72e2144d5f..ba171b99a8 100644 --- a/src/library/library.cpp +++ b/src/library/library.cpp @@ -29,6 +29,7 @@ #include "library/librarycontrol.h" #include "library/setlogfeature.h" #include "util/sandbox.h" +#include "util/logger.h" #include "util/assert.h" #include "widget/wtracktableview.h" @@ -37,6 +38,13 @@ #include "controllers/keyboard/keyboardeventfilter.h" + +namespace { + +const mixxx::Logger kLogger("Library"); + +} // anonymous namespace + // This is is the name which we use to register the WTrackTableView with the // WLibrary const QString Library::m_sTrackViewName = QString("WTrackTableView"); @@ -54,11 +62,19 @@ Library::Library(QObject* parent, UserSettingsPointer pConfig, m_pLibraryControl(new LibraryControl(this)), m_pRecordingManager(pRecordingManager), m_scanner(m_pTrackCollection, pConfig) { + kLogger.info() << "Initializing datbase schema"; if (!m_pRepository->initDatabaseSchema()) { // TODO(XXX) something a little more elegant exit(-1); } - m_pTrackCollection->setDatabase(m_pRepository->database()); + + QSqlDatabase database = m_pRepository->database(); + + kLogger.info() << "Repairing database"; + m_pTrackCollection->repairDatabase(database); + + kLogger.info() << "Connecting database"; + m_pTrackCollection->connectDatabase(database); qRegisterMetaType<Library::RemovalType>("Library::RemovalType"); @@ -156,6 +172,10 @@ Library::~Library() { } delete m_pLibraryControl; + + kLogger.info() << "Disconnecting database"; + m_pTrackCollection->disconnectDatabase(); + //IMPORTANT: m_pTrackCollection gets destroyed via the QObject hierarchy somehow. // Qt does it for us due to the way RJ wrote all this stuff. //Update: - OR NOT! As of Dec 8, 2009, this pointer must be destroyed manually otherwise |