1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

HackStudio: Remove release_values_but_fixme_should_propogate_errorss

There were a total of 20 fixmes that were removed. This required me to
create a `initialize_all()` function for the HackStudioWidget class
that could actually propagate the errors forward to the Serenity::Main
function for the HackStudio application.

All the fixmes dealt with loading icons for the various actions
possible.
This should not be a failure that keeps HackStudio from running, but
currently, if the icons cannot be loaded HackStudio fails to open.
This commit is contained in:
ominusliticus 2022-12-17 20:48:17 -05:00 committed by Ali Mohammad Pur
parent da4067a75f
commit ae16cfff0f
3 changed files with 177 additions and 137 deletions

View file

@ -15,6 +15,7 @@
#include <LibCore/System.h>
#include <LibGUI/Application.h>
#include <LibGUI/Menubar.h>
#include <LibGUI/MessageBox.h>
#include <LibGUI/Notification.h>
#include <LibGUI/Window.h>
#include <LibMain/Main.h>
@ -30,7 +31,7 @@ using namespace HackStudio;
static WeakPtr<HackStudioWidget> s_hack_studio_widget;
static bool make_is_available();
static void notify_make_not_available();
static ErrorOr<void> notify_make_not_available();
static void update_path_environment_variable();
static Optional<DeprecatedString> last_opened_project_path();
@ -43,12 +44,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto window = GUI::Window::construct();
window->resize(840, 600);
window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-hack-studio.png"sv).release_value_but_fixme_should_propagate_errors());
auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-hack-studio.png"sv));
window->set_icon(icon);
update_path_environment_variable();
if (!make_is_available()) {
notify_make_not_available();
TRY(notify_make_not_available());
}
char const* path_argument = nullptr;
@ -74,7 +76,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_title(DeprecatedString::formatted("{} - Hack Studio", hack_studio_widget->project().name()));
hack_studio_widget->initialize_menubar(*window);
TRY(hack_studio_widget->initialize_menubar(*window));
window->on_close_request = [&]() -> GUI::Window::CloseRequestDecision {
hack_studio_widget->locator().close();
@ -110,13 +112,15 @@ static bool make_is_available()
return WEXITSTATUS(wstatus) == 0;
}
static void notify_make_not_available()
static ErrorOr<void> notify_make_not_available()
{
auto notification = GUI::Notification::construct();
notification->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png"sv).release_value_but_fixme_should_propagate_errors());
auto icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png"sv));
notification->set_icon(icon);
notification->set_title("'make' Not Available");
notification->set_text("You probably want to install the binutils, gcc, and make ports from the root of the Serenity repository");
notification->show();
return {};
}
static void update_path_environment_variable()