Added confirmation dialogue when set added.
This commit is contained in:
parent
c914395236
commit
54a759497f
4 changed files with 61 additions and 0 deletions
|
@ -7,6 +7,7 @@ PROJECT(cockatrice)
|
|||
SET(cockatrice_SOURCES
|
||||
src/abstractcounter.cpp
|
||||
src/counter_general.cpp
|
||||
src/dlg_add_set.cpp
|
||||
src/dlg_creategame.cpp
|
||||
src/dlg_filter_games.cpp
|
||||
src/dlg_connect.cpp
|
||||
|
|
39
cockatrice/src/dlg_add_set.cpp
Normal file
39
cockatrice/src/dlg_add_set.cpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include "dlg_add_set.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
DlgAddSet::DlgAddSet(QWidget *parent, bool success) : QDialog(parent) {
|
||||
status = new QLabel(this);
|
||||
restart = new QLabel(this);
|
||||
|
||||
if (success) {
|
||||
setWindowTitle(tr("Success"));
|
||||
status->setText(QString("Set added to Cockatrice."));
|
||||
restart->setText(QString("You must restart to use your new set."));
|
||||
}
|
||||
else {
|
||||
setWindowTitle(tr("Failed"));
|
||||
status->setText(QString("Set failed to import."));
|
||||
}
|
||||
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
|
||||
ok = new QPushButton(tr("Ok"), this);
|
||||
buttonBox->addButton(ok, QDialogButtonBox::AcceptRole);
|
||||
connect(ok, SIGNAL(clicked()), this, SLOT(closeDialog()));
|
||||
|
||||
QVBoxLayout *parentLayout = new QVBoxLayout(this);
|
||||
parentLayout->addWidget(status);
|
||||
parentLayout->addWidget(restart);
|
||||
parentLayout->addWidget(buttonBox);
|
||||
|
||||
setLayout(parentLayout);
|
||||
|
||||
exec();
|
||||
}
|
||||
|
||||
void DlgAddSet::closeDialog()
|
||||
{
|
||||
accept();
|
||||
}
|
18
cockatrice/src/dlg_add_set.h
Normal file
18
cockatrice/src/dlg_add_set.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef DLG_ADD_SET_H
|
||||
#define DLG_ADD_SET_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
|
||||
class DlgAddSet : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DlgAddSet(QWidget *parent, bool success);
|
||||
private slots:
|
||||
void closeDialog();
|
||||
private:
|
||||
QLabel *status, *restart;
|
||||
QPushButton *ok;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -32,6 +32,7 @@
|
|||
#include "cardinfowidget.h"
|
||||
#include "dlg_load_deck_from_clipboard.h"
|
||||
#include "dlg_edit_tokens.h"
|
||||
#include "dlg_add_set.h"
|
||||
#include "main.h"
|
||||
#include "settingscache.h"
|
||||
#include "priceupdater.h"
|
||||
|
@ -904,6 +905,8 @@ void TabDeckEditor::actAddCustomSet()
|
|||
fileName, dir.absolutePath() + "/" + (maxIndex > 9 ? "" : "0") +
|
||||
QString::number(maxIndex) + "." + QFileInfo(fileName).fileName()
|
||||
);
|
||||
|
||||
DlgAddSet dlg(this, res);
|
||||
}
|
||||
|
||||
void TabDeckEditor::actEditSets()
|
||||
|
|
Loading…
Reference in a new issue