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
be7efa98
Commit
be7efa98
authored
Aug 23, 2015
by
marco
Browse files
Fix relative path for image download & settings
parent
1e2d5b06
Changes
4
Show whitespace changes
Inline
Side-by-side
cockatrice/src/main.cpp
View file @
be7efa98
...
...
@@ -154,10 +154,14 @@ int main(int argc, char *argv[])
qsrand
(
QDateTime
::
currentDateTime
().
toTime_t
());
#ifdef PORTABLE_BUILD
const
QString
dataDir
=
"data/"
;
#else
#if QT_VERSION < 0x050000
const
QString
dataDir
=
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DataLocation
);
#else
const
QString
dataDir
=
QStandardPaths
::
standardLocations
(
QStandardPaths
::
DataLocation
).
first
();
#endif
#endif
if
(
!
db
->
getLoadSuccess
())
if
(
!
db
->
loadCardDatabase
(
dataDir
+
"/cards.xml"
))
...
...
cockatrice/src/settingscache.cpp
View file @
be7efa98
#include
"settingscache.h"
#include
<QSettings>
#include
<QFile>
#if QT_VERSION >= 0x050000
#include
<QStandardPaths>
#else
...
...
@@ -9,7 +10,7 @@
QString
SettingsCache
::
getSettingsPath
()
{
QString
file
=
""
;
QString
file
=
"
settings/
"
;
#ifndef PORTABLE_BUILD
#if QT_VERSION >= 0x050000
...
...
@@ -17,8 +18,8 @@ QString SettingsCache::getSettingsPath()
#else
file
=
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DataLocation
);
#endif
#endif
file
.
append
(
"/settings/"
);
#endif
return
file
;
}
...
...
cockatrice/src/settingscache.h
View file @
be7efa98
...
...
@@ -114,10 +114,10 @@ private:
bool
spectatorsCanTalk
;
bool
spectatorsCanSeeEverything
;
int
keepalive
;
QString
getSettingsPath
();
void
translateLegacySettings
();
public:
SettingsCache
();
QString
getSettingsPath
();
const
QByteArray
&
getMainWindowGeometry
()
const
{
return
mainWindowGeometry
;
}
QString
getLang
()
const
{
return
lang
;
}
QString
getDeckPath
()
const
{
return
deckPath
;
}
...
...
oracle/src/oraclewizard.cpp
View file @
be7efa98
...
...
@@ -45,19 +45,19 @@
OracleWizard
::
OracleWizard
(
QWidget
*
parent
)
:
QWizard
(
parent
)
{
settings
=
new
QSettings
(
this
);
settings
=
new
QSettings
(
settingsCache
->
getSettingsPath
()
+
"global.ini"
,
QSettings
::
IniFormat
,
this
);
connect
(
settingsCache
,
SIGNAL
(
langChanged
()),
this
,
SLOT
(
updateLanguage
()));
QString
dataDir
;
#ifndef PORTABLE_BUILD
#if QT_VERSION < 0x050000
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DataLocation
)
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DataLocation
)
;
#else
QStandardPaths
::
standardLocations
(
QStandardPaths
::
DataLocation
).
first
();
#endif
#else
dataDir
.
append
(
"data
/
"
);
dataDir
.
append
(
"
../cockatrice/
data"
);
#endif
importer
=
new
OracleImporter
(
dataDir
,
this
);
...
...
@@ -517,11 +517,17 @@ bool SaveSetsPage::validatePage()
dataDir
=
QStandardPaths
::
standardLocations
(
QStandardPaths
::
DataLocation
).
first
();
#endif
#else
dataDir
=
"data
/
"
;
dataDir
=
"
../cockatrice/
data"
;
#endif
QSettings
*
settings
=
new
QSettings
(
this
);
#ifdef PORTABLE_BUILD
QSettings
*
settings
=
new
QSettings
(
"../cockatrice/settings/global.ini"
,
QSettings
::
IniFormat
,
this
);
QString
defaultPath
=
"../cockatrice/data/cards.xml"
;
settings
->
setValue
(
"paths/carddatabase"
,
"data/cards.xml"
);
#else
QSettings
*
settings
=
new
QSettings
(
settingsCache
->
getSettingsPath
()
+
"global.ini"
,
QSettings
::
IniFormat
,
this
);
QString
defaultPath
=
settings
->
value
(
"paths/carddatabase"
).
toString
();
#endif
QString
windowName
=
tr
(
"Save card database"
);
QString
fileType
=
tr
(
"XML; card database (*.xml)"
);
...
...
@@ -532,6 +538,7 @@ bool SaveSetsPage::validatePage()
fileName
=
dataDir
+
"/cards.xml"
;
else
fileName
=
QFileDialog
::
getSaveFileName
(
this
,
windowName
,
dataDir
+
"/cards.xml"
,
fileType
);
settings
->
setValue
(
"paths/carddatabase"
,
fileName
);
}
else
{
...
...
@@ -725,10 +732,18 @@ bool SaveTokensPage::validatePage()
dataDir
=
QStandardPaths
::
standardLocations
(
QStandardPaths
::
DataLocation
).
first
();
#endif
#else
dataDir
=
"data
/
"
;
dataDir
=
"
../cockatrice/
data"
;
#endif
QSettings
*
settings
=
new
QSettings
(
this
);
#ifdef PORTABLE_BUILD
QSettings
*
settings
=
new
QSettings
(
"../cockatrice/settings/global.ini"
,
QSettings
::
IniFormat
,
this
);
QString
defaultPath
=
"../cockatrice/data/tokens.xml"
;
settings
->
setValue
(
"paths/tokendatabase"
,
"data/tokens.xml"
);
#else
QSettings
*
settings
=
new
QSettings
(
settingsCache
->
getSettingsPath
()
+
"global.ini"
,
QSettings
::
IniFormat
,
this
);
QString
defaultPath
=
settings
->
value
(
"paths/tokendatabase"
).
toString
();
#endif
QString
windowName
=
tr
(
"Save token database"
);
QString
fileType
=
tr
(
"XML; token database (*.xml)"
);
...
...
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