Applications: Use GUI::Icon::default_icon to set application icon
This commit is contained in:
parent
6861cb8a23
commit
5ed7ca3627
Notes:
sideshowbarker
2024-07-19 01:34:54 +09:00
Author: https://github.com/bcoles Commit: https://github.com/SerenityOS/serenity/commit/5ed7ca36277 Pull-request: https://github.com/SerenityOS/serenity/pull/3922
14 changed files with 55 additions and 22 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <LibGUI/AboutDialog.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/utsname.h>
|
||||
|
@ -51,6 +52,7 @@ int main(int argc, char** argv)
|
|||
|
||||
unveil(nullptr, nullptr);
|
||||
|
||||
GUI::AboutDialog::show("SerenityOS", nullptr, nullptr, Gfx::Bitmap::load_from_file("/res/icons/16x16/ladybug.png"));
|
||||
auto app_icon = GUI::Icon::default_icon("ladybug");
|
||||
GUI::AboutDialog::show("SerenityOS", nullptr, nullptr, app_icon.bitmap_for_size(32));
|
||||
return app->exec();
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <LibGUI/AboutDialog.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/TabWidget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
|
@ -123,6 +124,8 @@ int main(int argc, char** argv)
|
|||
|
||||
unveil(nullptr, nullptr);
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-browser");
|
||||
|
||||
auto m_config = Core::ConfigFile::get_for_app("Browser");
|
||||
Browser::g_home_url = m_config->read_entry("Preferences", "Home", "about:blank");
|
||||
|
||||
|
@ -131,7 +134,7 @@ int main(int argc, char** argv)
|
|||
|
||||
auto window = GUI::Window::construct();
|
||||
window->resize(640, 480);
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-browser.png"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
window->set_title("Browser");
|
||||
|
||||
auto& widget = window->set_main_widget<GUI::Widget>();
|
||||
|
@ -221,7 +224,7 @@ int main(int argc, char** argv)
|
|||
};
|
||||
|
||||
window_actions.on_about = [&] {
|
||||
GUI::AboutDialog::show("Browser", Gfx::Bitmap::load_from_file("/res/icons/32x32/app-browser.png"), window);
|
||||
GUI::AboutDialog::show("Browser", app_icon.bitmap_for_size(32), window);
|
||||
};
|
||||
|
||||
window_actions.on_show_bookmarks_bar = [&](auto& action) {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <LibGUI/AboutDialog.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
@ -55,6 +56,8 @@ int main(int argc, char** argv)
|
|||
|
||||
unveil(nullptr, nullptr);
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-calculator");
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("Calculator");
|
||||
window->set_resizable(false);
|
||||
|
@ -63,7 +66,7 @@ int main(int argc, char** argv)
|
|||
window->set_main_widget<CalculatorWidget>();
|
||||
|
||||
window->show();
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-calculator.png"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
||||
auto menubar = GUI::MenuBar::construct();
|
||||
|
||||
|
@ -75,7 +78,7 @@ int main(int argc, char** argv)
|
|||
|
||||
auto& help_menu = menubar->add_menu("Help");
|
||||
help_menu.add_action(GUI::Action::create("About", [&](const GUI::Action&) {
|
||||
GUI::AboutDialog::show("Calculator", Gfx::Bitmap::load_from_file("/res/icons/16x16/app-calculator.png"), window);
|
||||
GUI::AboutDialog::show("Calculator", app_icon.bitmap_for_size(32), window);
|
||||
}));
|
||||
|
||||
app->set_menubar(move(menubar));
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
|
@ -50,6 +51,8 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-display-settings");
|
||||
|
||||
// FIXME: Clean up this bizarre object graph
|
||||
auto instance = DisplaySettingsWidget::construct();
|
||||
|
||||
|
@ -59,7 +62,7 @@ int main(int argc, char** argv)
|
|||
window->resize(360, 390);
|
||||
window->set_resizable(false);
|
||||
window->set_main_widget(instance->root_widget());
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-display-settings.png"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
||||
auto menubar = GUI::MenuBar::construct();
|
||||
|
||||
|
@ -70,7 +73,7 @@ int main(int argc, char** argv)
|
|||
|
||||
auto& help_menu = menubar->add_menu("Help");
|
||||
help_menu.add_action(GUI::Action::create("About", [&](const GUI::Action&) {
|
||||
GUI::AboutDialog::show("Display settings", Gfx::Bitmap::load_from_file("/res/icons/32x32/app-display-settings.png"), window);
|
||||
GUI::AboutDialog::show("Display settings", app_icon.bitmap_for_size(32), window);
|
||||
}));
|
||||
|
||||
app->set_menubar(move(menubar));
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include "HexEditorWidget.h"
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -42,6 +43,8 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-hexeditor");
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("Hex Editor");
|
||||
window->resize(640, 400);
|
||||
|
@ -55,7 +58,7 @@ int main(int argc, char** argv)
|
|||
};
|
||||
|
||||
window->show();
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-hexeditor.png"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
||||
if (argc >= 2)
|
||||
hex_editor_widget.open_file(argv[1]);
|
||||
|
|
|
@ -52,11 +52,12 @@ int main(int argc, char** argv)
|
|||
|
||||
TrackManager track_manager;
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-piano");
|
||||
auto window = GUI::Window::construct();
|
||||
auto& main_widget = window->set_main_widget<MainWidget>(track_manager);
|
||||
window->set_title("Piano");
|
||||
window->resize(840, 600);
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-piano.png"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
window->show();
|
||||
|
||||
Audio::WavWriter wav_writer;
|
||||
|
@ -119,7 +120,7 @@ int main(int argc, char** argv)
|
|||
|
||||
auto& help_menu = menubar->add_menu("Help");
|
||||
help_menu.add_action(GUI::Action::create("About", [&](const GUI::Action&) {
|
||||
GUI::AboutDialog::show("Piano", Gfx::Bitmap::load_from_file("/res/icons/32x32/app-piano.png"), window);
|
||||
GUI::AboutDialog::show("Piano", app_icon.bitmap_for_size(32), window);
|
||||
}));
|
||||
|
||||
app->set_menubar(move(menubar));
|
||||
|
|
|
@ -64,6 +64,8 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("filetype-image");
|
||||
|
||||
const char* path = nullptr;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(path, "The image file to be displayed.", "file", Core::ArgsParser::Required::No);
|
||||
|
@ -72,7 +74,7 @@ int main(int argc, char** argv)
|
|||
auto window = GUI::Window::construct();
|
||||
window->set_double_buffering_enabled(true);
|
||||
window->resize(300, 200);
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-image.png"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
window->set_title("QuickShow");
|
||||
|
||||
auto& root_widget = window->set_main_widget<GUI::Widget>();
|
||||
|
@ -247,7 +249,7 @@ int main(int argc, char** argv)
|
|||
|
||||
auto about_action = GUI::Action::create("About",
|
||||
[&](auto&) {
|
||||
GUI::AboutDialog::show("QuickShow", Gfx::Bitmap::load_from_file("/res/icons/32x32/filetype-image.png"), window);
|
||||
GUI::AboutDialog::show("QuickShow", app_icon.bitmap_for_size(32), window);
|
||||
});
|
||||
|
||||
auto copy_action = GUI::CommonActions::make_copy_action([&](auto&) {
|
||||
|
|
|
@ -58,11 +58,13 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-sound-player");
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("SoundPlayer");
|
||||
window->set_resizable(false);
|
||||
window->resize(350, 140);
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-sound-player.png"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
||||
auto menubar = GUI::MenuBar::construct();
|
||||
auto& app_menu = menubar->add_menu("SoundPlayer");
|
||||
|
@ -100,7 +102,7 @@ int main(int argc, char** argv)
|
|||
|
||||
auto& help_menu = menubar->add_menu("Help");
|
||||
help_menu.add_action(GUI::Action::create("About", [&](auto&) {
|
||||
GUI::AboutDialog::show("SoundPlayer", Gfx::Bitmap::load_from_file("/res/icons/32x32/app-sound-player.png"), window);
|
||||
GUI::AboutDialog::show("SoundPlayer", app_icon.bitmap_for_size(32), window);
|
||||
}));
|
||||
|
||||
app->set_menubar(move(menubar));
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/FilePicker.h>
|
||||
#include <LibGUI/Forward.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
@ -85,10 +86,11 @@ int main(int argc, char* argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-spreadsheet");
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("Spreadsheet");
|
||||
window->resize(640, 480);
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-spreadsheet.png"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
||||
auto& spreadsheet_widget = window->set_main_widget<Spreadsheet::SpreadsheetWidget>(NonnullRefPtrVector<Spreadsheet::Sheet> {}, filename == nullptr);
|
||||
|
||||
|
@ -157,7 +159,7 @@ int main(int argc, char* argv[])
|
|||
app_menu.add_separator();
|
||||
|
||||
help_menu.add_action(GUI::Action::create("About", [&](auto&) {
|
||||
GUI::AboutDialog::show("Spreadsheet", Gfx::Bitmap::load_from_file("/res/icons/32x32/app-spreadsheet.png"), window);
|
||||
GUI::AboutDialog::show("Spreadsheet", app_icon.bitmap_for_size(32), window);
|
||||
}));
|
||||
|
||||
app->set_menubar(move(menubar));
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/GroupBox.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/JsonArrayModel.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/LazyWidget.h>
|
||||
|
@ -147,6 +148,8 @@ int main(int argc, char** argv)
|
|||
|
||||
unveil(nullptr, nullptr);
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-system-monitor");
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("System Monitor");
|
||||
window->resize(680, 400);
|
||||
|
@ -295,7 +298,7 @@ int main(int argc, char** argv)
|
|||
|
||||
auto& help_menu = menubar->add_menu("Help");
|
||||
help_menu.add_action(GUI::Action::create("About", [&](const GUI::Action&) {
|
||||
GUI::AboutDialog::show("System Monitor", Gfx::Bitmap::load_from_file("/res/icons/32x32/app-system-monitor.png"), window);
|
||||
GUI::AboutDialog::show("System Monitor", app_icon.bitmap_for_size(32), window);
|
||||
}));
|
||||
|
||||
app->set_menubar(move(menubar));
|
||||
|
@ -332,7 +335,7 @@ int main(int argc, char** argv)
|
|||
|
||||
window->show();
|
||||
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-system-monitor.png"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
||||
return app->exec();
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/GroupBox.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/RadioButton.h>
|
||||
|
@ -266,6 +267,8 @@ int main(int argc, char** argv)
|
|||
auto* pts_name = ptsname(ptm_fd);
|
||||
utmp_update(pts_name, shell_pid, true);
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-terminal");
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("Terminal");
|
||||
window->set_background_color(Color::Black);
|
||||
|
@ -280,7 +283,7 @@ int main(int argc, char** argv)
|
|||
};
|
||||
terminal.apply_size_increments_to_window(*window);
|
||||
window->show();
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
terminal.set_should_beep(config->read_bool_entry("Window", "AudibleBeep", false));
|
||||
|
||||
RefPtr<GUI::Window> settings_window;
|
||||
|
@ -345,7 +348,7 @@ int main(int argc, char** argv)
|
|||
|
||||
auto& help_menu = menubar->add_menu("Help");
|
||||
help_menu.add_action(GUI::Action::create("About", [&](auto&) {
|
||||
GUI::AboutDialog::show("Terminal", Gfx::Bitmap::load_from_file("/res/icons/32x32/app-terminal.png"), window);
|
||||
GUI::AboutDialog::show("Terminal", app_icon.bitmap_for_size(32), window);
|
||||
}));
|
||||
|
||||
app->set_menubar(move(menubar));
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <AK/LexicalPath.h>
|
||||
#include <LibGUI/ActionGroup.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/TextEditor.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
|
|
@ -53,6 +53,8 @@ int main(int argc, char** argv)
|
|||
|
||||
StringView preview_mode_view = preview_mode;
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-text-editor");
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("Text Editor");
|
||||
window->resize(640, 400);
|
||||
|
@ -84,7 +86,7 @@ int main(int argc, char** argv)
|
|||
text_widget.open_sesame(file_to_edit);
|
||||
|
||||
window->show();
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-text-editor.png"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
||||
return app->exec();
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/ColorInput.h>
|
||||
#include <LibGUI/ComboBox.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Model.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
||||
|
@ -67,6 +68,8 @@ int main(int argc, char** argv)
|
|||
{
|
||||
auto app = GUI::Application::construct(argc, argv);
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-theme-editor");
|
||||
|
||||
Gfx::Palette preview_palette = app->palette();
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
|
@ -109,6 +112,6 @@ int main(int argc, char** argv)
|
|||
window->resize(480, 500);
|
||||
window->show();
|
||||
window->set_title("Theme Editor");
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-theme-editor.png"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
return app->exec();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue