Merge pull request #390 from Koerty/grid-swap-left-right-shoulder

[GRID 1] Allow quick system swap using left/right shoulder
This commit is contained in:
Jools Wills 2018-04-05 14:28:37 +01:00 committed by GitHub
commit 75844f4568
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 2 deletions

View file

@ -97,6 +97,16 @@ void BasicGameListView::addPlaceholder()
mList.add(placeholder->getName(), placeholder, (placeholder->getType() == PLACEHOLDER));
}
std::string BasicGameListView::getQuickSystemSelectRightButton()
{
return "right";
}
std::string BasicGameListView::getQuickSystemSelectLeftButton()
{
return "left";
}
void BasicGameListView::launch(FileData* game)
{
ViewController::get()->launch(game);

View file

@ -24,6 +24,8 @@ public:
virtual void launch(FileData* game) override;
protected:
virtual std::string getQuickSystemSelectRightButton() override;
virtual std::string getQuickSystemSelectLeftButton() override;
virtual void populateList(const std::vector<FileData*>& files) override;
virtual void remove(FileData* game, bool deleteFile) override;
virtual void addPlaceholder();

View file

@ -1,6 +1,7 @@
#include "views/gamelist/GridGameListView.h"
#include "views/ViewController.h"
#include "Settings.h"
#include "SystemData.h"
GridGameListView::GridGameListView(Window* window, FileData* root) : ISimpleGameListView(window, root),
@ -27,6 +28,16 @@ void GridGameListView::setCursor(FileData* file)
}
}
std::string GridGameListView::getQuickSystemSelectRightButton()
{
return "pagedown"; //rightshoulder
}
std::string GridGameListView::getQuickSystemSelectLeftButton()
{
return "pageup"; //leftshoulder
}
bool GridGameListView::input(InputConfig* config, Input input)
{
if(config->isMappedTo("left", input) || config->isMappedTo("right", input))
@ -88,6 +99,12 @@ void GridGameListView::remove(FileData *game, bool deleteFile)
std::vector<HelpPrompt> GridGameListView::getHelpPrompts()
{
std::vector<HelpPrompt> prompts;
if(Settings::getInstance()->getBool("QuickSystemSelect"))
{
prompts.push_back(HelpPrompt("l", "system"));
prompts.push_back(HelpPrompt("r", "system"));
}
prompts.push_back(HelpPrompt("up/down/left/right", "scroll"));
prompts.push_back(HelpPrompt("a", "launch"));
prompts.push_back(HelpPrompt("b", "back"));

View file

@ -23,6 +23,8 @@ public:
virtual void launch(FileData* game) override;
protected:
virtual std::string getQuickSystemSelectRightButton() override;
virtual std::string getQuickSystemSelectLeftButton() override;
virtual void populateList(const std::vector<FileData*>& files) override;
virtual void remove(FileData* game, bool deleteFile) override;
virtual void addPlaceholder();

View file

@ -118,7 +118,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
}
return true;
}else if(config->isMappedTo("right", input))
}else if(config->isMappedTo(getQuickSystemSelectRightButton(), input))
{
if(Settings::getInstance()->getBool("QuickSystemSelect"))
{
@ -126,7 +126,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
ViewController::get()->goToNextGameList();
return true;
}
}else if(config->isMappedTo("left", input))
}else if(config->isMappedTo(getQuickSystemSelectLeftButton(), input))
{
if(Settings::getInstance()->getBool("QuickSystemSelect"))
{

View file

@ -28,6 +28,8 @@ public:
virtual void launch(FileData* game) = 0;
protected:
virtual std::string getQuickSystemSelectRightButton() = 0;
virtual std::string getQuickSystemSelectLeftButton() = 0;
virtual void populateList(const std::vector<FileData*>& files) = 0;
TextComponent mHeaderText;