From 690147db48eca4ff90923ec23e9211e457a89e7b Mon Sep 17 00:00:00 2001 From: Kitsune Date: Mon, 26 Jun 2023 19:45:25 +0800 Subject: [PATCH] Add Paste Button & AutoResize for BeatmapIdSearchUi --- Downloader/res/language/en_us.json | 3 ++- Downloader/res/language/zh_cn.json | 3 ++- Downloader/src/ui/BeatmapIdSearchUi.cpp | 9 +++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Downloader/res/language/en_us.json b/Downloader/res/language/en_us.json index 8763906..658ab9a 100644 --- a/Downloader/res/language/en_us.json +++ b/Downloader/res/language/en_us.json @@ -100,5 +100,6 @@ "MainMenuHotkey": "Toggle Main Menu UI Show", "IdSearchHotkey": "Toggle Sid/Bid Search UI Show", "Main": "Main", - "Theme": "Theme" + "Theme": "Theme", + "Paste": "Paste" } \ No newline at end of file diff --git a/Downloader/res/language/zh_cn.json b/Downloader/res/language/zh_cn.json index eef4598..cce9c64 100644 --- a/Downloader/res/language/zh_cn.json +++ b/Downloader/res/language/zh_cn.json @@ -100,5 +100,6 @@ "MainMenuHotkey": "切换主菜单显示", "IdSearchHotkey": "切换Sid/Bid搜索界面显示", "Main": "主要", - "Theme": "主题" + "Theme": "主题", + "Paste": "粘贴" } \ No newline at end of file diff --git a/Downloader/src/ui/BeatmapIdSearchUi.cpp b/Downloader/src/ui/BeatmapIdSearchUi.cpp index 915e88f..a02c83b 100644 --- a/Downloader/src/ui/BeatmapIdSearchUi.cpp +++ b/Downloader/src/ui/BeatmapIdSearchUi.cpp @@ -32,7 +32,7 @@ void ui::search::beatmapid::Update() { auto &lang = i18n::I18nManager::GetInstance(); - constexpr static ImVec2 windowSize = ImVec2(400, 65); + constexpr static ImVec2 windowSize = ImVec2(425, 65); if (static bool inited = false; !inited) { const ImVec2 screenSize = ImGui::GetIO().DisplaySize; const ImVec2 windowPos(screenSize.x / 2 - windowSize.x / 2, screenSize.y / 2 - windowSize.y / 2); @@ -41,7 +41,8 @@ void ui::search::beatmapid::Update() { inited = true; } - ImGui::Begin(lang.getTextCStr("SearchBeatmapId"), nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize); + ImGui::Begin(lang.getTextCStr("SearchBeatmapId"), nullptr, + ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize); static std::string input; static const char *items[] = {"Sid", "Bid"}; @@ -60,6 +61,10 @@ void ui::search::beatmapid::Update() { if (ImGui::Button(lang.getTextCStr("Clear"))) { input = ""; } + ImGui::SameLine(); + if (ImGui::Button(lang.getTextCStr("Paste"))) { + input = ImGui::GetClipboardText(); + } ImGui::SameLine(); if (ImGui::Button(lang.getTextCStr("Search"))) {