diff options
Diffstat (limited to 'src/widgets')
| -rw-r--r-- | src/widgets/BrowserApp.cpp | 6 | ||||
| -rw-r--r-- | src/widgets/BrowserApp.hpp | 2 | ||||
| -rw-r--r-- | src/widgets/BrowserWindow.cpp | 16 | ||||
| -rw-r--r-- | src/widgets/BrowserWindow.hpp | 2 |
4 files changed, 10 insertions, 16 deletions
diff --git a/src/widgets/BrowserApp.cpp b/src/widgets/BrowserApp.cpp index 2ab47c2..4977a2a 100644 --- a/src/widgets/BrowserApp.cpp +++ b/src/widgets/BrowserApp.cpp @@ -21,11 +21,11 @@ BrowserApp::BrowserApp() { lua.load_file("./config.lua"); connect(&window_action_router, &WindowActionRouter::new_window_requested, - this, [this](const QUrl &url) { create_window(url.toString()); }); + this, [this](const QUrl &url) { create_window({url.toString()}); }); }; -BrowserWindow *BrowserApp::create_window(const QString &url) { - auto *window = new BrowserWindow((const Configuration &)configuration, url); +BrowserWindow *BrowserApp::create_window(const QStringList &urls) { + auto *window = new BrowserWindow((const Configuration &)configuration, urls); window->setWindowTitle("null-browser"); WindowActionRouter::instance().add_window(window); window->show(); diff --git a/src/widgets/BrowserApp.hpp b/src/widgets/BrowserApp.hpp index b20d710..1b8fdcf 100644 --- a/src/widgets/BrowserApp.hpp +++ b/src/widgets/BrowserApp.hpp @@ -8,7 +8,7 @@ class BrowserApp : public QObject { public: BrowserApp(); - BrowserWindow *create_window(const QString &url = ""); + BrowserWindow *create_window(const QStringList &urls = {}); protected: bool eventFilter(QObject *target, QEvent *event) override; diff --git a/src/widgets/BrowserWindow.cpp b/src/widgets/BrowserWindow.cpp index 701167f..38392a0 100644 --- a/src/widgets/BrowserWindow.cpp +++ b/src/widgets/BrowserWindow.cpp @@ -11,7 +11,7 @@ #include "widgets/WebViewStack.hpp" BrowserWindow::BrowserWindow(const Configuration &configuration, - const QString &start_url) + const QStringList &urls) : configuration(configuration) { setCentralWidget(new QWidget()); @@ -50,17 +50,11 @@ BrowserWindow::BrowserWindow(const Configuration &configuration, } }); - // TODO: remove auto &lua = LuaRuntime::instance(); - lua.queue_task([this, start_url]() { - auto def_url = start_url.isEmpty() - ? "https://github.com/phenax/null-browser" - : start_url; - emit win_mediator->url_opened(def_url, OpenType::OpenUrlInTab, 0); - emit win_mediator->url_opened("https://ediblemonad.dev", - OpenType::OpenUrlInBgTab, 0); - emit win_mediator->url_opened("https://github.com/trending", - OpenType::OpenUrlInBgTab, 0); + lua.queue_task([this, urls]() { + for (const auto &url : urls) { + emit win_mediator->url_opened(url, OpenType::OpenUrlInTab, 0); + } }); } diff --git a/src/widgets/BrowserWindow.hpp b/src/widgets/BrowserWindow.hpp index db3c181..c83b4b7 100644 --- a/src/widgets/BrowserWindow.hpp +++ b/src/widgets/BrowserWindow.hpp @@ -13,7 +13,7 @@ class BrowserWindow : public QMainWindow { public: BrowserWindow(const Configuration &configuration, - const QString &start_url = ""); + const QStringList &urls = {}); DEFINE_GETTER(mediator, win_mediator) DEFINE_GETTER(get_id, win_id) |
