Commit 6d558916 authored by Supernature2k's avatar Supernature2k

enhancement

parent ac5aaf78
This diff is collapsed.
......@@ -125,34 +125,22 @@ void GuiHashStart::start()
bool GuiHashStart::input(InputConfig* config, Input input)
{
bool consumed = GuiComponent::input(config, input);
if(consumed)
return true;
if (mLoading)
return false;
if(input.value != 0 && config->isMappedTo("a", input))
{
delete this;
return true;
}
return false;
if (config->isMappedTo("a", input) && input.value != 0)
{
delete this;
}
return GuiComponent::input(config, input);
}
void GuiHashStart::update(int deltaTime) {
GuiComponent::update(deltaTime);
mBusyAnim.update(deltaTime);
Window* window = mWindow;
if (mState == 1) {
window->pushGui(
new GuiMsgBox(window, _("REALLY UPDATE?"), _("YES"), [this, window] {
this->mLoading = true;
mHandle = new boost::thread(boost::bind(&GuiHashStart::start, this));
}, _("NO"), [this] {
mState = -1;
})
);
this->mLoading = true;
mHandle = new boost::thread(boost::bind(&GuiHashStart::start, this));
mState = 0;
}
if (mState == -1) {
......@@ -163,7 +151,8 @@ void GuiHashStart::update(int deltaTime) {
void GuiHashStart::render(const Eigen::Affine3f &parentTrans) {
Eigen::Affine3f trans = parentTrans * getTransform();
renderChildren(trans);
if (!mLoading)
renderChildren(trans);
Renderer::setMatrix(trans);
Renderer::drawRect(0.f, 0.f, mSize.x(), mSize.y(), 0x00000011);
......
......@@ -21,6 +21,26 @@
using namespace Eigen;
bool compareLowerCase(std::string str1, std::string str2)
{
for(unsigned int i = 0; i < str1.length(); i++)
{
str1[i] = tolower(str1[i]);
}
for(unsigned int i = 0; i < str2.length(); i++)
{
str2[i] = tolower(str2[i]);
}
if (str1 == str2) {
return true;
} else {
return false;
};
}
//end util functions
GuiNetPlay::GuiNetPlay(Window* window) : GuiComponent(window),
mBackground(window, ":/frame.png"), mGrid(window, Eigen::Vector2i(1, 3)), mList(NULL),
mGridMeta(new ComponentGrid(window, Eigen::Vector2i(2, 1)))
......@@ -218,11 +238,14 @@ bool GuiNetPlay::parseLobby()
}
for (json::ptree::value_type &array_element : root) {
if (array_element.second.get<std::string>("fields.game_crc") == "00000000") {
mGames.push_back(findGame(array_element.second.get<std::string>("fields.game_name")));
} else {
mGames.push_back(findGame(array_element.second.get<std::string>("fields.game_crc")));
FileData* tmp = NULL;
if (array_element.second.get<std::string>("fields.game_crc") != "00000000") {
tmp = findGame(array_element.second.get<std::string>("fields.game_crc"));
}
if (!tmp) {
tmp = findGame(array_element.second.get<std::string>("fields.game_name"));
}
mGames.push_back(tmp);
//mPings.push_back(pingLobbyHost(array_element.second.get<std::string>("fields.ip")));
mRooms.push_back(array_element);
......@@ -240,7 +263,6 @@ FileData* GuiNetPlay::findGame(std::string gameNameOrHash)
std::vector<FileData*> games = tmp->getRootFolder()->getChildren();
FileData* result = findRecursive(games, gameNameOrHash);
if (result != NULL) {
//std::cout << gameNameOrHash << " found : " << result->getName() << "\n";
return result;
}
}
......@@ -264,7 +286,7 @@ FileData* GuiNetPlay::findRecursive(const std::vector<FileData*>& gameFolder, co
return foundGame;
}
}
if ((*game)->getType() == GAME and (gameAndPath == gameNameOrHash or (*game)->getHash() == gameNameOrHash)) {
if ((*game)->getType() == GAME and (compareLowerCase(gameAndPath, gameNameOrHash) or (*game)->getHash() == gameNameOrHash)) {
return *game;
}
}
......
......@@ -14,6 +14,7 @@
#include <guis/GuiSettings.h>
#include <RecalboxConf.h>
#include <guis/GuiNetPlay.h>
#include <guis/GuiLoading.h>
#include "ThemeData.h"
#include "MenuThemeData.h"
#include "AudioManager.h"
......@@ -185,7 +186,7 @@ bool SystemView::input(InputConfig* config, Input input)
launchKodi = false;
delete s;
});
auto lbl = std::make_shared<TextComponent>(mWindow, _("KODI MEDIA CENTER"), menuTheme->menuText.font, menuTheme->menuText.color);
auto lbl = std::make_shared<TextComponent>(mWindow, "\uF1c3 " + _("KODI MEDIA CENTER"), menuTheme->menuText.font, menuTheme->menuText.color);
row.addElement(lbl, true); // label
s->addRow(row);
row.elements.clear();
......@@ -194,7 +195,17 @@ bool SystemView::input(InputConfig* config, Input input)
mWindow->pushGui(netplay);
delete s;
});
auto lbl2 = std::make_shared<TextComponent>(mWindow, _("NETPLAY LOBBY"), menuTheme->menuText.font, menuTheme->menuText.color);
/*std::function<void(void *)> showLobby = [this, s](void *guilobby) {
mWindow->pushGui((GuiComponent *)guilobby);
delete s;
};
row.makeAcceptInputHandler([this, s, showLobby] {
mWindow->pushGui(new GuiLoading(mWindow, [this, s, showLobby] {
auto netplay = new GuiNetPlay(mWindow);
return (void *) netplay;
}, showLobby));
});*/
auto lbl2 = std::make_shared<TextComponent>(mWindow, "\uF1c4 " + _("NETPLAY LOBBY"), menuTheme->menuText.font, menuTheme->menuText.color);
row.addElement(lbl2, true); // label
s->addRow(row);
mWindow->pushGui(s);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment