fixed #43: add delete button to local dir view in deck storage tab and in remote dir view in replays tab
This commit is contained in:
parent
7c8b3fc5e3
commit
e5a0a08569
14 changed files with 192 additions and 40 deletions
|
@ -20,6 +20,7 @@ private:
|
||||||
Response::ResponseCode cmdReplayList(const Command_ReplayList & /*cmd*/, ResponseContainer & /*rc*/) { return Response::RespFunctionNotAllowed; }
|
Response::ResponseCode cmdReplayList(const Command_ReplayList & /*cmd*/, ResponseContainer & /*rc*/) { return Response::RespFunctionNotAllowed; }
|
||||||
Response::ResponseCode cmdReplayDownload(const Command_ReplayDownload & /*cmd*/, ResponseContainer & /*rc*/) { return Response::RespFunctionNotAllowed; }
|
Response::ResponseCode cmdReplayDownload(const Command_ReplayDownload & /*cmd*/, ResponseContainer & /*rc*/) { return Response::RespFunctionNotAllowed; }
|
||||||
Response::ResponseCode cmdReplayModifyMatch(const Command_ReplayModifyMatch &cmd, ResponseContainer &rc) { return Response::RespFunctionNotAllowed; }
|
Response::ResponseCode cmdReplayModifyMatch(const Command_ReplayModifyMatch &cmd, ResponseContainer &rc) { return Response::RespFunctionNotAllowed; }
|
||||||
|
Response::ResponseCode cmdReplayDeleteMatch(const Command_ReplayDeleteMatch &cmd, ResponseContainer &rc) { return Response::RespFunctionNotAllowed; }
|
||||||
Response::ResponseCode cmdBanFromServer(const Command_BanFromServer & /*cmd*/, ResponseContainer & /*rc*/) { return Response::RespFunctionNotAllowed; }
|
Response::ResponseCode cmdBanFromServer(const Command_BanFromServer & /*cmd*/, ResponseContainer & /*rc*/) { return Response::RespFunctionNotAllowed; }
|
||||||
Response::ResponseCode cmdShutdownServer(const Command_ShutdownServer & /*cmd*/, ResponseContainer & /*rc*/) { return Response::RespFunctionNotAllowed; }
|
Response::ResponseCode cmdShutdownServer(const Command_ShutdownServer & /*cmd*/, ResponseContainer & /*rc*/) { return Response::RespFunctionNotAllowed; }
|
||||||
Response::ResponseCode cmdUpdateServerMessage(const Command_UpdateServerMessage & /*cmd*/, ResponseContainer & /*rc*/) { return Response::RespFunctionNotAllowed; }
|
Response::ResponseCode cmdUpdateServerMessage(const Command_UpdateServerMessage & /*cmd*/, ResponseContainer & /*rc*/) { return Response::RespFunctionNotAllowed; }
|
||||||
|
|
|
@ -243,6 +243,17 @@ void RemoteReplayList_TreeModel::updateMatchInfo(int gameId, const ServerInfo_Re
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RemoteReplayList_TreeModel::removeMatchInfo(int gameId)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < replayMatches.size(); ++i)
|
||||||
|
if (replayMatches[i]->getMatchInfo().game_id() == gameId) {
|
||||||
|
beginRemoveRows(QModelIndex(), i, i);
|
||||||
|
replayMatches.removeAt(i);
|
||||||
|
endRemoveRows();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RemoteReplayList_TreeModel::replayListFinished(const Response &r)
|
void RemoteReplayList_TreeModel::replayListFinished(const Response &r)
|
||||||
{
|
{
|
||||||
const Response_ReplayList &resp = r.GetExtension(Response_ReplayList::ext);
|
const Response_ReplayList &resp = r.GetExtension(Response_ReplayList::ext);
|
||||||
|
|
|
@ -72,6 +72,7 @@ public:
|
||||||
ServerInfo_ReplayMatch const* getReplayMatch(const QModelIndex &index) const;
|
ServerInfo_ReplayMatch const* getReplayMatch(const QModelIndex &index) const;
|
||||||
void addMatchInfo(const ServerInfo_ReplayMatch &matchInfo);
|
void addMatchInfo(const ServerInfo_ReplayMatch &matchInfo);
|
||||||
void updateMatchInfo(int gameId, const ServerInfo_ReplayMatch &matchInfo);
|
void updateMatchInfo(int gameId, const ServerInfo_ReplayMatch &matchInfo);
|
||||||
|
void removeMatchInfo(int gameId);
|
||||||
};
|
};
|
||||||
|
|
||||||
class RemoteReplayList_TreeWidget : public QTreeView {
|
class RemoteReplayList_TreeWidget : public QTreeView {
|
||||||
|
@ -86,6 +87,7 @@ public:
|
||||||
void refreshTree();
|
void refreshTree();
|
||||||
void addMatchInfo(const ServerInfo_ReplayMatch &matchInfo) { treeModel->addMatchInfo(matchInfo); }
|
void addMatchInfo(const ServerInfo_ReplayMatch &matchInfo) { treeModel->addMatchInfo(matchInfo); }
|
||||||
void updateMatchInfo(int gameId, const ServerInfo_ReplayMatch &matchInfo) { treeModel->updateMatchInfo(gameId, matchInfo); }
|
void updateMatchInfo(int gameId, const ServerInfo_ReplayMatch &matchInfo) { treeModel->updateMatchInfo(gameId, matchInfo); }
|
||||||
|
void removeMatchInfo(int gameId) { treeModel->removeMatchInfo(gameId); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
#include "tab_deck_storage.h"
|
#include "tab_deck_storage.h"
|
||||||
#include "remotedecklist_treewidget.h"
|
#include "remotedecklist_treewidget.h"
|
||||||
#include "abstractclient.h"
|
#include "abstractclient.h"
|
||||||
#include "decklist.h"
|
#include "decklist.h"
|
||||||
//#include "window_deckeditor.h"
|
|
||||||
#include "settingscache.h"
|
#include "settingscache.h"
|
||||||
|
|
||||||
#include "pending_command.h"
|
#include "pending_command.h"
|
||||||
|
@ -80,6 +80,9 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor, AbstractClient *_c
|
||||||
aUpload = new QAction(this);
|
aUpload = new QAction(this);
|
||||||
aUpload->setIcon(QIcon(":/resources/arrow_right_green.svg"));
|
aUpload->setIcon(QIcon(":/resources/arrow_right_green.svg"));
|
||||||
connect(aUpload, SIGNAL(triggered()), this, SLOT(actUpload()));
|
connect(aUpload, SIGNAL(triggered()), this, SLOT(actUpload()));
|
||||||
|
aDeleteLocalDeck = new QAction(this);
|
||||||
|
aDeleteLocalDeck->setIcon(QIcon(":/resources/remove_row.svg"));
|
||||||
|
connect(aDeleteLocalDeck, SIGNAL(triggered()), this, SLOT(actDeleteLocalDeck()));
|
||||||
aOpenRemoteDeck = new QAction(this);
|
aOpenRemoteDeck = new QAction(this);
|
||||||
aOpenRemoteDeck->setIcon(QIcon(":/resources/pencil.svg"));
|
aOpenRemoteDeck->setIcon(QIcon(":/resources/pencil.svg"));
|
||||||
connect(aOpenRemoteDeck, SIGNAL(triggered()), this, SLOT(actOpenRemoteDeck()));
|
connect(aOpenRemoteDeck, SIGNAL(triggered()), this, SLOT(actOpenRemoteDeck()));
|
||||||
|
@ -89,16 +92,17 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor, AbstractClient *_c
|
||||||
aNewFolder = new QAction(this);
|
aNewFolder = new QAction(this);
|
||||||
aNewFolder->setIcon(qApp->style()->standardIcon(QStyle::SP_FileDialogNewFolder));
|
aNewFolder->setIcon(qApp->style()->standardIcon(QStyle::SP_FileDialogNewFolder));
|
||||||
connect(aNewFolder, SIGNAL(triggered()), this, SLOT(actNewFolder()));
|
connect(aNewFolder, SIGNAL(triggered()), this, SLOT(actNewFolder()));
|
||||||
aDelete = new QAction(this);
|
aDeleteRemoteDeck = new QAction(this);
|
||||||
aDelete->setIcon(QIcon(":/resources/remove_row.svg"));
|
aDeleteRemoteDeck->setIcon(QIcon(":/resources/remove_row.svg"));
|
||||||
connect(aDelete, SIGNAL(triggered()), this, SLOT(actDelete()));
|
connect(aDeleteRemoteDeck, SIGNAL(triggered()), this, SLOT(actDeleteRemoteDeck()));
|
||||||
|
|
||||||
leftToolBar->addAction(aOpenLocalDeck);
|
leftToolBar->addAction(aOpenLocalDeck);
|
||||||
leftToolBar->addAction(aUpload);
|
leftToolBar->addAction(aUpload);
|
||||||
|
leftToolBar->addAction(aDeleteLocalDeck);
|
||||||
rightToolBar->addAction(aOpenRemoteDeck);
|
rightToolBar->addAction(aOpenRemoteDeck);
|
||||||
rightToolBar->addAction(aDownload);
|
rightToolBar->addAction(aDownload);
|
||||||
rightToolBar->addAction(aNewFolder);
|
rightToolBar->addAction(aNewFolder);
|
||||||
rightToolBar->addAction(aDelete);
|
rightToolBar->addAction(aDeleteRemoteDeck);
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
setLayout(hbox);
|
setLayout(hbox);
|
||||||
|
@ -114,7 +118,8 @@ void TabDeckStorage::retranslateUi()
|
||||||
aOpenRemoteDeck->setText(tr("Open in deck editor"));
|
aOpenRemoteDeck->setText(tr("Open in deck editor"));
|
||||||
aDownload->setText(tr("Download deck"));
|
aDownload->setText(tr("Download deck"));
|
||||||
aNewFolder->setText(tr("New folder"));
|
aNewFolder->setText(tr("New folder"));
|
||||||
aDelete->setText(tr("Delete"));
|
aDeleteLocalDeck->setText(tr("Delete"));
|
||||||
|
aDeleteRemoteDeck->setText(tr("Delete"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckStorage::actOpenLocalDeck()
|
void TabDeckStorage::actOpenLocalDeck()
|
||||||
|
@ -178,6 +183,15 @@ void TabDeckStorage::uploadFinished(const Response &r, const CommandContainer &c
|
||||||
serverDirView->addFileToTree(resp.new_file(), serverDirView->getNodeByPath(QString::fromStdString(cmd.path())));
|
serverDirView->addFileToTree(resp.new_file(), serverDirView->getNodeByPath(QString::fromStdString(cmd.path())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabDeckStorage::actDeleteLocalDeck()
|
||||||
|
{
|
||||||
|
QModelIndex curLeft = localDirView->selectionModel()->currentIndex();
|
||||||
|
if (QMessageBox::warning(this, tr("Delete local file"), tr("Are you sure you want to delete \"%1\"?").arg(localDirModel->fileName(curLeft)), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
|
localDirModel->remove(curLeft);
|
||||||
|
}
|
||||||
|
|
||||||
void TabDeckStorage::actOpenRemoteDeck()
|
void TabDeckStorage::actOpenRemoteDeck()
|
||||||
{
|
{
|
||||||
RemoteDeckList_TreeModel::FileNode *curRight = dynamic_cast<RemoteDeckList_TreeModel::FileNode *>(serverDirView->getCurrentItem());
|
RemoteDeckList_TreeModel::FileNode *curRight = dynamic_cast<RemoteDeckList_TreeModel::FileNode *>(serverDirView->getCurrentItem());
|
||||||
|
@ -269,7 +283,7 @@ void TabDeckStorage::newFolderFinished(const Response &response, const CommandCo
|
||||||
serverDirView->addFolderToTree(QString::fromStdString(cmd.dir_name()), serverDirView->getNodeByPath(QString::fromStdString(cmd.path())));
|
serverDirView->addFolderToTree(QString::fromStdString(cmd.dir_name()), serverDirView->getNodeByPath(QString::fromStdString(cmd.path())));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckStorage::actDelete()
|
void TabDeckStorage::actDeleteRemoteDeck()
|
||||||
{
|
{
|
||||||
PendingCommand *pend;
|
PendingCommand *pend;
|
||||||
RemoteDeckList_TreeModel::Node *curRight = serverDirView->getCurrentItem();
|
RemoteDeckList_TreeModel::Node *curRight = serverDirView->getCurrentItem();
|
||||||
|
@ -285,8 +299,12 @@ void TabDeckStorage::actDelete()
|
||||||
pend = client->prepareSessionCommand(cmd);
|
pend = client->prepareSessionCommand(cmd);
|
||||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(deleteFolderFinished(Response, CommandContainer)));
|
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(deleteFolderFinished(Response, CommandContainer)));
|
||||||
} else {
|
} else {
|
||||||
|
RemoteDeckList_TreeModel::FileNode *deckNode = dynamic_cast<RemoteDeckList_TreeModel::FileNode *>(curRight);
|
||||||
|
if (QMessageBox::warning(this, tr("Delete remote deck"), tr("Are you sure you want to delete \"%1\"?").arg(deckNode->getName()), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
Command_DeckDel cmd;
|
Command_DeckDel cmd;
|
||||||
cmd.set_deck_id(dynamic_cast<RemoteDeckList_TreeModel::FileNode *>(curRight)->getId());
|
cmd.set_deck_id(deckNode->getId());
|
||||||
pend = client->prepareSessionCommand(cmd);
|
pend = client->prepareSessionCommand(cmd);
|
||||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(deleteDeckFinished(Response, CommandContainer)));
|
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(deleteDeckFinished(Response, CommandContainer)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,13 +24,15 @@ private:
|
||||||
RemoteDeckList_TreeWidget *serverDirView;
|
RemoteDeckList_TreeWidget *serverDirView;
|
||||||
QGroupBox *leftGroupBox, *rightGroupBox;
|
QGroupBox *leftGroupBox, *rightGroupBox;
|
||||||
|
|
||||||
QAction *aOpenLocalDeck, *aUpload, *aOpenRemoteDeck, *aDownload, *aNewFolder, *aDelete;
|
QAction *aOpenLocalDeck, *aUpload, *aDeleteLocalDeck, *aOpenRemoteDeck, *aDownload, *aNewFolder, *aDeleteRemoteDeck;
|
||||||
private slots:
|
private slots:
|
||||||
void actOpenLocalDeck();
|
void actOpenLocalDeck();
|
||||||
|
|
||||||
void actUpload();
|
void actUpload();
|
||||||
void uploadFinished(const Response &r, const CommandContainer &commandContainer);
|
void uploadFinished(const Response &r, const CommandContainer &commandContainer);
|
||||||
|
|
||||||
|
void actDeleteLocalDeck();
|
||||||
|
|
||||||
void actOpenRemoteDeck();
|
void actOpenRemoteDeck();
|
||||||
void openRemoteDeckFinished(const Response &r);
|
void openRemoteDeckFinished(const Response &r);
|
||||||
|
|
||||||
|
@ -40,7 +42,7 @@ private slots:
|
||||||
void actNewFolder();
|
void actNewFolder();
|
||||||
void newFolderFinished(const Response &response, const CommandContainer &commandContainer);
|
void newFolderFinished(const Response &response, const CommandContainer &commandContainer);
|
||||||
|
|
||||||
void actDelete();
|
void actDeleteRemoteDeck();
|
||||||
void deleteFolderFinished(const Response &response, const CommandContainer &commandContainer);
|
void deleteFolderFinished(const Response &response, const CommandContainer &commandContainer);
|
||||||
void deleteDeckFinished(const Response &response, const CommandContainer &commandContainer);
|
void deleteDeckFinished(const Response &response, const CommandContainer &commandContainer);
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
#include "tab_replays.h"
|
#include "tab_replays.h"
|
||||||
#include "remotereplaylist_treewidget.h"
|
#include "remotereplaylist_treewidget.h"
|
||||||
#include "abstractclient.h"
|
#include "abstractclient.h"
|
||||||
|
@ -20,6 +21,7 @@
|
||||||
#include "pb/response_replay_download.pb.h"
|
#include "pb/response_replay_download.pb.h"
|
||||||
#include "pb/command_replay_download.pb.h"
|
#include "pb/command_replay_download.pb.h"
|
||||||
#include "pb/command_replay_modify_match.pb.h"
|
#include "pb/command_replay_modify_match.pb.h"
|
||||||
|
#include "pb/command_replay_delete_match.pb.h"
|
||||||
#include "pb/event_replay_added.pb.h"
|
#include "pb/event_replay_added.pb.h"
|
||||||
|
|
||||||
TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client)
|
TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client)
|
||||||
|
@ -74,6 +76,9 @@ TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client)
|
||||||
aOpenLocalReplay = new QAction(this);
|
aOpenLocalReplay = new QAction(this);
|
||||||
aOpenLocalReplay->setIcon(QIcon(":/resources/pencil.svg"));
|
aOpenLocalReplay->setIcon(QIcon(":/resources/pencil.svg"));
|
||||||
connect(aOpenLocalReplay, SIGNAL(triggered()), this, SLOT(actOpenLocalReplay()));
|
connect(aOpenLocalReplay, SIGNAL(triggered()), this, SLOT(actOpenLocalReplay()));
|
||||||
|
aDeleteLocalReplay = new QAction(this);
|
||||||
|
aDeleteLocalReplay->setIcon(QIcon(":/resources/remove_row.svg"));
|
||||||
|
connect(aDeleteLocalReplay, SIGNAL(triggered()), this, SLOT(actDeleteLocalReplay()));
|
||||||
aOpenRemoteReplay = new QAction(this);
|
aOpenRemoteReplay = new QAction(this);
|
||||||
aOpenRemoteReplay->setIcon(QIcon(":/resources/pencil.svg"));
|
aOpenRemoteReplay->setIcon(QIcon(":/resources/pencil.svg"));
|
||||||
connect(aOpenRemoteReplay, SIGNAL(triggered()), this, SLOT(actOpenRemoteReplay()));
|
connect(aOpenRemoteReplay, SIGNAL(triggered()), this, SLOT(actOpenRemoteReplay()));
|
||||||
|
@ -83,11 +88,16 @@ TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client)
|
||||||
aKeep = new QAction(this);
|
aKeep = new QAction(this);
|
||||||
aKeep->setIcon(QIcon(":/resources/lock.svg"));
|
aKeep->setIcon(QIcon(":/resources/lock.svg"));
|
||||||
connect(aKeep, SIGNAL(triggered()), this, SLOT(actKeepRemoteReplay()));
|
connect(aKeep, SIGNAL(triggered()), this, SLOT(actKeepRemoteReplay()));
|
||||||
|
aDeleteRemoteReplay = new QAction(this);
|
||||||
|
aDeleteRemoteReplay->setIcon(QIcon(":/resources/remove_row.svg"));
|
||||||
|
connect(aDeleteRemoteReplay, SIGNAL(triggered()), this, SLOT(actDeleteRemoteReplay()));
|
||||||
|
|
||||||
leftToolBar->addAction(aOpenLocalReplay);
|
leftToolBar->addAction(aOpenLocalReplay);
|
||||||
|
leftToolBar->addAction(aDeleteLocalReplay);
|
||||||
rightToolBar->addAction(aOpenRemoteReplay);
|
rightToolBar->addAction(aOpenRemoteReplay);
|
||||||
rightToolBar->addAction(aDownload);
|
rightToolBar->addAction(aDownload);
|
||||||
rightToolBar->addAction(aKeep);
|
rightToolBar->addAction(aKeep);
|
||||||
|
rightToolBar->addAction(aDeleteRemoteReplay);
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
setLayout(hbox);
|
setLayout(hbox);
|
||||||
|
@ -101,9 +111,11 @@ void TabReplays::retranslateUi()
|
||||||
rightGroupBox->setTitle(tr("Server replay storage"));
|
rightGroupBox->setTitle(tr("Server replay storage"));
|
||||||
|
|
||||||
aOpenLocalReplay->setText(tr("Watch replay"));
|
aOpenLocalReplay->setText(tr("Watch replay"));
|
||||||
|
aDeleteLocalReplay->setText(tr("Delete"));
|
||||||
aOpenRemoteReplay->setText(tr("Watch replay"));
|
aOpenRemoteReplay->setText(tr("Watch replay"));
|
||||||
aDownload->setText(tr("Download replay"));
|
aDownload->setText(tr("Download replay"));
|
||||||
aKeep->setText(tr("Toggle expiration lock"));
|
aKeep->setText(tr("Toggle expiration lock"));
|
||||||
|
aDeleteLocalReplay->setText(tr("Delete"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabReplays::actOpenLocalReplay()
|
void TabReplays::actOpenLocalReplay()
|
||||||
|
@ -125,6 +137,15 @@ void TabReplays::actOpenLocalReplay()
|
||||||
emit openReplay(replay);
|
emit openReplay(replay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabReplays::actDeleteLocalReplay()
|
||||||
|
{
|
||||||
|
QModelIndex curLeft = localDirView->selectionModel()->currentIndex();
|
||||||
|
if (QMessageBox::warning(this, tr("Delete local file"), tr("Are you sure you want to delete \"%1\"?").arg(localDirModel->fileName(curLeft)), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
|
localDirModel->remove(curLeft);
|
||||||
|
}
|
||||||
|
|
||||||
void TabReplays::actOpenRemoteReplay()
|
void TabReplays::actOpenRemoteReplay()
|
||||||
{
|
{
|
||||||
ServerInfo_Replay const *curRight = serverDirView->getCurrentReplay();
|
ServerInfo_Replay const *curRight = serverDirView->getCurrentReplay();
|
||||||
|
@ -214,6 +235,31 @@ void TabReplays::keepRemoteReplayFinished(const Response &r, const CommandContai
|
||||||
serverDirView->updateMatchInfo(cmd.game_id(), temp);
|
serverDirView->updateMatchInfo(cmd.game_id(), temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabReplays::actDeleteRemoteReplay()
|
||||||
|
{
|
||||||
|
ServerInfo_ReplayMatch const *curRight = serverDirView->getCurrentReplayMatch();
|
||||||
|
if (!curRight)
|
||||||
|
return;
|
||||||
|
if (QMessageBox::warning(this, tr("Delete remote replay"), tr("Are you sure you want to delete the replay of game %1?").arg(curRight->game_id()), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Command_ReplayDeleteMatch cmd;
|
||||||
|
cmd.set_game_id(curRight->game_id());
|
||||||
|
|
||||||
|
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||||
|
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(deleteRemoteReplayFinished(Response, CommandContainer)));
|
||||||
|
client->sendCommand(pend);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabReplays::deleteRemoteReplayFinished(const Response &r, const CommandContainer &commandContainer)
|
||||||
|
{
|
||||||
|
if (r.response_code() != Response::RespOk)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const Command_ReplayDeleteMatch &cmd = commandContainer.session_command(0).GetExtension(Command_ReplayDeleteMatch::ext);
|
||||||
|
serverDirView->removeMatchInfo(cmd.game_id());
|
||||||
|
}
|
||||||
|
|
||||||
void TabReplays::replayAddedEventReceived(const Event_ReplayAdded &event)
|
void TabReplays::replayAddedEventReceived(const Event_ReplayAdded &event)
|
||||||
{
|
{
|
||||||
serverDirView->addMatchInfo(event.match_info());
|
serverDirView->addMatchInfo(event.match_info());
|
||||||
|
|
|
@ -24,10 +24,12 @@ private:
|
||||||
RemoteReplayList_TreeWidget *serverDirView;
|
RemoteReplayList_TreeWidget *serverDirView;
|
||||||
QGroupBox *leftGroupBox, *rightGroupBox;
|
QGroupBox *leftGroupBox, *rightGroupBox;
|
||||||
|
|
||||||
QAction *aOpenLocalReplay, *aOpenRemoteReplay, *aDownload, *aKeep;
|
QAction *aOpenLocalReplay, *aDeleteLocalReplay, *aOpenRemoteReplay, *aDownload, *aKeep, *aDeleteRemoteReplay;
|
||||||
private slots:
|
private slots:
|
||||||
void actOpenLocalReplay();
|
void actOpenLocalReplay();
|
||||||
|
|
||||||
|
void actDeleteLocalReplay();
|
||||||
|
|
||||||
void actOpenRemoteReplay();
|
void actOpenRemoteReplay();
|
||||||
void openRemoteReplayFinished(const Response &r);
|
void openRemoteReplayFinished(const Response &r);
|
||||||
|
|
||||||
|
@ -37,6 +39,9 @@ private slots:
|
||||||
void actKeepRemoteReplay();
|
void actKeepRemoteReplay();
|
||||||
void keepRemoteReplayFinished(const Response &r, const CommandContainer &commandContainer);
|
void keepRemoteReplayFinished(const Response &r, const CommandContainer &commandContainer);
|
||||||
|
|
||||||
|
void actDeleteRemoteReplay();
|
||||||
|
void deleteRemoteReplayFinished(const Response &r, const CommandContainer &commandContainer);
|
||||||
|
|
||||||
void replayAddedEventReceived(const Event_ReplayAdded &event);
|
void replayAddedEventReceived(const Event_ReplayAdded &event);
|
||||||
signals:
|
signals:
|
||||||
void openReplay(GameReplay *replay);
|
void openReplay(GameReplay *replay);
|
||||||
|
|
|
@ -5160,7 +5160,7 @@ Lokale Version ist %1, Serverversion ist %2.</translation>
|
||||||
<location filename="../src/player.cpp" line="832"/>
|
<location filename="../src/player.cpp" line="832"/>
|
||||||
<location filename="../src/player.cpp" line="847"/>
|
<location filename="../src/player.cpp" line="847"/>
|
||||||
<location filename="../src/player.cpp" line="870"/>
|
<location filename="../src/player.cpp" line="870"/>
|
||||||
<location filename="../src/player.cpp" line="2023"/>
|
<location filename="../src/player.cpp" line="2021"/>
|
||||||
<source>Number:</source>
|
<source>Number:</source>
|
||||||
<translation>Anzahl:</translation>
|
<translation>Anzahl:</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -5175,27 +5175,27 @@ Lokale Version ist %1, Serverversion ist %2.</translation>
|
||||||
<translation>Oberste Karten ins Exil schicken</translation>
|
<translation>Oberste Karten ins Exil schicken</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/player.cpp" line="1879"/>
|
<location filename="../src/player.cpp" line="1877"/>
|
||||||
<source>Set power/toughness</source>
|
<source>Set power/toughness</source>
|
||||||
<translation>Kampfwerte setzen</translation>
|
<translation>Kampfwerte setzen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/player.cpp" line="1879"/>
|
<location filename="../src/player.cpp" line="1877"/>
|
||||||
<source>Please enter the new PT:</source>
|
<source>Please enter the new PT:</source>
|
||||||
<translation>Bitte die neuen Kampfwerte eingeben:</translation>
|
<translation>Bitte die neuen Kampfwerte eingeben:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/player.cpp" line="1947"/>
|
<location filename="../src/player.cpp" line="1945"/>
|
||||||
<source>Set annotation</source>
|
<source>Set annotation</source>
|
||||||
<translation>Hinweis setzen</translation>
|
<translation>Hinweis setzen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/player.cpp" line="1947"/>
|
<location filename="../src/player.cpp" line="1945"/>
|
||||||
<source>Please enter the new annotation:</source>
|
<source>Please enter the new annotation:</source>
|
||||||
<translation>Bitte den Hinweis eingeben:</translation>
|
<translation>Bitte den Hinweis eingeben:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/player.cpp" line="2023"/>
|
<location filename="../src/player.cpp" line="2021"/>
|
||||||
<source>Set counters</source>
|
<source>Set counters</source>
|
||||||
<translation>Setze Zählmarken</translation>
|
<translation>Setze Zählmarken</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -5743,66 +5743,83 @@ Bitte überprüfen Sie, dass Sie Schreibrechte in dem Verzeichnis haben, und ver
|
||||||
<context>
|
<context>
|
||||||
<name>TabDeckStorage</name>
|
<name>TabDeckStorage</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_deck_storage.cpp" line="109"/>
|
<location filename="../src/tab_deck_storage.cpp" line="113"/>
|
||||||
<source>Local file system</source>
|
<source>Local file system</source>
|
||||||
<translation>Lokales Dateisystem</translation>
|
<translation>Lokales Dateisystem</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_deck_storage.cpp" line="110"/>
|
<location filename="../src/tab_deck_storage.cpp" line="114"/>
|
||||||
<source>Server deck storage</source>
|
<source>Server deck storage</source>
|
||||||
<translation>Deckspeicherplatz auf dem Server</translation>
|
<translation>Deckspeicherplatz auf dem Server</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_deck_storage.cpp" line="112"/>
|
<location filename="../src/tab_deck_storage.cpp" line="116"/>
|
||||||
<location filename="../src/tab_deck_storage.cpp" line="114"/>
|
<location filename="../src/tab_deck_storage.cpp" line="118"/>
|
||||||
<source>Open in deck editor</source>
|
<source>Open in deck editor</source>
|
||||||
<translation>Im Deckeditor öffnen</translation>
|
<translation>Im Deckeditor öffnen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_deck_storage.cpp" line="113"/>
|
<location filename="../src/tab_deck_storage.cpp" line="117"/>
|
||||||
<source>Upload deck</source>
|
<source>Upload deck</source>
|
||||||
<translation>Deck hochladen</translation>
|
<translation>Deck hochladen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_deck_storage.cpp" line="115"/>
|
<location filename="../src/tab_deck_storage.cpp" line="119"/>
|
||||||
<source>Download deck</source>
|
<source>Download deck</source>
|
||||||
<translation>Deck herunterladen</translation>
|
<translation>Deck herunterladen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_deck_storage.cpp" line="116"/>
|
<location filename="../src/tab_deck_storage.cpp" line="120"/>
|
||||||
<location filename="../src/tab_deck_storage.cpp" line="241"/>
|
<location filename="../src/tab_deck_storage.cpp" line="255"/>
|
||||||
<source>New folder</source>
|
<source>New folder</source>
|
||||||
<translation>Neuer Ordner</translation>
|
<translation>Neuer Ordner</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_deck_storage.cpp" line="117"/>
|
<location filename="../src/tab_deck_storage.cpp" line="121"/>
|
||||||
|
<location filename="../src/tab_deck_storage.cpp" line="122"/>
|
||||||
<source>Delete</source>
|
<source>Delete</source>
|
||||||
<translation>Löschen</translation>
|
<translation>Löschen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_deck_storage.cpp" line="148"/>
|
<location filename="../src/tab_deck_storage.cpp" line="153"/>
|
||||||
<source>Enter deck name</source>
|
<source>Enter deck name</source>
|
||||||
<translation>Decknamen eingeben</translation>
|
<translation>Decknamen eingeben</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_deck_storage.cpp" line="148"/>
|
<location filename="../src/tab_deck_storage.cpp" line="153"/>
|
||||||
<source>This decklist does not have a name.
|
<source>This decklist does not have a name.
|
||||||
Please enter a name:</source>
|
Please enter a name:</source>
|
||||||
<translation>Diese Deckliste hat keinen Namen.
|
<translation>Diese Deckliste hat keinen Namen.
|
||||||
Bitte geben Sie einen Namen ein:</translation>
|
Bitte geben Sie einen Namen ein:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_deck_storage.cpp" line="152"/>
|
<location filename="../src/tab_deck_storage.cpp" line="157"/>
|
||||||
<source>Unnamed deck</source>
|
<source>Unnamed deck</source>
|
||||||
<translation>Unbenanntes Deck</translation>
|
<translation>Unbenanntes Deck</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_deck_storage.cpp" line="241"/>
|
<location filename="../src/tab_deck_storage.cpp" line="189"/>
|
||||||
|
<source>Delete local file</source>
|
||||||
|
<translation>Lokale Datei löschen</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/tab_deck_storage.cpp" line="189"/>
|
||||||
|
<location filename="../src/tab_deck_storage.cpp" line="303"/>
|
||||||
|
<source>Are you sure you want to delete "%1"?</source>
|
||||||
|
<translation>Sind Sie sicher, dass Sie "%1" löschen möchten?</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/tab_deck_storage.cpp" line="255"/>
|
||||||
<source>Name of new folder:</source>
|
<source>Name of new folder:</source>
|
||||||
<translation>Name für den neuen Ordner:</translation>
|
<translation>Name für den neuen Ordner:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_deck_storage.h" line="49"/>
|
<location filename="../src/tab_deck_storage.cpp" line="303"/>
|
||||||
|
<source>Delete remote deck</source>
|
||||||
|
<translation>Deck auf dem Server löschen</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/tab_deck_storage.h" line="51"/>
|
||||||
<source>Deck storage</source>
|
<source>Deck storage</source>
|
||||||
<translation>Deckspeicherplatz</translation>
|
<translation>Deckspeicherplatz</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -6023,33 +6040,59 @@ Bitte geben Sie einen Namen ein:</translation>
|
||||||
<context>
|
<context>
|
||||||
<name>TabReplays</name>
|
<name>TabReplays</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_replays.cpp" line="100"/>
|
<location filename="../src/tab_replays.cpp" line="110"/>
|
||||||
<source>Local file system</source>
|
<source>Local file system</source>
|
||||||
<translation>Lokales Dateisystem</translation>
|
<translation>Lokales Dateisystem</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_replays.cpp" line="101"/>
|
<location filename="../src/tab_replays.cpp" line="111"/>
|
||||||
<source>Server replay storage</source>
|
<source>Server replay storage</source>
|
||||||
<translation>Replay-Speicherplatz auf dem Server</translation>
|
<translation>Replay-Speicherplatz auf dem Server</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_replays.cpp" line="103"/>
|
<location filename="../src/tab_replays.cpp" line="113"/>
|
||||||
<location filename="../src/tab_replays.cpp" line="104"/>
|
<location filename="../src/tab_replays.cpp" line="115"/>
|
||||||
<source>Watch replay</source>
|
<source>Watch replay</source>
|
||||||
<translation>Replay abspielen</translation>
|
<translation>Replay abspielen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_replays.cpp" line="105"/>
|
<location filename="../src/tab_replays.cpp" line="114"/>
|
||||||
|
<location filename="../src/tab_replays.cpp" line="118"/>
|
||||||
|
<source>Delete</source>
|
||||||
|
<translation>Löschen</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/tab_replays.cpp" line="116"/>
|
||||||
<source>Download replay</source>
|
<source>Download replay</source>
|
||||||
<translation>Replay herunterladen</translation>
|
<translation>Replay herunterladen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_replays.cpp" line="106"/>
|
<location filename="../src/tab_replays.cpp" line="117"/>
|
||||||
<source>Toggle expiration lock</source>
|
<source>Toggle expiration lock</source>
|
||||||
<translation>automatische Löschung umschalten</translation>
|
<translation>automatische Löschung umschalten</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/tab_replays.h" line="46"/>
|
<location filename="../src/tab_replays.cpp" line="143"/>
|
||||||
|
<source>Delete local file</source>
|
||||||
|
<translation>Lokale Datei löschen</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/tab_replays.cpp" line="143"/>
|
||||||
|
<source>Are you sure you want to delete "%1"?</source>
|
||||||
|
<translation>Sind Sie sicher, dass Sie "%1" löschen möchten?</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/tab_replays.cpp" line="243"/>
|
||||||
|
<source>Delete remote replay</source>
|
||||||
|
<translation>Replay auf dem Server löschen</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/tab_replays.cpp" line="243"/>
|
||||||
|
<source>Are you sure you want to delete the replay of game %1?</source>
|
||||||
|
<translation>Sind Sie sicher, dass Sie das Replay des Spiels %1 löschen möchten?</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/tab_replays.h" line="51"/>
|
||||||
<source>Game replays</source>
|
<source>Game replays</source>
|
||||||
<translation>Replays</translation>
|
<translation>Replays</translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
|
@ -31,6 +31,7 @@ SET(PROTO_FILES
|
||||||
command_mulligan.proto
|
command_mulligan.proto
|
||||||
command_next_turn.proto
|
command_next_turn.proto
|
||||||
command_ready_start.proto
|
command_ready_start.proto
|
||||||
|
command_replay_delete_match.proto
|
||||||
command_replay_list.proto
|
command_replay_list.proto
|
||||||
command_replay_download.proto
|
command_replay_download.proto
|
||||||
command_replay_modify_match.proto
|
command_replay_modify_match.proto
|
||||||
|
|
|
@ -19,6 +19,7 @@ message SessionCommand {
|
||||||
REPLAY_LIST = 1100;
|
REPLAY_LIST = 1100;
|
||||||
REPLAY_DOWNLOAD = 1101;
|
REPLAY_DOWNLOAD = 1101;
|
||||||
REPLAY_MODIFY_MATCH = 1102;
|
REPLAY_MODIFY_MATCH = 1102;
|
||||||
|
REPLAY_DELETE_MATCH = 1103;
|
||||||
}
|
}
|
||||||
extensions 100 to max;
|
extensions 100 to max;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "pb/command_replay_list.pb.h"
|
#include "pb/command_replay_list.pb.h"
|
||||||
#include "pb/command_replay_download.pb.h"
|
#include "pb/command_replay_download.pb.h"
|
||||||
#include "pb/command_replay_modify_match.pb.h"
|
#include "pb/command_replay_modify_match.pb.h"
|
||||||
|
#include "pb/command_replay_delete_match.pb.h"
|
||||||
#include "pb/response.pb.h"
|
#include "pb/response.pb.h"
|
||||||
#include "pb/response_login.pb.h"
|
#include "pb/response_login.pb.h"
|
||||||
#include "pb/response_list_users.pb.h"
|
#include "pb/response_list_users.pb.h"
|
||||||
|
@ -149,6 +150,7 @@ Response::ResponseCode Server_ProtocolHandler::processSessionCommandContainer(co
|
||||||
case SessionCommand::REPLAY_LIST: resp = cmdReplayList(sc.GetExtension(Command_ReplayList::ext), rc); break;
|
case SessionCommand::REPLAY_LIST: resp = cmdReplayList(sc.GetExtension(Command_ReplayList::ext), rc); break;
|
||||||
case SessionCommand::REPLAY_DOWNLOAD: resp = cmdReplayDownload(sc.GetExtension(Command_ReplayDownload::ext), rc); break;
|
case SessionCommand::REPLAY_DOWNLOAD: resp = cmdReplayDownload(sc.GetExtension(Command_ReplayDownload::ext), rc); break;
|
||||||
case SessionCommand::REPLAY_MODIFY_MATCH: resp = cmdReplayModifyMatch(sc.GetExtension(Command_ReplayModifyMatch::ext), rc); break;
|
case SessionCommand::REPLAY_MODIFY_MATCH: resp = cmdReplayModifyMatch(sc.GetExtension(Command_ReplayModifyMatch::ext), rc); break;
|
||||||
|
case SessionCommand::REPLAY_DELETE_MATCH: resp = cmdReplayDeleteMatch(sc.GetExtension(Command_ReplayDeleteMatch::ext), rc); break;
|
||||||
case SessionCommand::GET_GAMES_OF_USER: resp = cmdGetGamesOfUser(sc.GetExtension(Command_GetGamesOfUser::ext), rc); break;
|
case SessionCommand::GET_GAMES_OF_USER: resp = cmdGetGamesOfUser(sc.GetExtension(Command_GetGamesOfUser::ext), rc); break;
|
||||||
case SessionCommand::GET_USER_INFO: resp = cmdGetUserInfo(sc.GetExtension(Command_GetUserInfo::ext), rc); break;
|
case SessionCommand::GET_USER_INFO: resp = cmdGetUserInfo(sc.GetExtension(Command_GetUserInfo::ext), rc); break;
|
||||||
case SessionCommand::LIST_ROOMS: resp = cmdListRooms(sc.GetExtension(Command_ListRooms::ext), rc); break;
|
case SessionCommand::LIST_ROOMS: resp = cmdListRooms(sc.GetExtension(Command_ListRooms::ext), rc); break;
|
||||||
|
|
|
@ -43,6 +43,7 @@ class Command_DeckUpload;
|
||||||
class Command_ReplayList;
|
class Command_ReplayList;
|
||||||
class Command_ReplayDownload;
|
class Command_ReplayDownload;
|
||||||
class Command_ReplayModifyMatch;
|
class Command_ReplayModifyMatch;
|
||||||
|
class Command_ReplayDeleteMatch;
|
||||||
class Command_ListRooms;
|
class Command_ListRooms;
|
||||||
class Command_JoinRoom;
|
class Command_JoinRoom;
|
||||||
class Command_LeaveRoom;
|
class Command_LeaveRoom;
|
||||||
|
@ -84,6 +85,7 @@ private:
|
||||||
virtual Response::ResponseCode cmdReplayList(const Command_ReplayList &cmd, ResponseContainer &rc) = 0;
|
virtual Response::ResponseCode cmdReplayList(const Command_ReplayList &cmd, ResponseContainer &rc) = 0;
|
||||||
virtual Response::ResponseCode cmdReplayDownload(const Command_ReplayDownload &cmd, ResponseContainer &rc) = 0;
|
virtual Response::ResponseCode cmdReplayDownload(const Command_ReplayDownload &cmd, ResponseContainer &rc) = 0;
|
||||||
virtual Response::ResponseCode cmdReplayModifyMatch(const Command_ReplayModifyMatch &cmd, ResponseContainer &rc) = 0;
|
virtual Response::ResponseCode cmdReplayModifyMatch(const Command_ReplayModifyMatch &cmd, ResponseContainer &rc) = 0;
|
||||||
|
virtual Response::ResponseCode cmdReplayDeleteMatch(const Command_ReplayDeleteMatch &cmd, ResponseContainer &rc) = 0;
|
||||||
Response::ResponseCode cmdGetGamesOfUser(const Command_GetGamesOfUser &cmd, ResponseContainer &rc);
|
Response::ResponseCode cmdGetGamesOfUser(const Command_GetGamesOfUser &cmd, ResponseContainer &rc);
|
||||||
Response::ResponseCode cmdGetUserInfo(const Command_GetUserInfo &cmd, ResponseContainer &rc);
|
Response::ResponseCode cmdGetUserInfo(const Command_GetUserInfo &cmd, ResponseContainer &rc);
|
||||||
Response::ResponseCode cmdListRooms(const Command_ListRooms &cmd, ResponseContainer &rc);
|
Response::ResponseCode cmdListRooms(const Command_ListRooms &cmd, ResponseContainer &rc);
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "pb/command_replay_list.pb.h"
|
#include "pb/command_replay_list.pb.h"
|
||||||
#include "pb/command_replay_download.pb.h"
|
#include "pb/command_replay_download.pb.h"
|
||||||
#include "pb/command_replay_modify_match.pb.h"
|
#include "pb/command_replay_modify_match.pb.h"
|
||||||
|
#include "pb/command_replay_delete_match.pb.h"
|
||||||
#include "pb/event_connection_closed.pb.h"
|
#include "pb/event_connection_closed.pb.h"
|
||||||
#include "pb/event_server_message.pb.h"
|
#include "pb/event_server_message.pb.h"
|
||||||
#include "pb/event_server_identification.pb.h"
|
#include "pb/event_server_identification.pb.h"
|
||||||
|
@ -480,7 +481,7 @@ Response::ResponseCode ServerSocketInterface::cmdReplayList(const Command_Replay
|
||||||
|
|
||||||
servatrice->dbMutex.lock();
|
servatrice->dbMutex.lock();
|
||||||
QSqlQuery query1;
|
QSqlQuery query1;
|
||||||
query1.prepare("select a.id_game, a.replay_name, b.room_name, b.time_started, b.time_finished, b.descr, a.do_not_hide from cockatrice_replays_access a left join cockatrice_games b on b.id = a.id_game where a.id_player = :id_player and (a.do_not_hide = 1 or date_add(b.time_started, interval 14 day) > now())");
|
query1.prepare("select a.id_game, a.replay_name, b.room_name, b.time_started, b.time_finished, b.descr, a.do_not_hide from cockatrice_replays_access a left join cockatrice_games b on b.id = a.id_game where a.id_player = :id_player and (a.do_not_hide = 1 or date_add(b.time_started, interval 7 day) > now())");
|
||||||
query1.bindValue(":id_player", userInfo->id());
|
query1.bindValue(":id_player", userInfo->id());
|
||||||
servatrice->execSqlQuery(query1);
|
servatrice->execSqlQuery(query1);
|
||||||
while (query1.next()) {
|
while (query1.next()) {
|
||||||
|
@ -570,6 +571,22 @@ Response::ResponseCode ServerSocketInterface::cmdReplayModifyMatch(const Command
|
||||||
return servatrice->execSqlQuery(query1) ? Response::RespOk : Response::RespNameNotFound;
|
return servatrice->execSqlQuery(query1) ? Response::RespOk : Response::RespNameNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Response::ResponseCode ServerSocketInterface::cmdReplayDeleteMatch(const Command_ReplayDeleteMatch &cmd, ResponseContainer & /*rc*/)
|
||||||
|
{
|
||||||
|
if (authState != PasswordRight)
|
||||||
|
return Response::RespFunctionNotAllowed;
|
||||||
|
|
||||||
|
QMutexLocker dbLocker(&servatrice->dbMutex);
|
||||||
|
|
||||||
|
QSqlQuery query1;
|
||||||
|
query1.prepare("delete from " + servatrice->getDbPrefix() + "_replays_access where id_player = :id_player and id_game = :id_game");
|
||||||
|
query1.bindValue(":id_player", userInfo->id());
|
||||||
|
query1.bindValue(":id_game", cmd.game_id());
|
||||||
|
|
||||||
|
servatrice->execSqlQuery(query1);
|
||||||
|
return query1.numRowsAffected() > 0 ? Response::RespOk: Response::RespNameNotFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// MODERATOR FUNCTIONS.
|
// MODERATOR FUNCTIONS.
|
||||||
// May be called by admins and moderators. Permission is checked by the calling function.
|
// May be called by admins and moderators. Permission is checked by the calling function.
|
||||||
|
|
|
@ -64,6 +64,7 @@ private:
|
||||||
Response::ResponseCode cmdReplayList(const Command_ReplayList &cmd, ResponseContainer &rc);
|
Response::ResponseCode cmdReplayList(const Command_ReplayList &cmd, ResponseContainer &rc);
|
||||||
Response::ResponseCode cmdReplayDownload(const Command_ReplayDownload &cmd, ResponseContainer &rc);
|
Response::ResponseCode cmdReplayDownload(const Command_ReplayDownload &cmd, ResponseContainer &rc);
|
||||||
Response::ResponseCode cmdReplayModifyMatch(const Command_ReplayModifyMatch &cmd, ResponseContainer &rc);
|
Response::ResponseCode cmdReplayModifyMatch(const Command_ReplayModifyMatch &cmd, ResponseContainer &rc);
|
||||||
|
Response::ResponseCode cmdReplayDeleteMatch(const Command_ReplayDeleteMatch &cmd, ResponseContainer &rc);
|
||||||
Response::ResponseCode cmdBanFromServer(const Command_BanFromServer &cmd, ResponseContainer &rc);
|
Response::ResponseCode cmdBanFromServer(const Command_BanFromServer &cmd, ResponseContainer &rc);
|
||||||
Response::ResponseCode cmdShutdownServer(const Command_ShutdownServer &cmd, ResponseContainer &rc);
|
Response::ResponseCode cmdShutdownServer(const Command_ShutdownServer &cmd, ResponseContainer &rc);
|
||||||
Response::ResponseCode cmdUpdateServerMessage(const Command_UpdateServerMessage &cmd, ResponseContainer &rc);
|
Response::ResponseCode cmdUpdateServerMessage(const Command_UpdateServerMessage &cmd, ResponseContainer &rc);
|
||||||
|
|
Loading…
Reference in a new issue