ladybird/Userland/Libraries/LibGUI/ProcessChooser.h
sin-ack 3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
2022-07-12 23:11:35 +02:00

42 lines
1 KiB
C++

/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibCore/Timer.h>
#include <LibGUI/Dialog.h>
#include <LibGUI/RunningProcessesModel.h>
namespace GUI {
class ProcessChooser final : public GUI::Dialog {
C_OBJECT(ProcessChooser);
public:
virtual ~ProcessChooser() override = default;
pid_t pid() const { return m_pid; }
private:
ProcessChooser(StringView window_title = "Process Chooser"sv, StringView button_label = "Select"sv, Gfx::Bitmap const* window_icon = nullptr, GUI::Window* parent_window = nullptr);
void set_pid_from_index_and_close(ModelIndex const&);
pid_t m_pid { 0 };
String m_window_title;
String m_button_label;
RefPtr<Gfx::Bitmap> m_window_icon;
RefPtr<TableView> m_table_view;
RefPtr<RunningProcessesModel> m_process_model;
bool m_refresh_enabled { true };
unsigned m_refresh_interval { 1000 };
RefPtr<Core::Timer> m_refresh_timer;
};
}