- Timestamp:
- 12/15/09 15:40:49 (15 years ago)
- Location:
- Evidence/Edd
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Evidence/Edd/Edd.cc
r138 r139 4 4 5 5 Qt-based graphical user interface for the Evidence contron system 6 7 Edd_Indicator changes its background colour in case it display 8 a DIM status service 6 9 7 10 December 2009, Oliver Grimm … … 21 24 22 25 // Constructor 23 Edd_Indicator::Edd_Indicator(char *DIMService, QWidget *P): QLineEdit(P) { 24 25 ServiceName = new char [strlen(DIMService)+1]; 26 strcpy(ServiceName, DIMService); 26 Edd_Indicator::Edd_Indicator(QString DIMService, QWidget *P): QLineEdit(P) { 27 28 ServiceName = qstrdup(DIMService.toAscii().data()); 27 29 28 30 // Widget properties … … 31 33 connect(this, SIGNAL(YEP(QString)), this, SLOT(setText(QString))); 32 34 35 // Context menu 36 Menu = new QMenu(this); 37 Menu->addAction("Copy service", this, SLOT(MenuCopyService())); 38 33 39 // DIM client 34 Data = new DimStampedInfo( DIMService, INT_MAX, (char *) NO_LINK, this);40 Data = new DimStampedInfo(ServiceName, INT_MAX, (char *) NO_LINK, this); 35 41 } 36 42 … … 44 50 void Edd_Indicator::infoHandler() { 45 51 52 QPalette Pal = palette(); 53 QString S; 54 46 55 // Check if service available 47 QPalette Pal = palette();48 56 if (getInfo()->getSize() == strlen(NO_LINK)+1 && strcmp(getInfo()->getString(), NO_LINK) == 0) { 49 50 57 emit(YEP(QString("n/a"))); 58 setStatusTip(QString("%1: unavailable").arg(ServiceName)); 51 59 Pal.setColor(backgroundRole(), Qt::red); 52 60 setPalette(Pal); 53 61 return; 54 62 } 55 63 Pal.setColor(backgroundRole(), Qt::white); 56 setPalette(Pal);57 64 58 65 // Translate data into ASCII 59 66 char *Text = EvidenceServer::ToString(getInfo()); 60 QString S; 61 67 68 // If this is a status indicator, adapt background colour 69 if (getInfo()->getSize() == (int) strlen(Text)+3) { 70 switch (*((char *) getInfo()->getData() + strlen(Text) + 2)) { 71 case 0: Pal.setColor(backgroundRole(), Qt::white); break; 72 case 1: Pal.setColor(backgroundRole(), Qt::cyan); break; 73 case 2: Pal.setColor(backgroundRole(), Qt::red); break; 74 case 3: Pal.setColor(backgroundRole(), Qt::red); break; 75 default: break; 76 } 77 } 78 setPalette(Pal); 79 62 80 if (Text != NULL) { 63 81 QTextStream(&S) << Text; … … 81 99 void Edd_Indicator::mouseReleaseEvent(QMouseEvent *Event) { 82 100 83 if (Event->button()==Qt::LeftButton && contentsRect().contains(Event->pos())) { 84 Edd_Plot *Graph = new Edd_Plot(ServiceName, NULL); 85 Graph->show(); 86 } 101 if (Event->button()!=Qt::LeftButton || !contentsRect().contains(Event->pos())) return; 102 103 // Check if last history plot still open, then raise 104 foreach (QWidget *Widget, QApplication::allWidgets()) { 105 if (Widget == LastPlot) { 106 Widget->activateWindow(); 107 Widget->raise(); 108 return; 109 } 110 } 111 112 // If not, open new plot 113 LastPlot = new Edd_Plot(ServiceName); 114 LastPlot->show(); 87 115 } 88 116 … … 106 134 } 107 135 136 // 137 // Opening context menu 138 // 139 void Edd_Indicator::contextMenuEvent(QContextMenuEvent *Event) { 140 141 Menu->exec(Event->globalPos()); 142 } 143 144 // Copy service name 145 void Edd_Indicator::MenuCopyService() { 146 147 QApplication::clipboard()->setText(QString(ServiceName)); 148 } 108 149 109 150 ////////////////////////////////// … … 114 155 // Constructor 115 156 // 116 Edd_Plot::Edd_Plot( char *DIMService, QWidget *P): QwtPlot(P) {157 Edd_Plot::Edd_Plot(QString DIMService, QWidget *P): QwtPlot(P) { 117 158 118 159 setAcceptDrops(true); 119 160 setAttribute(Qt::WA_DeleteOnClose); 161 120 162 // Graph properties 121 163 QwtText XAxisTitle("Time (RJD-55000)"); … … 144 186 NormAction = Menu->addAction("Normalize", this, SLOT(UpdatePlot())); 145 187 NormAction->setCheckable(true); 188 StyleAction = Menu->addAction("Draw dots", this, SLOT(UpdatePlot())); 189 StyleAction->setCheckable(true); 146 190 Menu->addAction("Zoom out", this, SLOT(MenuZoomOut())); 147 191 Menu->addAction("Single trace", this, SLOT(MenuSingleTrace())); 148 192 Menu->addSeparator(); 193 Menu->addAction("Save as ASCII", this, SLOT(MenuSaveASCII())); 149 194 Menu->addAction("Save plot", this, SLOT(MenuSave())); 150 195 Menu->addAction("Print plot", this, SLOT(MenuPrint())); 196 Menu->addSeparator(); 197 Menu->addAction("Paste service", this, SLOT(MenuPasteService())); 151 198 152 199 // DIM client 153 AddService(DIMService);200 if (!DIMService.isEmpty()) AddService(DIMService); 154 201 } 155 202 … … 161 208 for (int i=0; i<Items.size(); i++) { 162 209 delete Items[i].Data; 210 delete Items[i].LiveData; 163 211 delete Items[i].Signal; 164 212 delete[] Items[i].x; … … 171 219 // Add history service to plot 172 220 // 173 void Edd_Plot::AddService(char *DIMService) { 174 175 // Generate name of DIM service 176 QString Name(DIMService); 177 Name.append(".hist"); 178 179 // Lock this thread (because infoHandler() might be called before list insertion) 221 void Edd_Plot::AddService(QString Name) { 222 223 QString HistName = Name+".hist"; 224 225 // Lock before accessing Items list 180 226 QMutexLocker Locker(&Mutex); 227 228 // Check if already subsribed to service 229 for (int i=0; i<Items.size(); i++) { 230 if (HistName == Items[i].Data->getName()) { 231 QMessageBox::warning(this, "Edd Message",HistName+" already present",QMessageBox::Ok); 232 return; 233 } 234 } 181 235 182 236 // Generate new curve and subscribe to service … … 184 238 New.Signal = new QwtPlotCurve; 185 239 New.Signal->attach(this); 186 New.Signal->setTitle( Name);240 New.Signal->setTitle(HistName); 187 241 New.Signal->setPen(QColor(LineColors[Items.size()%(sizeof(LineColors)/sizeof(Qt::GlobalColor))])); 188 242 New.x = NULL; 189 243 New.y = NULL; 190 New.Data = new DimStampedInfo(Name.toAscii(), NO_LINK, this); 244 New.Count = 0; 245 New.Data = new DimStampedInfo(HistName.toAscii(), NO_LINK, this); 246 New.LiveData = new DimStampedInfo(Name.toAscii(), NO_LINK, this); 191 247 192 248 Items.append(New); … … 204 260 } 205 261 206 // Lock this thread (see AddService())262 // Lock before accessing Items list 207 263 QMutexLocker Locker(&Mutex); 208 264 209 265 // Determine which plot item this call belongs to 210 266 int ItemNo; 211 for (ItemNo=0; ItemNo<Items.size(); ItemNo++) if (Items[ItemNo].Data == getInfo()) break; 212 if (ItemNo == Items.size()) return; // safety check 213 214 EvidenceHistoryItem *Curr = (EvidenceHistoryItem *) getInfo()->getData(); 215 int Count=0, DataPoints = getInfo()->getSize()/sizeof(struct EvidenceHistoryItem); 216 217 delete[] Items[ItemNo].x; 218 delete[] Items[ItemNo].y; 219 Items[ItemNo].x = new double [DataPoints]; 220 Items[ItemNo].y = new double [DataPoints]; 221 222 // Find oldest item 223 int Oldest; 224 for (Oldest=1; Oldest<DataPoints; Oldest++) { 225 if (Curr[Oldest].Seconds < Curr[Oldest-1].Seconds) break; 226 } 227 228 // Plot data starting with oldest value 229 for (int i=0; i<DataPoints; i++) { 230 Items[ItemNo].x[Count] = (double) Curr[(i+Oldest)%DataPoints].Seconds; 231 Items[ItemNo].y[Count] = Curr[(i+Oldest)%DataPoints].Value; 232 if (Items[ItemNo].x[Count] != 0) Count++; 233 } 234 235 // Find smallest and largest item 236 double Smallest = DBL_MAX, Largest = DBL_MIN; 237 for (int i=0; i<Count; i++) { 238 if (Largest < Items[ItemNo].y[i]) Largest = Items[ItemNo].y[i]; 239 if (Smallest > Items[ItemNo].y[i]) Smallest = Items[ItemNo].y[i]; 240 } 241 Items[ItemNo].Smallest = Smallest; 242 Items[ItemNo].Largest = Largest; 243 Items[ItemNo].Count = Count; 244 245 // Update status tip 246 QDateTime Time = QDateTime::fromTime_t(getInfo()->getTimestamp()); 247 setStatusTip(QString("%1: Last update %2 Format '%3'").arg(getInfo()->getName(), Time.toString()).arg(getInfo()->getFormat())); 248 267 for (ItemNo=0; ItemNo<Items.size(); ItemNo++) if (Items[ItemNo].Data == getInfo()) { 268 // This is a history service 269 EvidenceHistoryItem *Curr = (EvidenceHistoryItem *) getInfo()->getData(); 270 int Count=0, DataPoints = getInfo()->getSize()/sizeof(struct EvidenceHistoryItem); 271 272 delete[] Items[ItemNo].x; 273 delete[] Items[ItemNo].y; 274 Items[ItemNo].x = new int [DataPoints]; 275 Items[ItemNo].y = new double [DataPoints]; 276 277 // Find oldest item 278 int Oldest; 279 for (Oldest=1; Oldest<DataPoints; Oldest++) { 280 if (Curr[Oldest].Seconds < Curr[Oldest-1].Seconds) break; 281 } 282 283 // Plot data starting with oldest value 284 for (int i=0; i<DataPoints; i++) { 285 Items[ItemNo].x[Count] = Curr[(i+Oldest)%DataPoints].Seconds; 286 Items[ItemNo].y[Count] = Curr[(i+Oldest)%DataPoints].Value; 287 if (Items[ItemNo].x[Count] != 0) Count++; 288 } 289 290 // Find smallest and largest item 291 double Smallest = DBL_MAX, Largest = DBL_MIN; 292 for (int i=0; i<Count; i++) { 293 if (Largest < Items[ItemNo].y[i]) Largest = Items[ItemNo].y[i]; 294 if (Smallest > Items[ItemNo].y[i]) Smallest = Items[ItemNo].y[i]; 295 } 296 Items[ItemNo].Smallest = Smallest; 297 Items[ItemNo].Largest = Largest; 298 Items[ItemNo].Count = Count; 299 300 // Clear local history 301 Items[ItemNo].Live.clear(); 302 303 // Update status tip 304 QDateTime Time = QDateTime::fromTime_t(getInfo()->getTimestamp()); 305 setStatusTip(QString("%1: Last update %2 Format '%3'").arg(getInfo()->getName(), Time.toString()).arg(getInfo()->getFormat())); 306 307 } else if (Items[ItemNo].LiveData == getInfo()) { 308 // This is a live service 309 310 // Limit size of list 311 if (Items[ItemNo].Live.size() > 1000) Items[ItemNo].Live.removeFirst(); 312 313 // Append data 314 struct EvidenceHistoryItem Data; 315 Data.Seconds = getInfo()->getTimestamp(); 316 Data.Value = atof(EvidenceServer::ToString(getInfo())); 317 Items[ItemNo].Live.append(Data); 318 319 // Update largest and smallest value 320 if (Data.Value > Items[ItemNo].Largest) Items[ItemNo].Largest = Data.Value; 321 if (Data.Value < Items[ItemNo].Smallest) Items[ItemNo].Smallest = Data.Value; 322 } 323 324 Locker.unlock(); 325 326 // Do not call replot() directly from this thread! 249 327 emit(YEP()); 250 328 } … … 255 333 // 256 334 void Edd_Plot::UpdatePlot() { 257 258 QMutexLocker Locker(&Mutex);259 335 260 336 if (!YLogAction->isChecked()) { … … 263 339 else setAxisScaleEngine(QwtPlot::yLeft, new QwtLog10ScaleEngine); 264 340 341 // Lock before accessing Items list 342 QMutexLocker Locker(&Mutex); 343 265 344 for (int ItemNo=0; ItemNo<Items.size(); ItemNo++) { 266 267 double *x = new double [Items[ItemNo].Count]; 268 double *y = new double [Items[ItemNo].Count]; 269 345 346 if (Items[ItemNo].Count == 0) continue; 347 348 if (StyleAction->isChecked()) Items[ItemNo].Signal->setStyle(QwtPlotCurve::Dots); 349 else Items[ItemNo].Signal->setStyle(QwtPlotCurve::Lines); 350 351 int DataPoints = Items[ItemNo].Count + Items[ItemNo].Live.size(); 352 double *x = new double [DataPoints]; 353 double *y = new double [DataPoints]; 354 270 355 // Adapt time scale and normalize y scale if requested 271 for (int i=0; i<Items[ItemNo].Count; i++) { 272 x[i] = Items[ItemNo].x[i]/86400 + 40587.5 - 55000; 273 y[i] = Items[ItemNo].y[i]; 356 for (int i=0; i<DataPoints; i++) { 357 if (i < Items[ItemNo].Count) { 358 x[i] = Items[ItemNo].x[i] / 86400.0 + 40587.5 - 55000; 359 y[i] = Items[ItemNo].y[i]; 360 } 361 else { 362 x[i]= Items[ItemNo].Live[i-Items[ItemNo].Count].Seconds / 86400.0 + 40587.5 - 55000; 363 y[i] = Items[ItemNo].Live[i-Items[ItemNo].Count].Value; 364 } 365 274 366 if (NormAction->isChecked()) { 275 if (Items[ItemNo].Smallest != Items[ItemNo].Largest) y[i] = ( Items[ItemNo].y[i] - Items[ItemNo].Smallest)/(Items[ItemNo].Largest-Items[ItemNo].Smallest);367 if (Items[ItemNo].Smallest != Items[ItemNo].Largest) y[i] = (y[i] - Items[ItemNo].Smallest)/(Items[ItemNo].Largest-Items[ItemNo].Smallest); 276 368 else y[i] = 1; 277 369 } … … 279 371 280 372 // Plot datas 281 Items[ItemNo].Signal->setData(x, y, Items[ItemNo].Count);373 Items[ItemNo].Signal->setData(x, y, DataPoints); 282 374 Items[ItemNo].Signal->show(); 283 375 Zoomer->setZoomBase(Items[ItemNo].Signal->boundingRect()); … … 315 407 316 408 // 317 // Context menu and its functions409 // Opening context menu 318 410 // 319 411 void Edd_Plot::contextMenuEvent(QContextMenuEvent *Event) { … … 325 417 326 418 Zoomer->zoom(0); 327 emit YEP(); 328 } 329 419 UpdatePlot(); 420 } 421 422 // Remove all items except last 330 423 void Edd_Plot::MenuSingleTrace() { 331 424 425 // Lock before accessing Items list 332 426 QMutexLocker Locker(&Mutex); 333 427 334 428 while (Items.size() > 1) { 335 429 delete Items.last().Data; 430 delete Items.last().LiveData; 336 431 delete Items.last().Signal; 337 432 delete[] Items.last().x; … … 339 434 Items.takeLast(); 340 435 } 341 emit(YEP()); 342 } 343 436 437 Locker.unlock(); 438 UpdatePlot(); 439 } 440 441 // Save data of plot as test 442 void Edd_Plot::MenuSaveASCII() { 443 QString Filename = QFileDialog::getSaveFileName(this, 444 "Filename", ".", "Text files (*.txt *.ascii *.asc);;All files (*)"); 445 if (Filename.length() <= 0) return; 446 447 QFile File(Filename); 448 if (!File.open(QFile::WriteOnly | QIODevice::Text | QFile::Truncate)) { 449 QMessageBox::warning(this, "Edd Message","Could not open file for writing.",QMessageBox::Ok); 450 return; 451 } 452 453 // Lock before accessing Items list 454 QMutexLocker Locker(&Mutex); 455 QTextStream Stream(&File); 456 457 // Write x and y data for all signals to file 458 for (int ItemNo=0; ItemNo<Items.size(); ItemNo++) { 459 Stream << QString("# ")+Items[ItemNo].Data->getName() << endl; 460 for (int i=0; i<Items[ItemNo].Signal->dataSize(); i++) { 461 Stream << (int) Items[ItemNo].x[i] << " " << Items[ItemNo].Signal->y(i) << endl; 462 } 463 } 464 } 465 466 // Print plot 344 467 void Edd_Plot::MenuPrint() { 345 468 … … 354 477 } 355 478 479 // Save plot as image 356 480 void Edd_Plot::MenuSave() { 357 481 … … 361 485 QPixmap Pixmap = QPixmap::grabWidget(this); 362 486 if(!Pixmap.save(Filename)) { 363 QMessageBox::warning(this, " ddd Message","Could not write image file.",QMessageBox::Ok);487 QMessageBox::warning(this, "Edd Message","Could not write image file.",QMessageBox::Ok); 364 488 remove(Filename.toAscii().data()); 365 489 } … … 367 491 } 368 492 369 // 370 // Main GUI 493 // Add new service by pasting name 494 void Edd_Plot::MenuPasteService() { 495 496 AddService(QApplication::clipboard()->text().toAscii().data()); 497 } 498 499 500 // 501 // Main GUI (all widgets have ultimately Central as parent) 371 502 // 372 503 GUI::GUI() { 504 505 Edd_Indicator *Value; 506 Edd_Plot *Graph; 507 QString Text; 373 508 374 509 // Set features of main window 375 510 Central = new QWidget(this); 376 511 setCentralWidget(Central); 377 setStatusBar 512 setStatusBar(new QStatusBar(this)); 378 513 379 514 // TextBox for value 380 Value = new Edd_Indicator((char *) "SQM/NSB", Central); 381 Graph = new Edd_Plot((char *) "SQM/NSB", Central); 382 383 Value1 = new Edd_Indicator((char *) "BIAS/VOLT/ID00/00-000", Central); 384 //Graph1 = new Edd_Plot((char *) "BIAS/VOLT/ID00/00-000", Central); 515 //Value = new Edd_Indicator((char *) "SQM/NSB", Central); 516 //Graph = new Edd_Plot((char *) "SQM/NSB", Central); 517 //Graph->AddService("BIAS/VOLT/ID00/00-000"); 518 385 519 386 520 // Clock (updated every second) … … 397 531 398 532 MainWidget = new QWidget(); 533 MainLayout = new QGridLayout(MainWidget); 399 534 400 535 // Layout of all widgets 401 MainLayout = new QGridLayout(MainWidget); 402 MainLayout->addWidget(Value, 0, 0, 1, 1); 536 //MainLayout->addWidget(Value, 0, 0, 1, 1); 403 537 //MainLayout->addWidget(Clock, 0, 1, 1, 1); 404 MainLayout->addWidget(Graph, 1, 0, 1, 2);538 //MainLayout->addWidget(Graph, 1, 0, 1, 2); 405 539 //MainLayout->setColumnStretch(1, 10); 406 540 407 MainLayout->addWidget(Value1, 0, 1, 1, 1);408 541 //MainLayout->addWidget(Clock, 0, 1, 1, 1); 409 542 //MainLayout->addWidget(Graph1, 2, 0, 1, 2); 410 543 544 // Bias voltage page 411 545 BiasWidget = new QWidget(); 412 546 BiasLayout = new QGridLayout(BiasWidget); 413 for (int i=0; i<19; i++) { 414 char *Item; 415 if (asprintf(&Item, "BIAS/VOLT/ID00/00-%.3d", i) != -1) { 416 Value = new Edd_Indicator(Item, NULL); 417 BiasLayout->addWidget(Value, i%10, 0+i/10, 1, 1); 418 free(Item); 419 } 420 if (asprintf(&Item, "BIAS/VOLT/ID00/01-%.3d", i) != -1) { 421 Value = new Edd_Indicator(Item, NULL); 422 BiasLayout->addWidget(Value, i%10, 2+i/10, 1, 1); 423 free(Item); 424 } 425 } 426 547 Graph = new Edd_Plot(); 548 for (int i=0; i<18; i++) { 549 Text = Text.sprintf("BIAS/VOLT/ID00/00-%.3d",i); 550 Value = new Edd_Indicator(Text); 551 BiasLayout->addWidget(Value, i%9+1, 0+i/9, 1, 1); 552 Graph->AddService(Text); 553 554 Text = Text.sprintf("BIAS/VOLT/ID00/01-%.3d",i); 555 Value = new Edd_Indicator(Text); 556 BiasLayout->addWidget(Value, i%9+1, 2+i/9, 1, 1); 557 Graph->AddService(Text); 558 } 559 BiasLayout->addWidget(Graph, 0, 4, 12, 3); 560 Value = new Edd_Indicator("BIAS/Status"); 561 Value->setMaximumWidth(200); 562 BiasLayout->addWidget(Value, 0, 0, 1, 3); 563 564 // Environment page 427 565 EnvironmentWidget = new QWidget(); 428 566 EnvironmentLayout = new QGridLayout(EnvironmentWidget); 567 Value = new Edd_Indicator("ARDUINO/Status"); 568 Value->setMaximumWidth(200); 569 EnvironmentLayout->addWidget(Value, 0, 0, 1, 3); 570 571 Graph = new Edd_Plot(); 429 572 for (int i=0; i<10; i++) { 430 char *Item; 431 if (asprintf(&Item, "ARDUINO/VAL%.2d", i) != -1) { 432 Value = new Edd_Indicator(Item, NULL); 433 EnvironmentLayout->addWidget(Value, i%5, i/5, 1, 1); 434 free(Item); 435 } 436 } 573 Text = Text.sprintf("ARDUINO/VAL%.2d", i); 574 Value = new Edd_Indicator(Text); 575 EnvironmentLayout->addWidget(Value, i%5+1, i/5, 1, 1); 576 Graph->AddService(Text); 577 } 578 EnvironmentLayout->addWidget(Graph, 0, 3, 7, 4); 579 580 Value = new Edd_Indicator("SQM/NSB"); 581 EnvironmentLayout->addWidget(Value, 6, 0, 1, 1); 437 582 438 583 // Tab widget … … 444 589 // Menu bar 445 590 QMenu* Menu = menuBar()->addMenu("&Menu"); 591 Menu->addAction("New history plot", this, SLOT(MenuNewHistory())); 592 Menu->addSeparator(); 446 593 Menu->addAction("About", this, SLOT(MenuAbout())); 447 594 Menu->addSeparator(); … … 455 602 456 603 void GUI::MenuAbout() { 604 QString Rev(SVN_REVISION); 605 Rev.remove(0,1).chop(1); 606 457 607 QMessageBox::about(this, "About Edd","Evidence Data Display\n\n" 458 608 "Written by Oliver Grimm, IPP, ETH Zurich\n" 459 "EMail: oliver.grimm@phys.ethz.ch\n" 460 "This version compiled "__DATE__".\n" 461 "subversion revision "SVN_REVISION".\n\n" 609 "This version compiled "__DATE__" ("+Rev+")\n\n" 462 610 "Graphical user interface implemented with Qt.\n" 463 "Evidence control system based on DIM (http://dim.web.cern.ch)."); 464 printf("Revision: $Revision$\n"); 611 "Evidence control system based on DIM (http://dim.web.cern.ch).\n\n" 612 "Comments to oliver.grimm@phys.ethz.ch."); 613 } 614 615 // Open request for new history plot 616 void GUI::MenuNewHistory() { 617 618 QStringList List; 619 char *Name, *Format; 620 int Type; 621 bool OK; 622 623 // Find all services that are not history services and sort 624 getServices("*"); 625 while ((Type = getNextService(Name, Format)) != 0) { 626 if (Type==DimSERVICE && strstr(Name, ".hist")==NULL) List.append(Name); 627 } 628 List.sort(); 629 630 // Open dialog and open history window 631 QString Result = QInputDialog::getItem(this, "Edd Request", 632 "Enter DIM service name", List, 0, true, &OK); 633 if (OK && !Result.isEmpty()) { 634 Result = Result.trimmed(); 635 if (Result.endsWith(".hist")) Result.chop(5); 636 Edd_Plot *Plot = new Edd_Plot(Result); 637 Plot->show(); 638 } 465 639 } 466 640 … … 483 657 484 658 GUI MainWindow; 485 MainWindow.setGeometry(100, 100, 800, 500);659 MainWindow.setGeometry(100, 100, 800, 650); 486 660 MainWindow.setWindowTitle("Edd - Evidence Data Display"); 487 661 MainWindow.show(); -
Evidence/Edd/Edd.h
r138 r139 32 32 DimStampedInfo *Data; 33 33 34 QMenu *Menu; 34 35 QPoint dragStart; 35 36 QwtPlot *LastPlot; 37 36 38 void infoHandler(); 37 39 void mousePressEvent(QMouseEvent *); … … 40 42 41 43 public: 42 Edd_Indicator( char*, QWidget* = NULL);44 Edd_Indicator(QString, QWidget * = NULL); 43 45 ~Edd_Indicator(); 46 47 private slots: 48 void contextMenuEvent(QContextMenuEvent *); 49 void MenuCopyService(); 44 50 45 51 signals: … … 53 59 struct PlotItem { 54 60 DimInfo *Data; 61 DimInfo *LiveData; 55 62 QwtPlotCurve *Signal; 56 double*x;63 int *x; 57 64 double *y; 58 65 int Count; 59 66 double Smallest; 60 67 double Largest; 68 QList<struct EvidenceHistoryItem> Live; 61 69 }; 62 70 … … 67 75 QAction *YLogAction; 68 76 QAction *NormAction; 77 QAction *StyleAction; 69 78 70 79 QwtPlotPanner *Panner; … … 73 82 QwtLegend *Legend; 74 83 75 void AddService(char *);76 84 void infoHandler(); 77 85 void dragEnterEvent(QDragEnterEvent *); … … 79 87 80 88 public: 81 Edd_Plot( char *, QWidget * = NULL);89 Edd_Plot(QString = QString(), QWidget * = NULL); 82 90 ~Edd_Plot(); 91 void AddService(QString); 83 92 84 93 private slots: … … 88 97 void MenuZoomOut(); 89 98 void MenuSingleTrace(); 99 void MenuSaveASCII(); 90 100 void MenuSave(); 91 101 void MenuPrint(); 92 102 void MenuPasteService(); 103 93 104 signals: 94 105 void YEP(); … … 97 108 98 109 // Main window class 99 class GUI: public QMainWindow {110 class GUI: public QMainWindow, public DimBrowser { 100 111 Q_OBJECT 101 112 102 Edd_Indicator *Value, *Value1;103 Edd_Plot *Graph, *Graph1;104 113 QwtAnalogClock *Clock; 105 114 … … 117 126 private slots: 118 127 void MenuAbout(); 128 void MenuNewHistory(); 119 129 }; 120 130
Note:
See TracChangeset
for help on using the changeset viewer.