コード例 #1
0
void NameServerViewImpl::updateObjectList()
{
    treeWidget.clear();

    ncHelper.setLocation(hostAddressBox.string(), portNumberSpin.value());

    if(ncHelper.isAlive()) {

        NamingContextHelper::ObjectInfoList objects = ncHelper.getObjectList();

        for(size_t i=0; i < objects.size(); ++i) {

            const NamingContextHelper::ObjectInfo& info = objects[i];
            //if(info.isAlive){
            if(true) {

                QTreeWidgetItem* item = new QTreeWidgetItem();
                QString name = info.id.c_str();
                if(!info.kind.empty()) {
                    name += QString("(%1)").arg(QString::fromStdString(info.kind));
                }
                item->setText(0, name);
                treeWidget.addTopLevelItem(item);
            }
        }
    }
}
コード例 #2
0
void RTSNameServerViewImpl::updateObjectList(const NamingContextHelper::ObjectInfoList& objects, QTreeWidgetItem* parent)
{
    for(size_t i = 0; i < objects.size(); ++i){
        const NamingContextHelper::ObjectInfo& info = objects[i];
        if (iequals(info.kind, "rtc") || iequals(info.kind, "host_cxt")) {
            if (parent == NULL && iequals(info.kind, "host_cxt")) {
            #ifdef _HOST_CXT_VERSION
                extendDiagram(info, parent);
            } else if (parent && iequals(info.kind, "rtc")){
            #else
            } else if (iequals(info.kind, "rtc")){
            #endif
                QTreeWidgetItem* item = new QTreeWidgetItem();
                QString name = info.id.c_str();
                item->setText(0, name);
                item->setIcon(0, info.isAlive ? QIcon(":/Corba/icons/NSRTC.png") :
                        QIcon(":/Corba/icons/NSZombi.png"));
                if (parent == NULL) treeWidget.addTopLevelItem(item);
                else parent->addChild(item);
            }
        }
    }
}