Add new method for updating songs based on song ID
Show status updating database. Fixes #750
This commit is contained in:
@@ -99,8 +99,10 @@ void RegisterMetaTypes() {
|
||||
qRegisterMetaType<Subdirectory>("Subdirectory");
|
||||
qRegisterMetaType<SubdirectoryList>("SubdirectoryList");
|
||||
qRegisterMetaType<Song>("Song");
|
||||
qRegisterMetaType<QList<Song>>("QList<Song>");
|
||||
qRegisterMetaType<SongList>("SongList");
|
||||
qRegisterMetaType<SongMap>("SongMap");
|
||||
qRegisterMetaType<QList<Song>>("QList<Song>");
|
||||
qRegisterMetaType<QMap<QString, Song>>("QMap<QString, Song>");
|
||||
qRegisterMetaType<Engine::EngineType>("EngineType");
|
||||
qRegisterMetaType<Engine::SimpleMetaBundle>("Engine::SimpleMetaBundle");
|
||||
qRegisterMetaType<Engine::State>("Engine::State");
|
||||
|
||||
@@ -25,19 +25,23 @@
|
||||
#include "core/logging.h"
|
||||
#include "scopedtransaction.h"
|
||||
|
||||
ScopedTransaction::ScopedTransaction(QSqlDatabase *db)
|
||||
: db_(db), pending_(true) {
|
||||
ScopedTransaction::ScopedTransaction(QSqlDatabase *db) : db_(db), pending_(true) {
|
||||
|
||||
db->transaction();
|
||||
|
||||
}
|
||||
|
||||
ScopedTransaction::~ScopedTransaction() {
|
||||
|
||||
if (pending_) {
|
||||
qLog(Warning) << "Rolling back transaction";
|
||||
db_->rollback();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ScopedTransaction::Commit() {
|
||||
|
||||
if (!pending_) {
|
||||
qLog(Warning) << "Tried to commit a ScopedTransaction twice";
|
||||
return;
|
||||
@@ -45,4 +49,5 @@ void ScopedTransaction::Commit() {
|
||||
|
||||
db_->commit();
|
||||
pending_ = false;
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <QMetaType>
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
#include <QMap>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
@@ -396,10 +397,13 @@ class Song {
|
||||
|
||||
QSharedDataPointer<Private> d;
|
||||
};
|
||||
Q_DECLARE_METATYPE(Song)
|
||||
|
||||
typedef QList<Song> SongList;
|
||||
Q_DECLARE_METATYPE(QList<Song>)
|
||||
typedef QMap<QString, Song> SongMap;
|
||||
|
||||
Q_DECLARE_METATYPE(Song)
|
||||
Q_DECLARE_METATYPE(SongList)
|
||||
Q_DECLARE_METATYPE(SongMap)
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
size_t qHash(const Song &song);
|
||||
|
||||
Reference in New Issue
Block a user