mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 23:17:44 +00:00
HackStudio: Hide the ProcessStateWidget while no process is running
This commit is contained in:
parent
5c3647b8a3
commit
f61622a501
1 changed files with 6 additions and 8 deletions
|
@ -10,6 +10,7 @@ ProcessStateWidget::ProcessStateWidget(GWidget* parent)
|
||||||
{
|
{
|
||||||
set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||||
set_preferred_size(0, 20);
|
set_preferred_size(0, 20);
|
||||||
|
set_visible(false);
|
||||||
|
|
||||||
set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
||||||
|
|
||||||
|
@ -41,14 +42,6 @@ ProcessStateWidget::~ProcessStateWidget()
|
||||||
|
|
||||||
void ProcessStateWidget::refresh()
|
void ProcessStateWidget::refresh()
|
||||||
{
|
{
|
||||||
if (m_tty_fd == -1) {
|
|
||||||
m_pid_label->set_text("(none)");
|
|
||||||
m_state_label->set_text("n/a");
|
|
||||||
m_cpu_label->set_text("n/a");
|
|
||||||
m_memory_label->set_text("n/a");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pid_t pid = tcgetpgrp(m_tty_fd);
|
pid_t pid = tcgetpgrp(m_tty_fd);
|
||||||
|
|
||||||
auto processes = CProcessStatisticsReader::get_all();
|
auto processes = CProcessStatisticsReader::get_all();
|
||||||
|
@ -70,5 +63,10 @@ void ProcessStateWidget::refresh()
|
||||||
void ProcessStateWidget::set_tty_fd(int tty_fd)
|
void ProcessStateWidget::set_tty_fd(int tty_fd)
|
||||||
{
|
{
|
||||||
m_tty_fd = tty_fd;
|
m_tty_fd = tty_fd;
|
||||||
|
if (m_tty_fd == -1) {
|
||||||
|
set_visible(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
set_visible(true);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue