mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:57:47 +00:00
Calculator: Port to LibMain :^)
This commit is contained in:
parent
b3d412d3c1
commit
973cb0a49e
2 changed files with 10 additions and 20 deletions
|
@ -15,4 +15,4 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_app(Calculator ICON app-calculator)
|
serenity_app(Calculator ICON app-calculator)
|
||||||
target_link_libraries(Calculator LibGUI)
|
target_link_libraries(Calculator LibGUI LibMain)
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CalculatorWidget.h"
|
#include "CalculatorWidget.h"
|
||||||
|
#include <LibCore/System.h>
|
||||||
#include <LibGUI/Action.h>
|
#include <LibGUI/Action.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/Clipboard.h>
|
#include <LibGUI/Clipboard.h>
|
||||||
|
@ -13,33 +14,22 @@
|
||||||
#include <LibGUI/Menubar.h>
|
#include <LibGUI/Menubar.h>
|
||||||
#include <LibGUI/Window.h>
|
#include <LibGUI/Window.h>
|
||||||
#include <LibGfx/Bitmap.h>
|
#include <LibGfx/Bitmap.h>
|
||||||
|
#include <LibMain/Main.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
if (pledge("stdio recvfd sendfd rpath unix", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix", nullptr));
|
||||||
perror("pledge");
|
auto app = TRY(GUI::Application::try_create(arguments));
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
TRY(Core::System::pledge("stdio recvfd sendfd rpath", nullptr));
|
||||||
|
TRY(Core::System::unveil("/res", "r"));
|
||||||
if (pledge("stdio recvfd sendfd rpath", nullptr) < 0) {
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil("/res", "r") < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
unveil(nullptr, nullptr);
|
|
||||||
|
|
||||||
auto app_icon = GUI::Icon::default_icon("app-calculator");
|
auto app_icon = GUI::Icon::default_icon("app-calculator");
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = TRY(GUI::Window::try_create());
|
||||||
window->set_title("Calculator");
|
window->set_title("Calculator");
|
||||||
window->set_resizable(false);
|
window->set_resizable(false);
|
||||||
window->resize(250, 215);
|
window->resize(250, 215);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue