Index: binaries/data/mods/public/art/LICENSE.txt =================================================================== --- binaries/data/mods/public/art/LICENSE.txt +++ binaries/data/mods/public/art/LICENSE.txt @@ -3,6 +3,13 @@ These files are licensed under the Creative Commons Attribution-Share Alike 3.0 (CC-by-sa) license, available at http://creativecommons.org/licenses/by-sa/3.0/ +Files: + art/textures/ui/pregame/icons/clipboard.png + art/textures/ui/pregame/icons/folder-simple.png +Copyright: Phosphor Icons +License: MIT +Comment: see https://raw.githubusercontent.com/phosphor-icons/phosphor-home/master/LICENSE + Briefly, this means: * You may use, modify and distribute these files, for commercial and Index: binaries/data/mods/public/gui/replaymenu/replay_actions.js =================================================================== --- binaries/data/mods/public/gui/replaymenu/replay_actions.js +++ binaries/data/mods/public/gui/replaymenu/replay_actions.js @@ -35,6 +35,30 @@ } /** + * Copies the selected replay's file path to the clipboard. + */ +function copyReplayFilePath() +{ + const selected = Engine.GetGUIObjectByName("replaySelection").selected; + if (selected == -1) + return; + + Engine.CopyTextToClipboard(Engine.GetReplayDirectoryName(g_ReplaysFiltered[selected].directory)); +} + +/** + * Opens the selected replay in the users preferred application for files. + */ +function openReplayDirectory() +{ + const selected = Engine.GetGUIObjectByName("replaySelection").selected; + if (selected == -1) + return; + + Engine.OpenURL(Engine.GetReplayDirectoryName(g_ReplaysFiltered[selected].directory)); +} + +/** * Starts the selected visual replay, or shows an error message in case of incompatibility. */ function startReplay() Index: binaries/data/mods/public/gui/replaymenu/replay_menu.js =================================================================== --- binaries/data/mods/public/gui/replaymenu/replay_menu.js +++ binaries/data/mods/public/gui/replaymenu/replay_menu.js @@ -269,6 +269,8 @@ Engine.GetGUIObjectByName("replayInfoEmpty").hidden = replaySelected; Engine.GetGUIObjectByName("startReplayButton").enabled = replaySelected; Engine.GetGUIObjectByName("deleteReplayButton").enabled = replaySelected; + Engine.GetGUIObjectByName("copyFilePathButton").hidden = !replaySelected; + Engine.GetGUIObjectByName("openReplayDirectoryButton").hidden = !replaySelected; Engine.GetGUIObjectByName("replayFilename").hidden = !replaySelected; Engine.GetGUIObjectByName("summaryButton").hidden = true; Index: binaries/data/mods/public/gui/replaymenu/replay_menu.xml =================================================================== --- binaries/data/mods/public/gui/replaymenu/replay_menu.xml +++ binaries/data/mods/public/gui/replaymenu/replay_menu.xml @@ -52,7 +52,7 @@ - - - File path for the currently selected replay. + + + + + Copies the file path for the currently selected replay to your clipboard. + copyReplayFilePath(); + + + + + + + Opens the file directory for the currently selected replay. + openReplayDirectory(); + + + + + + + File path for the currently selected replay. + + Index: license_mit_Phosphor_Icons.txt =================================================================== --- /dev/null +++ license_mit_Phosphor_Icons.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Phosphor Icons + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. Index: source/ps/scripting/JSInterface_Main.cpp =================================================================== --- source/ps/scripting/JSInterface_Main.cpp +++ source/ps/scripting/JSInterface_Main.cpp @@ -63,6 +63,11 @@ sys_open_url(url); } +void CopyTextToClipboard(const std::string& text) +{ + SDL_SetClipboardText(text.c_str()); +} + std::wstring GetSystemUsername() { return sys_get_user_name(); @@ -125,6 +130,7 @@ ScriptFunction::Register<&AtlasIsAvailable>(rq, "AtlasIsAvailable"); ScriptFunction::Register<&IsAtlasRunning>(rq, "IsAtlasRunning"); ScriptFunction::Register<&OpenURL>(rq, "OpenURL"); + ScriptFunction::Register<&CopyTextToClipboard>(rq, "CopyTextToClipboard"); ScriptFunction::Register<&GetSystemUsername>(rq, "GetSystemUsername"); ScriptFunction::Register<&GetMatchID>(rq, "GetMatchID"); ScriptFunction::Register<&LoadMapSettings>(rq, "LoadMapSettings");