1 /* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #include "main_window/GeneralPage.h" 7 8 #include <stdio.h> 9 10 11 MainWindow::GeneralPage::GeneralPage() 12 : 13 AbstractGeneralPage(), 14 fModel(NULL), 15 fDataSourceView(NULL), 16 fRunTimeView(NULL), 17 fTeamCountView(NULL), 18 fThreadCountView(NULL) 19 { 20 fDataSourceView = AddDataView("Data Source:"); 21 fRunTimeView = AddDataView("Run Time:"); 22 fTeamCountView = AddDataView("Teams:"); 23 fThreadCountView = AddDataView("Threads:"); 24 } 25 26 27 MainWindow::GeneralPage::~GeneralPage() 28 { 29 } 30 31 32 void 33 MainWindow::GeneralPage::SetModel(Model* model) 34 { 35 if (model == fModel) 36 return; 37 38 fModel = model; 39 40 if (fModel != NULL) { 41 // data source 42 fDataSourceView->SetText(fModel->DataSourceName()); 43 44 // run time 45 char buffer[128]; 46 snprintf(buffer, sizeof(buffer), "%lld μs", fModel->LastEventTime()); 47 fRunTimeView->SetText(buffer); 48 49 // team count 50 snprintf(buffer, sizeof(buffer), "%ld", fModel->CountTeams()); 51 fTeamCountView->SetText(buffer); 52 53 // threads 54 snprintf(buffer, sizeof(buffer), "%ld", fModel->CountThreads()); 55 fThreadCountView->SetText(buffer); 56 } else { 57 fDataSourceView->SetText(""); 58 fRunTimeView->SetText(""); 59 fTeamCountView->SetText(""); 60 fThreadCountView->SetText(""); 61 } 62 } 63