mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
Ladybird: Add SettingsDialog stub
This commit is contained in:
parent
a838004725
commit
91e5b6d4f5
Notes:
sideshowbarker
2024-07-17 08:42:05 +09:00
Author: https://github.com/filiphsps Commit: https://github.com/SerenityOS/serenity/commit/91e5b6d4f5 Pull-request: https://github.com/SerenityOS/serenity/pull/16583 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/awesomekling ✅ Reviewed-by: https://github.com/linusg
@ -1,17 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2022, Matthew Costa <ucosty@gmail.com>
|
||||
* Copyright (c) 2022, Filiph Sandström <filiph.sandstrom@filfatstudios.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "BrowserWindow.h"
|
||||
#include "Settings.h"
|
||||
#include "SettingsDialog.h"
|
||||
#include "WebView.h"
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <QAction>
|
||||
#include <QDialog>
|
||||
#include <QPlainTextEdit>
|
||||
|
||||
extern String s_serenity_resource_root;
|
||||
extern Browser::Settings* s_settings;
|
||||
|
||||
BrowserWindow::BrowserWindow(Core::EventLoop& event_loop)
|
||||
: m_event_loop(event_loop)
|
||||
@ -30,6 +35,10 @@ BrowserWindow::BrowserWindow(Core::EventLoop& event_loop)
|
||||
new_tab_action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_T));
|
||||
menu->addAction(new_tab_action);
|
||||
|
||||
auto* settings_action = new QAction("&Settings");
|
||||
settings_action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Comma));
|
||||
menu->addAction(settings_action);
|
||||
|
||||
auto* close_current_tab_action = new QAction("Close Current Tab");
|
||||
close_current_tab_action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_W));
|
||||
menu->addAction(close_current_tab_action);
|
||||
@ -163,6 +172,9 @@ BrowserWindow::BrowserWindow(Core::EventLoop& event_loop)
|
||||
});
|
||||
|
||||
QObject::connect(new_tab_action, &QAction::triggered, this, &BrowserWindow::new_tab);
|
||||
QObject::connect(settings_action, &QAction::triggered, this, [this] {
|
||||
new SettingsDialog(this);
|
||||
});
|
||||
QObject::connect(quit_action, &QAction::triggered, this, &QMainWindow::close);
|
||||
QObject::connect(m_tabs_container, &QTabWidget::currentChanged, [this](int index) {
|
||||
setWindowTitle(QString("%1 - Ladybird").arg(m_tabs_container->tabText(index)));
|
||||
|
@ -54,6 +54,7 @@ set(SOURCES
|
||||
WebView.cpp
|
||||
History.cpp
|
||||
Settings.cpp
|
||||
SettingsDialog.cpp
|
||||
Tab.cpp
|
||||
)
|
||||
|
||||
|
19
Ladybird/SettingsDialog.cpp
Normal file
19
Ladybird/SettingsDialog.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Filiph Sandström <filiph.sandstrom@filfatstudios.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "SettingsDialog.h"
|
||||
|
||||
SettingsDialog::SettingsDialog(QMainWindow* window)
|
||||
: m_window(window)
|
||||
{
|
||||
m_layout = new QBoxLayout(QBoxLayout::Direction::TopToBottom, this);
|
||||
|
||||
setWindowTitle("Settings");
|
||||
resize(340, 400);
|
||||
setLayout(m_layout);
|
||||
show();
|
||||
setFocus();
|
||||
}
|
21
Ladybird/SettingsDialog.h
Normal file
21
Ladybird/SettingsDialog.h
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Filiph Sandström <filiph.sandstrom@filfatstudios.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <QDialog>
|
||||
#include <QMainWindow>
|
||||
|
||||
#pragma once
|
||||
|
||||
class SettingsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SettingsDialog(QMainWindow* window);
|
||||
|
||||
private:
|
||||
QBoxLayout* m_layout;
|
||||
QMainWindow* m_window { nullptr };
|
||||
};
|
Loading…
Reference in New Issue
Block a user