diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 03573cc6..155cdcb4 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -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 diff --git a/cockatrice/src/dlg_add_set.cpp b/cockatrice/src/dlg_add_set.cpp new file mode 100644 index 00000000..2d37d6c6 --- /dev/null +++ b/cockatrice/src/dlg_add_set.cpp @@ -0,0 +1,39 @@ +#include "dlg_add_set.h" + +#include +#include +#include + +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(); +} \ No newline at end of file diff --git a/cockatrice/src/dlg_add_set.h b/cockatrice/src/dlg_add_set.h new file mode 100644 index 00000000..cd8e4d32 --- /dev/null +++ b/cockatrice/src/dlg_add_set.h @@ -0,0 +1,18 @@ +#ifndef DLG_ADD_SET_H +#define DLG_ADD_SET_H + +#include +#include + +class DlgAddSet : public QDialog { +Q_OBJECT +public: + DlgAddSet(QWidget *parent, bool success); +private slots: + void closeDialog(); +private: + QLabel *status, *restart; + QPushButton *ok; +}; + +#endif \ No newline at end of file diff --git a/cockatrice/src/tab_deck_editor.cpp b/cockatrice/src/tab_deck_editor.cpp index b8448440..a1426632 100644 --- a/cockatrice/src/tab_deck_editor.cpp +++ b/cockatrice/src/tab_deck_editor.cpp @@ -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()