Changeset 244 in flair-src for trunk/tools/FlairGCS/src/Manager.cpp
- Timestamp:
- 05/24/18 11:45:33 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/FlairGCS/src/Manager.cpp
r234 r244 37 37 qRegisterMetaType<QModelIndex>("QModelIndex"); // pour le file ui?? 38 38 this->name = name; 39 //f printf(stderr,"Manager %x\n",thread());39 //ffprintf(stderr,stderr,"Manager %x\n",thread()); 40 40 setWindowTitle(name); 41 41 … … 88 88 89 89 if (UDT::ERROR == UDT::bind(serv, (sockaddr *)&my_addr, sizeof(my_addr))) { 90 printf("bind error, %s\n", UDT::getlasterror().getErrorMessage());90 fprintf(stderr,"bind error, %s\n", UDT::getlasterror().getErrorMessage()); 91 91 } 92 92 93 93 if (UDT::ERROR == UDT::listen(serv, 1)) { 94 printf("listen error, %s\n", UDT::getlasterror().getErrorMessage());94 fprintf(stderr,"listen error, %s\n", UDT::getlasterror().getErrorMessage()); 95 95 } 96 96 … … 101 101 102 102 Manager::~Manager() { 103 printf("%i\n",udtSockets.count());104 103 for (int i = 0; i < udtSockets.count(); i++) { 105 104 udtSockets.at(i)->kill(); … … 109 108 // delete main_layout; 110 109 UDT::cleanup(); 111 printf("ok\n");112 110 } 113 111 … … 120 118 if (UDT::INVALID_SOCK ==(socket = UDT::accept(serv, (sockaddr *)&their_addr, &namelen))) { 121 119 if (UDT::getlasterror().getErrorCode() != 6002) 122 printf("accept error: %s, code %i\n", UDT::getlasterror().getErrorMessage(),UDT::getlasterror().getErrorCode());120 fprintf(stderr,"accept error: %s, code %i\n", UDT::getlasterror().getErrorMessage(),UDT::getlasterror().getErrorCode()); 123 121 return; 124 122 } else { 125 123 QString name=QString("%1:%2").arg(inet_ntoa(their_addr.sin_addr)).arg(their_addr.sin_port); 126 printf("connected to %s\n",name.toLocal8Bit().constData());124 fprintf(stderr,"connected to %s\n",name.toLocal8Bit().constData()); 127 125 128 126 QThread *thread = new QThread(this); … … 148 146 connect(udtSocket, SIGNAL(dataReady(char *, int)), newLayout,SLOT(receive(char *, int)),Qt::BlockingQueuedConnection); 149 147 connect(newLayout, SIGNAL(destroyed(QObject *)), this, SLOT(layoutDestroyed(QObject *))); 148 connect(udtSocket, SIGNAL(destroyed(QObject *)), this, SLOT(udtSocketDestroyed(QObject *))); 150 149 connect(udtSocket, SIGNAL(destroyed()), newLayout, SLOT(deleteLater())); 151 150 … … 171 170 } 172 171 172 void Manager::udtSocketDestroyed(QObject *obj) { 173 udtSockets.removeOne((UdtSocket *)obj); 174 } 175 173 176 void Manager::layoutDestroyed(QObject *obj) { 174 177 int index = connectionsLayout.indexOf((ConnectionLayout *)obj); 175 178 179 delete connectionsWidget.at(index); 180 connectionsWidget.removeAt(index); 181 connectionsLayout.removeOne((ConnectionLayout *)obj); 182 176 183 //tab: avoid having only 1 tab (0, 2 or more) 177 184 if (tabBar->count() > 1) { … … 179 186 } 180 187 181 delete connectionsWidget.at(index);182 connectionsWidget.removeAt(index);183 connectionsLayout.removeOne((ConnectionLayout *)obj);184 185 188 if (connectionsLayout.count() == 1) { 186 189 hiddenTabName = tabBar->tabText(0); … … 191 194 status->showMessage(""); 192 195 } 196 197 193 198 } 194 199 … … 222 227 223 228 void Manager::tabBarCurrentChanged(int index) { 229 224 230 if (index >= 0) { 225 connectionsWidget.at(currentTab)->hide(); 231 //if we are coming from layout destroyed 232 if(currentTab<connectionsLayout.count()) connectionsWidget.at(currentTab)->hide(); 226 233 connectionsWidget.at(index)->show(); 227 234 currentTab = index; … … 230 237 connectionsWidget.at(0)->show(); 231 238 } 232 233 239 if (tabBar->count() == 0) { 234 240 status->showMessage(connectionsLayout.at(0)->getUDTStats()); … … 341 347 QDomDocument doc("remote_ui_xml"); 342 348 connectionsLayout.at(i)->GetUpdateXml((QDomElement *)&doc); 343 // printf("merge\n%s\n",doc.toString().toLocal8Bit().constData());349 // fprintf(stderr,"merge\n%s\n",doc.toString().toLocal8Bit().constData()); 344 350 345 351 connectionsLayout.at(i)->XmlToSend(doc);
Note:
See TracChangeset
for help on using the changeset viewer.