Made some special Unicode characters work correctly with the MSVC compiler.

This commit is contained in:
Leon Styhre 2020-12-29 14:51:29 +01:00
parent c747416071
commit 56cc17d7a1
6 changed files with 44 additions and 19 deletions

View file

@ -33,8 +33,19 @@
#include "Window.h"
ViewController* ViewController::sInstance = nullptr;
#if defined(_MSC_VER) // MSVC compiler.
const std::string ViewController::FAVORITE_CHAR = Utils::String::wideStringToString(L"\uF005");
const std::string ViewController::FOLDER_CHAR = Utils::String::wideStringToString(L"\uF07C");
const std::string ViewController::TICKMARK_CHAR = Utils::String::wideStringToString(L"\uF14A");
const std::string ViewController::CONTROLLER_CHAR = Utils::String::wideStringToString(L"\uF11b");
const std::string ViewController::FILTER_CHAR = Utils::String::wideStringToString(L"\uF0b0");
#else
const std::string ViewController::FAVORITE_CHAR = "\uF005";
const std::string ViewController::FOLDER_CHAR = "\uF07C";
const std::string ViewController::TICKMARK_CHAR = "\uF14A";
const std::string ViewController::CONTROLLER_CHAR = "\uF11b";
const std::string ViewController::FILTER_CHAR = "\uF0b0";
#endif
ViewController* ViewController::get()
{

View file

@ -106,6 +106,9 @@ public:
static const std::string FAVORITE_CHAR;
static const std::string FOLDER_CHAR;
static const std::string TICKMARK_CHAR;
static const std::string CONTROLLER_CHAR;
static const std::string FILTER_CHAR;
private:
ViewController(Window* window);

View file

@ -78,14 +78,14 @@ void BasicGameListView::populateList(const std::vector<FileData*>& files, FileDa
// currently being edited.
if (isEditing && (*it)->getType() == GAME) {
if (CollectionSystemsManager::get()->inCustomCollection(editingCollection, (*it)))
inCollectionPrefix = "\uF14A ";
inCollectionPrefix = ViewController::TICKMARK_CHAR + " ";
else
inCollectionPrefix = "";
}
if ((*it)->getFavorite() && favoriteStar &&
mRoot->getSystem()->getName() != "favorites") {
mList.add(inCollectionPrefix + ViewController::FAVORITE_CHAR + " " + (*it)->getName(),
*it, ((*it)->getType() == FOLDER));
mList.add(inCollectionPrefix + ViewController::FAVORITE_CHAR + " " +
(*it)->getName(), *it, ((*it)->getType() == FOLDER));
}
else if ((*it)->getType() == FOLDER &&
mRoot->getSystem()->getName() != "collections") {

View file

@ -355,22 +355,26 @@ void DetailedGameListView::updateInfoPanel()
std::string gamelistInfoString;
if (mIsFolder)
gamelistInfoString = "\uF07C ";
gamelistInfoString = ViewController::FOLDER_CHAR + " ";
if (mIsFiltered) {
if (mFilteredGameCountAll == mFilteredGameCount)
gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " / " +
gamelistInfoString += ViewController::FILTER_CHAR + " " +
std::to_string(mFilteredGameCount) + " / " +
std::to_string(mGameCount);
else
gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " + " +
gamelistInfoString += ViewController::FILTER_CHAR + " " +
std::to_string(mFilteredGameCount) + " + " +
std::to_string(mFilteredGameCountAll - mFilteredGameCount) + " / " +
std::to_string(mGameCount);
}
else {
gamelistInfoString += "\uF11b " + std::to_string(mGameCount);
gamelistInfoString += ViewController::CONTROLLER_CHAR + " " +
std::to_string(mGameCount);
if (!(file->getSystem()->isCollection() &&
file->getSystem()->getFullName() == "favorites"))
gamelistInfoString += " \uF005 " + std::to_string(mFavoritesGameCount);
gamelistInfoString += " " + ViewController::FAVORITE_CHAR + " "
+ std::to_string(mFavoritesGameCount);
}
mGamelistInfo.setValue(gamelistInfoString);

View file

@ -446,22 +446,25 @@ void GridGameListView::updateInfoPanel()
if (mIsFiltered) {
if (mFilteredGameCountAll == mFilteredGameCount)
gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " / " +
std::to_string(mGameCount);
gamelistInfoString += ViewController::FILTER_CHAR + " "
+ std::to_string(mFilteredGameCount) + " / " + std::to_string(mGameCount);
else
gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " + " +
gamelistInfoString += ViewController::FILTER_CHAR + " " +
std::to_string(mFilteredGameCount) + " + " +
std::to_string(mFilteredGameCountAll - mFilteredGameCount) + " / " +
std::to_string(mGameCount);
}
else {
gamelistInfoString += "\uF11b " + std::to_string(mGameCount);
gamelistInfoString += ViewController::CONTROLLER_CHAR + " " +
std::to_string(mGameCount);
if (!(file->getSystem()->isCollection() &&
file->getSystem()->getFullName() == "favorites"))
gamelistInfoString += " \uF005 " + std::to_string(mFavoritesGameCount);
gamelistInfoString += " " + ViewController::FAVORITE_CHAR + " " +
std::to_string(mFavoritesGameCount);
}
if (mIsFolder)
gamelistInfoString += " \uF07C";
gamelistInfoString += " " + ViewController::FOLDER_CHAR;
mGamelistInfo.setValue(gamelistInfoString);

View file

@ -398,22 +398,26 @@ void VideoGameListView::updateInfoPanel()
std::string gamelistInfoString;
if (mIsFolder)
gamelistInfoString = "\uF07C ";
gamelistInfoString = ViewController::FOLDER_CHAR + " ";
if (mIsFiltered) {
if (mFilteredGameCountAll == mFilteredGameCount)
gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " / " +
gamelistInfoString += ViewController::FILTER_CHAR + " " +
std::to_string(mFilteredGameCount) + " / " +
std::to_string(mGameCount);
else
gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " + " +
gamelistInfoString += ViewController::FILTER_CHAR + " " +
std::to_string(mFilteredGameCount) + " + " +
std::to_string(mFilteredGameCountAll - mFilteredGameCount) + " / " +
std::to_string(mGameCount);
}
else {
gamelistInfoString += "\uF11b " + std::to_string(mGameCount);
gamelistInfoString += ViewController::CONTROLLER_CHAR + " " +
std::to_string(mGameCount);
if (!(file->getSystem()->isCollection() &&
file->getSystem()->getFullName() == "favorites"))
gamelistInfoString += " \uF005 " + std::to_string(mFavoritesGameCount);
gamelistInfoString += " " + ViewController::FAVORITE_CHAR + " "
+ std::to_string(mFavoritesGameCount);
}
mGamelistInfo.setValue(gamelistInfoString);