mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Applets/Audio: Port to LibMain :^)
This commit is contained in:
parent
31867bed5c
commit
365379bcb1
Notes:
sideshowbarker
2024-07-18 00:45:57 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/365379bcb1f
2 changed files with 12 additions and 25 deletions
|
@ -9,4 +9,4 @@ set(SOURCES
|
|||
)
|
||||
|
||||
serenity_app(Audio.Applet ICON audio-volume-high)
|
||||
target_link_libraries(Audio.Applet LibGUI LibGfx LibAudio LibCore LibConfig)
|
||||
target_link_libraries(Audio.Applet LibGUI LibGfx LibAudio LibCore LibConfig LibMain)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <LibAudio/ClientConnection.h>
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/CheckBox.h>
|
||||
|
@ -19,6 +20,7 @@
|
|||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
class AudioWidget final : public GUI::Widget {
|
||||
C_OBJECT(AudioWidget)
|
||||
|
@ -208,31 +210,19 @@ private:
|
|||
RefPtr<GUI::Label> m_root_container;
|
||||
};
|
||||
|
||||
int main(int argc, char** argv)
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
if (pledge("stdio recvfd sendfd rpath wpath cpath unix", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath wpath cpath unix", nullptr));
|
||||
|
||||
auto app = GUI::Application::construct(argc, argv);
|
||||
if (unveil("/tmp/portal/config", "rw") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
if (unveil("/tmp/portal/audio", "rw") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
if (unveil("/res", "r") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
unveil(nullptr, nullptr);
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
TRY(Core::System::unveil("/tmp/portal/config", "rw"));
|
||||
TRY(Core::System::unveil("/tmp/portal/audio", "rw"));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
Config::pledge_domains("AudioApplet");
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
auto window = TRY(GUI::Window::try_create());
|
||||
window->set_has_alpha_channel(true);
|
||||
window->set_title("Audio");
|
||||
window->set_window_type(GUI::WindowType::Applet);
|
||||
|
@ -243,10 +233,7 @@ int main(int argc, char** argv)
|
|||
// This positioning code depends on the window actually existing.
|
||||
static_cast<AudioWidget*>(window->main_widget())->set_audio_widget_size(Config::read_bool("AudioApplet", "Applet", "ShowPercent", false));
|
||||
|
||||
if (pledge("stdio recvfd sendfd rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath", nullptr));
|
||||
|
||||
return app->exec();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue