Merge pull request #1088 from ctrlaltca/customsets
Load additional xml sets from $userprofile/customsets/
This commit is contained in:
commit
595d70cf23
3 changed files with 20 additions and 0 deletions
|
@ -1053,6 +1053,18 @@ void CardDatabase::loadTokenDatabase()
|
|||
loadCardDatabase(settingsCache->getTokenDatabasePath(), true);
|
||||
}
|
||||
|
||||
void CardDatabase::loadCustomCardDatabases(const QString &path)
|
||||
{
|
||||
QDir dir(path);
|
||||
if(!dir.exists())
|
||||
return;
|
||||
|
||||
foreach(QString fileName, dir.entryList(QStringList("*.xml"), QDir::Files | QDir::Readable, QDir::Name | QDir::IgnoreCase))
|
||||
{
|
||||
loadCardDatabase(dir.absoluteFilePath(fileName), false);
|
||||
}
|
||||
}
|
||||
|
||||
QStringList CardDatabase::getAllColors() const
|
||||
{
|
||||
QSet<QString> colors;
|
||||
|
|
|
@ -271,6 +271,7 @@ public:
|
|||
public slots:
|
||||
void clearPixmapCache();
|
||||
LoadStatus loadCardDatabase(const QString &path, bool tokens = false);
|
||||
void loadCustomCardDatabases(const QString &path);
|
||||
void emitCardListChanged();
|
||||
private slots:
|
||||
void imageLoaded(CardInfo *card, QImage image);
|
||||
|
|
|
@ -164,6 +164,13 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
if (!QDir().mkpath(settingsCache->getPicsPath() + "/CUSTOM"))
|
||||
qDebug() << "Could not create " + settingsCache->getPicsPath().toUtf8() + "/CUSTOM. Will fall back on default card images.";
|
||||
if (QDir().mkpath(dataDir + "/customsets"))
|
||||
{
|
||||
// if the dir exists (or has just been created)
|
||||
db->loadCustomCardDatabases(dataDir + "/customsets");
|
||||
} else {
|
||||
qDebug() << "Could not create " + dataDir + "/customsets folder.";
|
||||
}
|
||||
|
||||
if(settingsCache->getSoundPath().isEmpty() || !QDir(settingsCache->getSoundPath()).exists())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue