mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-13 17:44:48 -07:00
Add a dialog to prompt user to convert to .cod format if trying to apply tags to a .txt deck. (#5514)
* Add a dialog to prompt user to convert to .cod format if trying to apply tags to a .txt deck. * Lint mocks. * Address comments, move dialog to appropriate folder. * Unlint. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
4e96157091
commit
ce416df3fb
14 changed files with 229 additions and 6 deletions
40
cockatrice/src/dialogs/dlg_convert_deck_to_cod_format.cpp
Normal file
40
cockatrice/src/dialogs/dlg_convert_deck_to_cod_format.cpp
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#include "dlg_convert_deck_to_cod_format.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
DialogConvertDeckToCodFormat::DialogConvertDeckToCodFormat(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
layout = new QVBoxLayout(this);
|
||||
label = new QLabel();
|
||||
layout->addWidget(label);
|
||||
|
||||
dontAskAgainCheckbox = new QCheckBox(this);
|
||||
layout->addWidget(dontAskAgainCheckbox);
|
||||
|
||||
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
||||
layout->addWidget(buttonBox);
|
||||
|
||||
connect(buttonBox, &QDialogButtonBox::accepted, this, [this]() { accept(); });
|
||||
|
||||
connect(buttonBox, &QDialogButtonBox::rejected, this, [this]() { reject(); });
|
||||
|
||||
setLayout(layout);
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
void DialogConvertDeckToCodFormat::retranslateUi()
|
||||
{
|
||||
setWindowTitle(tr("Deck Format Conversion"));
|
||||
label->setText(
|
||||
tr("You tried to add a tag to a .txt format deck.\n Tags can only be added to .cod format decks.\n Do "
|
||||
"you want to convert the deck to the .cod format?"));
|
||||
dontAskAgainCheckbox->setText(tr("Remember and automatically apply choice in the future"));
|
||||
}
|
||||
|
||||
bool DialogConvertDeckToCodFormat::dontAskAgain() const
|
||||
{
|
||||
return dontAskAgainCheckbox->isChecked();
|
||||
}
|
||||
29
cockatrice/src/dialogs/dlg_convert_deck_to_cod_format.h
Normal file
29
cockatrice/src/dialogs/dlg_convert_deck_to_cod_format.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef DIALOG_CONVERT_DECK_TO_COD_FORMAT_H
|
||||
#define DIALOG_CONVERT_DECK_TO_COD_FORMAT_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
class DialogConvertDeckToCodFormat : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogConvertDeckToCodFormat(QWidget *parent);
|
||||
void retranslateUi();
|
||||
|
||||
bool dontAskAgain() const;
|
||||
|
||||
private:
|
||||
QVBoxLayout *layout;
|
||||
QLabel *label;
|
||||
QCheckBox *dontAskAgainCheckbox;
|
||||
QDialogButtonBox *buttonBox;
|
||||
|
||||
Q_DISABLE_COPY(DialogConvertDeckToCodFormat)
|
||||
};
|
||||
|
||||
#endif // DIALOG_CONVERT_DECK_TO_COD_FORMAT_H
|
||||
|
|
@ -573,6 +573,15 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
|||
connect(&useTearOffMenusCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
[](const QT_STATE_CHANGED_T state) { SettingsCache::instance().setUseTearOffMenus(state == Qt::Checked); });
|
||||
|
||||
visualDeckStoragePromptForConversionCheckBox.setChecked(
|
||||
SettingsCache::instance().getVisualDeckStoragePromptForConversion());
|
||||
connect(&visualDeckStoragePromptForConversionCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDeckStoragePromptForConversion);
|
||||
|
||||
visualDeckStorageAlwaysConvertCheckBox.setChecked(SettingsCache::instance().getVisualDeckStorageAlwaysConvert());
|
||||
connect(&visualDeckStorageAlwaysConvertCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDeckStorageAlwaysConvert);
|
||||
|
||||
auto *generalGrid = new QGridLayout;
|
||||
generalGrid->addWidget(&doubleClickToPlayCheckBox, 0, 0);
|
||||
generalGrid->addWidget(&clickPlaysAllSelectedCheckBox, 1, 0);
|
||||
|
|
@ -580,6 +589,8 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
|||
generalGrid->addWidget(&closeEmptyCardViewCheckBox, 3, 0);
|
||||
generalGrid->addWidget(&annotateTokensCheckBox, 4, 0);
|
||||
generalGrid->addWidget(&useTearOffMenusCheckBox, 5, 0);
|
||||
generalGrid->addWidget(&visualDeckStoragePromptForConversionCheckBox, 6, 0);
|
||||
generalGrid->addWidget(&visualDeckStorageAlwaysConvertCheckBox, 7, 0);
|
||||
|
||||
generalGroupBox = new QGroupBox;
|
||||
generalGroupBox->setLayout(generalGrid);
|
||||
|
|
@ -658,6 +669,8 @@ void UserInterfaceSettingsPage::retranslateUi()
|
|||
closeEmptyCardViewCheckBox.setText(tr("Close card view window when last card is removed"));
|
||||
annotateTokensCheckBox.setText(tr("Annotate card text on tokens"));
|
||||
useTearOffMenusCheckBox.setText(tr("Use tear-off menus, allowing right click menus to persist on screen"));
|
||||
visualDeckStoragePromptForConversionCheckBox.setText(tr("Prompt before converting .txt decks to .cod format"));
|
||||
visualDeckStorageAlwaysConvertCheckBox.setText(tr("Always convert if not prompted"));
|
||||
notificationsGroupBox->setTitle(tr("Notifications settings"));
|
||||
notificationsEnabledCheckBox.setText(tr("Enable notifications in taskbar"));
|
||||
specNotificationsEnabledCheckBox.setText(tr("Notify in the taskbar for game events while you are spectating"));
|
||||
|
|
|
|||
|
|
@ -142,6 +142,8 @@ private:
|
|||
QCheckBox closeEmptyCardViewCheckBox;
|
||||
QCheckBox annotateTokensCheckBox;
|
||||
QCheckBox useTearOffMenusCheckBox;
|
||||
QCheckBox visualDeckStoragePromptForConversionCheckBox;
|
||||
QCheckBox visualDeckStorageAlwaysConvertCheckBox;
|
||||
QCheckBox tapAnimationCheckBox;
|
||||
QCheckBox openDeckInNewTabCheckBox;
|
||||
QLabel rewindBufferingMsLabel;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue