mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 16:32:16 -07:00
refactor deck loading to new method
This commit is contained in:
parent
9ab5ebc84a
commit
42363c34bd
2 changed files with 8 additions and 3 deletions
|
|
@ -294,12 +294,16 @@ void DeckViewContainer::loadLocalDeck()
|
|||
if (!dialog.exec())
|
||||
return;
|
||||
|
||||
QString fileName = dialog.selectedFiles().at(0);
|
||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(fileName);
|
||||
loadDeckFromFile(dialog.selectedFiles().at(0));
|
||||
}
|
||||
|
||||
void DeckViewContainer::loadDeckFromFile(const QString &filePath)
|
||||
{
|
||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(filePath);
|
||||
QString deckString;
|
||||
DeckLoader deck;
|
||||
|
||||
bool error = !deck.loadFromFile(fileName, fmt);
|
||||
bool error = !deck.loadFromFile(filePath, fmt);
|
||||
if (!error) {
|
||||
deckString = deck.writeToString_Native();
|
||||
error = deckString.length() > MAX_FILE_LENGTH;
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ public:
|
|||
void setReadyStart(bool ready);
|
||||
void setSideboardLocked(bool locked);
|
||||
void setDeck(const DeckLoader &deck);
|
||||
void loadDeckFromFile(const QString &filePath);
|
||||
};
|
||||
|
||||
class TabGame : public Tab
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue