Changeset 11266 for trunk/FACT++/gui
- Timestamp:
- 07/06/11 16:20:09 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/FactGui.h
r11242 r11266 20 20 #include "src/DimNetwork.h" 21 21 #include "src/tools.h" 22 22 23 23 24 #include "TROOT.h" … … 524 525 } 525 526 526 void RemoveServer(const std::string &s)527 {528 UnsubscribeServer(s);529 530 DimNetwork::RemoveServer(s);531 532 QApplication::postEvent(this,533 new FunctionEvent(boost::bind(&FactGui::handleRemoveServer, this, s)));534 }535 536 void RemoveAllServers()537 {538 UnsubscribeAllServers();539 540 vector<string> v = GetServerList();541 for (vector<string>::iterator i=v.begin(); i<v.end(); i++)542 QApplication::postEvent(this,543 new FunctionEvent(boost::bind(&FactGui::handleStateOffline, this, *i)));544 545 DimNetwork::RemoveAllServers();546 547 QApplication::postEvent(this,548 new FunctionEvent(boost::bind(&FactGui::handleRemoveAllServers, this)));549 }550 551 527 void AddService(const std::string &server, const std::string &service, const std::string &fmt, bool iscmd) 552 528 { … … 557 533 void RemoveService(const std::string &server, const std::string &service, bool iscmd) 558 534 { 559 if (fServices.find(server+'/'+service)!=fServices.end()) 560 UnsubscribeService(server+'/'+service); 535 UnsubscribeService(server+'/'+service); 561 536 562 537 QApplication::postEvent(this, … … 566 541 void RemoveAllServices(const std::string &server) 567 542 { 568 Unsubscribe Server(server);543 UnsubscribeAllServices(server); 569 544 570 545 QApplication::postEvent(this, … … 584 559 const State s = GetState(server, GetCurrentState(server)); 585 560 handleStateChanged(Time(), server, s); 586 }587 588 void handleRemoveServer(const string &server)589 {590 handleStateOffline(server);591 handleRemoveAllServices(server);592 }593 594 void handleRemoveAllServers()595 {596 QStandardItemModel *m = 0;597 if ((m=dynamic_cast<QStandardItemModel*>(fDimCmdServers->model())))598 m->removeRows(0, m->rowCount());599 600 if ((m = dynamic_cast<QStandardItemModel*>(fDimSvcServers->model())))601 m->removeRows(0, m->rowCount());602 561 } 603 562 … … 634 593 void handleRemoveAllServices(const std::string &server) 635 594 { 595 handleStateChanged(Time(), server, State(-2, "Offline", "No connection via DIM.")); 596 636 597 QStandardItemModel *m = 0; 637 598 if ((m=dynamic_cast<QStandardItemModel*>(fDimCmdServers->model()))) … … 686 647 } 687 648 688 void Unsubscribe Server(const string &server)649 void UnsubscribeAllServices(const string &server) 689 650 { 690 651 for (map<string,DimInfo*>::iterator i=fServices.begin(); … … 695 656 fServices.erase(i); 696 657 } 697 }698 699 void UnsubscribeAllServers()700 {701 for (map<string,DimInfo*>::iterator i=fServices.begin();702 i!=fServices.end(); i++)703 delete i->second;704 705 fServices.clear();706 658 } 707 659 … … 1797 1749 const FTM::DimError &sdata = d.ref<FTM::DimError>(); 1798 1750 1799 SetFtuLed(sdata.fError.fDestAddress 1751 SetFtuLed(sdata.fError.fDestAddress, sdata.fError.fNumCalls, d.time); 1800 1752 SetFtuStatusLed(d.time); 1801 1753 … … 1835 1787 fRatesWidget->setEnabled(enable); 1836 1788 1837 if (!enable) 1789 if (s.index>=FTM::kConnected) 1790 SetFtuStatusLed(time); 1791 else 1838 1792 { 1839 1793 SetLedColor(fStatusFTULed, kLedGray, time); … … 1841 1795 fStatusFTULabel->setToolTip("FTM is not online."); 1842 1796 } 1843 }1797 } 1844 1798 1845 1799 if (server=="FAD_CONTROL") … … 1939 1893 SetLedColor(fStatusSchedulerLed, s.index>=0 ? kLedGreen : kLedRed, time); 1940 1894 } 1941 }1942 1943 void handleStateOffline(const string &server)1944 {1945 handleStateChanged(Time(), server, State(-2, "Offline", "No connection via DIM."));1946 1895 } 1947 1896 … … 2830 2779 ~FactGui() 2831 2780 { 2832 UnsubscribeAllServers(); 2781 // Unsubscribe all services 2782 for (map<string,DimInfo*>::iterator i=fServices.begin(); 2783 i!=fServices.end(); i++) 2784 delete i->second; 2785 2833 2786 delete fEventData; 2834 2787 }
Note:
See TracChangeset
for help on using the changeset viewer.