mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-12 21:10:01 -08:00
Merge current upstream into finite-copy legality review
Preserve upstream master and the original nine-file copy-limit change. Retain QIODevice alongside upstream Oracle test includes. Invalidate derived format rules where the new upstream import reset and failure paths clear their cards.
This commit is contained in:
commit
3de8351b8b
443 changed files with 15637 additions and 11767 deletions
|
|
@ -1,7 +1,3 @@
|
|||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(HEADERS
|
||||
libcockatrice/card/card_info.h
|
||||
libcockatrice/card/card_info_comparator.h
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ LoadStatus CardDatabaseLoader::loadCardDatabase(const QString &path, CardDatabas
|
|||
auto startTime = QTime::currentTime();
|
||||
LoadStatus tempLoadStatus = NotLoaded;
|
||||
if (!path.isEmpty()) {
|
||||
QMutexLocker locker(loadFromFileMutex);
|
||||
QMutexLocker locker(&loadFromFileMutex);
|
||||
tempLoadStatus = loadFromFile(path, data);
|
||||
}
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ LoadStatus CardDatabaseLoader::loadCardDatabases(bool ignoreCache)
|
|||
|
||||
LoadStatus CardDatabaseLoader::doLoadCardDatabases(bool ignoreCache)
|
||||
{
|
||||
QMutexLocker locker(reloadDatabaseMutex);
|
||||
QMutexLocker locker(&reloadDatabaseMutex);
|
||||
|
||||
if (!database) {
|
||||
qCWarning(CardDatabaseLoadingLog) << "Loader has no database pointer";
|
||||
|
|
|
|||
|
|
@ -177,8 +177,8 @@ private:
|
|||
ICardSetPriorityController *priorityController; /**< Controller for reconstructing set state. */
|
||||
QList<ICardDatabaseParser *> availableParsers; /**< List of available parsers for different formats. */
|
||||
|
||||
QBasicMutex *loadFromFileMutex = new QBasicMutex(); /**< Mutex for single-file loading. */
|
||||
QBasicMutex *reloadDatabaseMutex = new QBasicMutex(); /**< Mutex for reloading entire database. */
|
||||
QBasicMutex loadFromFileMutex; /**< Mutex for single-file loading. */
|
||||
QBasicMutex reloadDatabaseMutex; /**< Mutex for reloading entire database. */
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_CARD_DATABASE_LOADER_H
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include <QIODevice>
|
||||
#include <QList>
|
||||
#include <QMessageLogger>
|
||||
#include <QSaveFile>
|
||||
#include <QSharedPointer>
|
||||
#include <QStringView>
|
||||
#include <QXmlStreamAttributes>
|
||||
|
|
@ -499,7 +500,7 @@ bool CockatriceXml3Parser::saveToFile(FormatRulesNameMap _formats,
|
|||
{
|
||||
Q_UNUSED(_formats);
|
||||
|
||||
QFile file(fileName);
|
||||
QSaveFile file(fileName);
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -539,5 +540,5 @@ bool CockatriceXml3Parser::saveToFile(FormatRulesNameMap _formats,
|
|||
xml.writeEndElement(); // cockatrice_carddatabase
|
||||
xml.writeEndDocument();
|
||||
|
||||
return true;
|
||||
return !xml.hasError() && file.commit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMessageLogger>
|
||||
#include <QSaveFile>
|
||||
#include <QSharedPointer>
|
||||
#include <QStringList>
|
||||
#include <QStringView>
|
||||
|
|
@ -682,7 +683,7 @@ bool CockatriceXml4Parser::saveToFile(FormatRulesNameMap _formats,
|
|||
const QString &sourceUrl,
|
||||
const QString &sourceVersion)
|
||||
{
|
||||
QFile file(fileName);
|
||||
QSaveFile file(fileName);
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -730,5 +731,5 @@ bool CockatriceXml4Parser::saveToFile(FormatRulesNameMap _formats,
|
|||
xml.writeEndElement(); // cockatrice_carddatabase
|
||||
xml.writeEndDocument();
|
||||
|
||||
return true;
|
||||
return !xml.hasError() && file.commit();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue