mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:38:11 +00:00
Misc: Use automatic window positioning in more applications
This is a follow up to #2936 / d3e3b4ae56aa79d9bde12ca1f143dcf116f89a4c. Affected programs: - Applications: Browser (Download, View source, Inspect DOM tree, JS console), Terminal (Settings) - Demos: Cube, Eyes, Fire, HelloWorld, LibGfxDemo, WebView, WidgetGallery - DevTools: HackStudio, Inspector, Profiler - Games: 2048, Minesweeper, Snake, Solitaire - Userland: test-web A few have been left out where manual positioning is done on purpose, e.g. ClipboardManager (to be close to the menu bar) or VisualBuilder (to preserve alignment of the multiple application windows).
This commit is contained in:
parent
0cab3bca2f
commit
2e5c434e22
17 changed files with 21 additions and 21 deletions
|
@ -157,7 +157,7 @@ Tab::Tab(Type type)
|
||||||
m_link_context_menu->add_separator();
|
m_link_context_menu->add_separator();
|
||||||
m_link_context_menu->add_action(GUI::Action::create("Download", [this](auto&) {
|
m_link_context_menu->add_action(GUI::Action::create("Download", [this](auto&) {
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_rect(300, 300, 300, 150);
|
window->resize(300, 150);
|
||||||
auto url = m_link_context_menu_url;
|
auto url = m_link_context_menu_url;
|
||||||
window->set_title(String::format("0%% of %s", url.basename().characters()));
|
window->set_title(String::format("0%% of %s", url.basename().characters()));
|
||||||
window->set_resizable(false);
|
window->set_resizable(false);
|
||||||
|
@ -262,7 +262,7 @@ Tab::Tab(Type type)
|
||||||
editor.set_text(source);
|
editor.set_text(source);
|
||||||
editor.set_mode(GUI::TextEditor::ReadOnly);
|
editor.set_mode(GUI::TextEditor::ReadOnly);
|
||||||
editor.set_ruler_visible(true);
|
editor.set_ruler_visible(true);
|
||||||
window->set_rect(150, 150, 640, 480);
|
window->resize(640, 480);
|
||||||
window->set_title(url);
|
window->set_title(url);
|
||||||
window->show();
|
window->show();
|
||||||
(void)window.leak_ref();
|
(void)window.leak_ref();
|
||||||
|
@ -277,7 +277,7 @@ Tab::Tab(Type type)
|
||||||
if (m_type == Type::InProcessWebView) {
|
if (m_type == Type::InProcessWebView) {
|
||||||
if (!m_dom_inspector_window) {
|
if (!m_dom_inspector_window) {
|
||||||
m_dom_inspector_window = GUI::Window::construct();
|
m_dom_inspector_window = GUI::Window::construct();
|
||||||
m_dom_inspector_window->set_rect(100, 100, 300, 500);
|
m_dom_inspector_window->resize(300, 500);
|
||||||
m_dom_inspector_window->set_title("DOM inspector");
|
m_dom_inspector_window->set_title("DOM inspector");
|
||||||
m_dom_inspector_window->set_main_widget<InspectorWidget>();
|
m_dom_inspector_window->set_main_widget<InspectorWidget>();
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ Tab::Tab(Type type)
|
||||||
if (m_type == Type::InProcessWebView) {
|
if (m_type == Type::InProcessWebView) {
|
||||||
if (!m_console_window) {
|
if (!m_console_window) {
|
||||||
m_console_window = GUI::Window::construct();
|
m_console_window = GUI::Window::construct();
|
||||||
m_console_window->set_rect(100, 100, 500, 300);
|
m_console_window->resize(500, 300);
|
||||||
m_console_window->set_title("JS Console");
|
m_console_window->set_title("JS Console");
|
||||||
m_console_window->set_main_widget<ConsoleWidget>();
|
m_console_window->set_main_widget<ConsoleWidget>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ static RefPtr<GUI::Window> create_settings_window(TerminalWidget& terminal)
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_title("Terminal Settings");
|
window->set_title("Terminal Settings");
|
||||||
window->set_resizable(false);
|
window->set_resizable(false);
|
||||||
window->set_rect(50, 50, 200, 185);
|
window->resize(200, 185);
|
||||||
window->set_modal(true);
|
window->set_modal(true);
|
||||||
|
|
||||||
auto& settings = window->set_main_widget<GUI::Widget>();
|
auto& settings = window->set_main_widget<GUI::Widget>();
|
||||||
|
|
|
@ -196,7 +196,7 @@ int main(int argc, char** argv)
|
||||||
window->set_double_buffering_enabled(true);
|
window->set_double_buffering_enabled(true);
|
||||||
window->set_title("Cube");
|
window->set_title("Cube");
|
||||||
window->set_resizable(false);
|
window->set_resizable(false);
|
||||||
window->set_rect(100, 100, WIDTH, HEIGHT);
|
window->resize(WIDTH, HEIGHT);
|
||||||
|
|
||||||
auto& cube = window->set_main_widget<Cube>();
|
auto& cube = window->set_main_widget<Cube>();
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ int main(int argc, char* argv[])
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_title("Eyes");
|
window->set_title("Eyes");
|
||||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-eyes.png"));
|
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-eyes.png"));
|
||||||
window->set_rect(350, 270, 75 * (full_rows > 0 ? max_in_row : extra_columns), 100 * (full_rows + (extra_columns > 0 ? 1 : 0)));
|
window->resize(75 * (full_rows > 0 ? max_in_row : extra_columns), 100 * (full_rows + (extra_columns > 0 ? 1 : 0)));
|
||||||
window->set_has_alpha_channel(true);
|
window->set_has_alpha_channel(true);
|
||||||
|
|
||||||
auto& eyes = window->set_main_widget<EyesWidget>(num_eyes, full_rows, extra_columns);
|
auto& eyes = window->set_main_widget<EyesWidget>(num_eyes, full_rows, extra_columns);
|
||||||
|
|
|
@ -228,7 +228,7 @@ int main(int argc, char** argv)
|
||||||
window->set_double_buffering_enabled(false);
|
window->set_double_buffering_enabled(false);
|
||||||
window->set_title("Fire");
|
window->set_title("Fire");
|
||||||
window->set_resizable(false);
|
window->set_resizable(false);
|
||||||
window->set_rect(100, 100, 640, 400);
|
window->resize(640, 400);
|
||||||
|
|
||||||
auto& fire = window->set_main_widget<Fire>();
|
auto& fire = window->set_main_widget<Fire>();
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ int main(int argc, char** argv)
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
auto app = GUI::Application::construct(argc, argv);
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_rect(100, 100, 240, 160);
|
window->resize(240, 160);
|
||||||
window->set_title("Hello World!");
|
window->set_title("Hello World!");
|
||||||
|
|
||||||
auto& main_widget = window->set_main_widget<GUI::Widget>();
|
auto& main_widget = window->set_main_widget<GUI::Widget>();
|
||||||
|
|
|
@ -202,7 +202,7 @@ int main(int argc, char** argv)
|
||||||
window->set_double_buffering_enabled(true);
|
window->set_double_buffering_enabled(true);
|
||||||
window->set_title("LibGfx Demo");
|
window->set_title("LibGfx Demo");
|
||||||
window->set_resizable(false);
|
window->set_resizable(false);
|
||||||
window->set_rect(100, 100, WIDTH, HEIGHT);
|
window->resize(WIDTH, HEIGHT);
|
||||||
window->set_main_widget<Canvas>();
|
window->set_main_widget<Canvas>();
|
||||||
window->show();
|
window->show();
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ int main(int argc, char** argv)
|
||||||
auto& view = main_widget.add<WebContentView>();
|
auto& view = main_widget.add<WebContentView>();
|
||||||
auto& statusbar = main_widget.add<GUI::StatusBar>();
|
auto& statusbar = main_widget.add<GUI::StatusBar>();
|
||||||
window->set_title("WebView");
|
window->set_title("WebView");
|
||||||
window->set_rect(100, 100, 640, 480);
|
window->resize(640, 480);
|
||||||
window->show();
|
window->show();
|
||||||
|
|
||||||
view.on_title_change = [&](auto& title) {
|
view.on_title_change = [&](auto& title) {
|
||||||
|
|
|
@ -90,7 +90,7 @@ int main(int argc, char** argv)
|
||||||
auto app_icon = GUI::Icon::default_icon("app-widget-gallery");
|
auto app_icon = GUI::Icon::default_icon("app-widget-gallery");
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_rect(100, 100, 430, 480);
|
window->resize(430, 480);
|
||||||
window->set_title("Widget Gallery");
|
window->set_title("Widget Gallery");
|
||||||
window->set_icon(app_icon.bitmap_for_size(16));
|
window->set_icon(app_icon.bitmap_for_size(16));
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ int main(int argc, char** argv)
|
||||||
Function<void()> update_actions;
|
Function<void()> update_actions;
|
||||||
|
|
||||||
g_window = GUI::Window::construct();
|
g_window = GUI::Window::construct();
|
||||||
g_window->set_rect(90, 90, 840, 600);
|
g_window->resize(840, 600);
|
||||||
g_window->set_title("HackStudio");
|
g_window->set_title("HackStudio");
|
||||||
|
|
||||||
auto& widget = g_window->set_main_widget<GUI::Widget>();
|
auto& widget = g_window->set_main_widget<GUI::Widget>();
|
||||||
|
|
|
@ -94,7 +94,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_title("Inspector");
|
window->set_title("Inspector");
|
||||||
window->set_rect(150, 150, 685, 500);
|
window->resize(685, 500);
|
||||||
window->set_icon(app_icon.bitmap_for_size(16));
|
window->set_icon(app_icon.bitmap_for_size(16));
|
||||||
|
|
||||||
auto menubar = GUI::MenuBar::construct();
|
auto menubar = GUI::MenuBar::construct();
|
||||||
|
|
|
@ -80,8 +80,8 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_title("Profiler");
|
window->set_title("Profiler");
|
||||||
window->set_rect(100, 100, 800, 600);
|
|
||||||
window->set_icon(app_icon.bitmap_for_size(16));
|
window->set_icon(app_icon.bitmap_for_size(16));
|
||||||
|
window->resize(800, 600);
|
||||||
|
|
||||||
auto& main_widget = window->set_main_widget<GUI::Widget>();
|
auto& main_widget = window->set_main_widget<GUI::Widget>();
|
||||||
main_widget.set_fill_with_background_color(true);
|
main_widget.set_fill_with_background_color(true);
|
||||||
|
@ -136,8 +136,8 @@ static bool prompt_to_stop_profiling()
|
||||||
{
|
{
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_title("Profiling");
|
window->set_title("Profiling");
|
||||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"));
|
|
||||||
window->resize(320, 200);
|
window->resize(320, 200);
|
||||||
|
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"));
|
||||||
window->center_on_screen();
|
window->center_on_screen();
|
||||||
auto& widget = window->set_main_widget<GUI::Widget>();
|
auto& widget = window->set_main_widget<GUI::Widget>();
|
||||||
widget.set_fill_with_background_color(true);
|
widget.set_fill_with_background_color(true);
|
||||||
|
|
|
@ -63,7 +63,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
window->set_double_buffering_enabled(false);
|
window->set_double_buffering_enabled(false);
|
||||||
window->set_title("2048");
|
window->set_title("2048");
|
||||||
window->set_rect(100, 100, 324, 336);
|
window->resize(324, 336);
|
||||||
|
|
||||||
auto& game = window->set_main_widget<TwentyFortyEightGame>();
|
auto& game = window->set_main_widget<TwentyFortyEightGame>();
|
||||||
game.set_fill_with_background_color(true);
|
game.set_fill_with_background_color(true);
|
||||||
|
|
|
@ -55,7 +55,7 @@ int main(int argc, char** argv)
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_resizable(false);
|
window->set_resizable(false);
|
||||||
window->set_title("Minesweeper");
|
window->set_title("Minesweeper");
|
||||||
window->set_rect(100, 100, 139, 175);
|
window->resize(139, 175);
|
||||||
|
|
||||||
auto& widget = window->set_main_widget<GUI::Widget>();
|
auto& widget = window->set_main_widget<GUI::Widget>();
|
||||||
widget.set_layout<GUI::VerticalBoxLayout>();
|
widget.set_layout<GUI::VerticalBoxLayout>();
|
||||||
|
|
|
@ -53,7 +53,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
window->set_double_buffering_enabled(false);
|
window->set_double_buffering_enabled(false);
|
||||||
window->set_title("Snake");
|
window->set_title("Snake");
|
||||||
window->set_rect(100, 100, 320, 320);
|
window->resize(320, 320);
|
||||||
|
|
||||||
auto& game = window->set_main_widget<SnakeGame>();
|
auto& game = window->set_main_widget<SnakeGame>();
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ int main(int argc, char** argv)
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
|
|
||||||
window->set_resizable(false);
|
window->set_resizable(false);
|
||||||
window->set_rect(300, 100, SolitaireWidget::width, SolitaireWidget::height);
|
window->resize(SolitaireWidget::width, SolitaireWidget::height);
|
||||||
|
|
||||||
auto widget = SolitaireWidget::construct(window, [&](uint32_t score) {
|
auto widget = SolitaireWidget::construct(window, [&](uint32_t score) {
|
||||||
window->set_title(String::format("Score: %u - Solitaire", score));
|
window->set_title(String::format("Score: %u - Solitaire", score));
|
||||||
|
|
|
@ -649,7 +649,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
if (show_window) {
|
if (show_window) {
|
||||||
window->set_title("LibWeb Test Window");
|
window->set_title("LibWeb Test Window");
|
||||||
window->set_rect(100, 100, 640, 480);
|
window->resize(640, 480);
|
||||||
window->show();
|
window->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue