mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:07:36 +00:00
Ladybird: Add SettingsDialog stub
This commit is contained in:
parent
a838004725
commit
91e5b6d4f5
4 changed files with 53 additions and 0 deletions
|
@ -1,17 +1,22 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2022, Matthew Costa <ucosty@gmail.com>
|
* Copyright (c) 2022, Matthew Costa <ucosty@gmail.com>
|
||||||
|
* Copyright (c) 2022, Filiph Sandström <filiph.sandstrom@filfatstudios.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "BrowserWindow.h"
|
#include "BrowserWindow.h"
|
||||||
|
#include "Settings.h"
|
||||||
|
#include "SettingsDialog.h"
|
||||||
#include "WebView.h"
|
#include "WebView.h"
|
||||||
#include <LibCore/EventLoop.h>
|
#include <LibCore/EventLoop.h>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QDialog>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
|
|
||||||
extern String s_serenity_resource_root;
|
extern String s_serenity_resource_root;
|
||||||
|
extern Browser::Settings* s_settings;
|
||||||
|
|
||||||
BrowserWindow::BrowserWindow(Core::EventLoop& event_loop)
|
BrowserWindow::BrowserWindow(Core::EventLoop& event_loop)
|
||||||
: m_event_loop(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));
|
new_tab_action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_T));
|
||||||
menu->addAction(new_tab_action);
|
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");
|
auto* close_current_tab_action = new QAction("Close Current Tab");
|
||||||
close_current_tab_action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_W));
|
close_current_tab_action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_W));
|
||||||
menu->addAction(close_current_tab_action);
|
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(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(quit_action, &QAction::triggered, this, &QMainWindow::close);
|
||||||
QObject::connect(m_tabs_container, &QTabWidget::currentChanged, [this](int index) {
|
QObject::connect(m_tabs_container, &QTabWidget::currentChanged, [this](int index) {
|
||||||
setWindowTitle(QString("%1 - Ladybird").arg(m_tabs_container->tabText(index)));
|
setWindowTitle(QString("%1 - Ladybird").arg(m_tabs_container->tabText(index)));
|
||||||
|
|
|
@ -54,6 +54,7 @@ set(SOURCES
|
||||||
WebView.cpp
|
WebView.cpp
|
||||||
History.cpp
|
History.cpp
|
||||||
Settings.cpp
|
Settings.cpp
|
||||||
|
SettingsDialog.cpp
|
||||||
Tab.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…
Add table
Add a link
Reference in a new issue