mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-13 14:02:15 -07:00
Lint.
Took 28 minutes
This commit is contained in:
parent
6943e35951
commit
fb1f4659ba
2 changed files with 7 additions and 1 deletions
|
|
@ -564,15 +564,22 @@ void AbstractTabDeckEditor::exportToDecklistWebsite(DeckLoader::DecklistWebsite
|
||||||
{
|
{
|
||||||
if (DeckLoader *const deck = getDeckList()) {
|
if (DeckLoader *const deck = getDeckList()) {
|
||||||
QString decklistUrlString = deck->exportDeckToDecklist(website);
|
QString decklistUrlString = deck->exportDeckToDecklist(website);
|
||||||
|
// Check to make sure the string isn't empty.
|
||||||
if (decklistUrlString.isEmpty()) {
|
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"));
|
QMessageBox::critical(this, tr("Error"), tr("There are no cards in your deck to be exported"));
|
||||||
return;
|
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);
|
QUrl decklistUrl = QUrl(decklistUrlString);
|
||||||
|
// we get the correctly encoded url.
|
||||||
decklistUrlString = decklistUrl.toEncoded();
|
decklistUrlString = decklistUrl.toEncoded();
|
||||||
|
// We open the url in the user's default browser
|
||||||
QDesktopServices::openUrl(decklistUrlString);
|
QDesktopServices::openUrl(decklistUrlString);
|
||||||
} else {
|
} else {
|
||||||
|
// if there's no deck loader object, return an error
|
||||||
QMessageBox::critical(this, tr("Error"), tr("No deck was selected to be exported."));
|
QMessageBox::critical(this, tr("Error"), tr("No deck was selected to be exported."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
* @brief Defines the AbstractTabDeckEditor class, which provides a base for
|
* @brief Defines the AbstractTabDeckEditor class, which provides a base for
|
||||||
* deck editor tabs in the application.
|
* deck editor tabs in the application.
|
||||||
*
|
*
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TAB_GENERIC_DECK_EDITOR_H
|
#ifndef TAB_GENERIC_DECK_EDITOR_H
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue