summaryrefslogtreecommitdiffstats
path: root/src/library/library.cpp
diff options
context:
space:
mode:
authorUwe Klotz <uwe_klotz@web.de>2017-06-07 22:04:51 +0200
committerUwe Klotz <uwe_klotz@web.de>2017-06-12 07:30:17 +0200
commitf861db223f51d77b2c07021e13e993e5683818d2 (patch)
tree3b6494be7cf0a8c4464dc0a65c2d0ce32e101e74 /src/library/library.cpp
parent83a1e2937aa0006a6d536c8c086a04056bc3b3b7 (diff)
Don't repair database without permission by the user
Diffstat (limited to 'src/library/library.cpp')
-rw-r--r--src/library/library.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/library/library.cpp b/src/library/library.cpp
index 983cfbf346..29e45c21b8 100644
--- a/src/library/library.cpp
+++ b/src/library/library.cpp
@@ -48,6 +48,9 @@ const mixxx::Logger kLogger("Library");
//static
const QString Library::kConfigGroup("[Library]");
+//static
+const ConfigKey Library::kConfigKeyRepairDatabaseOnNextRestart(kConfigGroup, "RepairDatabaseOnNextRestart");
+
// This is is the name which we use to register the WTrackTableView with the
// WLibrary
const QString Library::m_sTrackViewName = QString("WTrackTableView");
@@ -85,8 +88,14 @@ Library::Library(QObject* parent, UserSettingsPointer pConfig,
exit(-1);
}
- kLogger.info() << "Checking and repairing database (if necessary)";
- m_pTrackCollection->repairDatabase(database);
+ // TODO(XXX): Add a checkbox in the library preferences for checking
+ // and repairing the database on the next restart of the application.
+ if (pConfig->getValue(kConfigKeyRepairDatabaseOnNextRestart, false)) {
+ kLogger.info() << "Checking and repairing database (if necessary)";
+ m_pTrackCollection->repairDatabase(database);
+ // Reset config value
+ pConfig->setValue(kConfigKeyRepairDatabaseOnNextRestart, false);
+ }
kLogger.info() << "Connecting database";
m_pTrackCollection->connectDatabase(database);