| 182 | } |
| 183 | |
| 184 | Monitor::TreeNode* |
| 185 | Monitor::MonitorDataStorage::getTransportNode( |
| 186 | const TransportKey& key, |
| 187 | bool& create |
| 188 | ) |
| 189 | { |
| 190 | TreeNode* node = 0; |
| 191 | TransportToTreeMap::iterator location |
| 192 | = this->transportToTreeMap_.find( key); |
| 193 | if( location == this->transportToTreeMap_.end()) { |
| 194 | // We are done if not creating a new node. |
| 195 | if( !create) return 0; |
| 196 | |
| 197 | // This transport needs to be installed. |
| 198 | |
| 199 | // Find the parent node, if any. It is ok to not have a parent node |
| 200 | // for cases of out-of-order updates. We handle that as the updates |
| 201 | // are actually processed. |
| 202 | ProcessKey pid( key.host, key.pid); |
| 203 | TreeNode* parent = this->getProcessNode( pid, create); |
| 204 | |
| 205 | QList<QVariant> list; |
| 206 | QString value = QString("0x%1") |
| 207 | .arg( key.transport, 8, 16, QLatin1Char('0')); |
| 208 | list << QString( QObject::tr( "Transport")) << value; |
| 209 | node = new TreeNode( list, parent); |
| 210 | if( parent) { |
| 211 | parent->append( node); |
| 212 | } |
| 213 | |
| 214 | // Install the new node. |
| 215 | this->transportToTreeMap_[ key] = std::make_pair( node->row(), node); |
| 216 | |
| 217 | } else { |
| 218 | node = location->second.second; |
| 219 | create = false; |
| 220 | } |
| 221 | |
| 222 | // If there have been some out-of-order reports, we may have been |
| 223 | // created without a parent node. We can fill in that information now |
| 224 | // if we can. If we created the node, we already know it has a |
| 225 | // parent so this will be bypassed. |
| 226 | if( !node->parent()) { |
| 227 | create = true; |
| 228 | ProcessKey pid( key.host, key.pid); |
| 229 | node->parent() = this->getProcessNode( pid, create); |
| 230 | } |
| 231 | |
| 232 | //node->setColor(1,QColor("#ffbfbf")); |
| 233 | return node; |
| 234 | } |
| 235 | |
| 236 | Monitor::TreeNode* |
| 237 | Monitor::MonitorDataStorage::createParticipantNode( |
no test coverage detected