summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
authorBrendan Coles <bcoles@gmail.com>2020-11-02 19:30:17 +0000
committerAndreas Kling <kling@serenityos.org>2020-11-02 21:06:17 +0100
commit5ed7ca3627717634728cd90ee34168e9b3dd95e2 (patch)
tree87ce2163ceda705bdcd8ef3b6957c863346632e0 /Applications
parent6861cb8a23ff0bce02edc03fabd098e8a92ecf53 (diff)
downloadserenity-5ed7ca3627717634728cd90ee34168e9b3dd95e2.zip
Applications: Use GUI::Icon::default_icon to set application icon
Diffstat (limited to 'Applications')
-rw-r--r--Applications/About/main.cpp4
-rw-r--r--Applications/Browser/main.cpp7
-rw-r--r--Applications/Calculator/main.cpp7
-rw-r--r--Applications/DisplaySettings/main.cpp7
-rw-r--r--Applications/HexEditor/main.cpp5
-rw-r--r--Applications/Piano/main.cpp5
-rw-r--r--Applications/QuickShow/main.cpp6
-rw-r--r--Applications/SoundPlayer/main.cpp6
-rw-r--r--Applications/Spreadsheet/main.cpp6
-rw-r--r--Applications/SystemMonitor/main.cpp7
-rw-r--r--Applications/Terminal/main.cpp7
-rw-r--r--Applications/TextEditor/TextEditorWidget.h1
-rw-r--r--Applications/TextEditor/main.cpp4
-rw-r--r--Applications/ThemeEditor/main.cpp5
14 files changed, 55 insertions, 22 deletions
diff --git a/Applications/About/main.cpp b/Applications/About/main.cpp
index 24418d0321..b7e18caee3 100644
--- a/Applications/About/main.cpp
+++ b/Applications/About/main.cpp
@@ -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();
}
diff --git a/Applications/Browser/main.cpp b/Applications/Browser/main.cpp
index 764ab49d85..7fe4e5f94d 100644
--- a/Applications/Browser/main.cpp
+++ b/Applications/Browser/main.cpp
@@ -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) {
diff --git a/Applications/Calculator/main.cpp b/Applications/Calculator/main.cpp
index c2bf86ffeb..e9a8aab669 100644
--- a/Applications/Calculator/main.cpp
+++ b/Applications/Calculator/main.cpp
@@ -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));
diff --git a/Applications/DisplaySettings/main.cpp b/Applications/DisplaySettings/main.cpp
index 856a6058eb..edb7cae10e 100644
--- a/Applications/DisplaySettings/main.cpp
+++ b/Applications/DisplaySettings/main.cpp
@@ -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));
diff --git a/Applications/HexEditor/main.cpp b/Applications/HexEditor/main.cpp
index 32c986b58f..65e358726e 100644
--- a/Applications/HexEditor/main.cpp
+++ b/Applications/HexEditor/main.cpp
@@ -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]);
diff --git a/Applications/Piano/main.cpp b/Applications/Piano/main.cpp
index 6a57711c92..fa002f8fc9 100644
--- a/Applications/Piano/main.cpp
+++ b/Applications/Piano/main.cpp
@@ -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));
diff --git a/Applications/QuickShow/main.cpp b/Applications/QuickShow/main.cpp
index 220f752843..3227610ebc 100644
--- a/Applications/QuickShow/main.cpp
+++ b/Applications/QuickShow/main.cpp
@@ -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&) {
diff --git a/Applications/SoundPlayer/main.cpp b/Applications/SoundPlayer/main.cpp
index 7b249d1ed7..8948f8ef48 100644
--- a/Applications/SoundPlayer/main.cpp
+++ b/Applications/SoundPlayer/main.cpp
@@ -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));
diff --git a/Applications/Spreadsheet/main.cpp b/Applications/Spreadsheet/main.cpp
index 735cf2d0f6..643b715f23 100644
--- a/Applications/Spreadsheet/main.cpp
+++ b/Applications/Spreadsheet/main.cpp
@@ -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));
diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp
index ed554646f2..9011991955 100644
--- a/Applications/SystemMonitor/main.cpp
+++ b/Applications/SystemMonitor/main.cpp
@@ -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();
}
diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp
index ce0aad9815..4f4f6d5ff8 100644
--- a/Applications/Terminal/main.cpp
+++ b/Applications/Terminal/main.cpp
@@ -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));
diff --git a/Applications/TextEditor/TextEditorWidget.h b/Applications/TextEditor/TextEditorWidget.h
index b5d916a0bb..4b44902b3f 100644
--- a/Applications/TextEditor/TextEditorWidget.h
+++ b/Applications/TextEditor/TextEditorWidget.h
@@ -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>
diff --git a/Applications/TextEditor/main.cpp b/Applications/TextEditor/main.cpp
index 2f8965ad4e..53dd964abd 100644
--- a/Applications/TextEditor/main.cpp
+++ b/Applications/TextEditor/main.cpp
@@ -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();
}
diff --git a/Applications/ThemeEditor/main.cpp b/Applications/ThemeEditor/main.cpp
index 7b0d18a4a3..ec11048b15 100644
--- a/Applications/ThemeEditor/main.cpp
+++ b/Applications/ThemeEditor/main.cpp
@@ -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();
}