mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-20 09:22:15 -07:00
rename old get replay match method to get enclosing
This commit is contained in:
parent
d987628935
commit
019b254b7e
2 changed files with 15 additions and 1 deletions
|
|
@ -216,6 +216,18 @@ ServerInfo_Replay const *RemoteReplayList_TreeModel::getReplay(const QModelIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerInfo_ReplayMatch const *RemoteReplayList_TreeModel::getReplayMatch(const QModelIndex &index) const
|
ServerInfo_ReplayMatch const *RemoteReplayList_TreeModel::getReplayMatch(const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
if (!index.isValid())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
auto *node = dynamic_cast<MatchNode *>(static_cast<Node *>(index.internalPointer()));
|
||||||
|
if (!node)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return &node->getMatchInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
ServerInfo_ReplayMatch const *RemoteReplayList_TreeModel::getEnclosingReplayMatch(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -338,6 +350,7 @@ QList<ServerInfo_Replay const *> RemoteReplayList_TreeWidget::getSelectedReplays
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all currently selected replayMatches.
|
* Gets all currently selected replayMatches.
|
||||||
|
* If a non-folder node is selected, it will return the parent folder of that node.
|
||||||
*
|
*
|
||||||
* @return A Set of pointers to the selected replayMatches.
|
* @return A Set of pointers to the selected replayMatches.
|
||||||
*/
|
*/
|
||||||
|
|
@ -346,7 +359,7 @@ QSet<ServerInfo_ReplayMatch const *> RemoteReplayList_TreeWidget::getSelectedRep
|
||||||
const auto selection = selectionModel()->selectedRows();
|
const auto selection = selectionModel()->selectedRows();
|
||||||
auto replayMatches = QSet<ServerInfo_ReplayMatch const *>();
|
auto replayMatches = QSet<ServerInfo_ReplayMatch const *>();
|
||||||
for (const auto &row : selection) {
|
for (const auto &row : selection) {
|
||||||
if (const auto replayMatch = treeModel->getReplayMatch(proxyModel->mapToSource(row))) {
|
if (const auto replayMatch = treeModel->getEnclosingReplayMatch(proxyModel->mapToSource(row))) {
|
||||||
replayMatches << replayMatch;
|
replayMatches << replayMatch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,7 @@ public:
|
||||||
void refreshTree();
|
void refreshTree();
|
||||||
ServerInfo_Replay const *getReplay(const QModelIndex &index) const;
|
ServerInfo_Replay const *getReplay(const QModelIndex &index) const;
|
||||||
ServerInfo_ReplayMatch const *getReplayMatch(const QModelIndex &index) const;
|
ServerInfo_ReplayMatch const *getReplayMatch(const QModelIndex &index) const;
|
||||||
|
ServerInfo_ReplayMatch const *getEnclosingReplayMatch(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);
|
void removeMatchInfo(int gameId);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue