diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2021-03-21 15:52:23 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2021-03-21 15:52:23 +0000 |
| commit | e1d67586140fe18d48acf6fb4fef1556b15b091c (patch) | |
| tree | 8d732141d5f055de12255ee89c24271526a6475c /src/plugins/General/library/library.cpp | |
| parent | 0871f8bb3d5ff1f19ebab5b660ccfe13ec959f43 (diff) | |
| download | qmmp-e1d67586140fe18d48acf6fb4fef1556b15b091c.tar.gz qmmp-e1d67586140fe18d48acf6fb4fef1556b15b091c.tar.bz2 qmmp-e1d67586140fe18d48acf6fb4fef1556b15b091c.zip | |
library: added feature to recreate database
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9769 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General/library/library.cpp')
| -rw-r--r-- | src/plugins/General/library/library.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/plugins/General/library/library.cpp b/src/plugins/General/library/library.cpp index b174f4fa8..9c9582e9f 100644 --- a/src/plugins/General/library/library.cpp +++ b/src/plugins/General/library/library.cpp @@ -55,7 +55,7 @@ Library::Library(QPointer<LibraryWidget> *libraryWidget, QObject *parent) : if(createTables()) qDebug("Library: database initialization finished"); else - qWarning("Library: plugin is disabled"); + qWarning("Library: unable to create table"); } } QSqlDatabase::removeDatabase(CONNECTION_NAME); @@ -80,6 +80,20 @@ Library::Library(QPointer<LibraryWidget> *libraryWidget, QObject *parent) : m_libraryWidget->data()->refresh(); } }); + + if(settings.value("Library/recreate_db", false).toBool()) + { + settings.setValue("Library/recreate_db", false); + + { + QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", CONNECTION_NAME); + db.open(); + db.exec("DELETE FROM track_library"); + db.close(); + } + QSqlDatabase::removeDatabase(CONNECTION_NAME); + startDirectoryScanning(); + } } Library::~Library() @@ -114,6 +128,9 @@ void Library::showLibraryWindow() if(m_libraryWidget->data()->isWindow()) m_libraryWidget->data()->show(); + + if(m_future.isRunning()) + m_libraryWidget->data()->setBusyMode(true); } void Library::startDirectoryScanning() |
