Welcome: Use StandardPaths to load README.md

This commit is contained in:
thankyouverycool 2022-09-29 10:18:11 -04:00 committed by Ali Mohammad Pur
parent 12b9c0ce7f
commit f27f2e0d3b
Notes: sideshowbarker 2024-07-17 06:30:59 +09:00
2 changed files with 2 additions and 7 deletions

View file

@ -25,6 +25,8 @@ WelcomeWidget::WelcomeWidget()
load_from_gml(welcome_window_gml); load_from_gml(welcome_window_gml);
m_web_view = find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view"); m_web_view = find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view");
m_web_view->load(URL::create_with_file_scheme(String::formatted("{}/README.md", Core::StandardPaths::home_directory())));
m_tip_label = find_descendant_of_type_named<GUI::Label>("tip_label"); m_tip_label = find_descendant_of_type_named<GUI::Label>("tip_label");
m_tip_frame = find_descendant_of_type_named<GUI::Frame>("tip_frame"); m_tip_frame = find_descendant_of_type_named<GUI::Frame>("tip_frame");
@ -66,7 +68,6 @@ WelcomeWidget::WelcomeWidget()
Config::remove_group("SystemServer"sv, "Welcome"sv); Config::remove_group("SystemServer"sv, "Welcome"sv);
}; };
open_and_parse_readme_file();
if (auto result = open_and_parse_tips_file(); result.is_error()) { if (auto result = open_and_parse_tips_file(); result.is_error()) {
auto error = String::formatted("Opening \"{}/tips.txt\" failed: {}", Core::StandardPaths::documents_directory(), result.error()); auto error = String::formatted("Opening \"{}/tips.txt\" failed: {}", Core::StandardPaths::documents_directory(), result.error());
m_tip_label->set_text(error); m_tip_label->set_text(error);
@ -93,11 +94,6 @@ ErrorOr<void> WelcomeWidget::open_and_parse_tips_file()
return {}; return {};
} }
void WelcomeWidget::open_and_parse_readme_file()
{
m_web_view->load(URL::create_with_file_scheme("/home/anon/README.md"));
}
void WelcomeWidget::set_random_tip() void WelcomeWidget::set_random_tip()
{ {
if (m_tips.is_empty()) if (m_tips.is_empty())

View file

@ -22,7 +22,6 @@ private:
void set_random_tip(); void set_random_tip();
ErrorOr<void> open_and_parse_tips_file(); ErrorOr<void> open_and_parse_tips_file();
void open_and_parse_readme_file();
RefPtr<GUI::Button> m_close_button; RefPtr<GUI::Button> m_close_button;
RefPtr<GUI::Button> m_next_button; RefPtr<GUI::Button> m_next_button;