mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
Welcome: Use StandardPaths to load README.md
This commit is contained in:
parent
12b9c0ce7f
commit
f27f2e0d3b
Notes:
sideshowbarker
2024-07-17 06:30:59 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/f27f2e0d3b Pull-request: https://github.com/SerenityOS/serenity/pull/15329 Reviewed-by: https://github.com/alimpfard
|
@ -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())
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue