mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
LibGUI+Applications: Add --open-tab option to FooSettings applications
Similar to SystemMonitor's option of the same name, this allows you to launch the given application with the specific tab open.
This commit is contained in:
parent
ded5ba1f87
commit
5702f016f0
9 changed files with 67 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
|||
#include "BrowserSettingsWidget.h"
|
||||
#include "ContentFilterSettingsWidget.h"
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
|
@ -19,6 +20,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
Config::pledge_domain("Browser");
|
||||
|
||||
StringView selected_tab;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(selected_tab, "Tab, one of 'browser' or 'content-filtering'", "open-tab", 't', "tab");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
TRY(Core::System::unveil("/home", "r"));
|
||||
TRY(Core::System::unveil("/home/anon/.config/BrowserContentFilters.txt", "rwc"));
|
||||
|
@ -30,6 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
(void)TRY(window->add_tab<BrowserSettingsWidget>("Browser", "browser"));
|
||||
(void)TRY(window->add_tab<ContentFilterSettingsWidget>("Content Filtering", "content-filtering"));
|
||||
window->set_active_tab(selected_tab);
|
||||
|
||||
window->show();
|
||||
return app->exec();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue