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
aa658f95
Commit
aa658f95
authored
Feb 09, 2016
by
Ira Aspen
Browse files
Gave error dlg a description of the error for the user.
parent
d078cf52
Changes
3
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/dlg_add_set_result.cpp
View file @
aa658f95
...
...
@@ -4,18 +4,19 @@
#include
<QPushButton>
#include
<QVBoxLayout>
DlgAddSetResult
::
DlgAddSetResult
(
QWidget
*
parent
,
bool
success
)
:
QDialog
(
parent
)
{
DlgAddSetResult
::
DlgAddSetResult
(
QWidget
*
parent
,
bool
success
,
QString
msg
)
:
QDialog
(
parent
)
{
status
=
new
QLabel
(
this
);
r
es
tart
=
new
QLabel
(
this
);
m
es
sage
=
new
QLabel
(
this
);
if
(
success
)
{
setWindowTitle
(
tr
(
"Success"
));
status
->
setText
(
QString
(
"Sets/cards added to Cockatrice."
));
r
es
tart
->
setText
(
QString
(
"You must restart Cockatrice to use the new sets/cards."
));
m
es
sage
->
setText
(
QString
(
"You must restart Cockatrice to use the new sets/cards."
));
}
else
{
setWindowTitle
(
tr
(
"Failed"
));
status
->
setText
(
QString
(
"Sets/cards failed to import."
));
message
->
setText
(
msg
);
}
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
this
);
...
...
@@ -25,7 +26,7 @@ DlgAddSetResult::DlgAddSetResult(QWidget *parent, bool success) : QDialog(parent
QVBoxLayout
*
parentLayout
=
new
QVBoxLayout
(
this
);
parentLayout
->
addWidget
(
status
);
parentLayout
->
addWidget
(
r
es
tart
);
parentLayout
->
addWidget
(
m
es
sage
);
parentLayout
->
addWidget
(
buttonBox
);
setLayout
(
parentLayout
);
...
...
cockatrice/src/dlg_add_set_result.h
View file @
aa658f95
...
...
@@ -3,15 +3,16 @@
#include
<QDialog>
#include
<QLabel>
#include
<QString>
class
DlgAddSetResult
:
public
QDialog
{
Q_OBJECT
public:
DlgAddSetResult
(
QWidget
*
parent
,
bool
success
);
DlgAddSetResult
(
QWidget
*
parent
,
bool
success
,
QString
msg
);
private
slots
:
void
closeDialog
();
private:
QLabel
*
status
,
*
r
es
tart
;
QLabel
*
status
,
*
m
es
sage
;
QPushButton
*
ok
;
};
...
...
cockatrice/src/tab_deck_editor.cpp
View file @
aa658f95
...
...
@@ -885,16 +885,23 @@ void TabDeckEditor::actAddCustomSet()
if
(
!
dialog
.
exec
())
return
;
QString
fileName
=
dialog
.
selectedFiles
().
at
(
0
);
if
(
!
QFile
::
exists
(
fileName
))
{
DlgAddSetResult
dlg
(
this
,
false
,
QString
(
"Selected file cannot be found."
));
dlg
.
exec
();
return
;
}
QDir
dir
(
dataDir
+
"/customsets"
);
int
nextPrefix
=
getNextCustomSetPrefix
(
dir
);
QString
fileName
=
dialog
.
selectedFiles
().
at
(
0
);
bool
res
=
QFile
::
copy
(
fileName
,
dir
.
absolutePath
()
+
"/"
+
(
nextPrefix
>
9
?
""
:
"0"
)
+
QString
::
number
(
nextPrefix
)
+
"."
+
QFileInfo
(
fileName
).
fileName
()
);
DlgAddSetResult
dlg
(
this
,
res
);
DlgAddSetResult
dlg
(
this
,
res
,
QString
()
);
dlg
.
exec
();
}
...
...
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