Filter : Add text search filter in gamelist options

This commit is contained in:
Fabrice CARUSO
2019-09-23 14:40:36 +02:00
parent bd8c7f1066
commit b16b9d999d
19 changed files with 243 additions and 53 deletions
+15 -12
View File
@@ -120,16 +120,6 @@ const std::string FileData::getName()
return metadata.getName();
}
const std::string FileData::getCore() const
{
return metadata.get("core");
}
const std::string FileData::getEmulator() const
{
return metadata.get("emulator");
}
const std::string FileData::getVideoPath() const
{
std::string video = metadata.get("video");
@@ -216,6 +206,7 @@ void FileData::launchGame(Window* window)
AudioManager::getInstance()->deinit(); // batocera
VolumeControl::getInstance()->deinit();
const std::string controllersConfig = InputManager::getInstance()->configureEmulators(); // batocera / must be done before window->deinit while it closes joysticks
window->deinit();
@@ -230,6 +221,18 @@ void FileData::launchGame(Window* window)
command = Utils::String::replace(command, "%BASENAME%", basename);
command = Utils::String::replace(command, "%ROM_RAW%", rom_raw);
command = Utils::String::replace(command, "%CONTROLLERSCONFIG%", controllersConfig); // batocera
std::string emulator = SystemConf::getInstance()->get(Utils::FileSystem::getFileName(getPath()) + ".emulator");
if (emulator.length() == 0)
emulator = SystemConf::getInstance()->get(mSystem->getFullName() + ".emulator");
std::string core = SystemConf::getInstance()->get(Utils::FileSystem::getFileName(getPath()) + ".core");
if (core.length() == 0)
core = SystemConf::getInstance()->get(mSystem->getFullName() + ".core");
command = Utils::String::replace(command, "%EMULATOR%", emulator);
command = Utils::String::replace(command, "%CORE%", core);
command = Utils::String::replace(command, "%HOME%", Utils::FileSystem::getHomePath());
Scripting::fireEvent("game-start", rom, basename);
@@ -345,8 +348,8 @@ FolderData::SortType getSortTypeFromString(std::string desc) {
const std::vector<FileData*> FolderData::getChildrenListToDisplay()
{
if (mSystem->isCollection())
return mChildren;
// if (mSystem->isCollection())
// return mChildren;
std::vector<FileData*> ret;
-3
View File
@@ -52,9 +52,6 @@ public:
virtual const std::string getMarqueePath() const;
virtual const std::string getImagePath() const;
virtual const std::string getCore() const;
virtual const std::string getEmulator() const;
virtual const bool getHidden();
virtual const bool getFavorite();
virtual const bool getKidGame();
+8
View File
@@ -296,6 +296,11 @@ void FileFilterIndex::debugPrintIndexes()
}
}
void FileFilterIndex::setTextFilter(const std::string text)
{
mTextFilter = Utils::String::toUpper(text);
}
bool FileFilterIndex::showFile(FileData* game)
{
// this shouldn't happen, but just in case let's get it out of the way
@@ -319,6 +324,9 @@ bool FileFilterIndex::showFile(FileData* game)
bool keepGoing = false;
if (!mTextFilter.empty() && Utils::String::toUpper(game->getName()).find(mTextFilter) != std::string::npos)
keepGoing = true;
for (std::vector<FilterDataDecl>::const_iterator it = filterDataDecl.cbegin(); it != filterDataDecl.cend(); ++it ) {
FilterDataDecl filterData = (*it);
if(*(filterData.filteredByRef))
+6 -1
View File
@@ -42,7 +42,7 @@ public:
void clearAllFilters();
void debugPrintIndexes();
bool showFile(FileData* game);
bool isFiltered() { return (filterByGenre || filterByPlayers || filterByPubDev || filterByRatings || filterByFavorites || filterByHidden || filterByKidGame); };
bool isFiltered() { return (!mTextFilter.empty() || filterByGenre || filterByPlayers || filterByPubDev || filterByRatings || filterByFavorites || filterByHidden || filterByKidGame); };
bool isKeyBeingFilteredBy(std::string key, FilterIndexType type);
std::vector<FilterDataDecl>& getFilterDataDecls();
@@ -51,6 +51,9 @@ public:
void resetFilters();
void setUIModeFilters();
void setTextFilter(const std::string text);
inline const std::string getTextFilter() { return mTextFilter; }
private:
std::vector<FilterDataDecl> filterDataDecl;
std::string getIndexableKey(FileData* game, FilterIndexType type, bool getSecondary);
@@ -93,6 +96,8 @@ private:
FileData* mRootFolder;
std::string mTextFilter;
};
#endif // ES_APP_FILE_FILTER_INDEX_H
+45 -3
View File
@@ -3,6 +3,8 @@
#include "components/OptionListComponent.h"
#include "views/UIModeController.h"
#include "SystemData.h"
#include "guis/GuiTextEditPopup.h"
#include "guis/GuiTextEditPopupKeyboard.h"
GuiGamelistFilter::GuiGamelistFilter(Window* window, SystemData* system) : GuiComponent(window), mMenu(window, "FILTER GAMELIST BY"), mSystem(system)
{
@@ -21,6 +23,7 @@ void GuiGamelistFilter::initializeMenu()
mMenu.addEntry(_("RESET ALL FILTERS"), false, std::bind(&GuiGamelistFilter::resetAllFilters, this));
// addTextFilterToMenu();
addFiltersToMenu();
mMenu.addButton(_("BACK"), "back", std::bind(&GuiGamelistFilter::applyFilters, this));
@@ -48,6 +51,42 @@ GuiGamelistFilter::~GuiGamelistFilter()
mSystem->deleteIndex();
}
void GuiGamelistFilter::addTextFilterToMenu()
{
auto theme = ThemeData::getMenuTheme();
std::shared_ptr<Font> font = theme->Text.font;
unsigned int color = theme->Text.color;
ComponentListRow row;
auto lbl = std::make_shared<TextComponent>(mWindow, _("FIND GAMES"), font, color);
row.addElement(lbl, true); // label
mTextFilter = std::make_shared<TextComponent>(mWindow, mFilterIndex->getTextFilter(), font, color, ALIGN_RIGHT);
row.addElement(mTextFilter, true);
auto spacer = std::make_shared<GuiComponent>(mWindow);
spacer->setSize(Renderer::getScreenWidth() * 0.005f, 0);
row.addElement(spacer, false);
auto bracket = std::make_shared<ImageComponent>(mWindow);
bracket->setImage(theme->Icons.arrow);
bracket->setResize(Vector2f(0, lbl->getFont()->getLetterHeight()));
row.addElement(bracket, false);
auto updateVal = [this](const std::string& newVal) { mTextFilter->setValue(Utils::String::toUpper(newVal)); };
row.makeAcceptInputHandler([this, updateVal]
{
if (Settings::getInstance()->getBool("UseOSK"))
mWindow->pushGui(new GuiTextEditPopupKeyboard(mWindow, _("FIND GAMES"), mTextFilter->getValue(), updateVal, false));
else
mWindow->pushGui(new GuiTextEditPopup(mWindow, _("FIND GAMES"), mTextFilter->getValue(), updateVal, false));
});
mMenu.addRow(row);
}
void GuiGamelistFilter::addFiltersToMenu()
{
std::vector<FilterDataDecl> decls = mFilterIndex->getFilterDataDecls();
@@ -64,8 +103,7 @@ void GuiGamelistFilter::addFiltersToMenu()
std::map<std::string, int>* allKeys = (*it).allIndexKeys; // all possible filters for this type
std::string menuLabel = (*it).menuLabel; // text to show in menu
std::shared_ptr< OptionListComponent<std::string> > optionList;
// add filters (with first one selected)
ComponentListRow row;
@@ -84,8 +122,12 @@ void GuiGamelistFilter::addFiltersToMenu()
void GuiGamelistFilter::applyFilters()
{
if (mTextFilter)
mFilterIndex->setTextFilter(mTextFilter->getValue());
std::vector<FilterDataDecl> decls = mFilterIndex->getFilterDataDecls();
for (std::map<FilterIndexType, std::shared_ptr< OptionListComponent<std::string> >>::const_iterator it = mFilterOptions.cbegin(); it != mFilterOptions.cend(); ++it ) {
for (std::map<FilterIndexType, std::shared_ptr< OptionListComponent<std::string> >>::const_iterator it = mFilterOptions.cbegin(); it != mFilterOptions.cend(); ++it )
{
std::shared_ptr< OptionListComponent<std::string> > optionList = it->second;
std::vector<std::string> filters = optionList->getSelectedObjects();
mFilterIndex->setFilter(it->first, &filters);
+3
View File
@@ -24,12 +24,15 @@ private:
void applyFilters();
void resetAllFilters();
void addFiltersToMenu();
void addTextFilterToMenu();
std::map<FilterIndexType, std::shared_ptr< OptionListComponent<std::string> >> mFilterOptions;
MenuComponent mMenu;
SystemData* mSystem;
FileFilterIndex* mFilterIndex;
std::shared_ptr<GuiComponent> mTextFilter;
};
#endif // ES_APP_GUIS_GUI_GAME_LIST_FILTER_H
+84 -19
View File
@@ -14,6 +14,8 @@
#include "LocaleES.h"
#include "guis/GuiMenu.h"
#include "guis/GuiMsgBox.h"
#include "guis/GuiTextEditPopup.h"
#include "guis/GuiTextEditPopupKeyboard.h"
std::vector<std::string> GuiGamelistOptions::gridSizes {
"automatic",
@@ -78,12 +80,15 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system, bool
addChild(&mMenu);
if (!Settings::getInstance()->getBool("ForceDisableFilters"))
addTextFilterToMenu();
// check it's not a placeholder folder - if it is, only show "Filter Options"
FileData* file = getGamelist()->getCursor();
fromPlaceholder = file->isPlaceHolder();
ComponentListRow row;
if (!fromPlaceholder)
if (!fromPlaceholder)
{
// jump to letter
row.elements.clear();
@@ -118,25 +123,25 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system, bool
};
mMenu.addRow(row);
}
// sort list by
unsigned int currentSortId = mSystem->getSortId();
if (currentSortId > FileSorts::SortTypes.size())
currentSortId = 0;
mListSort = std::make_shared<SortList>(mWindow, _("SORT GAMES BY"), false);
for(unsigned int i = 0; i < FileSorts::SortTypes.size(); i++)
{
const FolderData::SortType& sort = FileSorts::SortTypes.at(i);
mListSort->add(sort.icon + _(Utils::String::toUpper(sort.description).c_str()), i, i == currentSortId); // TODO - actually make the sort type persistent
}
mMenu.addWithLabel(_("SORT GAMES BY"), mListSort); // batocera
}
// sort list by
unsigned int currentSortId = mSystem->getSortId();
if (currentSortId > FileSorts::SortTypes.size())
currentSortId = 0;
mListSort = std::make_shared<SortList>(mWindow, _("SORT GAMES BY"), false);
for(unsigned int i = 0; i < FileSorts::SortTypes.size(); i++)
{
const FolderData::SortType& sort = FileSorts::SortTypes.at(i);
mListSort->add(sort.icon + _(Utils::String::toUpper(sort.description).c_str()), i, i == currentSortId); // TODO - actually make the sort type persistent
}
mMenu.addWithLabel(_("SORT GAMES BY"), mListSort); // batocera
// Show filtered menu
if (!Settings::getInstance()->getBool("ForceDisableFilters"))
mMenu.addEntry(_("FILTER GAMELIST"), true, std::bind(&GuiGamelistOptions::openGamelistFilter, this));
mMenu.addEntry(_("OTHER FILTERS"), true, std::bind(&GuiGamelistOptions::openGamelistFilter, this));
// GameList view style
mViewMode = std::make_shared< OptionListComponent<std::string> >(mWindow, _("GAMELIST VIEW STYLE"), false);
@@ -237,7 +242,7 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system, bool
// batocera
if (UIModeController::getInstance()->isUIModeFull() && !(mSystem->isCollection() && file->getType() == FOLDER))
mMenu.addEntry(_("ADVANCED GAME OPTIONS"), true, [this, file, system] { GuiMenu::popGameConfigurationGui(mWindow, Utils::FileSystem::getFileName(file->getPath()), file->getSourceFileData()->getSystem(), ""); });
/*
// Game List Update
mMenu.addEntry(_("UPDATE GAMES LISTS"), false, [this, window]
{
@@ -268,12 +273,74 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system, bool
}, _("NO"), nullptr));
});
*/
mMenu.setMaxHeight(Renderer::getScreenHeight() * 0.85f);
// center the menu
setSize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight());
mMenu.animateTo(Vector2f((Renderer::getScreenWidth() - mMenu.getSize().x()) / 2, (Renderer::getScreenHeight() - mMenu.getSize().y()) / 2));
}
void GuiGamelistOptions::addTextFilterToMenu()
{
auto theme = ThemeData::getMenuTheme();
std::shared_ptr<Font> font = theme->Text.font;
unsigned int color = theme->Text.color;
ComponentListRow row;
auto lbl = std::make_shared<TextComponent>(mWindow, _("FILTER GAMES BY TEXT"), font, color);
row.addElement(lbl, true); // label
std::string searchText;
auto idx = mSystem->getIndex(false);
if (idx != nullptr)
searchText = idx->getTextFilter();
mTextFilter = std::make_shared<TextComponent>(mWindow, searchText, font, color, ALIGN_RIGHT);
row.addElement(mTextFilter, true);
auto spacer = std::make_shared<GuiComponent>(mWindow);
spacer->setSize(Renderer::getScreenWidth() * 0.005f, 0);
row.addElement(spacer, false);
auto bracket = std::make_shared<ImageComponent>(mWindow);
auto searchIcon = theme->getMenuIcon("searchIcon");
bracket->setImage(searchIcon.empty() ? ":/search.svg" : searchIcon);
bracket->setResize(Vector2f(0, lbl->getFont()->getLetterHeight()));
row.addElement(bracket, false);
auto updateVal = [this](const std::string& newVal)
{
mTextFilter->setValue(Utils::String::toUpper(newVal));
auto index = mSystem->getIndex(!newVal.empty());
if (index != nullptr)
{
mFiltersChanged = true;
index->setTextFilter(newVal);
if (!index->isFiltered())
mSystem->deleteIndex();
delete this;
}
};
row.makeAcceptInputHandler([this, updateVal]
{
if (Settings::getInstance()->getBool("UseOSK"))
mWindow->pushGui(new GuiTextEditPopupKeyboard(mWindow, _("FILTER GAMES BY TEXT"), mTextFilter->getValue(), updateVal, false));
else
mWindow->pushGui(new GuiTextEditPopup(mWindow, _("FILTER GAMES BY TEXT"), mTextFilter->getValue(), updateVal, false));
});
mMenu.addRow(row);
}
GuiGamelistOptions::~GuiGamelistOptions()
{
if (mSystem == nullptr)
@@ -329,8 +396,6 @@ GuiGamelistOptions::~GuiGamelistOptions()
// game is selected
ViewController::get()->reloadGameListView(mSystem);
}
}
void GuiGamelistOptions::openGamelistFilter()
+4 -1
View File
@@ -24,7 +24,8 @@ public:
private:
inline void addSaveFunc(const std::function<void()>& func) { mSaveFuncs.push_back(func); };
void addTextFilterToMenu();
void openGamelistFilter();
void openMetaDataEd();
void startEditMode();
@@ -39,6 +40,8 @@ private:
typedef OptionListComponent<unsigned int> SortList;
std::shared_ptr<SortList> mListSort;
std::shared_ptr<GuiComponent> mTextFilter;
std::shared_ptr<OptionListComponent<std::string>> mViewMode;
std::shared_ptr<OptionListComponent<std::string>> mGridSize;
+1 -1
View File
@@ -561,7 +561,7 @@ void SystemView::getViewElements(const std::shared_ptr<ThemeData>& theme)
if (sysInfoElem)
mSystemInfo.applyTheme(theme, "system", "systemInfo", ThemeFlags::ALL);
const ThemeData::ThemeElement* fixedBackgroundElem = theme->getElement("system", "fixedBackground", "image");
const ThemeData::ThemeElement* fixedBackgroundElem = theme->getElement("system", "staticBackground", "image");
if (fixedBackgroundElem)
{
if (mStaticBackground == nullptr)
+12
View File
@@ -236,6 +236,9 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>> The
{ "menuSwitch",{
{ "pathOn", PATH },
{ "pathOff", PATH } } },
{ "menuTextEdit",{
{ "active", PATH },
{ "inactive", PATH } } },
{ "menuSlider",{
{ "path", PATH } } },
{ "menuButton",{
@@ -1177,6 +1180,15 @@ ThemeData::ThemeMenu::ThemeMenu(ThemeData* theme)
Icons.button_filled = elem->get<std::string>("filledPath");
}
elem = theme->getElement("menu", "menutextedit", "menuTextEdit");
if (elem)
{
if (elem->has("active") && ResourceManager::getInstance()->fileExists(elem->get<std::string>("active")))
Icons.textinput_ninepatch_active = elem->get<std::string>("active");
if (elem->has("inactive") && ResourceManager::getInstance()->fileExists(elem->get<std::string>("inactive")))
Icons.textinput_ninepatch = elem->get<std::string>("inactive");
}
elem = theme->getElement("menu", "menuswitch", "menuSwitch");
if (elem)
{
+3 -1
View File
@@ -121,6 +121,8 @@ struct IconElement
std::string option_arrow;
std::string arrow;
std::string knob;
std::string textinput_ninepatch;
std::string textinput_ninepatch_active;
};
class ThemeData
@@ -136,7 +138,7 @@ public:
MenuElement Text{ 0x777777FF, 0xFFFFFFFF, 0x878787FF, 0xC6C7C6FF, 0x878787FF, true, "", "", nullptr };
MenuElement TextSmall{ 0x777777FF, 0xFFFFFFFF, 0x878787FF, 0xC6C7C6FF, 0x878787FF, true, "", "", nullptr };
MenuElement Footer{ 0xC6C6C6FF, 0xC6C6C6FF, 0xC6C6C6FF, 0xFFFFFFFF, 0xC6C6C6FF, true, "", "", nullptr };
IconElement Icons{ ":/button.png", ":/button_filled.png", ":/on.svg", ":/off.svg", ":/option_arrow.svg", ":/arrow.svg", ":/slider_knob.svg" };
IconElement Icons{ ":/button.png", ":/button_filled.png", ":/on.svg", ":/off.svg", ":/option_arrow.svg", ":/arrow.svg", ":/slider_knob.svg", ":/textinput_ninepatch.png", ":/textinput_ninepatch_active.png" };
std::string getMenuIcon(const std::string name)
{
+4 -1
View File
@@ -10,6 +10,8 @@
MenuComponent::MenuComponent(Window* window, const char* title, const std::shared_ptr<Font>& titleFont) : GuiComponent(window),
mBackground(window), mGrid(window, Vector2i(1, 3))
{
mMaxHeight = 0;
auto theme = ThemeData::getMenuTheme();
addChild(&mBackground);
@@ -149,7 +151,8 @@ void MenuComponent::updateSize()
return;
}
const float maxHeight = Renderer::getScreenHeight() * 0.75f;
const float maxHeight = mMaxHeight <= 0 ? Renderer::getScreenHeight() * 0.75f : mMaxHeight;
float height = TITLE_HEIGHT + mList->getTotalRowHeight() + getButtonGridHeight() + 2;
if(height > maxHeight)
{
+11
View File
@@ -39,6 +39,15 @@ public:
float getButtonGridHeight() const;
void setMaxHeight(float maxHeight)
{
if (mMaxHeight == maxHeight)
return;
mMaxHeight = maxHeight;
updateSize();
}
private:
void updateSize();
void updateGrid();
@@ -50,6 +59,8 @@ private:
std::shared_ptr<ComponentList> mList;
std::shared_ptr<ComponentGrid> mButtonGrid;
std::vector< std::shared_ptr<ButtonComponent> > mButtons;
float mMaxHeight;
};
#endif // ES_CORE_COMPONENTS_MENU_COMPONENT_H
+26 -7
View File
@@ -10,11 +10,18 @@
#define CURSOR_REPEAT_START_DELAY 500
#define CURSOR_REPEAT_SPEED 28 // lower is faster
#define BLINKTIME 1000
TextEditComponent::TextEditComponent(Window* window) : GuiComponent(window),
mBox(window, ":/textinput_ninepatch.png"), mFocused(false),
mScrollOffset(0.0f, 0.0f), mCursor(0), mEditing(false), mFont(Font::get(FONT_SIZE_MEDIUM, FONT_PATH_LIGHT)),
mCursorRepeatDir(0)
{
mBlinkTime = 0;
auto theme = ThemeData::getMenuTheme();
mBox.setImagePath(ThemeData::getMenuTheme()->Icons.textinput_ninepatch);
addChild(&mBox);
onFocusLost();
@@ -25,13 +32,13 @@ TextEditComponent::TextEditComponent(Window* window) : GuiComponent(window),
void TextEditComponent::onFocusGained()
{
mFocused = true;
mBox.setImagePath(":/textinput_ninepatch_active.png");
mBox.setImagePath(ThemeData::getMenuTheme()->Icons.textinput_ninepatch_active);
}
void TextEditComponent::onFocusLost()
{
mFocused = false;
mBox.setImagePath(":/textinput_ninepatch.png");
mBox.setImagePath(ThemeData::getMenuTheme()->Icons.textinput_ninepatch);
}
void TextEditComponent::onSizeChanged()
@@ -89,7 +96,7 @@ void TextEditComponent::stopEditing()
}
bool TextEditComponent::input(InputConfig* config, Input input)
{
{
bool const cursor_left = (config->getDeviceId() != DEVICE_KEYBOARD && config->isMappedLike("left", input)) ||
(config->getDeviceId() == DEVICE_KEYBOARD && input.id == SDLK_LEFT);
bool const cursor_right = (config->getDeviceId() != DEVICE_KEYBOARD && config->isMappedLike("right", input)) ||
@@ -137,10 +144,12 @@ bool TextEditComponent::input(InputConfig* config, Input input)
// TODO
}else if(cursor_left || cursor_right)
{
mBlinkTime = 0;
mCursorRepeatDir = cursor_left ? -1 : 1;
mCursorRepeatTimer = -(CURSOR_REPEAT_START_DELAY - CURSOR_REPEAT_SPEED);
moveCursor(mCursorRepeatDir);
} else if(config->getDeviceId() == DEVICE_KEYBOARD)
}
else if(config->getDeviceId() == DEVICE_KEYBOARD)
{
switch(input.id)
{
@@ -172,6 +181,10 @@ bool TextEditComponent::input(InputConfig* config, Input input)
void TextEditComponent::update(int deltaTime)
{
mBlinkTime += deltaTime;
if (mBlinkTime >= BLINKTIME)
mBlinkTime = 0;
updateCursorRepeat(deltaTime);
GuiComponent::update(deltaTime);
}
@@ -276,13 +289,19 @@ void TextEditComponent::render(const Transform4x4f& parentTrans)
if(isMultiline())
{
cursorPos = mFont->getWrappedTextCursorOffset(mText, getTextAreaSize().x(), mCursor);
}else{
}
else
{
cursorPos = mFont->sizeText(mText.substr(0, mCursor));
cursorPos[1] = 0;
}
float cursorHeight = mFont->getHeight() * 0.8f;
Renderer::drawRect(cursorPos.x(), cursorPos.y() + (mFont->getHeight() - cursorHeight) / 2, 2.0f, cursorHeight, 0x000000FF, 0x000000FF);
if (mBlinkTime < BLINKTIME / 2)
{
float cursorHeight = mFont->getHeight() * 0.8f;
auto cursorColor = (ThemeData::getMenuTheme()->Text.color & 0xFFFFFF00) | getOpacity();
Renderer::drawRect(cursorPos.x(), cursorPos.y() + (mFont->getHeight() - cursorHeight) / 2, 2.0f, cursorHeight, cursorColor, cursorColor); // 0x000000FF
}
}
}
@@ -62,6 +62,8 @@ private:
std::shared_ptr<Font> mFont;
std::unique_ptr<TextCache> mTextCache;
int mBlinkTime;
};
#endif // ES_CORE_COMPONENTS_TEXT_EDIT_COMPONENT_H
+1
View File
@@ -27,6 +27,7 @@ GuiTextEditPopup::GuiTextEditPopup(Window* window, const std::string& title, con
std::vector< std::shared_ptr<ButtonComponent> > buttons;
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, acceptBtnText, acceptBtnText, [this, okCallback] { okCallback(mText->getValue()); delete this; }));
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, _("RESET"), _("RESET"), [this, okCallback] { okCallback(""); delete this; }));
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, _("CANCEL"), _("DISCARD CHANGES"), [this] { delete this; })); // batocera
mButtonGrid = makeButtonGrid(mWindow, buttons);
@@ -64,7 +64,10 @@ GuiTextEditPopupKeyboard::GuiTextEditPopupKeyboard(Window* window, const std::st
mText->stopEditing();
});
space->setSize(space->getSize().x() * 3, space->getSize().y());
if (Renderer::isSmallScreen())
space->setSize(space->getSize().x(), space->getSize().y());
else
space->setSize(space->getSize().x() * 3, space->getSize().y());
buttons.push_back(space);
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, _("DELETE"), _("DELETE A CHAR"), [this] {
@@ -72,6 +75,9 @@ GuiTextEditPopupKeyboard::GuiTextEditPopupKeyboard(Window* window, const std::st
mText->textInput("\b");
mText->stopEditing();
}));
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, _("RESET"), _("RESET"), [this, okCallback] { okCallback(""); delete this; }));
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, _("CANCEL"), _("DISCARD CHANGES"), [this] { delete this; }));
// Add buttons
@@ -239,10 +245,10 @@ bool GuiTextEditPopupKeyboard::input(InputConfig* config, Input input)
return false;
}
/*
void GuiTextEditPopupKeyboard::update(int deltatime) {
}
}*/
// Shifts the keys when user hits the shift button.
void GuiTextEditPopupKeyboard::shiftKeys()
+1 -1
View File
@@ -13,7 +13,7 @@ public:
const std::function<void(const std::string&)>& okCallback, bool multiLine, const std::string acceptBtnText = "OK");
bool input(InputConfig* config, Input input);
void update(int deltatime) override;
//void update(int deltatime) override;
void onSizeChanged();
std::vector<HelpPrompt> getHelpPrompts() override;
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="30.239px" height="30.239px" viewBox="0 0 30.239 30.239" style="enable-background:new 0 0 30.239 30.239;" xml:space="preserve">
<g>
<path fill="#fff" d="M20.194,3.46c-4.613-4.613-12.121-4.613-16.734,0c-4.612,4.614-4.612,12.121,0,16.735 c4.108,4.107,10.506,4.547,15.116,1.34c0.097,0.459,0.319,0.897,0.676,1.254l6.718,6.718c0.979,0.977,2.561,0.977,3.535,0 c0.978-0.978,0.978-2.56,0-3.535l-6.718-6.72c-0.355-0.354-0.794-0.577-1.253-0.674C24.743,13.967,24.303,7.57,20.194,3.46z M18.073,18.074c-3.444,3.444-9.049,3.444-12.492,0c-3.442-3.444-3.442-9.048,0-12.492c3.443-3.443,9.048-3.443,12.492,0 C21.517,9.026,21.517,14.63,18.073,18.074z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB