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
1151077c
Commit
1151077c
authored
Feb 21, 2011
by
Max-Wilhelm Bruker
Browse files
carddb thread fix; added VG, AE, PCH to sets
parent
acac5add
Changes
3
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/carddatabase.cpp
View file @
1151077c
...
@@ -223,7 +223,6 @@ void PictureLoader::setPicDownload(bool _picDownload)
...
@@ -223,7 +223,6 @@ void PictureLoader::setPicDownload(bool _picDownload)
PictureLoadingThread
::
PictureLoadingThread
(
const
QString
&
_picsPath
,
bool
_picDownload
,
QObject
*
parent
)
PictureLoadingThread
::
PictureLoadingThread
(
const
QString
&
_picsPath
,
bool
_picDownload
,
QObject
*
parent
)
:
QThread
(
parent
),
picsPath
(
_picsPath
),
picDownload
(
_picDownload
)
:
QThread
(
parent
),
picsPath
(
_picsPath
),
picDownload
(
_picDownload
)
{
{
initMutex
.
lock
();
}
}
PictureLoadingThread
::~
PictureLoadingThread
()
PictureLoadingThread
::~
PictureLoadingThread
()
...
@@ -239,12 +238,22 @@ void PictureLoadingThread::run()
...
@@ -239,12 +238,22 @@ void PictureLoadingThread::run()
pictureLoader
->
setPicsPath
(
picsPath
);
pictureLoader
->
setPicsPath
(
picsPath
);
pictureLoader
->
setPicDownload
(
picDownload
);
pictureLoader
->
setPicDownload
(
picDownload
);
initMutex
.
unlock
();
usleep
(
100
);
initWaitCondition
.
wakeAll
();
exec
();
exec
();
delete
pictureLoader
;
delete
pictureLoader
;
}
}
void
PictureLoadingThread
::
waitForInit
()
{
QMutex
mutex
;
mutex
.
lock
();
initWaitCondition
.
wait
(
&
mutex
);
mutex
.
unlock
();
}
CardInfo
::
CardInfo
(
CardDatabase
*
_db
,
const
QString
&
_name
,
const
QString
&
_manacost
,
const
QString
&
_cardtype
,
const
QString
&
_powtough
,
const
QString
&
_text
,
const
QStringList
&
_colors
,
bool
_cipt
,
int
_tableRow
,
const
SetList
&
_sets
,
const
QMap
<
QString
,
QString
>
&
_picURLs
,
const
QMap
<
QString
,
QString
>
&
_picURLsHq
,
const
QMap
<
QString
,
QString
>
&
_picURLsSt
)
CardInfo
::
CardInfo
(
CardDatabase
*
_db
,
const
QString
&
_name
,
const
QString
&
_manacost
,
const
QString
&
_cardtype
,
const
QString
&
_powtough
,
const
QString
&
_text
,
const
QStringList
&
_colors
,
bool
_cipt
,
int
_tableRow
,
const
SetList
&
_sets
,
const
QMap
<
QString
,
QString
>
&
_picURLs
,
const
QMap
<
QString
,
QString
>
&
_picURLsHq
,
const
QMap
<
QString
,
QString
>
&
_picURLsSt
)
:
db
(
_db
),
name
(
_name
),
sets
(
_sets
),
manacost
(
_manacost
),
cardtype
(
_cardtype
),
powtough
(
_powtough
),
text
(
_text
),
colors
(
_colors
),
picURLs
(
_picURLs
),
picURLsHq
(
_picURLsHq
),
picURLsSt
(
_picURLsSt
),
cipt
(
_cipt
),
tableRow
(
_tableRow
),
pixmap
(
NULL
)
:
db
(
_db
),
name
(
_name
),
sets
(
_sets
),
manacost
(
_manacost
),
cardtype
(
_cardtype
),
powtough
(
_powtough
),
text
(
_text
),
colors
(
_colors
),
picURLs
(
_picURLs
),
picURLsHq
(
_picURLsHq
),
picURLsSt
(
_picURLsSt
),
cipt
(
_cipt
),
tableRow
(
_tableRow
),
pixmap
(
NULL
)
{
{
...
@@ -427,6 +436,7 @@ CardDatabase::CardDatabase(QObject *parent)
...
@@ -427,6 +436,7 @@ CardDatabase::CardDatabase(QObject *parent)
loadingThread
=
new
PictureLoadingThread
(
settingsCache
->
getPicsPath
(),
settingsCache
->
getPicDownload
(),
this
);
loadingThread
=
new
PictureLoadingThread
(
settingsCache
->
getPicsPath
(),
settingsCache
->
getPicDownload
(),
this
);
connect
(
loadingThread
,
SIGNAL
(
imageLoaded
(
CardInfo
*
,
QImage
)),
this
,
SLOT
(
imageLoaded
(
CardInfo
*
,
QImage
)));
connect
(
loadingThread
,
SIGNAL
(
imageLoaded
(
CardInfo
*
,
QImage
)),
this
,
SLOT
(
imageLoaded
(
CardInfo
*
,
QImage
)));
loadingThread
->
start
(
QThread
::
LowPriority
);
loadingThread
->
start
(
QThread
::
LowPriority
);
loadingThread
->
waitForInit
();
noCard
=
new
CardInfo
(
this
);
noCard
=
new
CardInfo
(
this
);
noCard
->
loadPixmap
();
// cache pixmap for card back
noCard
->
loadPixmap
();
// cache pixmap for card back
...
...
cockatrice/src/carddatabase.h
View file @
1151077c
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include
<QNetworkRequest>
#include
<QNetworkRequest>
#include
<QThread>
#include
<QThread>
#include
<QMutex>
#include
<QMutex>
#include
<QWaitCondition>
class
CardDatabase
;
class
CardDatabase
;
class
CardInfo
;
class
CardInfo
;
...
@@ -87,13 +88,14 @@ private:
...
@@ -87,13 +88,14 @@ private:
QString
picsPath
;
QString
picsPath
;
bool
picDownload
;
bool
picDownload
;
PictureLoader
*
pictureLoader
;
PictureLoader
*
pictureLoader
;
mutable
QMutex
initMutex
;
QWaitCondition
initWaitCondition
;
protected:
protected:
void
run
();
void
run
();
public:
public:
PictureLoadingThread
(
const
QString
&
_picsPath
,
bool
_picDownload
,
QObject
*
parent
);
PictureLoadingThread
(
const
QString
&
_picsPath
,
bool
_picDownload
,
QObject
*
parent
);
~
PictureLoadingThread
();
~
PictureLoadingThread
();
PictureLoader
*
getPictureLoader
()
const
{
QMutexLocker
locker
(
&
initMutex
);
return
pictureLoader
;
}
PictureLoader
*
getPictureLoader
()
const
{
return
pictureLoader
;
}
void
waitForInit
();
signals:
signals:
void
imageLoaded
(
CardInfo
*
card
,
const
QImage
&
image
);
void
imageLoaded
(
CardInfo
*
card
,
const
QImage
&
image
);
};
};
...
...
oracle/sets.xml
View file @
1151077c
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<picture_url>
http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!cardid!
&
type=card
</picture_url>
<picture_url>
http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!cardid!
&
type=card
</picture_url>
<picture_url_hq>
http://mtgpics.chutography.com/!set!/!name!.full.jpg
</picture_url_hq>
<picture_url_hq>
http://mtgpics.chutography.com/!set!/!name!.full.jpg
</picture_url_hq>
<picture_url_st>
http://mtgpics.chutography.com/!set!/!name!.jpg
</picture_url_st>
<picture_url_st>
http://mtgpics.chutography.com/!set!/!name!.jpg
</picture_url_st>
<set_url>
http://gatherer.wizards.com/Pages/Search/Default.aspx?output=spoiler
&
method=text
&
set=[
"
!longname!
"
]
</set_url>
<set_url>
http://gatherer.wizards.com/Pages/Search/Default.aspx?output=spoiler
&
method=text
&
set=[
"
!longname!
"
]
&
special=true
</set_url>
<set
import=
"1"
>
<set
import=
"1"
>
<name>
ARB
</name>
<name>
ARB
</name>
<longname>
Alara Reborn
</longname>
<longname>
Alara Reborn
</longname>
...
@@ -24,6 +24,10 @@
...
@@ -24,6 +24,10 @@
<name>
AN
</name>
<name>
AN
</name>
<longname>
Arabian Nights
</longname>
<longname>
Arabian Nights
</longname>
</set>
</set>
<set
import=
"0"
>
<name>
AE
</name>
<longname>
Archenemy
</longname>
</set>
<set
import=
"1"
>
<set
import=
"1"
>
<name>
BOK
</name>
<name>
BOK
</name>
<longname>
Betrayers of Kamigawa
</longname>
<longname>
Betrayers of Kamigawa
</longname>
...
@@ -176,6 +180,10 @@
...
@@ -176,6 +180,10 @@
<name>
PLC
</name>
<name>
PLC
</name>
<longname>
Planar Chaos
</longname>
<longname>
Planar Chaos
</longname>
</set>
</set>
<set
import=
"0"
>
<name>
PCH
</name>
<longname>
Planechase
</longname>
</set>
<set
import=
"1"
>
<set
import=
"1"
>
<name>
PS
</name>
<name>
PS
</name>
<longname>
Planeshift
</longname>
<longname>
Planeshift
</longname>
...
@@ -296,6 +304,10 @@
...
@@ -296,6 +304,10 @@
<name>
US
</name>
<name>
US
</name>
<longname>
Urza's Saga
</longname>
<longname>
Urza's Saga
</longname>
</set>
</set>
<set
import=
"0"
>
<name>
VG
</name>
<longname>
Vanguard
</longname>
</set>
<set
import=
"1"
>
<set
import=
"1"
>
<name>
VI
</name>
<name>
VI
</name>
<longname>
Visions
</longname>
<longname>
Visions
</longname>
...
...
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