Support exporting to decklist.xyz website (#5756)

* Support exporting to decklist.xyz

* fix typo
This commit is contained in:
RickyRister 2025-03-20 17:28:15 -07:00 committed by GitHub
parent be28d50997
commit 99376e75d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 55 additions and 14 deletions

View file

@ -455,17 +455,12 @@ void AbstractTabDeckEditor::actPrintDeck()
dlg->exec();
}
// Action called when export deck to decklist menu item is pressed.
void AbstractTabDeckEditor::actExportDeckDecklist()
void AbstractTabDeckEditor::exportToDecklistWebsite(DeckLoader::DecklistWebsite website)
{
// Get the decklist class for the deck.
DeckLoader *const deck = getDeckList();
// create a string to load the decklist url into.
QString decklistUrlString;
// check if deck is not null
if (deck) {
if (DeckLoader *const deck = getDeckList()) {
// Get the decklist url string from the deck loader class.
decklistUrlString = deck->exportDeckToDecklist();
QString decklistUrlString = deck->exportDeckToDecklist(website);
// Check to make sure the string isn't empty.
if (QString::compare(decklistUrlString, "", Qt::CaseInsensitive) == 0) {
// Show an error if the deck is empty, and return.
@ -481,10 +476,26 @@ void AbstractTabDeckEditor::actExportDeckDecklist()
QDesktopServices::openUrl(decklistUrlString);
} else {
// if there's no deck loader object, return an error
QMessageBox::critical(this, tr("Error"), tr("No deck was selected to be saved."));
QMessageBox::critical(this, tr("Error"), tr("No deck was selected to be exported."));
}
}
/**
* Exports the deck to www.decklist.org (the old website)
*/
void AbstractTabDeckEditor::actExportDeckDecklist()
{
exportToDecklistWebsite(DeckLoader::DecklistOrg);
}
/**
* Exports the deck to www.decklist.xyz (the new website)
*/
void AbstractTabDeckEditor::actExportDeckDecklistXyz()
{
exportToDecklistWebsite(DeckLoader::DecklistXyz);
}
void AbstractTabDeckEditor::actAnalyzeDeckDeckstats()
{
auto *interface = new DeckStatsInterface(*databaseDisplayDockWidget->databaseModel->getDatabase(),