Profiler: Remove the old process selection widget

This commit is contained in:
Gunnar Beutner 2021-05-07 13:46:52 +02:00 committed by Andreas Kling
parent 2d6091be10
commit 7b9cabb5a3
4 changed files with 0 additions and 91 deletions

View file

@ -3,7 +3,6 @@ set(SOURCES
main.cpp
IndividualSampleModel.cpp
Process.cpp
ProcessPickerWidget.cpp
Profile.cpp
ProfileModel.cpp
SamplesModel.cpp

View file

@ -1,52 +0,0 @@
/*
* Copyright (c) 2021, Gunnar Beutner <gunnar@beutner.name>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "ProcessPickerWidget.h"
#include "Profile.h"
#include <LibGUI/BoxLayout.h>
#include <LibGUI/ItemListModel.h>
#include <LibGUI/Label.h>
namespace Profiler {
ProcessPickerWidget::ProcessPickerWidget(Profile& profile)
: m_profile(profile)
{
set_layout<GUI::HorizontalBoxLayout>();
set_fixed_height(30);
set_frame_shape(Gfx::FrameShape::NoFrame);
auto& label = add<GUI::Label>("Process:");
label.set_fixed_width(50);
label.set_text_alignment(Gfx::TextAlignment::CenterRight);
m_process_combo = add<GUI::ComboBox>();
m_process_combo->set_only_allow_values_from_model(true);
m_processes.append("All processes");
for (auto& process : m_profile.processes())
m_processes.append(String::formatted("{}: {}", process.pid, process.executable));
m_process_combo->set_model(*GUI::ItemListModel<String>::create(m_processes));
m_process_combo->set_selected_index(0);
m_process_combo->on_change = [this](auto&, const GUI::ModelIndex& index) {
if (index.row() == 0) {
m_profile.clear_process_filter();
} else {
auto& process = m_profile.processes()[index.row() - 1];
auto end_valid = process.end_valid == 0 ? m_profile.last_timestamp() : process.end_valid;
m_profile.set_process_filter(process.pid, process.start_valid, end_valid);
}
};
}
ProcessPickerWidget::~ProcessPickerWidget()
{
}
}

View file

@ -1,35 +0,0 @@
/*
* Copyright (c) 2021, Gunnar Beutner <gunnar@beutner.name>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/ComboBox.h>
#include <LibGUI/Frame.h>
namespace Profiler {
class Profile;
class ProcessPickerWidget final : public GUI::Frame {
C_OBJECT(ProcessPickerWidget)
public:
virtual ~ProcessPickerWidget() override;
struct Process {
pid_t pid;
String name;
};
private:
explicit ProcessPickerWidget(Profile&);
Profile& m_profile;
Vector<String> m_processes;
RefPtr<GUI::ComboBox> m_process_combo;
};
}

View file

@ -5,7 +5,6 @@
*/
#include "IndividualSampleModel.h"
#include "ProcessPickerWidget.h"
#include "Profile.h"
#include "TimelineContainer.h"
#include "TimelineHeader.h"
@ -112,8 +111,6 @@ int main(int argc, char** argv)
[[maybe_unused]] auto& timeline_container = main_widget.add<TimelineContainer>(*timeline_header_container, *timeline_view);
main_widget.add<ProcessPickerWidget>(*profile);
auto& tab_widget = main_widget.add<GUI::TabWidget>();
auto& tree_tab = tab_widget.add_tab<GUI::Widget>("Call Tree");