2013-09-19 23:41:14 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../GuiComponent.h"
|
|
|
|
#include "../scrapers/Scraper.h"
|
2014-03-01 00:52:32 +00:00
|
|
|
#include "../components/ComponentGrid.h"
|
|
|
|
#include "../components/TextComponent.h"
|
|
|
|
#include "../components/ScrollableContainer.h"
|
|
|
|
#include "../components/TextEditComponent.h"
|
|
|
|
#include "../components/NinePatchComponent.h"
|
|
|
|
#include "../components/ImageComponent.h"
|
2013-09-19 23:41:14 +00:00
|
|
|
#include "../Settings.h"
|
2013-09-20 23:55:05 +00:00
|
|
|
#include "../HttpReq.h"
|
2013-09-19 23:41:14 +00:00
|
|
|
|
2013-09-24 04:58:59 +00:00
|
|
|
#define MAX_SCRAPER_RESULTS 5
|
|
|
|
|
2013-09-19 23:41:14 +00:00
|
|
|
class GuiGameScraper : public GuiComponent
|
|
|
|
{
|
|
|
|
public:
|
2013-09-23 00:40:51 +00:00
|
|
|
GuiGameScraper(Window* window, ScraperSearchParams params, std::function<void(MetaDataList)> doneFunc, std::function<void()> skipFunc = nullptr);
|
2013-09-19 23:41:14 +00:00
|
|
|
|
|
|
|
bool input(InputConfig* config, Input input) override;
|
2013-09-20 23:55:05 +00:00
|
|
|
void update(int deltaTime) override;
|
2013-09-19 23:41:14 +00:00
|
|
|
|
|
|
|
void search();
|
2014-01-25 23:34:29 +00:00
|
|
|
|
|
|
|
virtual std::vector<HelpPrompt> getHelpPrompts() override;
|
|
|
|
|
2013-09-19 23:41:14 +00:00
|
|
|
private:
|
|
|
|
int getSelectedIndex();
|
|
|
|
void onSearchDone(std::vector<MetaDataList> results);
|
2013-12-01 01:04:46 +00:00
|
|
|
void updateInfoPane();
|
2013-09-20 23:55:05 +00:00
|
|
|
void updateThumbnail();
|
2013-09-19 23:41:14 +00:00
|
|
|
|
2014-03-01 00:52:32 +00:00
|
|
|
ComponentGrid mList;
|
2013-09-19 23:41:14 +00:00
|
|
|
NinePatchComponent mBox;
|
|
|
|
|
|
|
|
TextComponent mHeader;
|
|
|
|
|
|
|
|
TextComponent mResultName;
|
|
|
|
ScrollableContainer mResultInfo;
|
|
|
|
TextComponent mResultDesc;
|
2013-09-20 23:55:05 +00:00
|
|
|
ImageComponent mResultThumbnail;
|
2013-09-19 23:41:14 +00:00
|
|
|
|
|
|
|
TextComponent mSearchLabel;
|
|
|
|
TextEditComponent mSearchText;
|
|
|
|
|
|
|
|
std::vector<TextComponent> mResultNames;
|
|
|
|
|
|
|
|
ScraperSearchParams mSearchParams;
|
|
|
|
|
|
|
|
std::vector<MetaDataList> mScraperResults;
|
|
|
|
|
|
|
|
std::function<void(MetaDataList)> mDoneFunc;
|
|
|
|
std::function<void()> mSkipFunc;
|
2013-09-20 23:55:05 +00:00
|
|
|
|
|
|
|
std::unique_ptr<HttpReq> mThumbnailReq;
|
2013-09-19 23:41:14 +00:00
|
|
|
};
|