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
924337ee
Commit
924337ee
authored
May 14, 2015
by
Fabio Bas
Browse files
revert
0b4701c4
parent
76422854
Changes
3
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/main.cpp
View file @
924337ee
...
...
@@ -164,42 +164,6 @@ 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."
;
#ifdef Q_OS_MAC
if
(
settingsCache
->
getHandBgPath
().
isEmpty
()
&&
settingsCache
->
getStackBgPath
().
isEmpty
()
&&
settingsCache
->
getTableBgPath
().
isEmpty
()
&&
settingsCache
->
getPlayerBgPath
().
isEmpty
())
{
QString
srcDir
=
QLibraryInfo
::
location
(
QLibraryInfo
::
DataPath
);
QString
destDir
=
dataDir
+
"/zonebg"
;
QDir
tmpDir
(
destDir
);
if
(
!
tmpDir
.
exists
())
{
// try to install the default images for the current user and set the settigs value
settingsCache
->
copyPath
(
srcDir
+
"/zonebg"
,
destDir
);
settingsCache
->
setHandBgPath
(
destDir
+
"/fabric_green.png"
);
settingsCache
->
setStackBgPath
(
destDir
+
"/fabric_red.png"
);
settingsCache
->
setTableBgPath
(
destDir
+
"/fabric_blue.png"
);
settingsCache
->
setPlayerBgPath
(
destDir
+
"/fabric_gray.png"
);
}
}
if
(
settingsCache
->
getSoundPath
().
isEmpty
())
{
QString
srcDir
=
QLibraryInfo
::
location
(
QLibraryInfo
::
DataPath
);
QString
destDir
=
dataDir
+
"/sounds"
;
QDir
tmpDir
(
destDir
);
if
(
!
tmpDir
.
exists
())
{
// try to install the default sounds for the current user and set the settigs value
settingsCache
->
copyPath
(
srcDir
+
"/sounds"
,
destDir
);
settingsCache
->
setSoundPath
(
destDir
);
}
}
#endif
if
(
!
settingsValid
()
||
db
->
getLoadStatus
()
!=
Ok
)
{
qDebug
(
"main(): invalid settings or load status"
);
...
...
cockatrice/src/settingscache.cpp
View file @
924337ee
#include
"settingscache.h"
#include
<QSettings>
#include
<QDebug>
#include
<QDir>
SettingsCache
::
SettingsCache
()
{
...
...
@@ -381,31 +379,3 @@ void SettingsCache::setPixmapCacheSize(const int _pixmapCacheSize)
settings
->
setValue
(
"personal/pixmapCacheSize"
,
pixmapCacheSize
);
emit
pixmapCacheSizeChanged
(
pixmapCacheSize
);
}
void
SettingsCache
::
copyPath
(
const
QString
&
src
,
const
QString
&
dst
)
{
// test source && return if inexistent
QDir
dir
(
src
);
if
(
!
dir
.
exists
())
return
;
// test destination && create if inexistent
QDir
tmpDir
(
dst
);
if
(
!
tmpDir
.
exists
())
{
tmpDir
.
setPath
(
QDir
::
rootPath
());
if
(
!
tmpDir
.
mkdir
(
dst
)
&&
!
tmpDir
.
exists
())
{
// TODO: this is probably not good.
qDebug
()
<<
"copyPath(): Failed to create dir: "
<<
dst
;
}
}
foreach
(
QString
d
,
dir
.
entryList
(
QDir
::
Dirs
|
QDir
::
NoDotAndDotDot
))
{
QString
dst_path
=
dst
+
QDir
::
separator
()
+
d
;
dir
.
mkpath
(
dst_path
);
copyPath
(
src
+
QDir
::
separator
()
+
d
,
dst_path
);
}
foreach
(
QString
f
,
dir
.
entryList
(
QDir
::
Files
))
{
QFile
::
copy
(
src
+
QDir
::
separator
()
+
f
,
dst
+
QDir
::
separator
()
+
f
);
}
}
cockatrice/src/settingscache.h
View file @
924337ee
...
...
@@ -129,7 +129,6 @@ public:
QString
getPicUrlHq
()
const
{
return
picUrlHq
;
}
QString
getPicUrlFallback
()
const
{
return
picUrlFallback
;
}
QString
getPicUrlHqFallback
()
const
{
return
picUrlHqFallback
;
}
void
copyPath
(
const
QString
&
src
,
const
QString
&
dst
);
bool
getAutoConnect
()
const
{
return
attemptAutoConnect
;
}
int
getPixmapCacheSize
()
const
{
return
pixmapCacheSize
;
}
bool
getScaleCards
()
const
{
return
scaleCards
;
}
...
...
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