Add ctrl+a to select all saves in save browser (#698)
This commit is contained in:
parent
0959354178
commit
5ab939720a
@ -177,6 +177,17 @@ void SearchController::Selected(int saveID, bool selected)
|
||||
searchModel->DeselectSave(saveID);
|
||||
}
|
||||
|
||||
void SearchController::SelectAllSaves()
|
||||
{
|
||||
if (!Client::Ref().GetAuthUser().UserID)
|
||||
return;
|
||||
if (searchModel->GetShowOwn() ||
|
||||
Client::Ref().GetAuthUser().UserElevation == User::ElevationModerator ||
|
||||
Client::Ref().GetAuthUser().UserElevation == User::ElevationAdmin)
|
||||
searchModel->SelectAllSaves();
|
||||
|
||||
}
|
||||
|
||||
void SearchController::InstantOpen(bool instant)
|
||||
{
|
||||
instantOpen = instant;
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
void ShowOwn(bool show);
|
||||
void ShowFavourite(bool show);
|
||||
void Selected(int saveID, bool selected);
|
||||
void SelectAllSaves();
|
||||
void InstantOpen(bool instant);
|
||||
void OpenSave(int saveID);
|
||||
void OpenSave(int saveID, int saveDate);
|
||||
|
@ -199,6 +199,14 @@ void SearchModel::SelectSave(int saveID)
|
||||
notifySelectedChanged();
|
||||
}
|
||||
|
||||
void SearchModel::SelectAllSaves()
|
||||
{
|
||||
for (int i = 0; i < saveList.size(); i++)
|
||||
{
|
||||
SelectSave(saveList[i]->id);
|
||||
}
|
||||
}
|
||||
|
||||
void SearchModel::DeselectSave(int saveID)
|
||||
{
|
||||
bool changed = false;
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
std::vector<int> GetSelected() { return selected; }
|
||||
void ClearSelected() { selected.clear(); notifySelectedChanged(); }
|
||||
void SelectSave(int saveID);
|
||||
void SelectAllSaves();
|
||||
void DeselectSave(int saveID);
|
||||
void Update();
|
||||
};
|
||||
|
@ -654,6 +654,8 @@ void SearchView::OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctr
|
||||
return;
|
||||
if (key == SDLK_ESCAPE)
|
||||
c->Exit();
|
||||
else if (key == SDLK_a && ctrl)
|
||||
c->SelectAllSaves();
|
||||
else if (key == SDLK_LCTRL || key == SDLK_RCTRL)
|
||||
c->InstantOpen(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user