Changeset 222 for Evidence/Edd
- Timestamp:
- 06/08/10 13:14:10 (15 years ago)
- Location:
- Evidence/Edd
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Evidence/Edd/Edd.cc
r221 r222 27 27 QWidget *OpenHistory(char *Service, int Index) { 28 28 29 char *Name, *Format; 30 DimBrowser Browser; 31 32 // If status service displayed as text history 33 if (strstr(Service, "/Message") != NULL) return new EddText(Service); 34 35 // If service currently not available, default open as plot 36 Browser.getServices(Service); 37 if (Browser.getNextService(Name, Format) != DimSERVICE) return new EddPlot(Service, Index); 38 39 // Otherwise, determine from format if plot or text history 40 if (strlen(Format) == 1 && *Format != 'C') return new EddPlot(Service, Index); 29 class EvidenceHistory *Hist = Handler->GetHistory(Service); 30 31 // Check if hitory service available 32 if (Hist == NULL || Hist->GetFormat() == NULL) { 33 QMessageBox::warning(NULL, "Edd Message", QString("Could not retrieve history for service ") + Service ,QMessageBox::Ok); 34 Handler->DropHistory(Service); 35 return NULL; 36 } 37 38 QString Format = Hist->GetFormat(); 39 Handler->DropHistory(Service); 40 41 //if (strlen(Hist->GetFormat()) == 1 && *Hist->GetFormat() != 'C') return new EddPlot(Service, Index); 42 if (Format.size() == 1 && Format[0] != 'C') return new EddPlot(Service, Index); 41 43 else return new EddText(Service); 42 44 } … … 66 68 QLineEdit(P), ServiceName(Name), Index(Index) { 67 69 68 Last Plot = NULL;70 LastHist = NULL; 69 71 70 72 // Widget properties … … 135 137 // Check if last history plot still open, then raise 136 138 foreach (QWidget *Widget, QApplication::allWidgets()) { 137 if (Widget == Last Plot) {139 if (Widget == LastHist) { 138 140 Widget->activateWindow(); 139 141 Widget->raise(); … … 177 179 void EddLineDisplay::MenuOpenHistory() { 178 180 179 Last Plot = OpenHistory(ServiceName.toAscii().data(), Index);180 if (Last Plot != NULL) LastPlot->show();181 LastHist = OpenHistory(ServiceName.toAscii().data(), Index); 182 if (LastHist != NULL) LastHist->show(); 181 183 } 182 184 … … 295 297 double Number=0; 296 298 while ((R=Hist->Next()) != NULL) { 297 switch ( Format[0].toUpper().toAscii()) {299 switch (*(Hist->GetFormat())) { 298 300 case 'I': 299 301 case 'L': Number = *((int *) R->Data + List[ItemNo].Index); break; … … 311 313 if (SizeLimit < 2*Count) SizeLimit = 2*Count; 312 314 } 315 Handler->DropHistory(List[ItemNo].Name); 313 316 } 314 317 … … 737 740 } 738 741 } 742 Handler->DropHistory(Name); 739 743 } 740 744 … … 876 880 } 877 881 878 // Update throughput statistics 882 // Reduce history usage counter 883 void EddDim::DropHistory(QString Name) { 884 885 for (int i=0; i<HistoryList.size(); i++) { 886 if (HistoryList[i].Name == Name) HistoryList[i].Count--; 887 } 888 } 889 890 // Update throughput statistics and clear up history memory 879 891 void EddDim::UpdateStatistics() { 892 893 // Remove unused histories after not less than 5 seconds 894 for (int i=0; i<HistoryList.size(); i++) { 895 if ((HistoryList[i].Count <= 0) && (time(NULL)-HistoryList[i].LastUpdate) > 5) { 896 delete HistoryList[i].HistClass; 897 HistoryList.removeAt(i); 898 } 899 } 880 900 881 901 // Lock before accessing internal variables … … 1534 1554 getServices("*"); 1535 1555 while ((Type = getNextService(Name, Format)) != 0) { 1536 if (Type==DimSERVICE && strstr(Name, ".hist")==NULL) List.append(Name);1556 if (Type==DimSERVICE) List.append(Name); 1537 1557 } 1538 1558 List.sort(); … … 1543 1563 if (OK && !Result.isEmpty()) { 1544 1564 Result = Result.trimmed(); 1545 if (Result.endsWith(".hist")) Result.chop(5);1546 1565 QWidget *Hist = OpenHistory(Result.toAscii().data(), 0); 1547 1566 if (Hist != NULL) Hist->show(); -
Evidence/Edd/Edd.h
r221 r222 96 96 QMenu *Menu; 97 97 QPoint dragStart; 98 QWidget *Last Plot;98 QWidget *LastHist; 99 99 100 100 QString ServiceName; … … 247 247 void Unsubscribe (QString); 248 248 class EvidenceHistory *GetHistory(QString); 249 void DropHistory(QString); 249 250 250 251 signals:
Note:
See TracChangeset
for help on using the changeset viewer.