Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
b566bf4a
Commit
b566bf4a
authored
May 20, 2015
by
Fabio Bas
Browse files
Load additional xml sets from $userprofile/customsets/
parent
292d730c
Changes
3
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/carddatabase.cpp
View file @
b566bf4a
...
@@ -1053,6 +1053,18 @@ void CardDatabase::loadTokenDatabase()
...
@@ -1053,6 +1053,18 @@ void CardDatabase::loadTokenDatabase()
loadCardDatabase
(
settingsCache
->
getTokenDatabasePath
(),
true
);
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
))
{
loadCardDatabase
(
dir
.
absoluteFilePath
(
fileName
),
false
);
}
}
QStringList
CardDatabase
::
getAllColors
()
const
QStringList
CardDatabase
::
getAllColors
()
const
{
{
QSet
<
QString
>
colors
;
QSet
<
QString
>
colors
;
...
...
cockatrice/src/carddatabase.h
View file @
b566bf4a
...
@@ -271,6 +271,7 @@ public:
...
@@ -271,6 +271,7 @@ public:
public
slots
:
public
slots
:
void
clearPixmapCache
();
void
clearPixmapCache
();
LoadStatus
loadCardDatabase
(
const
QString
&
path
,
bool
tokens
=
false
);
LoadStatus
loadCardDatabase
(
const
QString
&
path
,
bool
tokens
=
false
);
void
loadCustomCardDatabases
(
const
QString
&
path
);
void
emitCardListChanged
();
void
emitCardListChanged
();
private
slots
:
private
slots
:
void
imageLoaded
(
CardInfo
*
card
,
QImage
image
);
void
imageLoaded
(
CardInfo
*
card
,
QImage
image
);
...
...
cockatrice/src/main.cpp
View file @
b566bf4a
...
@@ -164,6 +164,13 @@ int main(int argc, char *argv[])
...
@@ -164,6 +164,13 @@ int main(int argc, char *argv[])
}
}
if
(
!
QDir
().
mkpath
(
settingsCache
->
getPicsPath
()
+
"/CUSTOM"
))
if
(
!
QDir
().
mkpath
(
settingsCache
->
getPicsPath
()
+
"/CUSTOM"
))
qDebug
()
<<
"Could not create "
+
settingsCache
->
getPicsPath
().
toUtf8
()
+
"/CUSTOM. Will fall back on default card images."
;
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
())
if
(
settingsCache
->
getSoundPath
().
isEmpty
()
||
!
QDir
(
settingsCache
->
getSoundPath
()).
exists
())
{
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment