1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Added 'open custom content folder' button to toolbar menu.

This commit is contained in:
Christian Schubert
2018-09-04 11:40:51 +02:00
committed by Aaron van Geffen
parent 574fd83882
commit 48d6e2f58f
11 changed files with 37 additions and 2 deletions

View File

@@ -76,7 +76,7 @@ The following people are not part of the development team, but have been contrib
* Nicolas Hawrysh (xp4xbox) - Various (ride) sprite improvements.
* Albert Morgese (Fusxfaranto) - Shop auto-rotation, unicode uppercasing.
* Olivier Wervers (oli414) - Remove unused objects command, various bugfixes
* Christian Schubert (Osmodium) - Ensuring custom user content folders.
* Christian Schubert (Osmodium) - Ensuring custom user content folders, incl. open folder.
## Bug fixes
* (halfbro)

View File

@@ -3726,6 +3726,7 @@ STR_6262 :Master volume
STR_6263 :{SMALLFONT}{BLACK}Toggle all sound on/off
STR_6264 :Always use system file browser
STR_6265 :{SMALLFONT}{BLACK}When enabled, your operating system's file browser will be used instead of OpenRCT2's.
STR_6266 :Open custom content folder
#############
# Scenarios #

View File

@@ -91,6 +91,12 @@ namespace OpenRCT2::Ui
MessageBoxW(hwnd, messageW.c_str(), L"OpenRCT2", MB_OK);
}
void OpenFolder(const std::string& path) override
{
std::wstring pathW = String::ToUtf16(path);
ShellExecuteW(NULL, L"open", pathW.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
std::string ShowFileDialog(SDL_Window* window, const FileDialogDesc& desc) override
{
std::wstring wcFilename = String::ToUtf16(desc.DefaultFilename);

View File

@@ -581,6 +581,11 @@ public:
_platformUiContext->ShowMessageBox(_window, message);
}
void OpenFolder(const std::string& path) override
{
_platformUiContext->OpenFolder(path);
}
std::string ShowFileDialog(const FileDialogDesc& desc) override
{
return _platformUiContext->ShowFileDialog(_window, desc);

View File

@@ -33,6 +33,7 @@ namespace OpenRCT2
virtual bool IsSteamOverlayAttached() abstract;
virtual void ShowMessageBox(SDL_Window * window, const std::string& message) abstract;
virtual void OpenFolder(const std::string& path) abstract;
virtual std::string ShowFileDialog(SDL_Window * window, const FileDialogDesc& desc) abstract;
virtual std::string ShowDirectoryDialog(SDL_Window * window, const std::string& title) abstract;
};

View File

@@ -178,9 +178,10 @@ static void window_title_menu_mousedown(rct_window* w, rct_widgetindex widgetInd
gDropdownItemsFormat[1] = STR_CONVERT_SAVED_GAME_TO_SCENARIO;
gDropdownItemsFormat[2] = STR_ROLLER_COASTER_DESIGNER;
gDropdownItemsFormat[3] = STR_TRACK_DESIGNS_MANAGER;
gDropdownItemsFormat[4] = STR_OPEN_CUSTOM_USER_FOLDER;
window_dropdown_show_text(
w->x + widget->left, w->y + widget->top, widget->bottom - widget->top + 1, TRANSLUCENT(w->colours[0]),
DROPDOWN_FLAG_STAY_OPEN, 4);
DROPDOWN_FLAG_STAY_OPEN, 5);
}
}
@@ -202,6 +203,9 @@ static void window_title_menu_dropdown(rct_window* w, rct_widgetindex widgetInde
case 3:
Editor::LoadTrackManager();
break;
case 4:
context_open_custom_user_content_folder();
break;
}
}
}

View File

@@ -1029,6 +1029,11 @@ namespace OpenRCT2
}
delete scanner;
}
void OpenCustomUserContentFolder() final override
{
_uiContext->OpenFolder(_env->GetDirectoryPath(DIRBASE::USER));
}
};
Context* Context::Instance = nullptr;
@@ -1262,6 +1267,11 @@ const utf8* context_get_path_legacy(int32_t pathId)
return result;
}
void context_open_custom_user_content_folder()
{
GetContext()->OpenCustomUserContentFolder();
}
bool platform_open_common_file_dialog(utf8* outFilename, file_dialog_desc* desc, size_t outSize)
{
try

View File

@@ -116,6 +116,7 @@ namespace OpenRCT2
virtual void WriteLine(const std::string& s) abstract;
virtual void Finish() abstract;
virtual void Quit() abstract;
virtual void OpenCustomUserContentFolder() abstract;
/**
* This is deprecated, use IPlatformEnvironment.
@@ -239,3 +240,4 @@ void context_quit();
const utf8* context_get_path_legacy(int32_t pathId);
bool context_load_park_from_file(const utf8* path);
bool context_load_park_from_stream(void* stream);
void context_open_custom_user_content_folder();

View File

@@ -3891,6 +3891,8 @@ enum
STR_ALWAYS_NATIVE_LOADSAVE = 6264,
STR_ALWAYS_NATIVE_LOADSAVE_TIP = 6265,
STR_OPEN_CUSTOM_USER_FOLDER = 6266,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768
};

View File

@@ -85,6 +85,9 @@ namespace OpenRCT2::Ui
void ShowMessageBox(const std::string& /*message*/) override
{
}
void OpenFolder(const std::string& /*path*/) override
{
}
std::string ShowFileDialog(const FileDialogDesc& /*desc*/) override
{
return std::string();

View File

@@ -110,6 +110,7 @@ namespace OpenRCT2
virtual void TriggerResize() abstract;
virtual void ShowMessageBox(const std::string& message) abstract;
virtual void OpenFolder(const std::string& path) abstract;
virtual std::string ShowFileDialog(const FileDialogDesc& desc) abstract;
virtual std::string ShowDirectoryDialog(const std::string& title) abstract;