mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 00:27:35 +00:00
Ladybird: Initial import :^)
This commit is contained in:
parent
26fb41d1f8
commit
1eb653115b
5 changed files with 841 additions and 0 deletions
43
Ladybird/main.cpp
Normal file
43
Ladybird/main.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
#include "WebView.h"
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
#include <QWidget>
|
||||
|
||||
extern void initialize_web_engine();
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
initialize_web_engine();
|
||||
|
||||
String url;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("The Ladybird web browser :^)");
|
||||
args_parser.add_positional_argument(url, "URL to open", "url", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
Core::EventLoop event_loop;
|
||||
|
||||
QApplication app(arguments.argc, arguments.argv);
|
||||
QMainWindow window;
|
||||
window.setWindowTitle("Ladybird");
|
||||
window.resize(800, 600);
|
||||
window.show();
|
||||
|
||||
WebView view;
|
||||
window.setCentralWidget(&view);
|
||||
|
||||
auto qt_event_loop_driver = Core::Timer::create_repeating(50, [&] {
|
||||
app.processEvents();
|
||||
});
|
||||
qt_event_loop_driver->start();
|
||||
|
||||
if (!url.is_empty()) {
|
||||
view.load(url);
|
||||
}
|
||||
|
||||
return event_loop.exec();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue