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
8b32a101
Commit
8b32a101
authored
Aug 10, 2014
by
Gavin Bisesi
Browse files
Merge pull request #265 from pliu037/clear-downloaded-pics
Clear downloaded images from settings
parents
4e3d6a14
d3459aab
Changes
2
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/dlg_settings.cpp
View file @
8b32a101
...
@@ -42,6 +42,9 @@ GeneralSettingsPage::GeneralSettingsPage()
...
@@ -42,6 +42,9 @@ GeneralSettingsPage::GeneralSettingsPage()
picDownloadCheckBox
=
new
QCheckBox
;
picDownloadCheckBox
=
new
QCheckBox
;
picDownloadCheckBox
->
setChecked
(
settingsCache
->
getPicDownload
());
picDownloadCheckBox
->
setChecked
(
settingsCache
->
getPicDownload
());
QPushButton
*
clearDownloadedPicsButton
=
new
QPushButton
(
tr
(
"Reset/Clear Downloaded Pictures"
));
connect
(
clearDownloadedPicsButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
clearDownloadedPicsButtonClicked
()));
picDownloadHqCheckBox
=
new
QCheckBox
;
picDownloadHqCheckBox
=
new
QCheckBox
;
picDownloadHqCheckBox
->
setChecked
(
settingsCache
->
getPicDownloadHq
());
picDownloadHqCheckBox
->
setChecked
(
settingsCache
->
getPicDownloadHq
());
...
@@ -55,6 +58,7 @@ GeneralSettingsPage::GeneralSettingsPage()
...
@@ -55,6 +58,7 @@ GeneralSettingsPage::GeneralSettingsPage()
personalGrid
->
addWidget
(
languageBox
,
0
,
1
);
personalGrid
->
addWidget
(
languageBox
,
0
,
1
);
personalGrid
->
addWidget
(
picDownloadCheckBox
,
1
,
0
,
1
,
2
);
personalGrid
->
addWidget
(
picDownloadCheckBox
,
1
,
0
,
1
,
2
);
personalGrid
->
addWidget
(
picDownloadHqCheckBox
,
2
,
0
,
1
,
2
);
personalGrid
->
addWidget
(
picDownloadHqCheckBox
,
2
,
0
,
1
,
2
);
personalGrid
->
addWidget
(
clearDownloadedPicsButton
,
3
,
0
,
1
,
1
);
personalGroupBox
=
new
QGroupBox
;
personalGroupBox
=
new
QGroupBox
;
personalGroupBox
->
setLayout
(
personalGrid
);
personalGroupBox
->
setLayout
(
personalGrid
);
...
@@ -161,6 +165,30 @@ void GeneralSettingsPage::picsPathButtonClicked()
...
@@ -161,6 +165,30 @@ void GeneralSettingsPage::picsPathButtonClicked()
settingsCache
->
setPicsPath
(
path
);
settingsCache
->
setPicsPath
(
path
);
}
}
void
GeneralSettingsPage
::
clearDownloadedPicsButtonClicked
()
{
QString
picsPath
=
settingsCache
->
getPicsPath
()
+
"/downloadedPics/"
;
QStringList
dirs
=
QDir
(
picsPath
).
entryList
(
QDir
::
AllDirs
|
QDir
::
NoDotAndDotDot
);
bool
outerSuccessRemove
=
true
;
for
(
int
i
=
0
;
i
<
dirs
.
length
();
i
++
)
{
QString
currentPath
=
picsPath
+
dirs
.
at
(
i
)
+
"/"
;
QStringList
files
=
QDir
(
currentPath
).
entryList
(
QDir
::
Files
);
bool
innerSuccessRemove
=
true
;
for
(
int
j
=
0
;
j
<
files
.
length
();
j
++
)
if
(
!
QDir
(
currentPath
).
remove
(
files
.
at
(
j
)))
{
qDebug
()
<<
"Failed to remove "
+
currentPath
.
toUtf8
()
+
files
.
at
(
j
).
toUtf8
();
outerSuccessRemove
=
false
;
innerSuccessRemove
=
false
;
}
if
(
innerSuccessRemove
)
QDir
(
picsPath
).
rmdir
(
dirs
.
at
(
i
));
}
if
(
outerSuccessRemove
)
QMessageBox
::
information
(
this
,
tr
(
"Success"
),
tr
(
"Downloaded card pictures have been reset."
));
else
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"One or more downloaded card pictures could not be cleared."
));
}
void
GeneralSettingsPage
::
cardDatabasePathButtonClicked
()
void
GeneralSettingsPage
::
cardDatabasePathButtonClicked
()
{
{
QString
path
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Choose path"
));
QString
path
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Choose path"
));
...
@@ -196,8 +224,8 @@ void GeneralSettingsPage::retranslateUi()
...
@@ -196,8 +224,8 @@ void GeneralSettingsPage::retranslateUi()
deckPathLabel
->
setText
(
tr
(
"Decks directory:"
));
deckPathLabel
->
setText
(
tr
(
"Decks directory:"
));
replaysPathLabel
->
setText
(
tr
(
"Replays directory:"
));
replaysPathLabel
->
setText
(
tr
(
"Replays directory:"
));
picsPathLabel
->
setText
(
tr
(
"Pictures directory:"
));
picsPathLabel
->
setText
(
tr
(
"Pictures directory:"
));
cardDatabasePathLabel
->
setText
(
tr
(
"
Path to c
ard database:"
));
cardDatabasePathLabel
->
setText
(
tr
(
"
C
ard database:"
));
tokenDatabasePathLabel
->
setText
(
tr
(
"
Path to t
oken database:"
));
tokenDatabasePathLabel
->
setText
(
tr
(
"
T
oken database:"
));
}
}
AppearanceSettingsPage
::
AppearanceSettingsPage
()
AppearanceSettingsPage
::
AppearanceSettingsPage
()
...
@@ -335,11 +363,11 @@ AppearanceSettingsPage::AppearanceSettingsPage()
...
@@ -335,11 +363,11 @@ AppearanceSettingsPage::AppearanceSettingsPage()
void
AppearanceSettingsPage
::
retranslateUi
()
void
AppearanceSettingsPage
::
retranslateUi
()
{
{
zoneBgGroupBox
->
setTitle
(
tr
(
"Zone background pictures"
));
zoneBgGroupBox
->
setTitle
(
tr
(
"Zone background pictures"
));
handBgLabel
->
setText
(
tr
(
"
Path to h
and background:"
));
handBgLabel
->
setText
(
tr
(
"
H
and background:"
));
stackBgLabel
->
setText
(
tr
(
"
Path to s
tack background:"
));
stackBgLabel
->
setText
(
tr
(
"
S
tack background:"
));
tableBgLabel
->
setText
(
tr
(
"
Path to t
able background:"
));
tableBgLabel
->
setText
(
tr
(
"
T
able background:"
));
playerAreaBgLabel
->
setText
(
tr
(
"P
ath to p
layer info background:"
));
playerAreaBgLabel
->
setText
(
tr
(
"Player info background:"
));
cardBackPicturePathLabel
->
setText
(
tr
(
"
Path to picture of c
ard back:"
));
cardBackPicturePathLabel
->
setText
(
tr
(
"
C
ard back:"
));
cardsGroupBox
->
setTitle
(
tr
(
"Card rendering"
));
cardsGroupBox
->
setTitle
(
tr
(
"Card rendering"
));
displayCardNamesCheckBox
->
setText
(
tr
(
"Display card names on cards having a picture"
));
displayCardNamesCheckBox
->
setText
(
tr
(
"Display card names on cards having a picture"
));
...
...
cockatrice/src/dlg_settings.h
View file @
8b32a101
...
@@ -31,6 +31,7 @@ private slots:
...
@@ -31,6 +31,7 @@ private slots:
void
deckPathButtonClicked
();
void
deckPathButtonClicked
();
void
replaysPathButtonClicked
();
void
replaysPathButtonClicked
();
void
picsPathButtonClicked
();
void
picsPathButtonClicked
();
void
clearDownloadedPicsButtonClicked
();
void
cardDatabasePathButtonClicked
();
void
cardDatabasePathButtonClicked
();
void
tokenDatabasePathButtonClicked
();
void
tokenDatabasePathButtonClicked
();
void
languageBoxChanged
(
int
index
);
void
languageBoxChanged
(
int
index
);
...
...
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