mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 22:18:11 +00:00
shot: Port to LibMain
This commit is contained in:
parent
ad7845ed7d
commit
c72930fdef
2 changed files with 6 additions and 4 deletions
|
@ -158,7 +158,7 @@ target_link_libraries(rev LibMain)
|
||||||
target_link_libraries(rm LibMain)
|
target_link_libraries(rm LibMain)
|
||||||
target_link_libraries(rmdir LibMain)
|
target_link_libraries(rmdir LibMain)
|
||||||
target_link_libraries(run-tests LibRegex LibCoredump)
|
target_link_libraries(run-tests LibRegex LibCoredump)
|
||||||
target_link_libraries(shot LibGUI)
|
target_link_libraries(shot LibGUI LibMain)
|
||||||
target_link_libraries(shuf LibMain)
|
target_link_libraries(shuf LibMain)
|
||||||
target_link_libraries(sql LibLine LibSQL LibIPC)
|
target_link_libraries(sql LibLine LibSQL LibIPC)
|
||||||
target_link_libraries(sort LibMain)
|
target_link_libraries(sort LibMain)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2021, Aziz Berkay Yesilyurt <abyesilyurt@gmail.com>
|
* Copyright (c) 2021, Aziz Berkay Yesilyurt <abyesilyurt@gmail.com>
|
||||||
|
* Copyright (c) 2022, Alex Major
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -19,6 +20,7 @@
|
||||||
#include <LibGUI/WindowServerConnection.h>
|
#include <LibGUI/WindowServerConnection.h>
|
||||||
#include <LibGfx/PNGWriter.h>
|
#include <LibGfx/PNGWriter.h>
|
||||||
#include <LibGfx/Palette.h>
|
#include <LibGfx/Palette.h>
|
||||||
|
#include <LibMain/Main.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
class SelectableLayover final : public GUI::Widget {
|
class SelectableLayover final : public GUI::Widget {
|
||||||
|
@ -85,7 +87,7 @@ private:
|
||||||
Gfx::Color const m_background_color;
|
Gfx::Color const m_background_color;
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
Core::ArgsParser args_parser;
|
Core::ArgsParser args_parser;
|
||||||
|
|
||||||
|
@ -101,13 +103,13 @@ int main(int argc, char** argv)
|
||||||
args_parser.add_option(screen, "The index of the screen (default: -1 for all screens)", "screen", 's', "index");
|
args_parser.add_option(screen, "The index of the screen (default: -1 for all screens)", "screen", 's', "index");
|
||||||
args_parser.add_option(select_region, "Select a region to capture", "region", 'r');
|
args_parser.add_option(select_region, "Select a region to capture", "region", 'r');
|
||||||
|
|
||||||
args_parser.parse(argc, argv);
|
args_parser.parse(arguments);
|
||||||
|
|
||||||
if (output_path.is_empty()) {
|
if (output_path.is_empty()) {
|
||||||
output_path = Core::DateTime::now().to_string("screenshot-%Y-%m-%d-%H-%M-%S.png");
|
output_path = Core::DateTime::now().to_string("screenshot-%Y-%m-%d-%H-%M-%S.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
auto app = GUI::Application::construct(arguments.argc, arguments.argv);
|
||||||
Optional<Gfx::IntRect> crop_region;
|
Optional<Gfx::IntRect> crop_region;
|
||||||
if (select_region) {
|
if (select_region) {
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue