mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +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)
|
||||
target_link_libraries(Calculator LibGUI)
|
||||
target_link_libraries(Calculator LibGUI LibMain)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "CalculatorWidget.h"
|
||||
#include <LibCore/System.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Clipboard.h>
|
||||
|
@ -13,33 +14,22 @@
|
|||
#include <LibGUI/Menubar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <stdio.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) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath unix", nullptr));
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
|
||||
auto app = GUI::Application::construct(argc, argv);
|
||||
|
||||
if (pledge("stdio recvfd sendfd rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (unveil("/res", "r") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
|
||||
unveil(nullptr, nullptr);
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath", nullptr));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
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_resizable(false);
|
||||
window->resize(250, 215);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue