mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +00:00
Changed ViewController::get() to ViewController::getInstance()
This commit is contained in:
parent
5d79c3d77e
commit
119dfc90f8
|
@ -264,7 +264,7 @@ void CollectionSystemsManager::updateSystemsList()
|
|||
for (auto sysIt = SystemData::sSystemVector.cbegin(); // Line break.
|
||||
sysIt != SystemData::sSystemVector.cend(); ++sysIt) {
|
||||
if ((*sysIt)->isCollection())
|
||||
ViewController::get()->getGameListView((*sysIt));
|
||||
ViewController::getInstance()->getGameListView((*sysIt));
|
||||
}
|
||||
|
||||
// If we were editing a custom collection, and it's no longer enabled, exit edit mode.
|
||||
|
@ -344,20 +344,20 @@ void CollectionSystemsManager::updateCollectionSystem(FileData* file, Collection
|
|||
// Found it, and we are removing it.
|
||||
if (name == "favorites" && file->metadata.get("favorite") == "false") {
|
||||
// Need to check if it is still marked as favorite, if not remove it.
|
||||
ViewController::get()->getGameListView(curSys).get()->remove(collectionEntry,
|
||||
false);
|
||||
ViewController::getInstance()->getGameListView(curSys).get()->remove(
|
||||
collectionEntry, false);
|
||||
}
|
||||
else if (name == "recent" && file->metadata.get("lastplayed") == "0") {
|
||||
// If lastplayed is set to 0 it means the entry has been cleared, and the
|
||||
// game should therefore be removed.
|
||||
ViewController::get()->getGameListView(curSys).get()->remove(collectionEntry,
|
||||
false);
|
||||
ViewController::get()->onFileChanged(rootFolder, true);
|
||||
ViewController::getInstance()->getGameListView(curSys).get()->remove(
|
||||
collectionEntry, false);
|
||||
ViewController::getInstance()->onFileChanged(rootFolder, true);
|
||||
}
|
||||
else if (curSys->isCollection() && !file->getCountAsGame()) {
|
||||
// If the countasgame flag has been set to false, then remove the game.
|
||||
if (curSys->isGroupedCustomCollection()) {
|
||||
ViewController::get()
|
||||
ViewController::getInstance()
|
||||
->getGameListView(curSys->getRootFolder()->getParent()->getSystem())
|
||||
.get()
|
||||
->remove(collectionEntry, false);
|
||||
|
@ -374,8 +374,8 @@ void CollectionSystemsManager::updateCollectionSystem(FileData* file, Collection
|
|||
4000);
|
||||
}
|
||||
else {
|
||||
ViewController::get()->getGameListView(curSys).get()->remove(collectionEntry,
|
||||
false);
|
||||
ViewController::getInstance()->getGameListView(curSys).get()->remove(
|
||||
collectionEntry, false);
|
||||
}
|
||||
rootFolder->sort(rootFolder->getSortTypeFromString(rootFolder->getSortTypeString()),
|
||||
mFavoritesSorting);
|
||||
|
@ -383,7 +383,7 @@ void CollectionSystemsManager::updateCollectionSystem(FileData* file, Collection
|
|||
else {
|
||||
// Re-index with new metadata.
|
||||
fileIndex->addToIndex(collectionEntry);
|
||||
ViewController::get()->onFileChanged(collectionEntry, true);
|
||||
ViewController::getInstance()->onFileChanged(collectionEntry, true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -402,7 +402,8 @@ void CollectionSystemsManager::updateCollectionSystem(FileData* file, Collection
|
|||
CollectionFileData* newGame = new CollectionFileData(file, curSys);
|
||||
rootFolder->addChild(newGame);
|
||||
fileIndex->addToIndex(newGame);
|
||||
ViewController::get()->getGameListView(curSys)->onFileChanged(newGame, true);
|
||||
ViewController::getInstance()->getGameListView(curSys)->onFileChanged(newGame,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -436,7 +437,7 @@ void CollectionSystemsManager::updateCollectionSystem(FileData* file, Collection
|
|||
|
||||
if (name == "recent") {
|
||||
trimCollectionCount(rootFolder, LAST_PLAYED_MAX);
|
||||
ViewController::get()->onFileChanged(rootFolder, false);
|
||||
ViewController::getInstance()->onFileChanged(rootFolder, false);
|
||||
// This is a bit of a hack to prevent a jump to the first line of the gamelist
|
||||
// if an entry is manually adjusted from within the 'recent' gamelist, for example
|
||||
// by toggling a game as favorite. If the time since the last played timestamp is
|
||||
|
@ -447,20 +448,21 @@ void CollectionSystemsManager::updateCollectionSystem(FileData* file, Collection
|
|||
auto nTime = Utils::Time::now();
|
||||
if (nTime - Utils::Time::stringToTime(file->metadata.get("lastplayed")) < 2) {
|
||||
// Select the first row of the gamelist (the game just played).
|
||||
IGameListView* gameList =
|
||||
ViewController::get()->getGameListView(getSystemToView(sysData.system)).get();
|
||||
IGameListView* gameList = ViewController::getInstance()
|
||||
->getGameListView(getSystemToView(sysData.system))
|
||||
.get();
|
||||
gameList->setCursor(gameList->getFirstEntry());
|
||||
}
|
||||
}
|
||||
else {
|
||||
ViewController::get()->onFileChanged(rootFolder, true);
|
||||
ViewController::getInstance()->onFileChanged(rootFolder, true);
|
||||
// For custom collections, update either the actual system or its parent depending
|
||||
// on whether the collection is grouped or not.
|
||||
if (sysData.decl.isCustom) {
|
||||
if (rootFolder->getSystem()->isGroupedCustomCollection())
|
||||
ViewController::get()->onFileChanged(rootFolder->getParent(), true);
|
||||
ViewController::getInstance()->onFileChanged(rootFolder->getParent(), true);
|
||||
else
|
||||
ViewController::get()->onFileChanged(rootFolder, true);
|
||||
ViewController::getInstance()->onFileChanged(rootFolder, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -486,7 +488,7 @@ void CollectionSystemsManager::deleteCollectionFiles(FileData* file)
|
|||
if (found) {
|
||||
FileData* collectionEntry = children.at(key);
|
||||
SystemData* systemViewToUpdate = getSystemToView(sysDataIt->second.system);
|
||||
ViewController::get()
|
||||
ViewController::getInstance()
|
||||
->getGameListView(systemViewToUpdate)
|
||||
.get()
|
||||
->remove(collectionEntry, false);
|
||||
|
@ -621,8 +623,8 @@ void CollectionSystemsManager::exitEditMode(bool showPopup)
|
|||
|
||||
// Remove all tick marks from the games that are part of the collection.
|
||||
for (auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); ++it) {
|
||||
ViewController::get()->getGameListView((*it))->onFileChanged(
|
||||
ViewController::get()->getGameListView((*it))->getCursor(), false);
|
||||
ViewController::getInstance()->getGameListView((*it))->onFileChanged(
|
||||
ViewController::getInstance()->getGameListView((*it))->getCursor(), false);
|
||||
}
|
||||
|
||||
mEditingCollectionSystemData->system->onMetaDataSavePoint();
|
||||
|
@ -667,14 +669,14 @@ const bool CollectionSystemsManager::toggleGameInCollection(FileData* file)
|
|||
// If we found it, we need to remove it.
|
||||
FileData* collectionEntry = children.at(key);
|
||||
fileIndex->removeFromIndex(collectionEntry);
|
||||
ViewController::get()
|
||||
ViewController::getInstance()
|
||||
->getGameListView(systemViewToUpdate)
|
||||
.get()
|
||||
->remove(collectionEntry, false);
|
||||
systemViewToUpdate->getRootFolder()->sort(
|
||||
rootFolder->getSortTypeFromString(rootFolder->getSortTypeString()),
|
||||
Settings::getInstance()->getBool("FavFirstCustom"));
|
||||
ViewController::get()->reloadGameListView(systemViewToUpdate);
|
||||
ViewController::getInstance()->reloadGameListView(systemViewToUpdate);
|
||||
|
||||
updateCollectionFolderMetadata(systemViewToUpdate);
|
||||
}
|
||||
|
@ -686,7 +688,8 @@ const bool CollectionSystemsManager::toggleGameInCollection(FileData* file)
|
|||
systemViewToUpdate->getRootFolder()->sort(
|
||||
rootFolder->getSortTypeFromString(rootFolder->getSortTypeString()),
|
||||
Settings::getInstance()->getBool("FavFirstCustom"));
|
||||
ViewController::get()->onFileChanged(systemViewToUpdate->getRootFolder(), true);
|
||||
ViewController::getInstance()->onFileChanged(systemViewToUpdate->getRootFolder(),
|
||||
true);
|
||||
fileIndex->addToIndex(newGame);
|
||||
|
||||
// Add to bundle index as well, if needed.
|
||||
|
@ -713,7 +716,7 @@ const bool CollectionSystemsManager::toggleGameInCollection(FileData* file)
|
|||
file->getSourceFileData()->getSystem()->onMetaDataSavePoint();
|
||||
refreshCollectionSystems(file->getSourceFileData());
|
||||
if (mAutoCollectionSystemsData["favorites"].isEnabled)
|
||||
ViewController::get()->reloadGameListView(
|
||||
ViewController::getInstance()->reloadGameListView(
|
||||
mAutoCollectionSystemsData["favorites"].system);
|
||||
}
|
||||
if (adding) {
|
||||
|
@ -904,15 +907,15 @@ void CollectionSystemsManager::deleteCustomCollection(const std::string& collect
|
|||
// The window deletion needs to be located here instead of in GuiCollectionSystemsOptions
|
||||
// (where the custom collection deletions are initiated), as there seems to be some random
|
||||
// issue with accessing mWindow via the lambda expression.
|
||||
while (mWindow->peekGui() && mWindow->peekGui() != ViewController::get())
|
||||
while (mWindow->peekGui() && mWindow->peekGui() != ViewController::getInstance())
|
||||
delete mWindow->peekGui();
|
||||
|
||||
if (collectionEntry != mCustomCollectionSystemsData.end()) {
|
||||
CollectionSystemsManager::getInstance()->loadEnabledListFromSettings();
|
||||
CollectionSystemsManager::getInstance()->updateSystemsList();
|
||||
|
||||
ViewController::get()->removeGameListView(collectionEntry->second.system);
|
||||
ViewController::get()->reloadAll();
|
||||
ViewController::getInstance()->removeGameListView(collectionEntry->second.system);
|
||||
ViewController::getInstance()->reloadAll();
|
||||
|
||||
delete collectionEntry->second.system;
|
||||
mCustomCollectionSystemsData.erase(collectionName);
|
||||
|
@ -999,7 +1002,8 @@ void CollectionSystemsManager::repopulateCollection(SystemData* sysData)
|
|||
// it to something valid. For empty collections we need to first create a placeholder
|
||||
// and then point to this, and for collections with games in them we select the first
|
||||
// entry.
|
||||
auto autoView = ViewController::get()->getGameListView(autoSystem->system).get();
|
||||
auto autoView =
|
||||
ViewController::getInstance()->getGameListView(autoSystem->system).get();
|
||||
if (autoSystem->system->getRootFolder()->getChildren().size() == 0) {
|
||||
autoView->addPlaceholder(autoSystem->system->getRootFolder());
|
||||
autoView->setCursor(autoView->getLastEntry());
|
||||
|
@ -1035,7 +1039,8 @@ void CollectionSystemsManager::repopulateCollection(SystemData* sysData)
|
|||
customSystem->isPopulated = false;
|
||||
populateCustomCollection(customSystem);
|
||||
|
||||
auto autoView = ViewController::get()->getGameListView(customSystem->system).get();
|
||||
auto autoView =
|
||||
ViewController::getInstance()->getGameListView(customSystem->system).get();
|
||||
autoView->setCursor(
|
||||
customSystem->system->getRootFolder()->getChildrenRecursive().front());
|
||||
autoView->setCursor(autoView->getFirstEntry());
|
||||
|
@ -1154,12 +1159,13 @@ void CollectionSystemsManager::populateAutoCollection(CollectionSystemData* sysD
|
|||
if (rootFolder->getName() == "recent" && !rootFolder->getChildrenRecursive().empty()) {
|
||||
// The following is needed to avoid a crash when repopulating the system as the previous
|
||||
// cursor pointer may point to a random memory address.
|
||||
auto recentGamelist = ViewController::get()->getGameListView(rootFolder->getSystem()).get();
|
||||
auto recentGamelist =
|
||||
ViewController::getInstance()->getGameListView(rootFolder->getSystem()).get();
|
||||
recentGamelist->setCursor(
|
||||
rootFolder->getSystem()->getRootFolder()->getChildrenRecursive().front());
|
||||
recentGamelist->setCursor(recentGamelist->getFirstEntry());
|
||||
if (rootFolder->getChildren().size() > 0)
|
||||
ViewController::get()
|
||||
ViewController::getInstance()
|
||||
->getGameListView(rootFolder->getSystem())
|
||||
.get()
|
||||
->onFileChanged(rootFolder->getChildren().front(), false);
|
||||
|
@ -1248,7 +1254,7 @@ void CollectionSystemsManager::removeCollectionsFromDisplayedSystems()
|
|||
// Clear index.
|
||||
mCustomCollectionsBundle->getIndex()->resetIndex();
|
||||
// Remove view so it's re-created as needed.
|
||||
ViewController::get()->removeGameListView(mCustomCollectionsBundle);
|
||||
ViewController::getInstance()->removeGameListView(mCustomCollectionsBundle);
|
||||
}
|
||||
|
||||
void CollectionSystemsManager::addEnabledCollectionsToDisplayedSystems(
|
||||
|
@ -1280,7 +1286,7 @@ void CollectionSystemsManager::addEnabledCollectionsToDisplayedSystems(
|
|||
Settings::getInstance()->getBool("FavFirstCustom"));
|
||||
// Jump to the first row of the game list, assuming it's not empty.
|
||||
IGameListView* gameList =
|
||||
ViewController::get()->getGameListView((it->second.system)).get();
|
||||
ViewController::getInstance()->getGameListView((it->second.system)).get();
|
||||
if (!gameList->getCursor()->isPlaceHolder()) {
|
||||
gameList->setCursor(gameList->getFirstEntry());
|
||||
}
|
||||
|
@ -1434,7 +1440,7 @@ void CollectionSystemsManager::trimCollectionCount(FileData* rootFolder, int lim
|
|||
while (static_cast<int>(rootFolder->getChildrenListToDisplay().size()) > limit) {
|
||||
CollectionFileData* gameToRemove =
|
||||
(CollectionFileData*)rootFolder->getChildrenListToDisplay().back();
|
||||
ViewController::get()->getGameListView(curSys).get()->remove(gameToRemove, false);
|
||||
ViewController::getInstance()->getGameListView(curSys).get()->remove(gameToRemove, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ bool MediaViewer::startMediaViewer(FileData* game)
|
|||
initiateViewer();
|
||||
|
||||
if (mHasVideo)
|
||||
ViewController::get()->onPauseVideo();
|
||||
ViewController::getInstance()->onPauseVideo();
|
||||
|
||||
if (mHasVideo || mHasImages)
|
||||
return true;
|
||||
|
@ -56,7 +56,7 @@ bool MediaViewer::startMediaViewer(FileData* game)
|
|||
void MediaViewer::stopMediaViewer()
|
||||
{
|
||||
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
||||
ViewController::get()->onStopVideo();
|
||||
ViewController::getInstance()->onStopVideo();
|
||||
|
||||
if (mVideo) {
|
||||
delete mVideo;
|
||||
|
@ -255,7 +255,7 @@ void MediaViewer::playVideo()
|
|||
return;
|
||||
|
||||
mDisplayingImage = false;
|
||||
ViewController::get()->onStopVideo();
|
||||
ViewController::getInstance()->onStopVideo();
|
||||
|
||||
mVideo = new VideoFFmpegComponent(mWindow);
|
||||
mVideo->topWindow(true);
|
||||
|
|
|
@ -1127,7 +1127,7 @@ FileData* SystemData::getRandomGame(const FileData* currentGame)
|
|||
gameList = mRootFolder->getParent()->getChildrenListToDisplay();
|
||||
}
|
||||
else {
|
||||
gameList = ViewController::get()
|
||||
gameList = ViewController::getInstance()
|
||||
->getGameListView(mRootFolder->getSystem())
|
||||
.get()
|
||||
->getCursor()
|
||||
|
@ -1210,10 +1210,10 @@ void SystemData::sortSystem(bool reloadGamelist, bool jumpToFirstRow)
|
|||
favoritesSorting);
|
||||
|
||||
if (reloadGamelist)
|
||||
ViewController::get()->reloadGameListView(this, false);
|
||||
ViewController::getInstance()->reloadGameListView(this, false);
|
||||
|
||||
if (jumpToFirstRow) {
|
||||
IGameListView* gameList = ViewController::get()->getGameListView(this).get();
|
||||
IGameListView* gameList = ViewController::getInstance()->getGameListView(this).get();
|
||||
gameList->setCursor(gameList->getFirstEntry());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,12 +209,12 @@ void SystemScreensaver::launchGame()
|
|||
{
|
||||
if (mCurrentGame != nullptr) {
|
||||
// Launching game
|
||||
ViewController::get()->triggerGameLaunch(mCurrentGame);
|
||||
ViewController::get()->goToGameList(mCurrentGame->getSystem());
|
||||
ViewController::getInstance()->triggerGameLaunch(mCurrentGame);
|
||||
ViewController::getInstance()->goToGameList(mCurrentGame->getSystem());
|
||||
IGameListView* view =
|
||||
ViewController::get()->getGameListView(mCurrentGame->getSystem()).get();
|
||||
ViewController::getInstance()->getGameListView(mCurrentGame->getSystem()).get();
|
||||
view->setCursor(mCurrentGame);
|
||||
ViewController::get()->cancelViewTransitions();
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,11 +222,11 @@ void SystemScreensaver::goToGame()
|
|||
{
|
||||
if (mCurrentGame != nullptr) {
|
||||
// Go to the game in the gamelist view, but don't launch it.
|
||||
ViewController::get()->goToGameList(mCurrentGame->getSystem());
|
||||
ViewController::getInstance()->goToGameList(mCurrentGame->getSystem());
|
||||
IGameListView* view =
|
||||
ViewController::get()->getGameListView(mCurrentGame->getSystem()).get();
|
||||
ViewController::getInstance()->getGameListView(mCurrentGame->getSystem()).get();
|
||||
view->setCursor(mCurrentGame);
|
||||
ViewController::get()->cancelViewTransitions();
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -252,6 +252,6 @@ std::vector<HelpPrompt> GuiAlternativeEmulators::getHelpPrompts()
|
|||
HelpStyle GuiAlternativeEmulators::getHelpStyle()
|
||||
{
|
||||
HelpStyle style = HelpStyle();
|
||||
style.applyTheme(ViewController::get()->getState().getSystem()->getTheme(), "system");
|
||||
style.applyTheme(ViewController::getInstance()->getState().getSystem()->getTheme(), "system");
|
||||
return style;
|
||||
}
|
||||
|
|
|
@ -399,7 +399,7 @@ void GuiCollectionSystemsOptions::createCustomCollection(std::string inName)
|
|||
setNeedsGoToSystem(newCollection);
|
||||
|
||||
Window* window = mWindow;
|
||||
while (window->peekGui() && window->peekGui() != ViewController::get())
|
||||
while (window->peekGui() && window->peekGui() != ViewController::getInstance())
|
||||
delete window->peekGui();
|
||||
CollectionSystemsManager::getInstance()->setEditMode(collectionName);
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ std::vector<HelpPrompt> GuiGameScraper::getHelpPrompts()
|
|||
HelpStyle GuiGameScraper::getHelpStyle()
|
||||
{
|
||||
HelpStyle style = HelpStyle();
|
||||
style.applyTheme(ViewController::get()->getState().getSystem()->getTheme(), "system");
|
||||
style.applyTheme(ViewController::getInstance()->getState().getSystem()->getTheme(), "system");
|
||||
return style;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ void GuiGamelistFilter::initializeMenu()
|
|||
|
||||
// If this is a collection and system names are shown per game, then let FileFilterIndex
|
||||
// know about this so the system names will not be included in game name text searches.
|
||||
if (ViewController::get()->getState().getSystem()->isCollection()) {
|
||||
if (ViewController::getInstance()->getState().getSystem()->isCollection()) {
|
||||
if (Settings::getInstance()->getBool("CollectionShowSystemInfo"))
|
||||
mFilterIndex->setTextRemoveSystem(true);
|
||||
else
|
||||
|
@ -262,6 +262,6 @@ std::vector<HelpPrompt> GuiGamelistFilter::getHelpPrompts()
|
|||
HelpStyle GuiGamelistFilter::getHelpStyle()
|
||||
{
|
||||
HelpStyle style = HelpStyle();
|
||||
style.applyTheme(ViewController::get()->getState().getSystem()->getTheme(), "system");
|
||||
style.applyTheme(ViewController::getInstance()->getState().getSystem()->getTheme(), "system");
|
||||
return style;
|
||||
}
|
||||
|
|
|
@ -258,20 +258,20 @@ GuiGamelistOptions::~GuiGamelistOptions()
|
|||
// This is required for the situation where scrolling started just before the menu
|
||||
// was openened. Without this, the scrolling would run until manually stopped after
|
||||
// the menu has been closed.
|
||||
ViewController::get()->stopScrolling();
|
||||
ViewController::getInstance()->stopScrolling();
|
||||
|
||||
if (mFiltersChanged) {
|
||||
if (!mCustomCollectionSystem) {
|
||||
ViewController::get()->reloadGameListView(mSystem);
|
||||
ViewController::getInstance()->reloadGameListView(mSystem);
|
||||
}
|
||||
else {
|
||||
if (!mFromPlaceholder) {
|
||||
ViewController::get()->reloadGameListView(mSystem);
|
||||
ViewController::getInstance()->reloadGameListView(mSystem);
|
||||
}
|
||||
else if (!mCustomCollectionSystem->getRootFolder()
|
||||
->getChildrenListToDisplay()
|
||||
.empty()) {
|
||||
ViewController::get()->reloadGameListView(mSystem);
|
||||
ViewController::getInstance()->reloadGameListView(mSystem);
|
||||
getGamelist()->setCursor(
|
||||
mCustomCollectionSystem->getRootFolder()->getChildrenListToDisplay().front());
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ void GuiGamelistOptions::startEditMode()
|
|||
// currently being edited. This is done cheaply using onFileChanged() which will trigger
|
||||
// populateList().
|
||||
for (auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); ++it) {
|
||||
ViewController::get()->getGameListView((*it))->onFileChanged(
|
||||
ViewController::get()->getGameListView((*it))->getCursor(), false);
|
||||
ViewController::getInstance()->getGameListView((*it))->onFileChanged(
|
||||
ViewController::getInstance()->getGameListView((*it))->getCursor(), false);
|
||||
}
|
||||
|
||||
if (mSystem->getRootFolder()->getChildren().size() == 0)
|
||||
|
@ -396,7 +396,7 @@ void GuiGamelistOptions::openMetaDataEd()
|
|||
LOG(LogInfo) << "Deleting the media files and gamelist.xml entry for the file \""
|
||||
<< file->getFullPath() << "\"";
|
||||
}
|
||||
ViewController::get()->getGameListView(file->getSystem()).get()->removeMedia(file);
|
||||
ViewController::getInstance()->getGameListView(file->getSystem()).get()->removeMedia(file);
|
||||
|
||||
// Manually reset all the metadata values, set the name to the actual file/folder name.
|
||||
const std::vector<MetaDataDecl>& mdd = file->metadata.getMDD();
|
||||
|
@ -443,10 +443,10 @@ void GuiGamelistOptions::openMetaDataEd()
|
|||
LOG(LogInfo) << "Deleting the game file \"" << file->getFullPath()
|
||||
<< "\", all its media files and its gamelist.xml entry.";
|
||||
CollectionSystemsManager::getInstance()->deleteCollectionFiles(file);
|
||||
ViewController::get()->getGameListView(file->getSystem()).get()->removeMedia(file);
|
||||
ViewController::get()->getGameListView(file->getSystem()).get()->remove(file, true);
|
||||
ViewController::getInstance()->getGameListView(file->getSystem()).get()->removeMedia(file);
|
||||
ViewController::getInstance()->getGameListView(file->getSystem()).get()->remove(file, true);
|
||||
mSystem->getRootFolder()->sort(*mListSort->getSelected(), mFavoritesSorting);
|
||||
ViewController::get()->reloadGameListView(mSystem);
|
||||
ViewController::getInstance()->reloadGameListView(mSystem);
|
||||
|
||||
mWindow->invalidateCachedBackground();
|
||||
};
|
||||
|
@ -456,7 +456,8 @@ void GuiGamelistOptions::openMetaDataEd()
|
|||
mWindow, &file->metadata, file->metadata.getMDD(FOLDER_METADATA), p,
|
||||
Utils::FileSystem::getFileName(file->getPath()),
|
||||
std::bind(&IGameListView::onFileChanged,
|
||||
ViewController::get()->getGameListView(file->getSystem()).get(), file, true),
|
||||
ViewController::getInstance()->getGameListView(file->getSystem()).get(), file,
|
||||
true),
|
||||
clearGameBtnFunc, deleteGameBtnFunc));
|
||||
}
|
||||
else {
|
||||
|
@ -464,7 +465,8 @@ void GuiGamelistOptions::openMetaDataEd()
|
|||
mWindow, &file->metadata, file->metadata.getMDD(GAME_METADATA), p,
|
||||
Utils::FileSystem::getFileName(file->getPath()),
|
||||
std::bind(&IGameListView::onFileChanged,
|
||||
ViewController::get()->getGameListView(file->getSystem()).get(), file, true),
|
||||
ViewController::getInstance()->getGameListView(file->getSystem()).get(), file,
|
||||
true),
|
||||
clearGameBtnFunc, deleteGameBtnFunc));
|
||||
}
|
||||
}
|
||||
|
@ -568,5 +570,5 @@ std::vector<HelpPrompt> GuiGamelistOptions::getHelpPrompts()
|
|||
|
||||
IGameListView* GuiGamelistOptions::getGamelist()
|
||||
{
|
||||
return ViewController::get()->getGameListView(mSystem).get();
|
||||
return ViewController::getInstance()->getGameListView(mSystem).get();
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ GuiMenu::~GuiMenu()
|
|||
// This is required for the situation where scrolling started just before the menu
|
||||
// was openened. Without this, the scrolling would run until manually stopped after
|
||||
// the menu has been closed.
|
||||
ViewController::get()->stopScrolling();
|
||||
ViewController::getInstance()->stopScrolling();
|
||||
}
|
||||
|
||||
void GuiMenu::openScraperOptions()
|
||||
|
@ -266,8 +266,9 @@ void GuiMenu::openUIOptions()
|
|||
(*it)->sortSystem();
|
||||
(*it)->getIndex()->resetFilters();
|
||||
}
|
||||
ViewController::get()->reloadAll();
|
||||
ViewController::get()->goToSystem(SystemData::sSystemVector.front(), false);
|
||||
ViewController::getInstance()->reloadAll();
|
||||
ViewController::getInstance()->goToSystem(SystemData::sSystemVector.front(),
|
||||
false);
|
||||
mWindow->invalidateCachedBackground();
|
||||
},
|
||||
"NO", nullptr));
|
||||
|
@ -828,7 +829,7 @@ void GuiMenu::openOtherOptions()
|
|||
auto updateValMediaDir = [this](const std::string& newVal) {
|
||||
Settings::getInstance()->setString("MediaDirectory", newVal);
|
||||
Settings::getInstance()->saveFile();
|
||||
ViewController::get()->reloadAll();
|
||||
ViewController::getInstance()->reloadAll();
|
||||
mWindow->invalidateCachedBackground();
|
||||
};
|
||||
rowMediaDir.makeAcceptInputHandler([this, titleMediaDir, mediaDirectoryStaticText,
|
||||
|
@ -1264,7 +1265,7 @@ void GuiMenu::close(bool closeAllWindows)
|
|||
else {
|
||||
Window* window = mWindow;
|
||||
closeFunc = [window] {
|
||||
while (window->peekGui() != ViewController::get())
|
||||
while (window->peekGui() != ViewController::getInstance())
|
||||
delete window->peekGui();
|
||||
};
|
||||
}
|
||||
|
@ -1298,6 +1299,6 @@ std::vector<HelpPrompt> GuiMenu::getHelpPrompts()
|
|||
HelpStyle GuiMenu::getHelpStyle()
|
||||
{
|
||||
HelpStyle style = HelpStyle();
|
||||
style.applyTheme(ViewController::get()->getState().getSystem()->getTheme(), "system");
|
||||
style.applyTheme(ViewController::getInstance()->getState().getSystem()->getTheme(), "system");
|
||||
return style;
|
||||
}
|
||||
|
|
|
@ -511,7 +511,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
|
|||
|
||||
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, "SAVE", "save metadata", [&] {
|
||||
save();
|
||||
ViewController::get()->onPauseVideo();
|
||||
ViewController::getInstance()->onPauseVideo();
|
||||
delete this;
|
||||
}));
|
||||
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, "CANCEL", "cancel changes",
|
||||
|
@ -698,7 +698,7 @@ void GuiMetaDataEd::save()
|
|||
if (std::find(children.begin(), children.end(), hideGame) != children.end()) {
|
||||
sys->getIndex()->removeFromIndex(hideGame);
|
||||
// Reload the gamelist as well as the view style may need to change.
|
||||
ViewController::get()->reloadGameListView(sys);
|
||||
ViewController::getInstance()->reloadGameListView(sys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -811,12 +811,12 @@ void GuiMetaDataEd::close()
|
|||
// until the user scrolls up and down the gamelist.
|
||||
TextureResource::manualUnload(mScraperParams.game->getImagePath(), false);
|
||||
TextureResource::manualUnload(mScraperParams.game->getMarqueePath(), false);
|
||||
ViewController::get()->reloadGameListView(mScraperParams.system);
|
||||
ViewController::getInstance()->reloadGameListView(mScraperParams.system);
|
||||
// Update all collections where the game is present.
|
||||
CollectionSystemsManager::getInstance()->refreshCollectionSystems(mScraperParams.game);
|
||||
mWindow->invalidateCachedBackground();
|
||||
}
|
||||
ViewController::get()->onPauseVideo();
|
||||
ViewController::getInstance()->onPauseVideo();
|
||||
delete this;
|
||||
};
|
||||
|
||||
|
@ -867,6 +867,6 @@ std::vector<HelpPrompt> GuiMetaDataEd::getHelpPrompts()
|
|||
HelpStyle GuiMetaDataEd::getHelpStyle()
|
||||
{
|
||||
HelpStyle style = HelpStyle();
|
||||
style.applyTheme(ViewController::get()->getState().getSystem()->getTheme(), "system");
|
||||
style.applyTheme(ViewController::getInstance()->getState().getSystem()->getTheme(), "system");
|
||||
return style;
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ GuiOfflineGenerator::~GuiOfflineGenerator()
|
|||
mMiximageGenerator.reset();
|
||||
|
||||
if (mImagesGenerated > 0)
|
||||
ViewController::get()->reloadAll();
|
||||
ViewController::getInstance()->reloadAll();
|
||||
}
|
||||
|
||||
void GuiOfflineGenerator::onSizeChanged()
|
||||
|
@ -336,6 +336,6 @@ std::vector<HelpPrompt> GuiOfflineGenerator::getHelpPrompts()
|
|||
HelpStyle GuiOfflineGenerator::getHelpStyle()
|
||||
{
|
||||
HelpStyle style = HelpStyle();
|
||||
style.applyTheme(ViewController::get()->getState().getSystem()->getTheme(), "system");
|
||||
style.applyTheme(ViewController::getInstance()->getState().getSystem()->getTheme(), "system");
|
||||
return style;
|
||||
}
|
||||
|
|
|
@ -1135,6 +1135,6 @@ std::vector<HelpPrompt> GuiScraperMenu::getHelpPrompts()
|
|||
HelpStyle GuiScraperMenu::getHelpStyle()
|
||||
{
|
||||
HelpStyle style = HelpStyle();
|
||||
style.applyTheme(ViewController::get()->getState().getSystem()->getTheme(), "system");
|
||||
style.applyTheme(ViewController::getInstance()->getState().getSystem()->getTheme(), "system");
|
||||
return style;
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ GuiScraperMulti::~GuiScraperMulti()
|
|||
(*it)->sortSystem();
|
||||
}
|
||||
}
|
||||
ViewController::get()->onPauseVideo();
|
||||
ViewController::getInstance()->onPauseVideo();
|
||||
}
|
||||
|
||||
void GuiScraperMulti::onSizeChanged()
|
||||
|
@ -324,6 +324,6 @@ std::vector<HelpPrompt> GuiScraperMulti::getHelpPrompts()
|
|||
HelpStyle GuiScraperMulti::getHelpStyle()
|
||||
{
|
||||
HelpStyle style = HelpStyle();
|
||||
style.applyTheme(ViewController::get()->getState().getSystem()->getTheme(), "system");
|
||||
style.applyTheme(ViewController::getInstance()->getState().getSystem()->getTheme(), "system");
|
||||
return style;
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ GuiScraperSearch::~GuiScraperSearch()
|
|||
mMiximageGeneratorThread.join();
|
||||
mMiximageGenerator.reset();
|
||||
TextureResource::manualUnload(mLastSearch.game->getMiximagePath(), false);
|
||||
ViewController::get()->onFileChanged(mLastSearch.game, true);
|
||||
ViewController::getInstance()->onFileChanged(mLastSearch.game, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1017,6 +1017,6 @@ std::vector<HelpPrompt> GuiScraperSearch::getHelpPrompts()
|
|||
HelpStyle GuiScraperSearch::getHelpStyle()
|
||||
{
|
||||
HelpStyle style = HelpStyle();
|
||||
style.applyTheme(ViewController::get()->getState().getSystem()->getTheme(), "system");
|
||||
style.applyTheme(ViewController::getInstance()->getState().getSystem()->getTheme(), "system");
|
||||
return style;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ void GuiSettings::save()
|
|||
(*it)->sortSystem(true);
|
||||
|
||||
// Jump to the first row of the gamelist.
|
||||
IGameListView* gameList = ViewController::get()->getGameListView((*it)).get();
|
||||
IGameListView* gameList = ViewController::getInstance()->getGameListView((*it)).get();
|
||||
gameList->setCursor(gameList->getFirstEntry());
|
||||
}
|
||||
}
|
||||
|
@ -94,38 +94,38 @@ void GuiSettings::save()
|
|||
}
|
||||
|
||||
if (mNeedsReloading)
|
||||
ViewController::get()->reloadAll();
|
||||
ViewController::getInstance()->reloadAll();
|
||||
|
||||
if (mNeedsGoToStart)
|
||||
ViewController::get()->goToStart(true);
|
||||
ViewController::getInstance()->goToStart(true);
|
||||
|
||||
if (mNeedsGoToSystem)
|
||||
ViewController::get()->goToSystem(mGoToSystem, false);
|
||||
ViewController::getInstance()->goToSystem(mGoToSystem, false);
|
||||
|
||||
if (mNeedsGoToGroupedCollections) {
|
||||
bool groupedSystemExists = false;
|
||||
for (SystemData* system : SystemData::sSystemVector) {
|
||||
if (system->getThemeFolder() == "custom-collections") {
|
||||
ViewController::get()->goToSystem(system, false);
|
||||
ViewController::getInstance()->goToSystem(system, false);
|
||||
groupedSystemExists = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!groupedSystemExists)
|
||||
// No grouped custom collection system exists, so go to the first system instead.
|
||||
ViewController::get()->goToSystem(SystemData::sSystemVector.front(), false);
|
||||
ViewController::getInstance()->goToSystem(SystemData::sSystemVector.front(), false);
|
||||
}
|
||||
|
||||
if (mNeedsCollectionsUpdate) {
|
||||
auto state = ViewController::get()->getState();
|
||||
auto state = ViewController::getInstance()->getState();
|
||||
// If we're in any view other than the grouped custom collections, always jump to the
|
||||
// system view in case of any collection updates. This is overkill in some instances but
|
||||
// these views can behave a bit strange during collection changes so it's better to be on
|
||||
// the safe side.
|
||||
if (state.getSystem()->isCollection() &&
|
||||
state.getSystem()->getThemeFolder() != "custom-collections") {
|
||||
ViewController::get()->goToStart(false);
|
||||
ViewController::get()->goToSystem(SystemData::sSystemVector.front(), false);
|
||||
ViewController::getInstance()->goToStart(false);
|
||||
ViewController::getInstance()->goToSystem(SystemData::sSystemVector.front(), false);
|
||||
// We don't want to invalidate the cached background when there has been a collection
|
||||
// systen change as that may show a black screen in some circumstances.
|
||||
return;
|
||||
|
@ -134,7 +134,7 @@ void GuiSettings::save()
|
|||
// system view).
|
||||
if (std::find(SystemData::sSystemVector.begin(), SystemData::sSystemVector.end(),
|
||||
state.getSystem()) == SystemData::sSystemVector.end()) {
|
||||
ViewController::get()->goToStart(false);
|
||||
ViewController::getInstance()->goToStart(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ bool GuiSettings::input(InputConfig* config, Input input)
|
|||
HelpStyle GuiSettings::getHelpStyle()
|
||||
{
|
||||
HelpStyle style = HelpStyle();
|
||||
style.applyTheme(ViewController::get()->getState().getSystem()->getTheme(), "system");
|
||||
style.applyTheme(ViewController::getInstance()->getState().getSystem()->getTheme(), "system");
|
||||
return style;
|
||||
}
|
||||
|
||||
|
|
|
@ -530,7 +530,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
Window* window = Window::getInstance();
|
||||
|
||||
ViewController::get();
|
||||
ViewController::getInstance();
|
||||
CollectionSystemsManager::getInstance();
|
||||
|
||||
SystemScreensaver screensaver;
|
||||
|
@ -542,7 +542,7 @@ int main(int argc, char* argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
window->pushGui(ViewController::get());
|
||||
window->pushGui(ViewController::getInstance());
|
||||
|
||||
bool splashScreen = Settings::getInstance()->getBool("SplashScreen");
|
||||
bool splashScreenProgress = Settings::getInstance()->getBool("SplashScreenProgress");
|
||||
|
@ -587,10 +587,10 @@ int main(int argc, char* argv[])
|
|||
// configure a different ROM directory as well as to generate the game systems
|
||||
// directory structure.
|
||||
if (loadSystemsStatus == INVALID_FILE) {
|
||||
ViewController::get()->invalidSystemsFileDialog();
|
||||
ViewController::getInstance()->invalidSystemsFileDialog();
|
||||
}
|
||||
else if (loadSystemsStatus == NO_ROMS) {
|
||||
ViewController::get()->noGamesDialog();
|
||||
ViewController::getInstance()->noGamesDialog();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -599,7 +599,7 @@ int main(int argc, char* argv[])
|
|||
// any command tag in es_systems.xml.
|
||||
for (auto system : SystemData::sSystemVector) {
|
||||
if (system->getAlternativeEmulator().substr(0, 9) == "<INVALID>") {
|
||||
ViewController::get()->invalidAlternativeEmulatorDialog();
|
||||
ViewController::getInstance()->invalidAlternativeEmulatorDialog();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -609,7 +609,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
// Preload what we can right away instead of waiting for the user to select it.
|
||||
// This makes for no delays when accessing content, but a longer startup time.
|
||||
ViewController::get()->preload();
|
||||
ViewController::getInstance()->preload();
|
||||
|
||||
if (splashScreen && splashScreenProgress)
|
||||
window->renderLoadingScreen("Done");
|
||||
|
@ -617,11 +617,11 @@ int main(int argc, char* argv[])
|
|||
// Open the input configuration GUI if the flag to force this was passed from the command line.
|
||||
if (!loadSystemsStatus) {
|
||||
if (forceInputConfig) {
|
||||
window->pushGui(new GuiDetectDevice(window, false, true,
|
||||
[] { ViewController::get()->goToStart(true); }));
|
||||
window->pushGui(new GuiDetectDevice(
|
||||
window, false, true, [] { ViewController::getInstance()->goToStart(true); }));
|
||||
}
|
||||
else {
|
||||
ViewController::get()->goToStart(true);
|
||||
ViewController::getInstance()->goToStart(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -679,7 +679,7 @@ int main(int argc, char* argv[])
|
|||
Log::flush();
|
||||
}
|
||||
|
||||
while (window->peekGui() != ViewController::get())
|
||||
while (window->peekGui() != ViewController::getInstance())
|
||||
delete window->peekGui();
|
||||
window->deinit();
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ MDResolveHandle::MDResolveHandle(const ScraperSearchResult& result,
|
|||
scrapeFiles.push_back(mediaFileInfo);
|
||||
#if defined(_WIN64)
|
||||
// Required due to the idiotic file locking that exists on this operating system.
|
||||
ViewController::get()->onStopVideo();
|
||||
ViewController::getInstance()->onStopVideo();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ bool SystemView::input(InputConfig* config, Input input)
|
|||
if (config->getDeviceId() == DEVICE_KEYBOARD && input.value && input.id == SDLK_r &&
|
||||
SDL_GetModState() & KMOD_LCTRL && Settings::getInstance()->getBool("Debug")) {
|
||||
LOG(LogDebug) << "SystemView::input(): Reloading all";
|
||||
ViewController::get()->reloadAll();
|
||||
ViewController::getInstance()->reloadAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -255,12 +255,12 @@ bool SystemView::input(InputConfig* config, Input input)
|
|||
case VERTICAL:
|
||||
case VERTICAL_WHEEL:
|
||||
if (config->isMappedLike("up", input)) {
|
||||
ViewController::get()->cancelViewTransitions();
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
listInput(-1);
|
||||
return true;
|
||||
}
|
||||
if (config->isMappedLike("down", input)) {
|
||||
ViewController::get()->cancelViewTransitions();
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
listInput(1);
|
||||
return true;
|
||||
}
|
||||
|
@ -269,12 +269,12 @@ bool SystemView::input(InputConfig* config, Input input)
|
|||
case HORIZONTAL_WHEEL:
|
||||
default:
|
||||
if (config->isMappedLike("left", input)) {
|
||||
ViewController::get()->cancelViewTransitions();
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
listInput(-1);
|
||||
return true;
|
||||
}
|
||||
if (config->isMappedLike("right", input)) {
|
||||
ViewController::get()->cancelViewTransitions();
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
listInput(1);
|
||||
return true;
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ bool SystemView::input(InputConfig* config, Input input)
|
|||
|
||||
if (config->isMappedTo("a", input)) {
|
||||
stopScrolling();
|
||||
ViewController::get()->goToGameList(getSelected());
|
||||
ViewController::getInstance()->goToGameList(getSelected());
|
||||
NavigationSounds::getInstance().playThemeNavigationSound(SELECTSOUND);
|
||||
return true;
|
||||
}
|
||||
|
@ -299,8 +299,8 @@ bool SystemView::input(InputConfig* config, Input input)
|
|||
if (!UIModeController::getInstance()->isUIModeKid() && config->isMappedTo("back", input) &&
|
||||
Settings::getInstance()->getBool("ScreensaverControls")) {
|
||||
if (!mWindow->isScreensaverActive()) {
|
||||
ViewController::get()->stopScrolling();
|
||||
ViewController::get()->cancelViewTransitions();
|
||||
ViewController::getInstance()->stopScrolling();
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
mWindow->startScreensaver();
|
||||
mWindow->renderScreensaver();
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ void UIModeController::monitorUIMode()
|
|||
{
|
||||
std::string uimode = Settings::getInstance()->getString("UIMode");
|
||||
// UI mode was changed.
|
||||
if (uimode != mCurrentUIMode && !ViewController::get()->isCameraMoving()) {
|
||||
if (uimode != mCurrentUIMode && !ViewController::getInstance()->isCameraMoving()) {
|
||||
mCurrentUIMode = uimode;
|
||||
// Reset filters and sort gamelists (which will update the game counter).
|
||||
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
|
||||
|
@ -51,7 +51,7 @@ void UIModeController::monitorUIMode()
|
|||
customSystem->getSystem()->getIndex()->resetFilters();
|
||||
}
|
||||
}
|
||||
ViewController::get()->ReloadAndGoToStart();
|
||||
ViewController::getInstance()->ReloadAndGoToStart();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ const std::string ViewController::KEYBOARD_CHAR = "\uf11c";
|
|||
const std::string ViewController::TICKMARK_CHAR = "\uf14a";
|
||||
#endif
|
||||
|
||||
ViewController* ViewController::get()
|
||||
ViewController* ViewController::getInstance()
|
||||
{
|
||||
static ViewController instance;
|
||||
return &instance;
|
||||
|
|
|
@ -29,7 +29,7 @@ class SystemView;
|
|||
class ViewController : public GuiComponent
|
||||
{
|
||||
public:
|
||||
static ViewController* get();
|
||||
static ViewController* getInstance();
|
||||
|
||||
// These functions are called from main().
|
||||
void invalidSystemsFileDialog();
|
||||
|
|
|
@ -40,7 +40,7 @@ void BasicGameListView::onFileChanged(FileData* file, bool reloadGameList)
|
|||
{
|
||||
if (reloadGameList) {
|
||||
// Might switch to a detailed view.
|
||||
ViewController::get()->reloadGameListView(this);
|
||||
ViewController::getInstance()->reloadGameListView(this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ void BasicGameListView::addPlaceholder(FileData* firstEntry)
|
|||
void BasicGameListView::launch(FileData* game)
|
||||
{
|
||||
// This triggers ViewController to launch the game.
|
||||
ViewController::get()->triggerGameLaunch(game);
|
||||
ViewController::getInstance()->triggerGameLaunch(game);
|
||||
}
|
||||
|
||||
void BasicGameListView::remove(FileData* game, bool deleteFile)
|
||||
|
@ -310,7 +310,7 @@ std::vector<HelpPrompt> BasicGameListView::getHelpPrompts()
|
|||
prompts.push_back(HelpPrompt("left/right", "system"));
|
||||
|
||||
if (mRoot->getSystem()->getThemeFolder() == "custom-collections" && mCursorStack.empty() &&
|
||||
ViewController::get()->getState().viewing == ViewController::GAME_LIST)
|
||||
ViewController::getInstance()->getState().viewing == ViewController::GAME_LIST)
|
||||
prompts.push_back(HelpPrompt("a", "enter"));
|
||||
else
|
||||
prompts.push_back(HelpPrompt("a", "launch"));
|
||||
|
@ -325,8 +325,8 @@ std::vector<HelpPrompt> BasicGameListView::getHelpPrompts()
|
|||
|
||||
if (mRoot->getSystem()->getThemeFolder() == "custom-collections" &&
|
||||
!CollectionSystemsManager::getInstance()->isEditing() && mCursorStack.empty() &&
|
||||
ViewController::get()->getState().viewing == ViewController::GAME_LIST &&
|
||||
ViewController::get()->getState().viewstyle != ViewController::BASIC) {
|
||||
ViewController::getInstance()->getState().viewing == ViewController::GAME_LIST &&
|
||||
ViewController::getInstance()->getState().viewstyle != ViewController::BASIC) {
|
||||
prompts.push_back(HelpPrompt("y", "jump to game"));
|
||||
}
|
||||
else if (mRoot->getSystem()->isGameSystem() &&
|
||||
|
|
|
@ -476,7 +476,7 @@ void DetailedGameListView::updateInfoPanel()
|
|||
|
||||
void DetailedGameListView::launch(FileData* game)
|
||||
{
|
||||
ViewController::get()->triggerGameLaunch(game);
|
||||
ViewController::getInstance()->triggerGameLaunch(game);
|
||||
}
|
||||
|
||||
std::vector<TextComponent*> DetailedGameListView::getMDLabels()
|
||||
|
@ -512,7 +512,7 @@ void DetailedGameListView::update(int deltaTime)
|
|||
BasicGameListView::update(deltaTime);
|
||||
mImage.update(deltaTime);
|
||||
|
||||
if (ViewController::get()->getGameLaunchTriggered() && mImage.isAnimationPlaying(0))
|
||||
if (ViewController::getInstance()->getGameLaunchTriggered() && mImage.isAnimationPlaying(0))
|
||||
mImage.finishAnimation(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ void GridGameListView::onFileChanged(FileData* file, bool reloadGameList)
|
|||
{
|
||||
if (reloadGameList) {
|
||||
// Might switch to a detailed view.
|
||||
ViewController::get()->reloadGameListView(this);
|
||||
ViewController::getInstance()->reloadGameListView(this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -519,7 +519,7 @@ void GridGameListView::addPlaceholder(FileData* firstEntry)
|
|||
void GridGameListView::launch(FileData* game)
|
||||
{
|
||||
// This triggers ViewController to launch the game.
|
||||
ViewController::get()->triggerGameLaunch(game);
|
||||
ViewController::getInstance()->triggerGameLaunch(game);
|
||||
}
|
||||
|
||||
void GridGameListView::remove(FileData* game, bool deleteFile)
|
||||
|
@ -687,7 +687,7 @@ std::vector<HelpPrompt> GridGameListView::getHelpPrompts()
|
|||
prompts.push_back(HelpPrompt("up/down/left/right", "choose"));
|
||||
|
||||
if (mRoot->getSystem()->getThemeFolder() == "custom-collections" && mCursorStack.empty() &&
|
||||
ViewController::get()->getState().viewing == ViewController::GAME_LIST)
|
||||
ViewController::getInstance()->getState().viewing == ViewController::GAME_LIST)
|
||||
prompts.push_back(HelpPrompt("a", "enter"));
|
||||
else
|
||||
prompts.push_back(HelpPrompt("a", "launch"));
|
||||
|
|
|
@ -33,7 +33,7 @@ bool IGameListView::input(InputConfig* config, Input input)
|
|||
// Select button opens GuiGamelistOptions.
|
||||
if (!UIModeController::getInstance()->isUIModeKid() && // Line break.
|
||||
config->isMappedTo("back", input) && input.value) {
|
||||
ViewController::get()->cancelViewTransitions();
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
stopListScrolling();
|
||||
mWindow->pushGui(new GuiGamelistOptions(mWindow, this->mRoot->getSystem()));
|
||||
return true;
|
||||
|
@ -45,7 +45,7 @@ bool IGameListView::input(InputConfig* config, Input input)
|
|||
(SDL_GetModState() & (KMOD_LCTRL | KMOD_RCTRL)) && input.id == SDLK_r &&
|
||||
input.value != 0) {
|
||||
LOG(LogDebug) << "IGameListView::input(): Reloading view";
|
||||
ViewController::get()->reloadGameListView(this, true);
|
||||
ViewController::getInstance()->reloadGameListView(this, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,14 +106,14 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
|
|||
FileData* cursor = getCursor();
|
||||
if (cursor->getType() == GAME) {
|
||||
onPauseVideo();
|
||||
ViewController::get()->cancelViewTransitions();
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
stopListScrolling();
|
||||
launch(cursor);
|
||||
}
|
||||
else {
|
||||
// It's a folder.
|
||||
if (cursor->getChildren().size() > 0) {
|
||||
ViewController::get()->cancelViewTransitions();
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
NavigationSounds::getInstance().playThemeNavigationSound(SELECTSOUND);
|
||||
mCursorStack.push(cursor);
|
||||
populateList(cursor->getChildrenListToDisplay(), cursor);
|
||||
|
@ -147,7 +147,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
|
|||
return true;
|
||||
}
|
||||
else if (config->isMappedTo("b", input)) {
|
||||
ViewController::get()->cancelViewTransitions();
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
if (mCursorStack.size()) {
|
||||
// Save the position to the cursor stack history.
|
||||
mCursorStackHistory.push_back(getCursor());
|
||||
|
@ -168,10 +168,10 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
|
|||
SystemData* systemToView = getCursor()->getSystem();
|
||||
if (systemToView->isCustomCollection() &&
|
||||
systemToView->getRootFolder()->getParent())
|
||||
ViewController::get()->goToSystemView(
|
||||
ViewController::getInstance()->goToSystemView(
|
||||
systemToView->getRootFolder()->getParent()->getSystem(), true);
|
||||
else
|
||||
ViewController::get()->goToSystemView(systemToView, true);
|
||||
ViewController::getInstance()->goToSystemView(systemToView, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -184,19 +184,20 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
|
|||
else if (config->isMappedTo("x", input) &&
|
||||
mRoot->getSystem()->getThemeFolder() == "custom-collections" &&
|
||||
mCursorStack.empty() &&
|
||||
ViewController::get()->getState().viewing == ViewController::GAME_LIST) {
|
||||
ViewController::getInstance()->getState().viewing ==
|
||||
ViewController::GAME_LIST) {
|
||||
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
||||
// Jump to the randomly selected game.
|
||||
if (mRandomGame) {
|
||||
stopListScrolling();
|
||||
ViewController::get()->cancelViewTransitions();
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
mWindow->startMediaViewer(mRandomGame);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (mRoot->getSystem()->isGameSystem()) {
|
||||
stopListScrolling();
|
||||
ViewController::get()->cancelViewTransitions();
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
||||
mWindow->startMediaViewer(getCursor());
|
||||
return true;
|
||||
|
@ -208,7 +209,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
|
|||
onPauseVideo();
|
||||
onFocusLost();
|
||||
stopListScrolling();
|
||||
ViewController::get()->goToNextGameList();
|
||||
ViewController::getInstance()->goToNextGameList();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -218,7 +219,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
|
|||
onPauseVideo();
|
||||
onFocusLost();
|
||||
stopListScrolling();
|
||||
ViewController::get()->goToPrevGameList();
|
||||
ViewController::getInstance()->goToPrevGameList();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +239,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
|
|||
else if (config->isMappedTo("y", input) &&
|
||||
mRoot->getSystem()->getThemeFolder() == "custom-collections" &&
|
||||
!CollectionSystemsManager::getInstance()->isEditing() && mCursorStack.empty() &&
|
||||
ViewController::get()->getState().viewing == ViewController::GAME_LIST) {
|
||||
ViewController::getInstance()->getState().viewing == ViewController::GAME_LIST) {
|
||||
// Jump to the randomly selected game.
|
||||
if (mRandomGame) {
|
||||
NavigationSounds::getInstance().playThemeNavigationSound(SELECTSOUND);
|
||||
|
@ -420,15 +421,15 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
|
|||
mRoot->getSortTypeFromString(mRoot->getSortTypeString()),
|
||||
Settings::getInstance()->getBool("FavoritesFirst"));
|
||||
|
||||
ViewController::get()->onFileChanged(getCursor(), false);
|
||||
ViewController::getInstance()->onFileChanged(getCursor(), false);
|
||||
|
||||
// Always jump to the first entry in the gamelist if the last favorite
|
||||
// was unmarked. We couldn't do this earlier as we didn't have the list
|
||||
// sorted yet.
|
||||
if (removedLastFavorite) {
|
||||
ViewController::get()
|
||||
ViewController::getInstance()
|
||||
->getGameListView(entryToUpdate->getSystem())
|
||||
->setCursor(ViewController::get()
|
||||
->setCursor(ViewController::getInstance()
|
||||
->getGameListView(entryToUpdate->getSystem())
|
||||
->getFirstEntry());
|
||||
}
|
||||
|
@ -444,13 +445,14 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
|
|||
// As the toggling of the game destroyed this object, we need to get the view
|
||||
// from ViewController instead of using the reference that existed before the
|
||||
// destruction. Otherwise we get random crashes.
|
||||
IGameListView* view = ViewController::get()->getGameListView(system).get();
|
||||
IGameListView* view =
|
||||
ViewController::getInstance()->getGameListView(system).get();
|
||||
// Jump to the first entry in the gamelist if the last favorite was unmarked.
|
||||
if (foldersOnTop && removedLastFavorite &&
|
||||
!entryToUpdate->getSystem()->isCustomCollection()) {
|
||||
ViewController::get()
|
||||
ViewController::getInstance()
|
||||
->getGameListView(entryToUpdate->getSystem())
|
||||
->setCursor(ViewController::get()
|
||||
->setCursor(ViewController::getInstance()
|
||||
->getGameListView(entryToUpdate->getSystem())
|
||||
->getFirstGameEntry());
|
||||
}
|
||||
|
@ -467,8 +469,9 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
|
|||
if (isEditing) {
|
||||
for (auto it = SystemData::sSystemVector.begin();
|
||||
it != SystemData::sSystemVector.end(); ++it) {
|
||||
ViewController::get()->getGameListView((*it))->onFileChanged(
|
||||
ViewController::get()->getGameListView((*it))->getCursor(), false);
|
||||
ViewController::getInstance()->getGameListView((*it))->onFileChanged(
|
||||
ViewController::getInstance()->getGameListView((*it))->getCursor(),
|
||||
false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -502,7 +502,10 @@ void VideoGameListView::updateInfoPanel()
|
|||
}
|
||||
}
|
||||
|
||||
void VideoGameListView::launch(FileData* game) { ViewController::get()->triggerGameLaunch(game); }
|
||||
void VideoGameListView::launch(FileData* game)
|
||||
{
|
||||
ViewController::getInstance()->triggerGameLaunch(game);
|
||||
}
|
||||
|
||||
std::vector<TextComponent*> VideoGameListView::getMDLabels()
|
||||
{
|
||||
|
@ -542,7 +545,7 @@ void VideoGameListView::update(int deltaTime)
|
|||
BasicGameListView::update(deltaTime);
|
||||
mVideo->update(deltaTime);
|
||||
|
||||
if (ViewController::get()->getGameLaunchTriggered() && mVideo->isAnimationPlaying(0))
|
||||
if (ViewController::getInstance()->getGameLaunchTriggered() && mVideo->isAnimationPlaying(0))
|
||||
mVideo->finishAnimation(0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue