mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 17:02:15 -07:00
support multi download
This commit is contained in:
parent
6d1d71795f
commit
a2b2e0cc38
1 changed files with 17 additions and 15 deletions
|
|
@ -274,30 +274,32 @@ void TabDeckStorage::openRemoteDeckFinished(const Response &r, const CommandCont
|
||||||
|
|
||||||
void TabDeckStorage::actDownload()
|
void TabDeckStorage::actDownload()
|
||||||
{
|
{
|
||||||
QString filePath;
|
QString dirPath;
|
||||||
QModelIndex curLeft = localDirView->selectionModel()->currentIndex();
|
QModelIndex curLeft = localDirView->selectionModel()->currentIndex();
|
||||||
if (!curLeft.isValid())
|
if (!curLeft.isValid())
|
||||||
filePath = localDirModel->rootPath();
|
dirPath = localDirModel->rootPath();
|
||||||
else {
|
else {
|
||||||
while (!localDirModel->isDir(curLeft))
|
while (!localDirModel->isDir(curLeft))
|
||||||
curLeft = curLeft.parent();
|
curLeft = curLeft.parent();
|
||||||
filePath = localDirModel->filePath(curLeft);
|
dirPath = localDirModel->filePath(curLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteDeckList_TreeModel::FileNode *curRight =
|
for (const auto &curRight : serverDirView->getCurrentSelection()) {
|
||||||
dynamic_cast<RemoteDeckList_TreeModel::FileNode *>(serverDirView->getCurrentItem());
|
RemoteDeckList_TreeModel::FileNode *node = dynamic_cast<RemoteDeckList_TreeModel::FileNode *>(curRight);
|
||||||
if (!curRight)
|
if (!node)
|
||||||
return;
|
return;
|
||||||
filePath += QString("/deck_%1.cod").arg(curRight->getId());
|
|
||||||
|
|
||||||
Command_DeckDownload cmd;
|
QString filePath = dirPath + QString("/deck_%1.cod").arg(node->getId());
|
||||||
cmd.set_deck_id(curRight->getId());
|
|
||||||
|
|
||||||
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
Command_DeckDownload cmd;
|
||||||
pend->setExtraData(filePath);
|
cmd.set_deck_id(node->getId());
|
||||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
|
||||||
SLOT(downloadFinished(Response, CommandContainer, QVariant)));
|
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||||
client->sendCommand(pend);
|
pend->setExtraData(filePath);
|
||||||
|
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||||
|
SLOT(downloadFinished(Response, CommandContainer, QVariant)));
|
||||||
|
client->sendCommand(pend);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckStorage::downloadFinished(const Response &r,
|
void TabDeckStorage::downloadFinished(const Response &r,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue