mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Change Enable/Disable All to just a Disable All button.
This commit is contained in:
parent
e21867315b
commit
f5afc91f23
@ -255,12 +255,34 @@ std::wstring Path::ToWString() const {
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string Path::ToVisualString() const {
|
||||
std::string Path::ToVisualString(const char *relativeRoot) const {
|
||||
if (type_ == PathType::CONTENT_URI) {
|
||||
return AndroidContentURI(path_).ToVisualString();
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
} else if (type_ == PathType::NATIVE) {
|
||||
return ReplaceAll(path_, "/", "\\");
|
||||
// It can be useful to show the path as relative to the memstick
|
||||
if (relativeRoot) {
|
||||
std::string root = ReplaceAll(relativeRoot, "/", "\\");
|
||||
std::string path = ReplaceAll(path_, "/", "\\");
|
||||
if (startsWithNoCase(path, root)) {
|
||||
return path.substr(root.size());
|
||||
} else {
|
||||
return path;
|
||||
}
|
||||
} else {
|
||||
return ReplaceAll(path_, "/", "\\");
|
||||
}
|
||||
#else
|
||||
if (relativeRoot) {
|
||||
std::string root = relativeRoot;
|
||||
if (startsWithNoCase(path_, root)) {
|
||||
return path_.substr(root.size());
|
||||
} else {
|
||||
return path_;
|
||||
}
|
||||
} else {
|
||||
return path_;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
return path_;
|
||||
|
@ -92,7 +92,8 @@ public:
|
||||
std::wstring ToWString() const;
|
||||
#endif
|
||||
|
||||
std::string ToVisualString() const;
|
||||
// Pass in a relative root to turn the path into a relative path - if it is one!
|
||||
std::string ToVisualString(const char *relativeRoot = nullptr) const;
|
||||
|
||||
bool CanNavigateUp() const;
|
||||
Path NavigateUp() const;
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
static const int FILE_CHECK_FRAME_INTERVAL = 53;
|
||||
|
||||
static Path GetGlobalCheatFile() {
|
||||
static Path GetGlobalCheatFilePath() {
|
||||
return GetSysDirectory(DIRECTORY_CHEATS) / "cheat.db";
|
||||
}
|
||||
|
||||
@ -93,16 +93,20 @@ void CwCheatScreen::CreateViews() {
|
||||
//leftColumn->Add(new Choice(cw->T("Add Cheat")))->OnClick.Handle(this, &CwCheatScreen::OnAddCheat);
|
||||
leftColumn->Add(new ItemHeader(cw->T("Import Cheats")));
|
||||
|
||||
Path cheatPath = GetGlobalCheatFile();
|
||||
Path cheatPath = GetGlobalCheatFilePath();
|
||||
|
||||
leftColumn->Add(new Choice(cheatPath.ToVisualString()))->OnClick.Handle(this, &CwCheatScreen::OnImportCheat);
|
||||
std::string root = GetSysDirectory(DIRECTORY_MEMSTICK_ROOT).ToString();
|
||||
|
||||
leftColumn->Add(new Choice(cheatPath.ToVisualString(root.c_str())))->OnClick.Handle(this, &CwCheatScreen::OnImportCheat);
|
||||
leftColumn->Add(new Choice(mm->T("Browse"), ImageID("I_FOLDER_OPEN")))->OnClick.Handle(this, &CwCheatScreen::OnImportBrowse);
|
||||
errorMessageView_ = leftColumn->Add(new TextView(di->T("LoadingFailed")));
|
||||
errorMessageView_->SetVisibility(V_GONE);
|
||||
|
||||
leftColumn->Add(new ItemHeader(cw->T("Options")));
|
||||
leftColumn->Add(new ItemHeader(di->T("Options")));
|
||||
#if !defined(MOBILE_DEVICE)
|
||||
leftColumn->Add(new Choice(cw->T("Edit Cheat File")))->OnClick.Handle(this, &CwCheatScreen::OnEditCheatFile);
|
||||
#endif
|
||||
leftColumn->Add(new Choice(cw->T("Enable/Disable All")))->OnClick.Handle(this, &CwCheatScreen::OnEnableAll);
|
||||
leftColumn->Add(new Choice(di->T("Disable All")))->OnClick.Handle(this, &CwCheatScreen::OnDisableAll);
|
||||
leftColumn->Add(new PopupSliderChoice(&g_Config.iCwCheatRefreshRate, 1, 1000, cw->T("Refresh Rate"), 1, screenManager()));
|
||||
|
||||
rightScroll_ = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT, 0.5f));
|
||||
@ -153,12 +157,10 @@ void CwCheatScreen::onFinish(DialogResult result) {
|
||||
}
|
||||
}
|
||||
|
||||
UI::EventReturn CwCheatScreen::OnEnableAll(UI::EventParams ¶ms) {
|
||||
enableAllFlag_ = !enableAllFlag_;
|
||||
|
||||
// Flip all the switches.
|
||||
UI::EventReturn CwCheatScreen::OnDisableAll(UI::EventParams ¶ms) {
|
||||
// Disable all the switches.
|
||||
for (auto &info : fileInfo_) {
|
||||
info.enabled = enableAllFlag_;
|
||||
info.enabled = false;
|
||||
}
|
||||
|
||||
if (!RebuildCheatFile(INDEX_ALL)) {
|
||||
@ -215,14 +217,14 @@ UI::EventReturn CwCheatScreen::OnImportBrowse(UI::EventParams ¶ms) {
|
||||
// Show an error message?
|
||||
}
|
||||
RecreateViews();
|
||||
// Chose a cheat file.
|
||||
});
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn CwCheatScreen::OnImportCheat(UI::EventParams ¶ms) {
|
||||
if (!ImportCheats(GetGlobalCheatFile())) {
|
||||
if (!ImportCheats(GetGlobalCheatFilePath())) {
|
||||
// Show an error message?
|
||||
errorMessageView_->SetVisibility(UI::V_VISIBLE);
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
UI::EventReturn OnImportCheat(UI::EventParams ¶ms);
|
||||
UI::EventReturn OnImportBrowse(UI::EventParams ¶ms);
|
||||
UI::EventReturn OnEditCheatFile(UI::EventParams ¶ms);
|
||||
UI::EventReturn OnEnableAll(UI::EventParams ¶ms);
|
||||
UI::EventReturn OnDisableAll(UI::EventParams ¶ms);
|
||||
|
||||
void update() override;
|
||||
void onFinish(DialogResult result) override;
|
||||
|
Loading…
Reference in New Issue
Block a user