mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-09 07:21:04 +02:00
Add ctrl+a to select all saves in save browser (#698)
This commit is contained in:
@@ -177,6 +177,17 @@ void SearchController::Selected(int saveID, bool selected)
|
|||||||
searchModel->DeselectSave(saveID);
|
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)
|
void SearchController::InstantOpen(bool instant)
|
||||||
{
|
{
|
||||||
instantOpen = instant;
|
instantOpen = instant;
|
||||||
|
@@ -42,6 +42,7 @@ public:
|
|||||||
void ShowOwn(bool show);
|
void ShowOwn(bool show);
|
||||||
void ShowFavourite(bool show);
|
void ShowFavourite(bool show);
|
||||||
void Selected(int saveID, bool selected);
|
void Selected(int saveID, bool selected);
|
||||||
|
void SelectAllSaves();
|
||||||
void InstantOpen(bool instant);
|
void InstantOpen(bool instant);
|
||||||
void OpenSave(int saveID);
|
void OpenSave(int saveID);
|
||||||
void OpenSave(int saveID, int saveDate);
|
void OpenSave(int saveID, int saveDate);
|
||||||
|
@@ -199,6 +199,14 @@ void SearchModel::SelectSave(int saveID)
|
|||||||
notifySelectedChanged();
|
notifySelectedChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchModel::SelectAllSaves()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < saveList.size(); i++)
|
||||||
|
{
|
||||||
|
SelectSave(saveList[i]->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SearchModel::DeselectSave(int saveID)
|
void SearchModel::DeselectSave(int saveID)
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
@@ -69,6 +69,7 @@ public:
|
|||||||
std::vector<int> GetSelected() { return selected; }
|
std::vector<int> GetSelected() { return selected; }
|
||||||
void ClearSelected() { selected.clear(); notifySelectedChanged(); }
|
void ClearSelected() { selected.clear(); notifySelectedChanged(); }
|
||||||
void SelectSave(int saveID);
|
void SelectSave(int saveID);
|
||||||
|
void SelectAllSaves();
|
||||||
void DeselectSave(int saveID);
|
void DeselectSave(int saveID);
|
||||||
void Update();
|
void Update();
|
||||||
};
|
};
|
||||||
|
@@ -654,6 +654,8 @@ void SearchView::OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctr
|
|||||||
return;
|
return;
|
||||||
if (key == SDLK_ESCAPE)
|
if (key == SDLK_ESCAPE)
|
||||||
c->Exit();
|
c->Exit();
|
||||||
|
else if (key == SDLK_a && ctrl)
|
||||||
|
c->SelectAllSaves();
|
||||||
else if (key == SDLK_LCTRL || key == SDLK_RCTRL)
|
else if (key == SDLK_LCTRL || key == SDLK_RCTRL)
|
||||||
c->InstantOpen(true);
|
c->InstantOpen(true);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user