mirror of
https://github.com/YACReader/yacreader
synced 2025-07-17 20:44:32 -04:00
Change the type of path passed to DataBaseManagement::updateToCurrentVersion
This commit is contained in:
@ -853,7 +853,7 @@ int DataBaseManagement::compareVersions(const QString &v1, const QString v2)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool DataBaseManagement::updateToCurrentVersion(const QString &libraryDataPath)
|
||||
bool DataBaseManagement::updateToCurrentVersion(const QString &libraryPath)
|
||||
{
|
||||
bool pre7 = false;
|
||||
bool pre7_1 = false;
|
||||
@ -863,28 +863,28 @@ bool DataBaseManagement::updateToCurrentVersion(const QString &libraryDataPath)
|
||||
bool pre9_13 = false;
|
||||
bool pre9_14 = false;
|
||||
|
||||
QString fullPath = libraryDataPath + "/library.ydb";
|
||||
QString libraryDatabasePath = LibraryPaths::libraryDatabasePath(libraryPath);
|
||||
|
||||
if (compareVersions(DataBaseManagement::checkValidDB(fullPath), "7.0.0") < 0)
|
||||
if (compareVersions(DataBaseManagement::checkValidDB(libraryDatabasePath), "7.0.0") < 0)
|
||||
pre7 = true;
|
||||
if (compareVersions(DataBaseManagement::checkValidDB(fullPath), "7.0.3") < 0)
|
||||
if (compareVersions(DataBaseManagement::checkValidDB(libraryDatabasePath), "7.0.3") < 0)
|
||||
pre7_1 = true;
|
||||
if (compareVersions(DataBaseManagement::checkValidDB(fullPath), "8.0.0") < 0)
|
||||
if (compareVersions(DataBaseManagement::checkValidDB(libraryDatabasePath), "8.0.0") < 0)
|
||||
pre8 = true;
|
||||
if (compareVersions(DataBaseManagement::checkValidDB(fullPath), "9.5.0") < 0)
|
||||
if (compareVersions(DataBaseManagement::checkValidDB(libraryDatabasePath), "9.5.0") < 0)
|
||||
pre9_5 = true;
|
||||
if (compareVersions(DataBaseManagement::checkValidDB(fullPath), "9.8.0") < 0)
|
||||
if (compareVersions(DataBaseManagement::checkValidDB(libraryDatabasePath), "9.8.0") < 0)
|
||||
pre9_8 = true;
|
||||
if (compareVersions(DataBaseManagement::checkValidDB(fullPath), "9.13.0") < 0)
|
||||
if (compareVersions(DataBaseManagement::checkValidDB(libraryDatabasePath), "9.13.0") < 0)
|
||||
pre9_13 = true;
|
||||
if (compareVersions(DataBaseManagement::checkValidDB(fullPath), "9.14.0") < 0)
|
||||
if (compareVersions(DataBaseManagement::checkValidDB(libraryDatabasePath), "9.14.0") < 0)
|
||||
pre9_14 = true;
|
||||
|
||||
QString connectionName = "";
|
||||
bool returnValue = true;
|
||||
|
||||
{
|
||||
QSqlDatabase db = loadDatabaseFromFile(fullPath);
|
||||
QSqlDatabase db = loadDatabaseFromFile(libraryDatabasePath);
|
||||
if (db.isValid() && db.isOpen()) {
|
||||
if (pre7) // TODO: execute only if previous version was < 7.0
|
||||
{
|
||||
@ -968,7 +968,8 @@ bool DataBaseManagement::updateToCurrentVersion(const QString &libraryDataPath)
|
||||
|
||||
QImageReader thumbnail;
|
||||
while (selectQuery.next()) {
|
||||
thumbnail.setFileName(libraryDataPath % "/covers/" % selectQuery.value(1).toString() % ".jpg");
|
||||
auto coverPath = LibraryPaths::coverPath(libraryPath, selectQuery.value(1).toString());
|
||||
thumbnail.setFileName(coverPath);
|
||||
|
||||
float coverSizeRatio = static_cast<float>(thumbnail.size().width()) / thumbnail.size().height();
|
||||
updateCoverInfo.bindValue(":coverSizeRatio", coverSizeRatio);
|
||||
|
Reference in New Issue
Block a user