mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
Ladybird: Add a location bar and allow navigating to new pages :^)
This commit is contained in:
parent
88d256c109
commit
8b7000e151
7 changed files with 60 additions and 18 deletions
|
@ -4,14 +4,13 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "BrowserWindow.h"
|
||||
#include "WebView.h"
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
#include <QStatusBar>
|
||||
#include <QWidget>
|
||||
|
||||
extern void initialize_web_engine();
|
||||
|
@ -29,24 +28,18 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
Core::EventLoop event_loop;
|
||||
|
||||
QApplication app(arguments.argc, arguments.argv);
|
||||
QMainWindow window;
|
||||
BrowserWindow window;
|
||||
window.setWindowTitle("Ladybird");
|
||||
window.resize(800, 600);
|
||||
window.show();
|
||||
|
||||
WebView view;
|
||||
window.setCentralWidget(&view);
|
||||
|
||||
QObject::connect(&view, &WebView::linkHovered, window.statusBar(), &QStatusBar::showMessage);
|
||||
QObject::connect(&view, &WebView::linkUnhovered, window.statusBar(), &QStatusBar::clearMessage);
|
||||
|
||||
auto qt_event_loop_driver = Core::Timer::create_repeating(50, [&] {
|
||||
app.processEvents();
|
||||
});
|
||||
qt_event_loop_driver->start();
|
||||
|
||||
if (!url.is_empty()) {
|
||||
view.load(url);
|
||||
window.view().load(url);
|
||||
}
|
||||
|
||||
return event_loop.exec();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue