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
b4436f24
Commit
b4436f24
authored
Oct 15, 2010
by
Max-Wilhelm Bruker
Browse files
minor oracle improvement
parent
dd7f8724
Changes
4
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/carddatabase.cpp
View file @
b4436f24
...
@@ -460,7 +460,8 @@ bool CardDatabase::loadFromFile(const QString &fileName)
...
@@ -460,7 +460,8 @@ bool CardDatabase::loadFromFile(const QString &fileName)
bool
CardDatabase
::
saveToFile
(
const
QString
&
fileName
)
bool
CardDatabase
::
saveToFile
(
const
QString
&
fileName
)
{
{
QFile
file
(
fileName
);
QFile
file
(
fileName
);
file
.
open
(
QIODevice
::
WriteOnly
);
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
))
return
false
;
QXmlStreamWriter
xml
(
&
file
);
QXmlStreamWriter
xml
(
&
file
);
xml
.
setAutoFormatting
(
true
);
xml
.
setAutoFormatting
(
true
);
...
...
oracle/src/oracleimporter.cpp
View file @
b4436f24
...
@@ -266,7 +266,6 @@ void OracleImporter::httpRequestFinished(int requestId, bool error)
...
@@ -266,7 +266,6 @@ void OracleImporter::httpRequestFinished(int requestId, bool error)
++
setIndex
;
++
setIndex
;
if
(
setIndex
==
setsToDownload
.
size
())
{
if
(
setIndex
==
setsToDownload
.
size
())
{
saveToFile
(
dataDir
+
"/cards.xml"
);
emit
setIndexChanged
(
cards
,
setIndex
,
QString
());
emit
setIndexChanged
(
cards
,
setIndex
,
QString
());
setIndex
=
-
1
;
setIndex
=
-
1
;
}
else
{
}
else
{
...
...
oracle/src/oracleimporter.h
View file @
b4436f24
...
@@ -49,6 +49,7 @@ public:
...
@@ -49,6 +49,7 @@ public:
int
startDownload
();
int
startDownload
();
int
importTextSpoiler
(
CardSet
*
set
,
const
QByteArray
&
data
);
int
importTextSpoiler
(
CardSet
*
set
,
const
QByteArray
&
data
);
QList
<
SetToDownload
>
&
getSets
()
{
return
allSets
;
}
QList
<
SetToDownload
>
&
getSets
()
{
return
allSets
;
}
const
QString
&
getDataDir
()
const
{
return
dataDir
;
}
};
};
#endif
#endif
oracle/src/window_main.cpp
View file @
b4436f24
...
@@ -153,6 +153,23 @@ void WindowMain::updateTotalProgress(int cardsImported, int setIndex, const QStr
...
@@ -153,6 +153,23 @@ void WindowMain::updateTotalProgress(int cardsImported, int setIndex, const QStr
totalProgressBar
->
setValue
(
setIndex
);
totalProgressBar
->
setValue
(
setIndex
);
if
(
nextSetName
.
isEmpty
())
{
if
(
nextSetName
.
isEmpty
())
{
QMessageBox
::
information
(
this
,
tr
(
"Oracle importer"
),
tr
(
"Import finished: %1 cards."
).
arg
(
importer
->
getCardList
().
size
()));
QMessageBox
::
information
(
this
,
tr
(
"Oracle importer"
),
tr
(
"Import finished: %1 cards."
).
arg
(
importer
->
getCardList
().
size
()));
bool
ok
=
false
;
QString
savePath
=
importer
->
getDataDir
()
+
"/cards.xml"
;
do
{
QString
fileName
;
if
(
savePath
.
isEmpty
())
fileName
=
QFileDialog
::
getSaveFileName
(
this
,
tr
(
"Save card database"
),
importer
->
getDataDir
()
+
"/cards.xml"
,
tr
(
"XML card database (*.xml)"
));
else
{
fileName
=
savePath
;
savePath
.
clear
();
}
if
(
fileName
.
isEmpty
())
qApp
->
quit
();
if
(
importer
->
saveToFile
(
fileName
))
ok
=
true
;
else
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"The file could not be saved to the desired location."
));
}
while
(
!
ok
);
qApp
->
quit
();
qApp
->
quit
();
}
else
{
}
else
{
nextSetLabel2
->
setText
(
nextSetName
);
nextSetLabel2
->
setText
(
nextSetName
);
...
...
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