From 5aaf1232cb7b844c8c574647852ac67cfd7b45dc Mon Sep 17 00:00:00 2001 From: RickyRister Date: Mon, 23 Dec 2024 00:32:49 -0800 Subject: [PATCH] support multi open deck --- .../src/client/tabs/tab_deck_storage.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cockatrice/src/client/tabs/tab_deck_storage.cpp b/cockatrice/src/client/tabs/tab_deck_storage.cpp index c71a29fbb..ea230e42c 100644 --- a/cockatrice/src/client/tabs/tab_deck_storage.cpp +++ b/cockatrice/src/client/tabs/tab_deck_storage.cpp @@ -150,16 +150,18 @@ QString TabDeckStorage::getTargetPath() const void TabDeckStorage::actOpenLocalDeck() { - QModelIndex curLeft = localDirView->selectionModel()->currentIndex(); - if (localDirModel->isDir(curLeft)) - return; - QString filePath = localDirModel->filePath(curLeft); + QModelIndexList curLefts = localDirView->selectionModel()->selectedRows(); + for (const auto &curLeft : curLefts) { + if (localDirModel->isDir(curLeft)) + return; + QString filePath = localDirModel->filePath(curLeft); - DeckLoader deckLoader; - if (!deckLoader.loadFromFile(filePath, DeckLoader::CockatriceFormat)) - return; + DeckLoader deckLoader; + if (!deckLoader.loadFromFile(filePath, DeckLoader::CockatriceFormat)) + return; - emit openDeckEditor(&deckLoader); + emit openDeckEditor(&deckLoader); + } } void TabDeckStorage::actUpload()