2013-09-19 23:41:14 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../GuiComponent.h"
|
|
|
|
#include "../scrapers/Scraper.h"
|
|
|
|
#include "ComponentListComponent.h"
|
|
|
|
#include "TextComponent.h"
|
|
|
|
#include "ScrollableContainer.h"
|
|
|
|
#include "TextEditComponent.h"
|
|
|
|
#include "NinePatchComponent.h"
|
|
|
|
#include "../Settings.h"
|
2013-09-20 23:55:05 +00:00
|
|
|
#include "../HttpReq.h"
|
|
|
|
#include "ImageComponent.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();
|
|
|
|
private:
|
|
|
|
int getSelectedIndex();
|
|
|
|
void onSearchDone(std::vector<MetaDataList> results);
|
2013-09-20 23:55:05 +00:00
|
|
|
void updateThumbnail();
|
2013-09-19 23:41:14 +00:00
|
|
|
|
|
|
|
ComponentListComponent mList;
|
|
|
|
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
|
|
|
};
|