CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/UI/MainScreen.h
Views: 1401
// Copyright (c) 2013- PPSSPP Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official git repository and contact information can be found at15// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.1617#pragma once1819#include <functional>2021#include "Common/File/Path.h"22#include "Common/UI/UIScreen.h"23#include "Common/UI/ViewGroup.h"24#include "UI/MiscScreens.h"25#include "Common/File/PathBrowser.h"2627enum GameBrowserFlags {28FLAG_HOMEBREWSTOREBUTTON = 129};3031enum class BrowseFlags {32NONE = 0,33NAVIGATE = 1,34BROWSE = 2,35ARCHIVES = 4,36PIN = 8,37HOMEBREW_STORE = 16,38STANDARD = 1 | 2 | 4 | 8,39};40ENUM_CLASS_BITOPS(BrowseFlags);4142bool LaunchFile(ScreenManager *screenManager, const Path &path);4344class GameBrowser : public UI::LinearLayout {45public:46GameBrowser(int token, const Path &path, BrowseFlags browseFlags, bool *gridStyle, ScreenManager *screenManager, std::string_view lastText, std::string_view lastLink, UI::LayoutParams *layoutParams = nullptr);4748UI::Event OnChoice;49UI::Event OnHoldChoice;50UI::Event OnHighlight;5152void FocusGame(const Path &gamePath);53void SetPath(const Path &path);54void ApplySearchFilter(const std::string &filter);55void Draw(UIContext &dc) override;56void Update() override;57void RequestRefresh() {58refreshPending_ = true;59}6061void SetHomePath(const Path &path) {62homePath_ = path;63}6465protected:66virtual bool DisplayTopBar();67virtual bool HasSpecialFiles(std::vector<Path> &filenames);68virtual Path HomePath();69void ApplySearchFilter();7071void Refresh();7273Path homePath_;7475private:76bool IsCurrentPathPinned();77std::vector<Path> GetPinnedPaths() const;78std::string GetBaseName(const std::string &path) const;7980UI::EventReturn GameButtonClick(UI::EventParams &e);81UI::EventReturn GameButtonHoldClick(UI::EventParams &e);82UI::EventReturn GameButtonHighlight(UI::EventParams &e);83UI::EventReturn NavigateClick(UI::EventParams &e);84UI::EventReturn LayoutChange(UI::EventParams &e);85UI::EventReturn LastClick(UI::EventParams &e);86UI::EventReturn BrowseClick(UI::EventParams &e);87UI::EventReturn StorageClick(UI::EventParams &e);88UI::EventReturn OnHomeClick(UI::EventParams &e);89UI::EventReturn PinToggleClick(UI::EventParams &e);90UI::EventReturn GridSettingsClick(UI::EventParams &e);91UI::EventReturn OnRecentClear(UI::EventParams &e);92UI::EventReturn OnHomebrewStore(UI::EventParams &e);9394enum class SearchState {95MATCH,96MISMATCH,97PENDING,98};99100UI::ViewGroup *gameList_ = nullptr;101PathBrowser path_;102bool *gridStyle_ = nullptr;103BrowseFlags browseFlags_;104std::string lastText_;105std::string lastLink_;106std::string searchFilter_;107std::vector<SearchState> searchStates_;108Path focusGamePath_;109bool listingPending_ = false;110bool searchPending_ = false;111bool refreshPending_ = false;112float lastScale_ = 1.0f;113bool lastLayoutWasGrid_ = true;114ScreenManager *screenManager_;115int token_;116};117118class RemoteISOBrowseScreen;119120class MainScreen : public UIScreenWithBackground {121public:122MainScreen();123~MainScreen();124125bool isTopLevel() const override { return true; }126127const char *tag() const override { return "Main"; }128129// Horrible hack to show the demos & homebrew tab after having installed a game from a zip file.130static bool showHomebrewTab;131132bool key(const KeyInput &touch) override;133134protected:135void CreateViews() override;136void DrawBackground(UIContext &dc) override;137void update() override;138void sendMessage(UIMessage message, const char *value) override;139void dialogFinished(const Screen *dialog, DialogResult result) override;140141bool DrawBackgroundFor(UIContext &dc, const Path &gamePath, float progress);142143UI::EventReturn OnGameSelected(UI::EventParams &e);144UI::EventReturn OnGameSelectedInstant(UI::EventParams &e);145UI::EventReturn OnGameHighlight(UI::EventParams &e);146// Event handlers147UI::EventReturn OnLoadFile(UI::EventParams &e);148UI::EventReturn OnGameSettings(UI::EventParams &e);149UI::EventReturn OnCredits(UI::EventParams &e);150UI::EventReturn OnSupport(UI::EventParams &e);151UI::EventReturn OnPPSSPPOrg(UI::EventParams &e);152UI::EventReturn OnForums(UI::EventParams &e);153UI::EventReturn OnExit(UI::EventParams &e);154UI::EventReturn OnDownloadUpgrade(UI::EventParams &e);155UI::EventReturn OnDismissUpgrade(UI::EventParams &e);156UI::EventReturn OnAllowStorage(UI::EventParams &e);157UI::EventReturn OnFullScreenToggle(UI::EventParams &e);158159UI::LinearLayout *upgradeBar_ = nullptr;160UI::TabHolder *tabHolder_ = nullptr;161UI::Button *fullscreenButton_ = nullptr;162163Path restoreFocusGamePath_;164std::vector<GameBrowser *> gameBrowsers_;165166Path highlightedGamePath_;167Path prevHighlightedGamePath_;168float highlightProgress_ = 0.0f;169float prevHighlightProgress_ = 0.0f;170bool backFromStore_ = false;171bool lockBackgroundAudio_ = false;172bool lastVertical_;173bool confirmedTemporary_ = false;174UI::ScrollView *scrollAllGames_ = nullptr;175bool searchKeyModifier_ = false;176bool searchChanged_ = false;177std::string searchFilter_;178179friend class RemoteISOBrowseScreen;180};181182class UmdReplaceScreen : public UIDialogScreenWithBackground {183public:184const char *tag() const override { return "UmdReplace"; }185186protected:187void CreateViews() override;188void update() override;189190private:191UI::EventReturn OnGameSelected(UI::EventParams &e);192UI::EventReturn OnGameSettings(UI::EventParams &e);193};194195class GridSettingsScreen : public PopupScreen {196public:197GridSettingsScreen(std::string_view label) : PopupScreen(label) {}198void CreatePopupContents(UI::ViewGroup *parent) override;199UI::Event OnRecentChanged;200201const char *tag() const override { return "GridSettings"; }202203private:204UI::EventReturn GridPlusClick(UI::EventParams &e);205UI::EventReturn GridMinusClick(UI::EventParams &e);206UI::EventReturn OnRecentClearClick(UI::EventParams &e);207const float MAX_GAME_GRID_SCALE = 3.0f;208const float MIN_GAME_GRID_SCALE = 0.8f;209};210211212