mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:17:35 +00:00
Ladybird: Remove the "home" icon from the toolbar (and the concept)
This feature isn't really that useful in practice, so let's remove it. (Other browsers haven't had this action for years either.)
This commit is contained in:
parent
f0f82c6391
commit
60312f2c83
7 changed files with 2 additions and 33 deletions
|
@ -13,16 +13,6 @@ Settings::Settings()
|
||||||
m_qsettings = new QSettings("Serenity", "Ladybird", this);
|
m_qsettings = new QSettings("Serenity", "Ladybird", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Settings::homepage()
|
|
||||||
{
|
|
||||||
return m_qsettings->value("homepage", "https://www.serenityos.org/").toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Settings::set_homepage(QString const& homepage)
|
|
||||||
{
|
|
||||||
m_qsettings->setValue("homepage", homepage);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Settings::new_tab_page()
|
QString Settings::new_tab_page()
|
||||||
{
|
{
|
||||||
return m_qsettings->value("new_tab_page", "about:blank").toString();
|
return m_qsettings->value("new_tab_page", "about:blank").toString();
|
||||||
|
|
|
@ -15,9 +15,6 @@ class Settings : public QObject {
|
||||||
public:
|
public:
|
||||||
Settings();
|
Settings();
|
||||||
|
|
||||||
QString homepage();
|
|
||||||
void set_homepage(QString const& homepage);
|
|
||||||
|
|
||||||
QString new_tab_page();
|
QString new_tab_page();
|
||||||
void set_new_tab_page(QString const& page);
|
void set_new_tab_page(QString const& page);
|
||||||
|
|
||||||
|
|
|
@ -15,16 +15,12 @@ SettingsDialog::SettingsDialog(QMainWindow* window)
|
||||||
: m_window(window)
|
: m_window(window)
|
||||||
{
|
{
|
||||||
m_layout = new QFormLayout(this);
|
m_layout = new QFormLayout(this);
|
||||||
m_homepage = new QLineEdit(this);
|
|
||||||
m_new_tab_page = new QLineEdit(this);
|
m_new_tab_page = new QLineEdit(this);
|
||||||
m_ok_button = new QPushButton("&Save", this);
|
m_ok_button = new QPushButton("&Save", this);
|
||||||
|
|
||||||
m_layout->addRow(new QLabel("HomePage", this), m_homepage);
|
|
||||||
m_layout->addRow(new QLabel("Page on New Tab", this), m_new_tab_page);
|
m_layout->addRow(new QLabel("Page on New Tab", this), m_new_tab_page);
|
||||||
m_layout->addWidget(m_ok_button);
|
m_layout->addWidget(m_ok_button);
|
||||||
|
|
||||||
m_homepage->setText(s_settings->homepage());
|
|
||||||
|
|
||||||
QObject::connect(m_ok_button, &QPushButton::released, this, [this] {
|
QObject::connect(m_ok_button, &QPushButton::released, this, [this] {
|
||||||
close();
|
close();
|
||||||
});
|
});
|
||||||
|
@ -46,6 +42,5 @@ void SettingsDialog::closeEvent(QCloseEvent* event)
|
||||||
void SettingsDialog::save()
|
void SettingsDialog::save()
|
||||||
{
|
{
|
||||||
// FIXME: Validate data.
|
// FIXME: Validate data.
|
||||||
s_settings->set_homepage(m_homepage->text());
|
|
||||||
s_settings->set_new_tab_page(m_new_tab_page->text());
|
s_settings->set_new_tab_page(m_new_tab_page->text());
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ public:
|
||||||
private:
|
private:
|
||||||
QFormLayout* m_layout;
|
QFormLayout* m_layout;
|
||||||
QPushButton* m_ok_button { nullptr };
|
QPushButton* m_ok_button { nullptr };
|
||||||
QLineEdit* m_homepage { nullptr };
|
|
||||||
QLineEdit* m_new_tab_page { nullptr };
|
QLineEdit* m_new_tab_page { nullptr };
|
||||||
QMainWindow* m_window { nullptr };
|
QMainWindow* m_window { nullptr };
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,7 +47,6 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::
|
||||||
|
|
||||||
auto back_icon_path = QString("%1/res/icons/16x16/go-back.png").arg(s_serenity_resource_root.characters());
|
auto back_icon_path = QString("%1/res/icons/16x16/go-back.png").arg(s_serenity_resource_root.characters());
|
||||||
auto forward_icon_path = QString("%1/res/icons/16x16/go-forward.png").arg(s_serenity_resource_root.characters());
|
auto forward_icon_path = QString("%1/res/icons/16x16/go-forward.png").arg(s_serenity_resource_root.characters());
|
||||||
auto home_icon_path = QString("%1/res/icons/16x16/go-home.png").arg(s_serenity_resource_root.characters());
|
|
||||||
auto reload_icon_path = QString("%1/res/icons/16x16/reload.png").arg(s_serenity_resource_root.characters());
|
auto reload_icon_path = QString("%1/res/icons/16x16/reload.png").arg(s_serenity_resource_root.characters());
|
||||||
m_back_action = make<QAction>(QIcon(back_icon_path), "Back");
|
m_back_action = make<QAction>(QIcon(back_icon_path), "Back");
|
||||||
m_back_action->setEnabled(false);
|
m_back_action->setEnabled(false);
|
||||||
|
@ -55,14 +54,12 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::
|
||||||
m_forward_action = make<QAction>(QIcon(forward_icon_path), "Forward");
|
m_forward_action = make<QAction>(QIcon(forward_icon_path), "Forward");
|
||||||
m_forward_action->setEnabled(false);
|
m_forward_action->setEnabled(false);
|
||||||
m_forward_action->setShortcuts(QKeySequence::keyBindings(QKeySequence::StandardKey::Forward));
|
m_forward_action->setShortcuts(QKeySequence::keyBindings(QKeySequence::StandardKey::Forward));
|
||||||
m_home_action = make<QAction>(QIcon(home_icon_path), "Home");
|
|
||||||
m_reload_action = make<QAction>(QIcon(reload_icon_path), "Reload");
|
m_reload_action = make<QAction>(QIcon(reload_icon_path), "Reload");
|
||||||
m_reload_action->setShortcuts(QKeySequence::keyBindings(QKeySequence::StandardKey::Refresh));
|
m_reload_action->setShortcuts(QKeySequence::keyBindings(QKeySequence::StandardKey::Refresh));
|
||||||
|
|
||||||
m_toolbar->addAction(m_back_action);
|
m_toolbar->addAction(m_back_action);
|
||||||
m_toolbar->addAction(m_forward_action);
|
m_toolbar->addAction(m_forward_action);
|
||||||
m_toolbar->addAction(m_reload_action);
|
m_toolbar->addAction(m_reload_action);
|
||||||
m_toolbar->addAction(m_home_action);
|
|
||||||
m_toolbar->addWidget(m_location_edit);
|
m_toolbar->addWidget(m_location_edit);
|
||||||
m_reset_zoom_button->setToolTip("Reset zoom level");
|
m_reset_zoom_button->setToolTip("Reset zoom level");
|
||||||
m_reset_zoom_button_action = m_toolbar->addWidget(m_reset_zoom_button);
|
m_reset_zoom_button_action = m_toolbar->addWidget(m_reset_zoom_button);
|
||||||
|
@ -127,7 +124,6 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::
|
||||||
|
|
||||||
QObject::connect(m_back_action, &QAction::triggered, this, &Tab::back);
|
QObject::connect(m_back_action, &QAction::triggered, this, &Tab::back);
|
||||||
QObject::connect(m_forward_action, &QAction::triggered, this, &Tab::forward);
|
QObject::connect(m_forward_action, &QAction::triggered, this, &Tab::forward);
|
||||||
QObject::connect(m_home_action, &QAction::triggered, this, &Tab::home);
|
|
||||||
QObject::connect(m_reload_action, &QAction::triggered, this, &Tab::reload);
|
QObject::connect(m_reload_action, &QAction::triggered, this, &Tab::reload);
|
||||||
QObject::connect(focus_location_editor_action, &QAction::triggered, this, &Tab::focus_location_editor);
|
QObject::connect(focus_location_editor_action, &QAction::triggered, this, &Tab::focus_location_editor);
|
||||||
|
|
||||||
|
@ -214,11 +210,6 @@ void Tab::forward()
|
||||||
view().load(m_history.current().url.to_deprecated_string());
|
view().load(m_history.current().url.to_deprecated_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::home()
|
|
||||||
{
|
|
||||||
navigate(s_settings->homepage());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tab::reload()
|
void Tab::reload()
|
||||||
{
|
{
|
||||||
m_is_history_navigation = true;
|
m_is_history_navigation = true;
|
||||||
|
|
|
@ -43,7 +43,6 @@ public slots:
|
||||||
void page_favicon_changed(QIcon);
|
void page_favicon_changed(QIcon);
|
||||||
void back();
|
void back();
|
||||||
void forward();
|
void forward();
|
||||||
void home();
|
|
||||||
void reload();
|
void reload();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -68,7 +67,6 @@ private:
|
||||||
|
|
||||||
OwnPtr<QAction> m_back_action;
|
OwnPtr<QAction> m_back_action;
|
||||||
OwnPtr<QAction> m_forward_action;
|
OwnPtr<QAction> m_forward_action;
|
||||||
OwnPtr<QAction> m_home_action;
|
|
||||||
OwnPtr<QAction> m_reload_action;
|
OwnPtr<QAction> m_reload_action;
|
||||||
|
|
||||||
int tab_index();
|
int tab_index();
|
||||||
|
|
|
@ -106,9 +106,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
if (auto url = TRY(get_formatted_url(raw_url)); url.is_valid()) {
|
if (auto url = TRY(get_formatted_url(raw_url)); url.is_valid()) {
|
||||||
window.view().load(url);
|
window.view().load(url);
|
||||||
} else if (!s_settings->homepage().isEmpty()) {
|
} else {
|
||||||
auto home_url = TRY(ak_string_from_qstring(s_settings->homepage()));
|
window.view().load("about:blank"sv);
|
||||||
window.view().load(TRY(get_formatted_url(home_url.bytes_as_string_view())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return event_loop.exec();
|
return event_loop.exec();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue