From fb1f4659baaab366b577839e06d58e08b0b4474c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Sat, 8 Nov 2025 23:25:20 +0100 Subject: [PATCH] Lint. Took 28 minutes --- .../interface/widgets/tabs/abstract_tab_deck_editor.cpp | 7 +++++++ .../src/interface/widgets/tabs/abstract_tab_deck_editor.h | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.cpp b/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.cpp index 1fa2e1646..21339e746 100644 --- a/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.cpp +++ b/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.cpp @@ -564,15 +564,22 @@ void AbstractTabDeckEditor::exportToDecklistWebsite(DeckLoader::DecklistWebsite { if (DeckLoader *const deck = getDeckList()) { QString decklistUrlString = deck->exportDeckToDecklist(website); + // Check to make sure the string isn't empty. if (decklistUrlString.isEmpty()) { + // Show an error if the deck is empty, and return. QMessageBox::critical(this, tr("Error"), tr("There are no cards in your deck to be exported")); return; } + // Encode the string recieved from the model to make sure all characters are encoded. + // first we put it into a qurl object QUrl decklistUrl = QUrl(decklistUrlString); + // we get the correctly encoded url. decklistUrlString = decklistUrl.toEncoded(); + // We open the url in the user's default browser 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 exported.")); } } diff --git a/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.h b/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.h index ab66a5899..c28f15b52 100644 --- a/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.h +++ b/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.h @@ -3,7 +3,6 @@ * @brief Defines the AbstractTabDeckEditor class, which provides a base for * deck editor tabs in the application. * - */ #ifndef TAB_GENERIC_DECK_EDITOR_H