mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:22:43 +00:00 
			
		
		
		
	 bff5b71467
			
		
	
	
		bff5b71467
		
	
	
	
	
		
			
			I don't want to use GEvent here since these need to be synchronous and mixing sync and async GEvents would be stupid.
		
			
				
	
	
		
			44 lines
		
	
	
	
		
			990 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
	
		
			990 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "ProcessTableView.h"
 | |
| #include "ProcessTableModel.h"
 | |
| 
 | |
| 
 | |
| ProcessTableView::ProcessTableView(GWidget* parent)
 | |
|     : GTableView(parent)
 | |
| {
 | |
|     set_model(make<ProcessTableModel>());
 | |
|     start_timer(1000);
 | |
|     model().update();
 | |
| }
 | |
| 
 | |
| ProcessTableView::~ProcessTableView()
 | |
| {
 | |
| }
 | |
| 
 | |
| void ProcessTableView::timer_event(GTimerEvent&)
 | |
| {
 | |
|     model().update();
 | |
| }
 | |
| 
 | |
| void ProcessTableView::model_notification(const GModelNotification& notification)
 | |
| {
 | |
|     if (notification.type() == GModelNotification::ModelUpdated) {
 | |
|         if (on_status_message)
 | |
|             on_status_message(String::format("%d processes", model().row_count()));
 | |
|         return;
 | |
|     }
 | |
| }
 | |
| 
 | |
| pid_t ProcessTableView::selected_pid() const
 | |
| {
 | |
|     return model().selected_pid();
 | |
| }
 | |
| 
 | |
| inline ProcessTableModel& ProcessTableView::model()
 | |
| {
 | |
|     return static_cast<ProcessTableModel&>(*GTableView::model());
 | |
| }
 | |
| 
 | |
| inline const ProcessTableModel& ProcessTableView::model() const
 | |
| {
 | |
|     return static_cast<const ProcessTableModel&>(*GTableView::model());
 | |
| }
 |