Applications: Implement some missing MenuBars & AboutDialogs

This commit is contained in:
Jami Kettunen 2019-12-31 00:12:52 +02:00 committed by Andreas Kling
parent 33b8d37dd3
commit 74a18c86c9
7 changed files with 80 additions and 7 deletions

View file

@ -1,5 +1,9 @@
#include "CalculatorWidget.h"
#include <LibDraw/PNGLoader.h>
#include <LibGUI/GAboutDialog.h>
#include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h>
#include <LibGUI/GMenuBar.h>
#include <LibGUI/GWindow.h>
int main(int argc, char** argv)
@ -16,5 +20,23 @@ int main(int argc, char** argv)
window->show();
window->set_icon(GraphicsBitmap::load_from_file("/res/icons/16x16/app-calculator.png"));
auto menubar = make<GMenuBar>();
auto app_menu = GMenu::construct("Calculator");
app_menu->add_action(GCommonActions::make_quit_action([](auto&) {
GApplication::the().quit(0);
return;
}));
menubar->add_menu(move(app_menu));
auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("Calculator", load_png("/res/icons/16x16/app-calculator.png"), window);
}));
menubar->add_menu(move(help_menu));
app.set_menubar(move(menubar));
return app.exec();
}

View file

@ -1,9 +1,12 @@
#include "BoardListModel.h"
#include "ThreadCatalogModel.h"
#include <LibDraw/PNGLoader.h>
#include <LibGUI/GAboutDialog.h>
#include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h>
#include <LibGUI/GBoxLayout.h>
#include <LibGUI/GComboBox.h>
#include <LibGUI/GMenuBar.h>
#include <LibGUI/GStatusBar.h>
#include <LibGUI/GTableView.h>
#include <LibGUI/GWindow.h>
@ -53,5 +56,22 @@ int main(int argc, char** argv)
window->show();
auto menubar = make<GMenuBar>();
auto app_menu = GMenu::construct("ChanViewer");
app_menu->add_action(GCommonActions::make_quit_action([](auto&) {
GApplication::the().quit(0);
return;
}));
menubar->add_menu(move(app_menu));
auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("ChanViewer", load_png("/res/icons/32x32/app-chanviewer.png"), window);
}));
menubar->add_menu(move(help_menu));
app.set_menubar(move(menubar));
return app.exec();
}

View file

@ -6,6 +6,7 @@
#include <LibCore/CConfigFile.h>
#include <LibCore/CUserInfo.h>
#include <LibDraw/PNGLoader.h>
#include <LibGUI/GAboutDialog.h>
#include <LibGUI/GAction.h>
#include <LibGUI/GActionGroup.h>
#include <LibGUI/GApplication.h>
@ -383,8 +384,8 @@ int main(int argc, char** argv)
menubar->add_menu(move(go_menu));
auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [](const GAction&) {
dbgprintf("FIXME: Implement Help/About\n");
help_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("File Manager", load_png("/res/icons/32x32/filetype-folder.png"), window);
}));
menubar->add_menu(move(help_menu));

View file

@ -1,6 +1,9 @@
#include "FontEditor.h"
#include <LibDraw/PNGLoader.h>
#include <LibGUI/GAboutDialog.h>
#include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h>
#include <LibGUI/GMenuBar.h>
#include <LibGUI/GWindow.h>
#include <stdio.h>
@ -28,9 +31,28 @@ int main(int argc, char** argv)
auto window = GWindow::construct();
window->set_title("Font Editor");
window->set_rect({ 50, 50, 390, 342 });
auto font_editor = FontEditorWidget::construct(path, move(edited_font));
window->set_main_widget(font_editor);
window->show();
window->set_icon(load_png("/res/icons/16x16/app-font-editor.png"));
auto menubar = make<GMenuBar>();
auto app_menu = GMenu::construct("Font Editor");
app_menu->add_action(GCommonActions::make_quit_action([](auto&) {
GApplication::the().quit(0);
return;
}));
menubar->add_menu(move(app_menu));
auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("Font Editor", load_png("/res/icons/FontEditor.png"), window);
}));
menubar->add_menu(move(help_menu));
app.set_menubar(move(menubar));
return app.exec();
}

View file

@ -3,9 +3,9 @@
#include <LibAudio/AClientConnection.h>
#include <LibCore/CFile.h>
#include <LibDraw/PNGLoader.h>
#include <LibGUI/GAboutDialog.h>
#include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h>
#include <LibGUI/GMenu.h>
#include <LibGUI/GMenuBar.h>
#include <LibGUI/GWindow.h>
#include <LibThread/Thread.h>
@ -51,6 +51,12 @@ int main(int argc, char** argv)
}));
menubar->add_menu(move(app_menu));
auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("Piano", load_png("/res/icons/32x32/app-piano.png"), window);
}));
menubar->add_menu(move(help_menu));
app.set_menubar(move(menubar));
return app.exec();

View file

@ -1,6 +1,7 @@
#include "Field.h"
#include <LibCore/CConfigFile.h>
#include <LibDraw/PNGLoader.h>
#include <LibGUI/GAboutDialog.h>
#include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h>
#include <LibGUI/GBoxLayout.h>
@ -89,8 +90,8 @@ int main(int argc, char** argv)
menubar->add_menu(move(difficulty_menu));
auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [](const GAction&) {
dbgprintf("FIXME: Implement Help/About\n");
help_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("Minesweeper", load_png("/res/icons/32x32/app-minesweeper.png"), window);
}));
menubar->add_menu(move(help_menu));

View file

@ -1,5 +1,6 @@
#include "SnakeGame.h"
#include <LibDraw/PNGLoader.h>
#include <LibGUI/GAboutDialog.h>
#include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h>
#include <LibGUI/GBoxLayout.h>
@ -35,8 +36,8 @@ int main(int argc, char** argv)
menubar->add_menu(move(app_menu));
auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [](const GAction&) {
dbgprintf("FIXME: Implement Help/About\n");
help_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("Snake", load_png("/res/icons/32x32/app-snake.png"), window);
}));
menubar->add_menu(move(help_menu));