impr: Improve Documentation AI UX
This commit is contained in:
parent
e2b7a69fc8
commit
8cb833eca9
@ -14,8 +14,14 @@ namespace hex::plugin::builtin {
|
||||
|
||||
class PopupDocsQuestion : public Popup<PopupDocsQuestion> {
|
||||
public:
|
||||
PopupDocsQuestion()
|
||||
: hex::Popup<PopupDocsQuestion>("hex.builtin.popup.docs_question.title", true, true) { }
|
||||
PopupDocsQuestion(const std::string &input = "")
|
||||
: hex::Popup<PopupDocsQuestion>("hex.builtin.popup.docs_question.title", true, true) {
|
||||
|
||||
if (!input.empty()) {
|
||||
m_inputBuffer = input;
|
||||
this->executeQuery();
|
||||
}
|
||||
}
|
||||
|
||||
enum class TextBlockType {
|
||||
Text,
|
||||
@ -99,6 +105,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
try {
|
||||
auto json = nlohmann::json::parse(response.getData());
|
||||
|
||||
if (!json.contains("answer"))
|
||||
continue;
|
||||
|
||||
@ -126,9 +133,9 @@ namespace hex::plugin::builtin {
|
||||
} catch(...) {
|
||||
continue;
|
||||
}
|
||||
|
||||
m_noAnswer = m_answer.empty();
|
||||
}
|
||||
|
||||
m_noAnswer = m_answer.empty();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -721,6 +721,7 @@
|
||||
"hex.builtin.view.help.about.translator": "Translated by WerWolv",
|
||||
"hex.builtin.view.help.calc_cheat_sheet": "Calculator Cheat Sheet",
|
||||
"hex.builtin.view.help.documentation": "ImHex Documentation",
|
||||
"hex.builtin.view.help.documentation_search": "Search Documentation",
|
||||
"hex.builtin.view.help.name": "Help",
|
||||
"hex.builtin.view.help.pattern_cheat_sheet": "Pattern Language Cheat Sheet",
|
||||
"hex.builtin.view.hex_editor.copy.address": "Address",
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <romfs/romfs.hpp>
|
||||
#include <wolv/utils/string.hpp>
|
||||
|
||||
#include <complex>
|
||||
#include <string>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
@ -81,14 +81,22 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.help" }, 2000);
|
||||
|
||||
// Add documentation links to the help menu
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.help", "hex.builtin.view.help.documentation" }, 3000, Shortcut::None, [] {
|
||||
hex::openWebpage("https://docs.werwolv.net/imhex");
|
||||
AchievementManager::unlockAchievement("hex.builtin.achievement.starting_out", "hex.builtin.achievement.starting_out.docs.name");
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.help" }, 3000, [] {
|
||||
static std::string content;
|
||||
if (ImGui::InputTextWithHint("##search", "hex.builtin.view.help.documentation_search"_lang, content, ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_EscapeClearsAll | ImGuiInputTextFlags_EnterReturnsTrue)) {
|
||||
PopupDocsQuestion::open(content);
|
||||
content.clear();
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
});
|
||||
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.help", "hex.builtin.menu.help.ask_for_help" }, 4000, CTRLCMD + SHIFT + Keys::D, [] {
|
||||
PopupDocsQuestion::open();
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.help" }, 4000);
|
||||
|
||||
|
||||
// Add documentation link to the help menu
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.help", "hex.builtin.view.help.documentation" }, 5000, Shortcut::None, [] {
|
||||
hex::openWebpage("https://docs.werwolv.net/imhex");
|
||||
AchievementManager::unlockAchievement("hex.builtin.achievement.starting_out", "hex.builtin.achievement.starting_out.docs.name");
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user