Skip to content

Commit

Permalink
po : update pos
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Adenis-Lamarre <[email protected]>
  • Loading branch information
Nicolas Adenis-Lamarre committed Feb 11, 2016
1 parent 0afd4ea commit 41d3242
Show file tree
Hide file tree
Showing 32 changed files with 8,311 additions and 4,065 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ add_subdirectory("es-app")

# i18n
find_program (MSGFMT_EXECUTABLE msgfmt)
if (MSGFMT_EXECUTABLE)
find_program (MSGMERGE_EXECUTABLE msgmerge)
find_program (XGETTEXT_EXECUTABLE xgettext)
if(MSGFMT_EXECUTABLE AND MSGMERGE_EXECUTABLE AND XGETTEXT_EXECUTABLE)
message (STATUS "Native language support enabled.")
add_subdirectory (locale)
endif (MSGFMT_EXECUTABLE)


endif()
28 changes: 13 additions & 15 deletions es-app/src/FileSorts.cpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
#include "FileSorts.h"
#include "Locale.h"

namespace FileSorts
{
const FileData::SortType typesArr[] = {
FileData::SortType(&compareFileName, true, "filename, ascending"),
FileData::SortType(&compareFileName, false, "filename, descending"),

FileData::SortType(&compareRating, true, "rating, ascending"),
FileData::SortType(&compareRating, false, "rating, descending"),

FileData::SortType(&compareTimesPlayed, true, "times played, ascending"),
FileData::SortType(&compareTimesPlayed, false, "times played, descending"),

FileData::SortType(&compareLastPlayed, true, "last played, ascending"),
FileData::SortType(&compareLastPlayed, false, "last played, descending")
};

const std::vector<FileData::SortType> SortTypes(typesArr, typesArr + sizeof(typesArr)/sizeof(typesArr[0]));
std::vector<FileData::SortType> SortTypes;

void init() {
SortTypes.push_back(FileData::SortType(&compareFileName, true, _("FILENAME, ASCENDING")));
SortTypes.push_back(FileData::SortType(&compareFileName, false, _("FILENAME, DESCENDING")));
SortTypes.push_back(FileData::SortType(&compareRating, true, _("RATING, ASCENDING")));
SortTypes.push_back(FileData::SortType(&compareRating, false, _("RATING, DESCENDING")));
SortTypes.push_back(FileData::SortType(&compareTimesPlayed, true, _("TIMES PLAYED, ASCENDING")));
SortTypes.push_back(FileData::SortType(&compareTimesPlayed, false, _("TIMES PLAYED, DESCENDING")));
SortTypes.push_back(FileData::SortType(&compareLastPlayed, true, _("LAST PLAYED, ASCENDING")));
SortTypes.push_back(FileData::SortType(&compareLastPlayed, false, _("LAST PLAYED, DESCENDING")));
}

//returns if file1 should come before file2
bool compareFileName(const FileData* file1, const FileData* file2)
Expand Down
3 changes: 2 additions & 1 deletion es-app/src/FileSorts.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ namespace FileSorts
bool compareTimesPlayed(const FileData* file1, const FileData* fil2);
bool compareLastPlayed(const FileData* file1, const FileData* file2);

extern const std::vector<FileData::SortType> SortTypes;
extern std::vector<FileData::SortType> SortTypes;
void init();
};
65 changes: 31 additions & 34 deletions es-app/src/MetaData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,40 @@
#include "Log.h"
#include "Util.h"
#include <strings.h>
#include "Locale.h"

namespace fs = boost::filesystem;

// WARN : statistic metadata must be last in list !
MetaDataDecl gameDecls[] = {
// key, type, default, statistic, name in GuiMetaDataEd, prompt in GuiMetaDataEd
{"emulator", MD_LIST, "default", false, "emulator", "enter emulator"},
{"core", MD_LIST, "default", false, "core", "enter core"},
{"name", MD_STRING, "", false, "name", "enter game name"},
{"desc", MD_MULTILINE_STRING, "", false, "description", "enter description"},
{"image", MD_IMAGE_PATH, "", false, "image", "enter path to image"},
{"thumbnail", MD_IMAGE_PATH, "", false, "thumbnail", "enter path to thumbnail"},
{"rating", MD_RATING, "0.000000", false, "rating", "enter rating"},
{"releasedate", MD_DATE, "not-a-date-time", false, "release date", "enter release date"},
{"developer", MD_STRING, "unknown", false, "developer", "enter game developer"},
{"publisher", MD_STRING, "unknown", false, "publisher", "enter game publisher"},
{"genre", MD_STRING, "unknown", false, "genre", "enter game genre"},
{"players", MD_INT, "1", false, "players", "enter number of players"},
{"favorite", MD_BOOL, "false", false, "favorite", "enter favorite"},
{"region", MD_STRING, "", false, "region", "enter region"},
{"romtype", MD_STRING, "Original", false, "romtype", "enter romtype"},
{"hidden", MD_BOOL, "false", false, "hidden", "set hidden"},
{"playcount", MD_INT, "0", true, "play count", "enter number of times played"},
{"lastplayed", MD_TIME, "0", true, "last played", "enter last played date"}
};

const std::vector<MetaDataDecl> gameMDD(gameDecls, gameDecls + sizeof(gameDecls) / sizeof(gameDecls[0]));

MetaDataDecl folderDecls[] = {
{"name", MD_STRING, "", false},
{"desc", MD_MULTILINE_STRING, "", false},
{"image", MD_IMAGE_PATH, "", false},
{"thumbnail", MD_IMAGE_PATH, "", false},
{"hidden", MD_BOOL, "false", false},

};
const std::vector<MetaDataDecl> folderMDD(folderDecls, folderDecls + sizeof(folderDecls) / sizeof(folderDecls[0]));
std::vector<MetaDataDecl> gameMDD;
std::vector<MetaDataDecl> folderMDD;

void initMetadata() {
// WARN : statistic metadata must be last in list !
gameMDD.push_back(MetaDataDecl("emulator", MD_LIST, "default", false, _("Emulator"), "enter emulator"));
gameMDD.push_back(MetaDataDecl("core", MD_LIST, "default", false, _("Core"), "enter core"));
gameMDD.push_back(MetaDataDecl("name", MD_STRING, "", false, _("Name"), "enter game name"));
gameMDD.push_back(MetaDataDecl("desc", MD_MULTILINE_STRING, "", false, _("Description"), "enter description"));
gameMDD.push_back(MetaDataDecl("image", MD_IMAGE_PATH, "", false, _("Image"), "enter path to image"));
gameMDD.push_back(MetaDataDecl("thumbnail", MD_IMAGE_PATH, "", false, _("Thumbnail"), "enter path to thumbnail"));
gameMDD.push_back(MetaDataDecl("rating", MD_RATING, "0.000000", false, _("Rating"), "enter rating"));
gameMDD.push_back(MetaDataDecl("releasedate", MD_DATE, "not-a-date-time", false, _("Release date"), "enter release date"));
gameMDD.push_back(MetaDataDecl("developer", MD_STRING, "unknown", false, _("Developer"), "enter game developer"));
gameMDD.push_back(MetaDataDecl("publisher", MD_STRING, "unknown", false, _("Publisher"), "enter game publisher"));
gameMDD.push_back(MetaDataDecl("genre", MD_STRING, "unknown", false, _("Genre"), "enter game genre"));
gameMDD.push_back(MetaDataDecl("players", MD_INT, "1", false, _("Players"), "enter number of players"));
gameMDD.push_back(MetaDataDecl("favorite", MD_BOOL, "false", false, _("Favorite"), "enter favorite"));
gameMDD.push_back(MetaDataDecl("region", MD_STRING, "", false, _("Region"), "enter region"));
gameMDD.push_back(MetaDataDecl("romtype", MD_STRING, "Original", false, _("Romtype"), "enter romtype"));
gameMDD.push_back(MetaDataDecl("hidden", MD_BOOL, "false", false, _("Hidden"), "set hidden"));
gameMDD.push_back(MetaDataDecl("playcount", MD_INT, "0", true, _("Play count"), "enter number of times played"));
gameMDD.push_back(MetaDataDecl("lastplayed", MD_TIME, "0", true, _("Last played"), "enter last played date"));

folderMDD.push_back(MetaDataDecl("name", MD_STRING, "", false));
folderMDD.push_back(MetaDataDecl("desc", MD_MULTILINE_STRING, "", false));
folderMDD.push_back(MetaDataDecl("image", MD_IMAGE_PATH, "", false));
folderMDD.push_back(MetaDataDecl("thumbnail", MD_IMAGE_PATH, "", false));
folderMDD.push_back(MetaDataDecl("hidden", MD_BOOL, "false", false));
}

const std::vector<MetaDataDecl>& getMDDByType(MetaDataListType type)
{
Expand Down
17 changes: 17 additions & 0 deletions es-app/src/MetaData.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ struct MetaDataDecl
bool isStatistic; //if true, ignore scraper values for this metadata
std::string displayName; // displayed as this in editors
std::string displayPrompt; // phrase displayed in editors when prompted to enter value (currently only for strings)

MetaDataDecl(std::string key, MetaDataType type, std::string defaultValue, bool isStatistic, std::string displayName, std::string displayPrompt) {
this->key = key;
this->type = type;
this->defaultValue = defaultValue;
this->isStatistic = isStatistic;
this->displayName = displayName;
this->displayPrompt = displayPrompt;
}

MetaDataDecl(std::string key, MetaDataType type, std::string defaultValue, bool isStatistic) {
this->key = key;
this->type = type;
this->defaultValue = defaultValue;
this->isStatistic = isStatistic;
}
};

enum MetaDataListType
Expand All @@ -41,6 +57,7 @@ enum MetaDataListType
};

const std::vector<MetaDataDecl>& getMDDByType(MetaDataListType type);
void initMetadata();

class MetaDataList
{
Expand Down
16 changes: 8 additions & 8 deletions es-app/src/components/ScraperSearchComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ ScraperSearchComponent::ScraperSearchComponent(Window* window, SearchType type)
mGrid.setEntry(std::make_shared<GuiComponent>(mWindow), Vector2i(0, 0), false, false, Vector2i(1, 3), GridFlags::BORDER_TOP | GridFlags::BORDER_BOTTOM);

// selected result name
mResultName = std::make_shared<TextComponent>(mWindow, _("Result name"), Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
mResultName = std::make_shared<TextComponent>(mWindow, _("RESULT NAME"), Font::get(FONT_SIZE_MEDIUM), 0x777777FF);

// selected result thumbnail
mResultThumbnail = std::make_shared<ImageComponent>(mWindow);
mGrid.setEntry(mResultThumbnail, Vector2i(1, 1), false, false, Vector2i(1, 1));

// selected result desc + container
mDescContainer = std::make_shared<ScrollableContainer>(mWindow);
mResultDesc = std::make_shared<TextComponent>(mWindow, _("Result desc"), Font::get(FONT_SIZE_SMALL), 0x777777FF);
mResultDesc = std::make_shared<TextComponent>(mWindow, _("RESULT DESC"), Font::get(FONT_SIZE_SMALL), 0x777777FF);
mDescContainer->addChild(mResultDesc.get());
mDescContainer->setAutoScroll(true);

Expand All @@ -53,12 +53,12 @@ ScraperSearchComponent::ScraperSearchComponent(Window* window, SearchType type)
mMD_Genre = std::make_shared<TextComponent>(mWindow, "", font, mdColor);
mMD_Players = std::make_shared<TextComponent>(mWindow, "", font, mdColor);

mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, _("RATING:"), font, mdLblColor), mMD_Rating, false));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, _("RELEASED:"), font, mdLblColor), mMD_ReleaseDate));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, _("DEVELOPER:"), font, mdLblColor), mMD_Developer));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, _("PUBLISHER:"), font, mdLblColor), mMD_Publisher));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, _("GENRE:"), font, mdLblColor), mMD_Genre));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, _("PLAYERS:"), font, mdLblColor), mMD_Players));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, strToUpper(_("Rating") + ":"), font, mdLblColor), mMD_Rating, false));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, strToUpper(_("Released") + ":"), font, mdLblColor), mMD_ReleaseDate));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, strToUpper(_("Developer") + ":"), font, mdLblColor), mMD_Developer));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, strToUpper(_("Publisher") + ":"), font, mdLblColor), mMD_Publisher));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, strToUpper(_("Genre") + ":"), font, mdLblColor), mMD_Genre));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, strToUpper(_("Players") + ":"), font, mdLblColor), mMD_Players));

mMD_Grid = std::make_shared<ComponentGrid>(mWindow, Vector2i(2, mMD_Pairs.size()*2 - 1));
unsigned int i = 0;
Expand Down
2 changes: 1 addition & 1 deletion es-app/src/guis/GuiGameScraper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ GuiGameScraper::GuiGameScraper(Window* window, ScraperSearchParams params, std::
mSearch->openInputScreen(mSearchParams);
mGrid.resetCursor();
}));
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, _("CANCEL"), _("cancel"), [&] { delete this; }));
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, _("CANCEL"), _("CANCEL"), [&] { delete this; }));
mButtonGrid = makeButtonGrid(mWindow, buttons);

mGrid.setEntry(mButtonGrid, Eigen::Vector2i(0, 6), true, false);
Expand Down
40 changes: 21 additions & 19 deletions es-app/src/guis/GuiMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#include "RecalboxConf.h"

void GuiMenu::createInputTextRow(GuiSettings *gui, const char *title, const char *settingsID, bool password) {
void GuiMenu::createInputTextRow(GuiSettings *gui, std::string title, const char *settingsID, bool password) {
// LABEL
Window *window = mWindow;
ComponentListRow row;
Expand Down Expand Up @@ -103,7 +103,7 @@ GuiMenu::GuiMenu(Window *window) : GuiComponent(window), mMenu(window, _("MAIN M
});
}
if (Settings::getInstance()->getBool("RomsManager")) {
addEntry(_("ROMS MANAGER").c_str(), 0x777777FF, true, [this] {
addEntry("ROMS MANAGER", 0x777777FF, true, [this] {
mWindow->pushGui(new GuiRomsManager(mWindow));
});
}
Expand Down Expand Up @@ -182,7 +182,7 @@ GuiMenu::GuiMenu(Window *window) : GuiComponent(window), mMenu(window, _("MAIN M
overclock_choice->add(_("NONE (900Mhz)"), "none-rpi2", currentOverclock == "none-rpi2");
#endif
#else
overclock_choice->add(_("None"), "none", true);
overclock_choice->add(_("NONE"), "none", true);
#endif
s->addWithLabel(_("OVERCLOCK"), overclock_choice);

Expand Down Expand Up @@ -346,8 +346,8 @@ GuiMenu::GuiMenu(Window *window) : GuiComponent(window), mMenu(window, _("MAIN M
retroachievements->addWithLabel(_("RETROACHIEVEMENTS"), retroachievements_enabled);

// retroachievements, username, password
createInputTextRow(retroachievements, _("USERNAME").c_str(), "global.retroachievements.username", false);
createInputTextRow(retroachievements, _("PASSWORD").c_str(), "global.retroachievements.password", false);
createInputTextRow(retroachievements, _("USERNAME"), "global.retroachievements.username", false);
createInputTextRow(retroachievements, _("PASSWORD"), "global.retroachievements.password", false);


retroachievements->addSaveFunc([retroachievements_enabled] {
Expand Down Expand Up @@ -617,7 +617,7 @@ GuiMenu::GuiMenu(Window *window) : GuiComponent(window), mMenu(window, _("MAIN M
Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
s->addWithLabel(_("IP ADDRESS"), ip);
// Hostname
createInputTextRow(s, _("HOSTNAME").c_str(), "system.hostname", false);
createInputTextRow(s, _("HOSTNAME"), "system.hostname", false);

// Wifi enable
auto enable_wifi = std::make_shared<SwitchComponent>(mWindow);
Expand All @@ -627,9 +627,9 @@ GuiMenu::GuiMenu(Window *window) : GuiComponent(window), mMenu(window, _("MAIN M

// window, title, settingstring,
const std::string baseSSID = RecalboxConf::getInstance()->get("wifi.ssid");
createInputTextRow(s, _("WIFI SSID").c_str(), "wifi.ssid", false);
createInputTextRow(s, _("WIFI SSID"), "wifi.ssid", false);
const std::string baseKEY = RecalboxConf::getInstance()->get("wifi.key");
createInputTextRow(s, _("WIFI KEY").c_str(), "wifi.key", true);
createInputTextRow(s, _("WIFI KEY"), "wifi.key", true);

s->addSaveFunc([baseEnabled, baseSSID, baseKEY, enable_wifi, window] {
bool wifienabled = enable_wifi->getState();
Expand Down Expand Up @@ -805,10 +805,10 @@ void GuiMenu::popSystemConfigurationGui(SystemData *systemData, std::string prev
popSystemConfigurationGui(systemData, s);
delete systemConfiguration;
});
systemConfiguration->addWithLabel(_("emulator"), emu_choice);
systemConfiguration->addWithLabel(_("Emulator"), emu_choice);

// Core choice
auto core_choice = std::make_shared<OptionListComponent<std::string> >(mWindow, _("core"), false);
auto core_choice = std::make_shared<OptionListComponent<std::string> >(mWindow, _("Core"), false);
selected = false;
for (auto emulator = systemData->getEmulators()->begin();
emulator != systemData->getEmulators()->end(); emulator++) {
Expand All @@ -821,7 +821,7 @@ void GuiMenu::popSystemConfigurationGui(SystemData *systemData, std::string prev
}
}
core_choice->add(_("DEFAULT"), "default", !selected);
systemConfiguration->addWithLabel(_("core"), core_choice);
systemConfiguration->addWithLabel(_("Core"), core_choice);


// Screen ratio choice
Expand Down Expand Up @@ -971,14 +971,17 @@ void GuiMenu::createConfigInput() {
clearLoadedInput();

std::vector<std::shared_ptr<OptionListComponent<StrInputConfig *>>> options;
char strbuf[256];

for (int player = 0; player < 4; player++) {
std::stringstream sstm;
sstm << "INPUT P" << player + 1;
std::string confName = sstm.str() + "NAME";
std::string confGuid = sstm.str() + "GUID";

snprintf(strbuf, 256, _("INPUT P%i").c_str(), player+1);

LOG(LogInfo) << player + 1 << " " << confName << " " << confGuid;
auto inputOptionList = std::make_shared<OptionListComponent<StrInputConfig *> >(mWindow, sstm.str(), false);
auto inputOptionList = std::make_shared<OptionListComponent<StrInputConfig *> >(mWindow, strbuf, false);
options.push_back(inputOptionList);

// Checking if a setting has been saved, else setting to default
Expand Down Expand Up @@ -1037,7 +1040,7 @@ void GuiMenu::createConfigInput() {
// ADD default config

// Populate controllers list
s->addWithLabel(sstm.str(), inputOptionList);
s->addWithLabel(strbuf, inputOptionList);
}
s->addSaveFunc([this, options, window] {
for (int player = 0; player < 4; player++) {
Expand All @@ -1055,12 +1058,11 @@ void GuiMenu::createConfigInput() {
Settings::getInstance()->setString(confName, name);
Settings::getInstance()->setString(confGuid, "");
} else {
LOG(LogWarning) << "Found the selected controller ! : name in list = " << selectedName;
LOG(LogWarning) << "Found the selected controller ! : guid = " <<
input_p1->getSelected()->deviceGUIDString;
LOG(LogWarning) << "Found the selected controller ! : name in list = " << selectedName;
LOG(LogWarning) << "Found the selected controller ! : guid = " << input_p1->getSelected()->deviceGUIDString;

Settings::getInstance()->setString(confName, input_p1->getSelected()->deviceName);
Settings::getInstance()->setString(confGuid, input_p1->getSelected()->deviceGUIDString);
Settings::getInstance()->setString(confName, input_p1->getSelected()->deviceName);
Settings::getInstance()->setString(confGuid, input_p1->getSelected()->deviceGUIDString);
}
}

Expand Down
2 changes: 1 addition & 1 deletion es-app/src/guis/GuiMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GuiMenu : public GuiComponent
private:
void addEntry(const char* name, unsigned int color, bool add_arrow, const std::function<void()>& func);
void createConfigInput();
void createInputTextRow(GuiSettings * gui, const char* title, const char* settingsID, bool password);
void createInputTextRow(GuiSettings * gui, std::string title, const char* settingsID, bool password);
MenuComponent mMenu;
TextComponent mVersion;

Expand Down
Loading

0 comments on commit 41d3242

Please sign in to comment.