mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:22:43 +00:00 
			
		
		
		
	 9da121f837
			
		
	
	
		9da121f837
		
	
	
	
	
		
			
			We now use GLazyWidget for all the secondary tabs, which makes the program start up way faster than before. There's a noticeable delay when you click on the "PCI Devices" tab for the first time, but that's definitely better than always eating that delay before seeing a window at all. :^)
		
			
				
	
	
		
			34 lines
		
	
	
	
		
			871 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
	
		
			871 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "ProcessTableView.h"
 | |
| #include "ProcessModel.h"
 | |
| #include <LibGUI/GSortingProxyModel.h>
 | |
| #include <stdio.h>
 | |
| 
 | |
| ProcessTableView::ProcessTableView(GWidget* parent)
 | |
|     : GTableView(parent)
 | |
| {
 | |
|     set_size_columns_to_fit_content(true);
 | |
|     set_model(GSortingProxyModel::create(ProcessModel::create()));
 | |
|     model()->set_key_column_and_sort_order(ProcessModel::Column::CPU, GSortOrder::Descending);
 | |
|     refresh();
 | |
| 
 | |
|     on_selection = [this](auto&) {
 | |
|         if (on_process_selected)
 | |
|             on_process_selected(selected_pid());
 | |
|     };
 | |
| }
 | |
| 
 | |
| ProcessTableView::~ProcessTableView()
 | |
| {
 | |
| }
 | |
| 
 | |
| void ProcessTableView::refresh()
 | |
| {
 | |
|     model()->update();
 | |
| }
 | |
| 
 | |
| pid_t ProcessTableView::selected_pid() const
 | |
| {
 | |
|     if (selection().is_empty())
 | |
|         return -1;
 | |
|     return model()->data(model()->index(selection().first().row(), ProcessModel::Column::PID), GModel::Role::Sort).as_int();
 | |
| }
 |