Add options to include/exclude set name and collector number during clipboard import/export. (#5482)

* Add options to include/exclude set name and collector number during clipboard import/export.

* Missing parentheses in action label.

* Revert the silliest lint in the world.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2025-01-17 03:38:01 +01:00 committed by GitHub
parent 315c224f24
commit 80165c28a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 108 additions and 17 deletions

View file

@ -4,6 +4,7 @@
#include "../settings/cache_settings.h"
#include <QApplication>
#include <QCheckBox>
#include <QClipboard>
#include <QDialogButtonBox>
#include <QMessageBox>
@ -24,9 +25,16 @@ DlgLoadDeckFromClipboard::DlgLoadDeckFromClipboard(QWidget *parent) : QDialog(pa
connect(buttonBox, SIGNAL(accepted()), this, SLOT(actOK()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
loadSetNameAndNumberCheckBox = new QCheckBox(tr("Parse Set Name and Number (if available)"));
loadSetNameAndNumberCheckBox->setChecked(true);
auto *buttonLayout = new QHBoxLayout;
buttonLayout->addWidget(loadSetNameAndNumberCheckBox);
buttonLayout->addWidget(buttonBox);
auto *mainLayout = new QVBoxLayout;
mainLayout->addWidget(contentsEdit);
mainLayout->addWidget(buttonBox);
mainLayout->addLayout(buttonLayout);
setLayout(mainLayout);
@ -65,7 +73,11 @@ void DlgLoadDeckFromClipboard::actOK()
}
} else if (deckLoader->loadFromStream_Plain(stream)) {
deckList = deckLoader;
deckList->resolveSetNameAndNumberToProviderID();
if (loadSetNameAndNumberCheckBox->isChecked()) {
deckList->resolveSetNameAndNumberToProviderID();
} else {
deckList->clearSetNamesAndNumbers();
}
accept();
} else {
QMessageBox::critical(this, tr("Error"), tr("Invalid deck list."));