2020-02-16 21:28:08 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-02-16 21:28:08 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <LibCore/ArgsParser.h>
|
|
|
|
#include <LibGUI/Application.h>
|
|
|
|
#include <LibGUI/Notification.h>
|
2020-03-29 20:04:05 +03:00
|
|
|
#include <LibGfx/Bitmap.h>
|
2020-02-16 21:28:08 +03:00
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
2020-07-04 15:05:19 +03:00
|
|
|
auto app = GUI::Application::construct(argc, argv);
|
2020-02-16 21:28:08 +03:00
|
|
|
|
|
|
|
Core::ArgsParser args_parser;
|
|
|
|
const char* title = nullptr;
|
|
|
|
const char* message = nullptr;
|
2020-03-26 22:38:28 +03:00
|
|
|
const char* icon_path = nullptr;
|
2020-02-16 21:28:08 +03:00
|
|
|
args_parser.add_positional_argument(title, "Title of the notification", "title");
|
|
|
|
args_parser.add_positional_argument(message, "Message to display in the notification", "message");
|
2020-03-26 22:38:28 +03:00
|
|
|
args_parser.add_positional_argument(icon_path, "Path of icon to display in the notification", "icon-path", Core::ArgsParser::Required::No);
|
2020-02-16 21:28:08 +03:00
|
|
|
args_parser.parse(argc, argv);
|
|
|
|
|
|
|
|
auto notification = GUI::Notification::construct();
|
|
|
|
notification->set_text(message);
|
|
|
|
notification->set_title(title);
|
2021-12-19 11:34:01 +03:00
|
|
|
if (icon_path)
|
|
|
|
notification->set_icon(Gfx::Bitmap::try_load_from_file(icon_path).release_value_but_fixme_should_propagate_errors());
|
2020-02-16 21:28:08 +03:00
|
|
|
notification->show();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|