mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Switched over the last functions in Utils.cpp to Utils::String, step 3 of 5 in the quest to remove boost::filesystem
This commit is contained in:
parent
c18d699914
commit
3d3fb2c277
|
@ -11,7 +11,6 @@
|
|||
#include "Settings.h"
|
||||
#include "SystemData.h"
|
||||
#include "ThemeData.h"
|
||||
#include "Util.h"
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <pugixml/src/pugixml.hpp>
|
||||
#include <fstream>
|
||||
|
@ -422,7 +421,7 @@ void CollectionSystemManager::setEditMode(std::string collectionName)
|
|||
// if it's bundled, this needs to be the bundle system
|
||||
mEditingCollectionSystemData = sysData;
|
||||
|
||||
GuiInfoPopup* s = new GuiInfoPopup(mWindow, "Editing the '" + strToUpper(collectionName) + "' Collection. Add/remove games with Y.", 10000);
|
||||
GuiInfoPopup* s = new GuiInfoPopup(mWindow, "Editing the '" + Utils::String::toUpper(collectionName) + "' Collection. Add/remove games with Y.", 10000);
|
||||
mWindow->setInfoPopup(s);
|
||||
}
|
||||
|
||||
|
@ -509,11 +508,11 @@ bool CollectionSystemManager::toggleGameInCollection(FileData* file)
|
|||
}
|
||||
if (adding)
|
||||
{
|
||||
s = new GuiInfoPopup(mWindow, "Added '" + Utils::String::removeParenthesis(name) + "' to '" + strToUpper(sysName) + "'", 4000);
|
||||
s = new GuiInfoPopup(mWindow, "Added '" + Utils::String::removeParenthesis(name) + "' to '" + Utils::String::toUpper(sysName) + "'", 4000);
|
||||
}
|
||||
else
|
||||
{
|
||||
s = new GuiInfoPopup(mWindow, "Removed '" + Utils::String::removeParenthesis(name) + "' from '" + strToUpper(sysName) + "'", 4000);
|
||||
s = new GuiInfoPopup(mWindow, "Removed '" + Utils::String::removeParenthesis(name) + "' from '" + Utils::String::toUpper(sysName) + "'", 4000);
|
||||
}
|
||||
mWindow->setInfoPopup(s);
|
||||
return true;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "Log.h"
|
||||
#include "platform.h"
|
||||
#include "SystemData.h"
|
||||
#include "Util.h"
|
||||
#include "VolumeControl.h"
|
||||
#include "Window.h"
|
||||
|
||||
|
@ -259,9 +258,9 @@ void FileData::launchGame(Window* window)
|
|||
const std::string basename = getPath().stem().string();
|
||||
const std::string rom_raw = boost::filesystem::path(getPath()).make_preferred().string();
|
||||
|
||||
command = strreplace(command, "%ROM%", rom);
|
||||
command = strreplace(command, "%BASENAME%", basename);
|
||||
command = strreplace(command, "%ROM_RAW%", rom_raw);
|
||||
command = Utils::String::replace(command, "%ROM%", rom);
|
||||
command = Utils::String::replace(command, "%BASENAME%", basename);
|
||||
command = Utils::String::replace(command, "%ROM_RAW%", rom_raw);
|
||||
|
||||
LOG(LogInfo) << " " << command;
|
||||
int exitCode = runSystemCommand(command);
|
||||
|
@ -325,7 +324,7 @@ const std::string& CollectionFileData::getName()
|
|||
{
|
||||
if (mDirty) {
|
||||
mCollectionFileName = Utils::String::removeParenthesis(mSourceFileData->metadata.get("name"));
|
||||
mCollectionFileName += " [" + strToUpper(mSourceFileData->getSystem()->getName()) + "]";
|
||||
mCollectionFileName += " [" + Utils::String::toUpper(mSourceFileData->getSystem()->getName()) + "]";
|
||||
mDirty = false;
|
||||
}
|
||||
return mCollectionFileName;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "FileData.h"
|
||||
#include "Log.h"
|
||||
#include "Settings.h"
|
||||
#include "Util.h"
|
||||
|
||||
#define UNKNOWN_LABEL "UNKNOWN"
|
||||
#define INCLUDE_UNKNOWN false;
|
||||
|
@ -93,7 +92,7 @@ std::string FileFilterIndex::getIndexableKey(FileData* game, FilterIndexType typ
|
|||
{
|
||||
case GENRE_FILTER:
|
||||
{
|
||||
key = strToUpper(game->metadata.get("genre"));
|
||||
key = Utils::String::toUpper(game->metadata.get("genre"));
|
||||
key = Utils::String::trim(key);
|
||||
if (getSecondary && !key.empty()) {
|
||||
std::istringstream f(key);
|
||||
|
@ -120,13 +119,13 @@ std::string FileFilterIndex::getIndexableKey(FileData* game, FilterIndexType typ
|
|||
}
|
||||
case PUBDEV_FILTER:
|
||||
{
|
||||
key = strToUpper(game->metadata.get("publisher"));
|
||||
key = Utils::String::toUpper(game->metadata.get("publisher"));
|
||||
key = Utils::String::trim(key);
|
||||
|
||||
if ((getSecondary && !key.empty()) || (!getSecondary && key.empty()))
|
||||
key = strToUpper(game->metadata.get("developer"));
|
||||
key = Utils::String::toUpper(game->metadata.get("developer"));
|
||||
else
|
||||
key = strToUpper(game->metadata.get("publisher"));
|
||||
key = Utils::String::toUpper(game->metadata.get("publisher"));
|
||||
break;
|
||||
}
|
||||
case RATINGS_FILTER:
|
||||
|
@ -155,21 +154,21 @@ std::string FileFilterIndex::getIndexableKey(FileData* game, FilterIndexType typ
|
|||
{
|
||||
if (game->getType() != GAME)
|
||||
return "FALSE";
|
||||
key = strToUpper(game->metadata.get("favorite"));
|
||||
key = Utils::String::toUpper(game->metadata.get("favorite"));
|
||||
break;
|
||||
}
|
||||
case HIDDEN_FILTER:
|
||||
{
|
||||
if (game->getType() != GAME)
|
||||
return "FALSE";
|
||||
key = strToUpper(game->metadata.get("hidden"));
|
||||
key = Utils::String::toUpper(game->metadata.get("hidden"));
|
||||
break;
|
||||
}
|
||||
case KIDGAME_FILTER:
|
||||
{
|
||||
if (game->getType() != GAME)
|
||||
return "FALSE";
|
||||
key = strToUpper(game->metadata.get("kidgame"));
|
||||
key = Utils::String::toUpper(game->metadata.get("kidgame"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "Log.h"
|
||||
#include "Settings.h"
|
||||
#include "SystemData.h"
|
||||
#include "Util.h"
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <pugixml/src/pugixml.hpp>
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "utils/FileSystemUtil.h"
|
||||
#include "Log.h"
|
||||
#include "Util.h"
|
||||
#include <pugixml/src/pugixml.hpp>
|
||||
|
||||
MetaDataDecl gameDecls[] = {
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "Renderer.h"
|
||||
#include "Sound.h"
|
||||
#include "SystemData.h"
|
||||
#include "Util.h"
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <pugixml/src/pugixml.hpp>
|
||||
#include <unordered_map>
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
#include "guis/GuiMsgBox.h"
|
||||
#include "guis/GuiTextEditPopup.h"
|
||||
#include "resources/Font.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "FileData.h"
|
||||
#include "Log.h"
|
||||
#include "Util.h"
|
||||
#include "Window.h"
|
||||
|
||||
ScraperSearchComponent::ScraperSearchComponent(Window* window, SearchType type) : GuiComponent(window),
|
||||
|
@ -244,7 +244,7 @@ void ScraperSearchComponent::onSearchDone(const std::vector<ScraperSearchResult>
|
|||
for(size_t i = 0; i < results.size(); i++)
|
||||
{
|
||||
row.elements.clear();
|
||||
row.addElement(std::make_shared<TextComponent>(mWindow, strToUpper(results.at(i).mdl.get("name")), font, color), true);
|
||||
row.addElement(std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(results.at(i).mdl.get("name")), font, color), true);
|
||||
row.makeAcceptInputHandler([this, i] { returnResult(mScraperResults.at(i)); });
|
||||
mResultList->addRow(row);
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ void ScraperSearchComponent::onSearchDone(const std::vector<ScraperSearchResult>
|
|||
void ScraperSearchComponent::onSearchError(const std::string& error)
|
||||
{
|
||||
LOG(LogInfo) << "ScraperSearchComponent search error: " << error;
|
||||
mWindow->pushGui(new GuiMsgBox(mWindow, strToUpper(error),
|
||||
mWindow->pushGui(new GuiMsgBox(mWindow, Utils::String::toUpper(error),
|
||||
"RETRY", std::bind(&ScraperSearchComponent::search, this, mLastSearch),
|
||||
"SKIP", mSkipCallback,
|
||||
"CANCEL", mCancelCallback));
|
||||
|
@ -294,8 +294,8 @@ void ScraperSearchComponent::updateInfoPane()
|
|||
if(i != -1 && (int)mScraperResults.size() > i)
|
||||
{
|
||||
ScraperSearchResult& res = mScraperResults.at(i);
|
||||
mResultName->setText(strToUpper(res.mdl.get("name")));
|
||||
mResultDesc->setText(strToUpper(res.mdl.get("desc")));
|
||||
mResultName->setText(Utils::String::toUpper(res.mdl.get("name")));
|
||||
mResultDesc->setText(Utils::String::toUpper(res.mdl.get("desc")));
|
||||
mDescContainer->reset();
|
||||
|
||||
mResultThumbnail->setImage("");
|
||||
|
@ -308,12 +308,12 @@ void ScraperSearchComponent::updateInfoPane()
|
|||
}
|
||||
|
||||
// metadata
|
||||
mMD_Rating->setValue(strToUpper(res.mdl.get("rating")));
|
||||
mMD_ReleaseDate->setValue(strToUpper(res.mdl.get("releasedate")));
|
||||
mMD_Developer->setText(strToUpper(res.mdl.get("developer")));
|
||||
mMD_Publisher->setText(strToUpper(res.mdl.get("publisher")));
|
||||
mMD_Genre->setText(strToUpper(res.mdl.get("genre")));
|
||||
mMD_Players->setText(strToUpper(res.mdl.get("players")));
|
||||
mMD_Rating->setValue(Utils::String::toUpper(res.mdl.get("rating")));
|
||||
mMD_ReleaseDate->setValue(Utils::String::toUpper(res.mdl.get("releasedate")));
|
||||
mMD_Developer->setText(Utils::String::toUpper(res.mdl.get("developer")));
|
||||
mMD_Publisher->setText(Utils::String::toUpper(res.mdl.get("publisher")));
|
||||
mMD_Genre->setText(Utils::String::toUpper(res.mdl.get("genre")));
|
||||
mMD_Players->setText(Utils::String::toUpper(res.mdl.get("players")));
|
||||
mGrid.onSizeChanged();
|
||||
}else{
|
||||
mResultName->setText("");
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
#include "components/IList.h"
|
||||
#include "math/Misc.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "Log.h"
|
||||
#include "Sound.h"
|
||||
#include "Util.h"
|
||||
#include <memory>
|
||||
|
||||
class TextCache;
|
||||
|
@ -188,7 +188,7 @@ void TextListComponent<T>::render(const Transform4x4f& parentTrans)
|
|||
color = mColors[entry.data.colorId];
|
||||
|
||||
if(!entry.data.textCache)
|
||||
entry.data.textCache = std::unique_ptr<TextCache>(font->buildTextCache(mUppercase ? strToUpper(entry.name) : entry.name, 0, 0, 0x000000FF));
|
||||
entry.data.textCache = std::unique_ptr<TextCache>(font->buildTextCache(mUppercase ? Utils::String::toUpper(entry.name) : entry.name, 0, 0, 0x000000FF));
|
||||
|
||||
entry.data.textCache->setColor(color);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ void GuiCollectionSystemsOptions::initializeMenu()
|
|||
};
|
||||
row.makeAcceptInputHandler(createCollectionCall);
|
||||
|
||||
auto themeFolder = std::make_shared<TextComponent>(mWindow, strToUpper(name), Font::get(FONT_SIZE_SMALL), 0x777777FF);
|
||||
auto themeFolder = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(name), Font::get(FONT_SIZE_SMALL), 0x777777FF);
|
||||
row.addElement(themeFolder, true);
|
||||
s->addRow(row);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ void GuiCollectionSystemsOptions::initializeMenu()
|
|||
if(CollectionSystemManager::get()->isEditing())
|
||||
{
|
||||
row.elements.clear();
|
||||
row.addElement(std::make_shared<TextComponent>(mWindow, "FINISH EDITING '" + strToUpper(CollectionSystemManager::get()->getEditingCollection()) + "' COLLECTION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
|
||||
row.addElement(std::make_shared<TextComponent>(mWindow, "FINISH EDITING '" + Utils::String::toUpper(CollectionSystemManager::get()->getEditingCollection()) + "' COLLECTION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
|
||||
row.makeAcceptInputHandler(std::bind(&GuiCollectionSystemsOptions::exitEditMode, this));
|
||||
mMenu.addRow(row);
|
||||
}
|
||||
|
|
|
@ -19,13 +19,13 @@ GuiGameScraper::GuiGameScraper(Window* window, ScraperSearchParams params, std::
|
|||
|
||||
// row 0 is a spacer
|
||||
|
||||
mGameName = std::make_shared<TextComponent>(mWindow, strToUpper(mSearchParams.game->getPath().filename().generic_string()),
|
||||
mGameName = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(mSearchParams.game->getPath().filename().generic_string()),
|
||||
Font::get(FONT_SIZE_MEDIUM), 0x777777FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mGameName, Vector2i(0, 1), false, true);
|
||||
|
||||
// row 2 is a spacer
|
||||
|
||||
mSystemName = std::make_shared<TextComponent>(mWindow, strToUpper(mSearchParams.system->getFullName()), Font::get(FONT_SIZE_SMALL),
|
||||
mSystemName = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(mSearchParams.system->getFullName()), Font::get(FONT_SIZE_SMALL),
|
||||
0x888888FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mSystemName, Vector2i(0, 3), false, true);
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui
|
|||
if(UIModeController::getInstance()->isUIModeFull() && CollectionSystemManager::get()->isEditing())
|
||||
{
|
||||
row.elements.clear();
|
||||
row.addElement(std::make_shared<TextComponent>(mWindow, "FINISH EDITING '" + strToUpper(CollectionSystemManager::get()->getEditingCollection()) + "' COLLECTION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
|
||||
row.addElement(std::make_shared<TextComponent>(mWindow, "FINISH EDITING '" + Utils::String::toUpper(CollectionSystemManager::get()->getEditingCollection()) + "' COLLECTION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
|
||||
row.makeAcceptInputHandler(std::bind(&GuiGamelistOptions::exitEditMode, this));
|
||||
mMenu.addRow(row);
|
||||
}
|
||||
|
|
|
@ -466,7 +466,7 @@ void GuiMenu::addVersionInfo()
|
|||
{
|
||||
mVersion.setFont(Font::get(FONT_SIZE_SMALL));
|
||||
mVersion.setColor(0x5E5E5EFF);
|
||||
mVersion.setText("EMULATIONSTATION V" + strToUpper(PROGRAM_VERSION_STRING));
|
||||
mVersion.setText("EMULATIONSTATION V" + Utils::String::toUpper(PROGRAM_VERSION_STRING));
|
||||
mVersion.setHorizontalAlignment(ALIGN_CENTER);
|
||||
addChild(&mVersion);
|
||||
}
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
#include "guis/GuiMsgBox.h"
|
||||
#include "guis/GuiTextEditPopup.h"
|
||||
#include "resources/Font.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "views/ViewController.h"
|
||||
#include "CollectionSystemManager.h"
|
||||
#include "FileData.h"
|
||||
#include "FileFilterIndex.h"
|
||||
#include "SystemData.h"
|
||||
#include "Util.h"
|
||||
#include "Window.h"
|
||||
|
||||
GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector<MetaDataDecl>& mdd, ScraperSearchParams scraperParams,
|
||||
|
@ -36,7 +36,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
|
|||
mHeaderGrid = std::make_shared<ComponentGrid>(mWindow, Vector2i(1, 5));
|
||||
|
||||
mTitle = std::make_shared<TextComponent>(mWindow, "EDIT METADATA", Font::get(FONT_SIZE_LARGE), 0x555555FF, ALIGN_CENTER);
|
||||
mSubtitle = std::make_shared<TextComponent>(mWindow, strToUpper(scraperParams.game->getPath().filename().generic_string()),
|
||||
mSubtitle = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(scraperParams.game->getPath().filename().generic_string()),
|
||||
Font::get(FONT_SIZE_SMALL), 0x777777FF, ALIGN_CENTER);
|
||||
mHeaderGrid->setEntry(mTitle, Vector2i(0, 1), false, true);
|
||||
mHeaderGrid->setEntry(mSubtitle, Vector2i(0, 3), false, true);
|
||||
|
@ -58,7 +58,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
|
|||
// create ed and add it (and any related components) to mMenu
|
||||
// ed's value will be set below
|
||||
ComponentListRow row;
|
||||
auto lbl = std::make_shared<TextComponent>(mWindow, strToUpper(iter->displayName), Font::get(FONT_SIZE_SMALL), 0x777777FF);
|
||||
auto lbl = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(iter->displayName), Font::get(FONT_SIZE_SMALL), 0x777777FF);
|
||||
row.addElement(lbl, true); // label
|
||||
|
||||
switch(iter->type)
|
||||
|
|
|
@ -99,11 +99,11 @@ void GuiScraperMulti::doNextSearch()
|
|||
|
||||
// update title
|
||||
std::stringstream ss;
|
||||
mSystem->setText(strToUpper(mSearchQueue.front().system->getFullName()));
|
||||
mSystem->setText(Utils::String::toUpper(mSearchQueue.front().system->getFullName()));
|
||||
|
||||
// update subtitle
|
||||
ss.str(""); // clear
|
||||
ss << "GAME " << (mCurrentGame + 1) << " OF " << mTotalGames << " - " << strToUpper(mSearchQueue.front().game->getPath().filename().string());
|
||||
ss << "GAME " << (mCurrentGame + 1) << " OF " << mTotalGames << " - " << Utils::String::toUpper(mSearchQueue.front().game->getPath().filename().string());
|
||||
mSubtitle->setText(ss.str());
|
||||
|
||||
mSearchComp->search(mSearchQueue.front());
|
||||
|
|
|
@ -48,7 +48,7 @@ void GuiScraperStart::pressedStart()
|
|||
if((*it)->getPlatformIds().empty())
|
||||
{
|
||||
mWindow->pushGui(new GuiMsgBox(mWindow,
|
||||
strToUpper("Warning: some of your selected systems do not have a platform set. Results may be even more inaccurate than usual!\nContinue anyway?"),
|
||||
Utils::String::toUpper("Warning: some of your selected systems do not have a platform set. Results may be even more inaccurate than usual!\nContinue anyway?"),
|
||||
"YES", std::bind(&GuiScraperStart::start, this),
|
||||
"NO", nullptr));
|
||||
return;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "components/SliderComponent.h"
|
||||
#include "components/SwitchComponent.h"
|
||||
#include "guis/GuiTextEditPopup.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "Settings.h"
|
||||
#include "Window.h"
|
||||
|
||||
|
@ -72,7 +73,7 @@ void GuiSlideshowScreensaverOptions::addWithLabel(ComponentListRow row, const st
|
|||
{
|
||||
row.elements.clear();
|
||||
|
||||
auto lbl = std::make_shared<TextComponent>(mWindow, strToUpper(label), Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
|
||||
auto lbl = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(label), Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
|
||||
row.addElement(lbl, true); // label
|
||||
|
||||
row.addElement(component, false, true);
|
||||
|
@ -84,7 +85,7 @@ void GuiSlideshowScreensaverOptions::addEditableTextComponent(ComponentListRow r
|
|||
{
|
||||
row.elements.clear();
|
||||
|
||||
auto lbl = std::make_shared<TextComponent>(mWindow, strToUpper(label), Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
|
||||
auto lbl = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(label), Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
|
||||
row.addElement(lbl, true); // label
|
||||
|
||||
row.addElement(ed, true);
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "PlatformId.h"
|
||||
#include "Settings.h"
|
||||
#include "SystemData.h"
|
||||
#include "Util.h"
|
||||
#include <pugixml/src/pugixml.hpp>
|
||||
|
||||
using namespace PlatformIds;
|
||||
|
|
|
@ -17,7 +17,6 @@ set(CORE_HEADERS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/src/Settings.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Sound.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/ThemeData.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Util.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Window.h
|
||||
|
||||
# Animations
|
||||
|
@ -95,7 +94,6 @@ set(CORE_SOURCES
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/src/Settings.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Sound.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/ThemeData.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Util.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Window.cpp
|
||||
|
||||
# Animations
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
#include "Util.h"
|
||||
|
||||
std::string strToUpper(const char* from)
|
||||
{
|
||||
std::string str(from);
|
||||
for(unsigned int i = 0; i < str.size(); i++)
|
||||
str[i] = (char)toupper(from[i]);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string& strToUpper(std::string& str)
|
||||
{
|
||||
for(unsigned int i = 0; i < str.size(); i++)
|
||||
str[i] = (char)toupper(str[i]);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string strToUpper(const std::string& str)
|
||||
{
|
||||
return strToUpper(str.c_str());
|
||||
}
|
||||
|
||||
std::string strreplace(std::string str, const std::string& replace, const std::string& with)
|
||||
{
|
||||
size_t pos;
|
||||
while((pos = str.find(replace)) != std::string::npos)
|
||||
str = str.replace(pos, replace.length(), with.c_str(), with.length());
|
||||
|
||||
return str;
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
#pragma once
|
||||
#ifndef ES_CORE_UTIL_H
|
||||
#define ES_CORE_UTIL_H
|
||||
|
||||
#include <string>
|
||||
|
||||
std::string strToUpper(const char* from);
|
||||
std::string& strToUpper(std::string& str);
|
||||
std::string strToUpper(const std::string& str);
|
||||
|
||||
std::string strreplace(std::string str, const std::string& replace, const std::string& with);
|
||||
|
||||
#endif // ES_CORE_UTIL_H
|
|
@ -1,8 +1,8 @@
|
|||
#include "components/ButtonComponent.h"
|
||||
|
||||
#include "resources/Font.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "Renderer.h"
|
||||
#include "Util.h"
|
||||
|
||||
ButtonComponent::ButtonComponent(Window* window, const std::string& text, const std::string& helpText, const std::function<void()>& func) : GuiComponent(window),
|
||||
mBox(window, ":/button.png"),
|
||||
|
@ -40,7 +40,7 @@ bool ButtonComponent::input(InputConfig* config, Input input)
|
|||
|
||||
void ButtonComponent::setText(const std::string& text, const std::string& helpText)
|
||||
{
|
||||
mText = strToUpper(text);
|
||||
mText = Utils::String::toUpper(text);
|
||||
mHelpText = helpText;
|
||||
|
||||
mTextCache = std::unique_ptr<TextCache>(mFont->buildTextCache(mText, 0, 0, getCurTextColor()));
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "components/DateTimeComponent.h"
|
||||
|
||||
#include "resources/Font.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "Renderer.h"
|
||||
#include "Util.h"
|
||||
|
||||
DateTimeComponent::DateTimeComponent(Window* window, DisplayMode dispMode) : GuiComponent(window),
|
||||
mEditing(false), mEditIndex(0), mDisplayMode(dispMode), mRelativeUpdateAccumulator(0),
|
||||
|
@ -245,7 +245,7 @@ std::shared_ptr<Font> DateTimeComponent::getFont() const
|
|||
void DateTimeComponent::updateTextCache()
|
||||
{
|
||||
DisplayMode mode = getCurrentDisplayMode();
|
||||
const std::string dispString = mUppercase ? strToUpper(getDisplayString(mode)) : getDisplayString(mode);
|
||||
const std::string dispString = mUppercase ? Utils::String::toUpper(getDisplayString(mode)) : getDisplayString(mode);
|
||||
std::shared_ptr<Font> font = getFont();
|
||||
mTextCache = std::unique_ptr<TextCache>(font->buildTextCache(dispString, 0, 0, mColor));
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
#include "components/ImageComponent.h"
|
||||
#include "components/TextComponent.h"
|
||||
#include "resources/TextureResource.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "Log.h"
|
||||
#include "Settings.h"
|
||||
#include "Util.h"
|
||||
|
||||
#define OFFSET_X 12 // move the entire thing right by this amount (px)
|
||||
#define OFFSET_Y 12 // move the entire thing up by this amount (px)
|
||||
|
@ -76,7 +76,7 @@ void HelpComponent::updateGrid()
|
|||
icon->setResize(0, height);
|
||||
icons.push_back(icon);
|
||||
|
||||
auto lbl = std::make_shared<TextComponent>(mWindow, strToUpper(it->second), font, mStyle.textColor);
|
||||
auto lbl = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(it->second), font, mStyle.textColor);
|
||||
labels.push_back(lbl);
|
||||
|
||||
width += icon->getSize().x() + lbl->getSize().x() + ICON_TEXT_SPACING + ENTRY_SPACING;
|
||||
|
|
|
@ -34,7 +34,7 @@ MenuComponent::MenuComponent(Window* window, const char* title, const std::share
|
|||
|
||||
void MenuComponent::setTitle(const char* title, const std::shared_ptr<Font>& font)
|
||||
{
|
||||
mTitle->setText(strToUpper(title));
|
||||
mTitle->setText(Utils::String::toUpper(title));
|
||||
mTitle->setFont(font);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ void MenuComponent::onSizeChanged()
|
|||
|
||||
void MenuComponent::addButton(const std::string& name, const std::string& helpText, const std::function<void()>& callback)
|
||||
{
|
||||
mButtons.push_back(std::make_shared<ButtonComponent>(mWindow, strToUpper(name), helpText, callback));
|
||||
mButtons.push_back(std::make_shared<ButtonComponent>(mWindow, Utils::String::toUpper(name), helpText, callback));
|
||||
updateGrid();
|
||||
updateSize();
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#include "components/ComponentList.h"
|
||||
#include "components/NinePatchComponent.h"
|
||||
#include "components/TextComponent.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "Renderer.h"
|
||||
#include "Util.h"
|
||||
|
||||
class ButtonComponent;
|
||||
class ImageComponent;
|
||||
|
@ -29,7 +29,7 @@ public:
|
|||
inline void addWithLabel(const std::string& label, const std::shared_ptr<GuiComponent>& comp, bool setCursorHere = false, bool invert_when_selected = true)
|
||||
{
|
||||
ComponentListRow row;
|
||||
row.addElement(std::make_shared<TextComponent>(mWindow, strToUpper(label), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
|
||||
row.addElement(std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(label), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
|
||||
row.addElement(comp, false, invert_when_selected);
|
||||
addRow(row, setCursorHere);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ private:
|
|||
for(auto it = mParent->mEntries.begin(); it != mParent->mEntries.end(); it++)
|
||||
{
|
||||
row.elements.clear();
|
||||
row.addElement(std::make_shared<TextComponent>(mWindow, strToUpper(it->name), font, 0x777777FF), true);
|
||||
row.addElement(std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(it->name), font, 0x777777FF), true);
|
||||
|
||||
OptionListData& e = *it;
|
||||
|
||||
|
@ -302,7 +302,7 @@ private:
|
|||
{
|
||||
if(it->selected)
|
||||
{
|
||||
mText.setText(strToUpper(it->name));
|
||||
mText.setText(Utils::String::toUpper(it->name));
|
||||
mText.setSize(0, mText.getSize().y());
|
||||
setSize(mText.getSize().x() + mLeftArrow.getSize().x() + mRightArrow.getSize().x() + 24, mText.getSize().y());
|
||||
if(mParent) // hack since theres no "on child size changed" callback atm...
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "Log.h"
|
||||
#include "Renderer.h"
|
||||
#include "Settings.h"
|
||||
#include "Util.h"
|
||||
|
||||
TextComponent::TextComponent(Window* window) : GuiComponent(window),
|
||||
mFont(Font::get(FONT_SIZE_MEDIUM)), mUppercase(false), mColor(0x000000FF), mAutoCalcExtent(true, true),
|
||||
|
@ -157,11 +156,11 @@ void TextComponent::calculateExtent()
|
|||
{
|
||||
if(mAutoCalcExtent.x())
|
||||
{
|
||||
mSize = mFont->sizeText(mUppercase ? strToUpper(mText) : mText, mLineSpacing);
|
||||
mSize = mFont->sizeText(mUppercase ? Utils::String::toUpper(mText) : mText, mLineSpacing);
|
||||
}else{
|
||||
if(mAutoCalcExtent.y())
|
||||
{
|
||||
mSize[1] = mFont->sizeWrappedText(mUppercase ? strToUpper(mText) : mText, getSize().x(), mLineSpacing).y();
|
||||
mSize[1] = mFont->sizeWrappedText(mUppercase ? Utils::String::toUpper(mText) : mText, getSize().x(), mLineSpacing).y();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +175,7 @@ void TextComponent::onTextChanged()
|
|||
return;
|
||||
}
|
||||
|
||||
std::string text = mUppercase ? strToUpper(mText) : mText;
|
||||
std::string text = mUppercase ? Utils::String::toUpper(mText) : mText;
|
||||
|
||||
std::shared_ptr<Font> f = mFont;
|
||||
const bool isMultiline = (mSize.y() == 0 || mSize.y() > f->getHeight()*1.2f);
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "PowerSaver.h"
|
||||
#include "Renderer.h"
|
||||
#include "ThemeData.h"
|
||||
#include "Util.h"
|
||||
#include "Window.h"
|
||||
#include <SDL_timer.h>
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
#include "components/TextComponent.h"
|
||||
#include "guis/GuiInputConfig.h"
|
||||
#include "utils/FileSystemUtil.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "InputManager.h"
|
||||
#include "PowerSaver.h"
|
||||
#include "Renderer.h"
|
||||
#include "Util.h"
|
||||
#include "Window.h"
|
||||
|
||||
#define HOLD_TIME 1000
|
||||
|
@ -85,7 +85,7 @@ bool GuiDetectDevice::input(InputConfig* config, Input input)
|
|||
// started holding
|
||||
mHoldingConfig = config;
|
||||
mHoldTime = HOLD_TIME;
|
||||
mDeviceHeld->setText(strToUpper(config->getDeviceName()));
|
||||
mDeviceHeld->setText(Utils::String::toUpper(config->getDeviceName()));
|
||||
}else if(!input.value && mHoldingConfig == config)
|
||||
{
|
||||
// cancel
|
||||
|
|
|
@ -162,7 +162,7 @@ GuiInputConfig::GuiInputConfig(Window* window, InputConfig* target, bool reconfi
|
|||
ss << "CEC";
|
||||
else
|
||||
ss << "GAMEPAD " << (target->getDeviceId() + 1);
|
||||
mSubtitle1 = std::make_shared<TextComponent>(mWindow, strToUpper(ss.str()), Font::get(FONT_SIZE_MEDIUM), 0x555555FF, ALIGN_CENTER);
|
||||
mSubtitle1 = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(ss.str()), Font::get(FONT_SIZE_MEDIUM), 0x555555FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mSubtitle1, Vector2i(0, 2), false, true);
|
||||
|
||||
mSubtitle2 = std::make_shared<TextComponent>(mWindow, "HOLD ANY BUTTON TO SKIP", Font::get(FONT_SIZE_SMALL), 0x99999900, ALIGN_CENTER);
|
||||
|
@ -379,7 +379,7 @@ void GuiInputConfig::setNotDefined(const std::shared_ptr<TextComponent>& text)
|
|||
|
||||
void GuiInputConfig::setAssignedTo(const std::shared_ptr<TextComponent>& text, Input input)
|
||||
{
|
||||
text->setText(strToUpper(input.string()));
|
||||
text->setText(Utils::String::toUpper(input.string()));
|
||||
text->setColor(0x777777FF);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ GuiMsgBox::GuiMsgBox(Window* window, const std::string& text,
|
|||
}else{
|
||||
for(auto it = mButtons.cbegin(); it != mButtons.cend(); it++)
|
||||
{
|
||||
if(strToUpper((*it)->getText()) == "OK" || strToUpper((*it)->getText()) == "NO")
|
||||
if(Utils::String::toUpper((*it)->getText()) == "OK" || Utils::String::toUpper((*it)->getText()) == "NO")
|
||||
{
|
||||
mAcceleratorFunc = (*it)->getPressedFunc();
|
||||
break;
|
||||
|
|
|
@ -11,7 +11,7 @@ GuiTextEditPopup::GuiTextEditPopup(Window* window, const std::string& title, con
|
|||
addChild(&mBackground);
|
||||
addChild(&mGrid);
|
||||
|
||||
mTitle = std::make_shared<TextComponent>(mWindow, strToUpper(title), Font::get(FONT_SIZE_LARGE), 0x555555FF, ALIGN_CENTER);
|
||||
mTitle = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(title), Font::get(FONT_SIZE_LARGE), 0x555555FF, ALIGN_CENTER);
|
||||
|
||||
mText = std::make_shared<TextEditComponent>(mWindow);
|
||||
mText->setValue(initValue);
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "utils/StringUtil.h"
|
||||
#include "Log.h"
|
||||
#include "Renderer.h"
|
||||
#include "Util.h"
|
||||
|
||||
FT_Library Font::sLibrary = NULL;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "utils/FileSystemUtil.h"
|
||||
#include "resources/TextureData.h"
|
||||
#include "Util.h"
|
||||
|
||||
TextureDataManager TextureResource::sTextureDataManager;
|
||||
std::map< TextureResource::TextureKeyType, std::weak_ptr<TextureResource> > TextureResource::sTextureMap;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
// because windows...
|
||||
#include <direct.h>
|
||||
#include <Windows.h>
|
||||
#define getcwd _getcwd
|
||||
#define mkdir(x,y) _mkdir(x)
|
||||
#define snprintf _snprintf
|
||||
#define unlink _unlink
|
||||
|
@ -245,7 +246,7 @@ namespace Utils
|
|||
else
|
||||
path = getParent(path) + "/" + resolved;
|
||||
|
||||
for( ++it; it != pathList.cend(); ++it)
|
||||
for(++it; it != pathList.cend(); ++it)
|
||||
path += (path.size() == 0) ? (*it) : ("/" + (*it));
|
||||
|
||||
scan = true;
|
||||
|
@ -335,19 +336,19 @@ namespace Utils
|
|||
|
||||
std::string resolveRelativePath(const std::string& _path, const std::string& _relativeTo, const bool _allowHome)
|
||||
{
|
||||
std::string path = getGenericPath(_path);
|
||||
std::string path = getGenericPath(_path);
|
||||
std::string relativeTo = isDirectory(_relativeTo) ? getGenericPath(_relativeTo) : getParent(_relativeTo);
|
||||
|
||||
// nothing to resolve
|
||||
if (!path.length())
|
||||
if(!path.length())
|
||||
return path;
|
||||
|
||||
// replace '.' with relativeTo
|
||||
if (path[0] == '.')
|
||||
if(path[0] == '.')
|
||||
return (relativeTo + "/" + &(path[1]));
|
||||
|
||||
// replace '~' with homePath
|
||||
if (_allowHome && (path[0] == '~'))
|
||||
if(_allowHome && (path[0] == '~'))
|
||||
return (getHomePath() + "/" + &(path[1]));
|
||||
|
||||
// nothing to resolve
|
||||
|
@ -357,21 +358,20 @@ namespace Utils
|
|||
|
||||
std::string createRelativePath(const std::string& _path, const std::string& _relativeTo, const bool _allowHome)
|
||||
{
|
||||
bool contains = false;
|
||||
std::string path = removeCommonPath(_path, _relativeTo, contains);
|
||||
bool contains = false;
|
||||
std::string path = removeCommonPath(_path, _relativeTo, contains);
|
||||
|
||||
if (contains)
|
||||
if(contains)
|
||||
{
|
||||
// success
|
||||
return ("." + path);
|
||||
}
|
||||
|
||||
if (_allowHome)
|
||||
if(_allowHome)
|
||||
{
|
||||
contains = false;
|
||||
std::string path = removeCommonPath(_path, getHomePath(), contains);
|
||||
path = removeCommonPath(_path, getHomePath(), contains);
|
||||
|
||||
if (contains)
|
||||
if(contains)
|
||||
{
|
||||
// success
|
||||
return ("~" + path);
|
||||
|
@ -385,11 +385,11 @@ namespace Utils
|
|||
|
||||
std::string removeCommonPath(const std::string& _path, const std::string& _common, bool& _contains)
|
||||
{
|
||||
std::string path = getGenericPath(_path);
|
||||
std::string path = getGenericPath(_path);
|
||||
std::string common = isDirectory(_common) ? getGenericPath(_common) : getParent(_common);
|
||||
|
||||
// check if path contains common
|
||||
if (path.find_first_of(common) == 0)
|
||||
if(path.find_first_of(common) == 0)
|
||||
{
|
||||
_contains = true;
|
||||
return path.substr(common.length() + 1);
|
||||
|
@ -409,10 +409,10 @@ namespace Utils
|
|||
#if defined(_WIN32)
|
||||
HANDLE hFile = CreateFile(path.c_str(), FILE_READ_ATTRIBUTES, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
|
||||
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
if(hFile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
resolved.resize(GetFinalPathNameByHandle(hFile, nullptr, 0, FILE_NAME_NORMALIZED) + 1);
|
||||
if (GetFinalPathNameByHandle(hFile, (LPSTR)resolved.data(), (DWORD)resolved.size(), FILE_NAME_NORMALIZED) > 0)
|
||||
if(GetFinalPathNameByHandle(hFile, (LPSTR)resolved.data(), (DWORD)resolved.size(), FILE_NAME_NORMALIZED) > 0)
|
||||
{
|
||||
resolved.resize(resolved.size() - 1);
|
||||
resolved = getGenericPath(resolved);
|
||||
|
@ -423,10 +423,10 @@ namespace Utils
|
|||
struct stat info;
|
||||
|
||||
// check if lstat succeeded
|
||||
if (lstat(path.c_str(), &info) == 0)
|
||||
if(lstat(path.c_str(), &info) == 0)
|
||||
{
|
||||
resolved.resize(info.st_size);
|
||||
if (readlink(path.c_str(), (char*)resolved.data(), resolved.size()) > 0)
|
||||
if(readlink(path.c_str(), (char*)resolved.data(), resolved.size()) > 0)
|
||||
resolved = getGenericPath(resolved);
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
|
|
@ -39,8 +39,7 @@ namespace Utils
|
|||
|
||||
void DateTime::setTime(const time_t& _time)
|
||||
{
|
||||
if(_time < 0) mTime = 0;
|
||||
else mTime = _time;
|
||||
mTime = (_time < 0) ? 0 : _time;
|
||||
mTimeStruct = *localtime(&mTime);
|
||||
mIsoString = timeToString(mTime);
|
||||
|
||||
|
|
Loading…
Reference in a new issue