Skip to content

Commit

Permalink
impr: Move update button from welcome screen to the title bar and sho…
Browse files Browse the repository at this point in the history
…w a toast
  • Loading branch information
WerWolv committed Feb 15, 2025
1 parent d8877e7 commit cf194e3
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion plugins/builtin/romfs/lang/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "Auto Backups",
"hex.builtin.welcome.start.recent.auto_backups.backup": "Backup vom {:%Y-%m-%d %H:%M:%S}",
"hex.builtin.welcome.tip_of_the_day": "Tipp des Tages",
"hex.builtin.welcome.update.desc": "ImHex {0} wurde gerade released! Downloade die neue Version hier",
"hex.builtin.welcome.update.desc": "ImHex {0} wurde gerade released!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "Neues Update verfügbar!"
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/builtin/romfs/lang/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "Auto Backups",
"hex.builtin.welcome.start.recent.auto_backups.backup": "Backup from {:%Y-%m-%d %H:%M:%S}",
"hex.builtin.welcome.tip_of_the_day": "Tip of the Day",
"hex.builtin.welcome.update.desc": "ImHex {0} just released! Download it here.",
"hex.builtin.welcome.update.desc": "ImHex {0} just released!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "New Update available!",
"hex.builtin.welcome.quick_settings.simplified": "Simplified"
Expand Down
2 changes: 1 addition & 1 deletion plugins/builtin/romfs/lang/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "",
"hex.builtin.welcome.start.recent.auto_backups.backup": "",
"hex.builtin.welcome.tip_of_the_day": "Consejo del día",
"hex.builtin.welcome.update.desc": "¡ImHex {0} está disponible! Descárguelo aquí.",
"hex.builtin.welcome.update.desc": "¡ImHex {0} está disponible!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "Nueva actualización disponible!"
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/builtin/romfs/lang/hu_HU.json
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "Automatikus mentések",
"hex.builtin.welcome.start.recent.auto_backups.backup": "Biztonsági mentés: {:%Y-%m-%d %H:%M:%S}",
"hex.builtin.welcome.tip_of_the_day": "A nap tippje",
"hex.builtin.welcome.update.desc": "Megjelent az ImHex {0}! Itt töltheted le.",
"hex.builtin.welcome.update.desc": "Megjelent az ImHex {0}!.",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "Elérhető egy új frissítés!",
"hex.builtin.welcome.quick_settings.simplified": "Egyszerűsített"
Expand Down
2 changes: 1 addition & 1 deletion plugins/builtin/romfs/lang/it_IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "",
"hex.builtin.welcome.start.recent.auto_backups.backup": "",
"hex.builtin.welcome.tip_of_the_day": "Consiglio del giorno",
"hex.builtin.welcome.update.desc": "ImHex {0} è appena stato rilasciato! Scaricalo qua",
"hex.builtin.welcome.update.desc": "ImHex {0} è appena stato rilasciato!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "Nuovo aggiornamento disponibile!"
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/builtin/romfs/lang/ja_JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "",
"hex.builtin.welcome.start.recent.auto_backups.backup": "",
"hex.builtin.welcome.tip_of_the_day": "今日の豆知識",
"hex.builtin.welcome.update.desc": "ImHex {0} がリリースされました。ここからダウンロードできます。",
"hex.builtin.welcome.update.desc": "ImHex {0} がリリースされました。",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "新しいアップデートが利用可能です。"
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/builtin/romfs/lang/ko_KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "",
"hex.builtin.welcome.start.recent.auto_backups.backup": "",
"hex.builtin.welcome.tip_of_the_day": "오늘의 팁",
"hex.builtin.welcome.update.desc": "ImHex {0}이(가) 출시되었습니다! 여기서 다운로드하세요.",
"hex.builtin.welcome.update.desc": "ImHex {0}이(가) 출시되었습니다!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "새 업데이트를 사용할 수 있습니다!"
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/builtin/romfs/lang/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "",
"hex.builtin.welcome.start.recent.auto_backups.backup": "",
"hex.builtin.welcome.tip_of_the_day": "Dica do Dia",
"hex.builtin.welcome.update.desc": "ImHex {0} acabou de lançar! Baixe aqui.",
"hex.builtin.welcome.update.desc": "ImHex {0} acabou de lançar!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "Nova atualização disponivel!"
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/builtin/romfs/lang/ru_RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "Резервные копии",
"hex.builtin.welcome.start.recent.auto_backups.backup": "Резервная копия от {:%Y-%m-%d %H:%M:%S}",
"hex.builtin.welcome.tip_of_the_day": "Подсказка дня",
"hex.builtin.welcome.update.desc": "ImHex {0} только что вышел! Его можно скачать здесь.",
"hex.builtin.welcome.update.desc": "ImHex {0} только что вышел!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "Доступно новое обновление!",
"hex.builtin.welcome.quick_settings.simplified": "Простой режим"
Expand Down
2 changes: 1 addition & 1 deletion plugins/builtin/romfs/lang/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "自动备份",
"hex.builtin.welcome.start.recent.auto_backups.backup": "备份于 {:%年-%月-%日 %时:%分:%秒}",
"hex.builtin.welcome.tip_of_the_day": "每日提示",
"hex.builtin.welcome.update.desc": "ImHex {0} 已发布!在这里下载。",
"hex.builtin.welcome.update.desc": "ImHex {0} 已发布!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "新的更新可用!"
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/builtin/romfs/lang/zh_TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@
"hex.builtin.welcome.start.recent.auto_backups": "",
"hex.builtin.welcome.start.recent.auto_backups.backup": "",
"hex.builtin.welcome.tip_of_the_day": "今日提示",
"hex.builtin.welcome.update.desc": "ImHex {0} 發布了!點此下載。",
"hex.builtin.welcome.update.desc": "ImHex {0} 發布了!",
"hex.builtin.welcome.update.link": "https://github.com/WerWolv/ImHex/releases/latest",
"hex.builtin.welcome.update.title": "有可用更新!"
}
Expand Down
9 changes: 9 additions & 0 deletions plugins/builtin/source/content/ui_items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,15 @@ namespace hex::plugin::builtin {
ContentRegistry::Interface::addMenuItemToToolbar("hex.builtin.view.hex_editor.menu.file.save", ImGuiCustomCol_ToolbarBlue);
ContentRegistry::Interface::addMenuItemToToolbar("hex.builtin.view.hex_editor.menu.file.save_as", ImGuiCustomCol_ToolbarBlue);
ContentRegistry::Interface::addMenuItemToToolbar("hex.builtin.menu.edit.bookmark.create", ImGuiCustomCol_ToolbarGreen);

const auto &initArgs = ImHexApi::System::getInitArguments();
if (auto it = initArgs.find("update-available"); it != initArgs.end()) {
ContentRegistry::Interface::addTitleBarButton(ICON_VS_GIFT, "hex.builtin.welcome.update.title", [] {
ImHexApi::System::updateImHex(ImHexApi::System::UpdateType::Stable);
});

ui::ToastInfo::open(hex::format("hex.builtin.welcome.update.desc"_lang, it->second));
}
});
}

Expand Down
8 changes: 0 additions & 8 deletions plugins/builtin/source/content/welcome_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,6 @@ namespace hex::plugin::builtin {
}
ImGuiExt::EndSubWindow();

if (ImHexApi::System::getInitArguments().contains("update-available")) {
ImGui::TableNextRow();
ImGui::TableNextColumn();

if (ImGuiExt::DescriptionButton("hex.builtin.welcome.update.title"_lang, hex::format("hex.builtin.welcome.update.desc"_lang, ImHexApi::System::getInitArgument("update-available")).c_str(), ImVec2(ImGui::GetContentRegionAvail().x * 0.8F, 0)))
ImHexApi::System::updateImHex(ImHexApi::System::UpdateType::Stable);
}

ImGui::EndTable();
}
ImGui::SameLine();
Expand Down

0 comments on commit cf194e3

Please sign in to comment.