mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-28 11:50:25 -07:00
* [Card Database] Improve loading times through binary cache Took 10 minutes Took 9 minutes Took 16 seconds * [Card Database] Remove lib qt include Took 18 minutes Took 14 seconds * Downgrade to 6.3 datastream Took 5 minutes * go up to 6.4 datastream Took 1 minute * Address comments * Small bug fixes Took 20 minutes Took 10 seconds * More fixes. Took 4 minutes Took 4 seconds * Even more fixes. Took 11 minutes Took 4 seconds * More fixes. Took 6 minutes Took 26 seconds Took 8 minutes * Namespace instead of class Took 6 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
67 lines
No EOL
2.2 KiB
C++
67 lines
No EOL
2.2 KiB
C++
#include "card_set.h"
|
|
|
|
#include <QSet>
|
|
#include <utility>
|
|
|
|
const char *CardSet::TOKENS_SETNAME = "TK";
|
|
|
|
CardSet::CardSet(ICardSetPriorityController *_priorityController,
|
|
const QString &_shortName,
|
|
const QString &_longName,
|
|
const QString &_setType,
|
|
const QDate &_releaseDate,
|
|
const CardSet::Priority _priority)
|
|
: priorityController(std::move(_priorityController)), shortName(_shortName), longName(_longName),
|
|
releaseDate(_releaseDate), setType(_setType), priority(_priority)
|
|
{
|
|
loadSetOptions();
|
|
}
|
|
|
|
CardSetPtr CardSet::newInstance(ICardSetPriorityController *_priorityController,
|
|
const QString &_shortName,
|
|
const QString &_longName,
|
|
const QString &_setType,
|
|
const QDate &_releaseDate,
|
|
const Priority _priority)
|
|
{
|
|
CardSetPtr ptr(new CardSet(_priorityController, _shortName, _longName, _setType, _releaseDate, _priority));
|
|
// ptr->setSmartPointer(ptr);
|
|
return ptr;
|
|
}
|
|
|
|
QString CardSet::getCorrectedShortName() const
|
|
{
|
|
// For Windows machines.
|
|
QSet<QString> invalidFileNames;
|
|
invalidFileNames << "CON" << "PRN" << "AUX" << "NUL" << "COM1" << "COM2" << "COM3" << "COM4" << "COM5" << "COM6"
|
|
<< "COM7" << "COM8" << "COM9" << "LPT1" << "LPT2" << "LPT3" << "LPT4" << "LPT5" << "LPT6" << "LPT7"
|
|
<< "LPT8" << "LPT9";
|
|
|
|
return invalidFileNames.contains(shortName) ? shortName + "_" : shortName;
|
|
}
|
|
|
|
void CardSet::loadSetOptions()
|
|
{
|
|
const ICardSetPriorityController::SetOptions options = priorityController->getSetOptions(shortName);
|
|
sortKey = options.sortKey;
|
|
enabled = options.enabled;
|
|
isknown = options.isKnown;
|
|
}
|
|
|
|
void CardSet::setSortKey(unsigned int _sortKey)
|
|
{
|
|
sortKey = _sortKey;
|
|
priorityController->setSortKey(shortName, _sortKey);
|
|
}
|
|
|
|
void CardSet::setEnabled(bool _enabled)
|
|
{
|
|
enabled = _enabled;
|
|
priorityController->setEnabled(shortName, _enabled);
|
|
}
|
|
|
|
void CardSet::setIsKnown(bool _isknown)
|
|
{
|
|
isknown = _isknown;
|
|
priorityController->setIsKnown(shortName, _isknown);
|
|
} |