コード例 #1
0
    void ExplorerTreeView::finishLoadDatabaseContent(const EventsInfo::LoadDatabaseContentResponce& res)
    {
        common::ErrorValueSPtr er = res.errorInfo();
        if(er && er->isError()){
            return;
        }

        IServer *serv = qobject_cast<IServer *>(sender());
        DCHECK(serv);
        if(!serv){
            return;
        }

        ExplorerTreeModel *mod = qobject_cast<ExplorerTreeModel*>(model());
        DCHECK(mod);
        if(!mod){
            return;
        }

        EventsInfo::LoadDatabaseContentResponce::keys_cont_type keys = res.keys_;

        for(int i = 0; i < keys.size(); ++i){
            NKey key = keys[i];
            mod->addKey(serv, res.inf_, key);
        }
    }
コード例 #2
0
    void ViewKeysDialog::finishLoadDatabaseContent(const EventsInfo::LoadDatabaseContentResponce& res)
    {
        common::ErrorValueSPtr er = res.errorInfo();
        if(er && er->isError()){
            return;
        }

        if(!keysModel_){
            return;
        }

        EventsInfo::LoadDatabaseContentResponce::keys_cont_type keys = res.keys_;

        size_t size = keys.size();
        for(size_t i = 0; i < size; ++i){
            NKey key = keys[i];
            keysModel_->insertItem(new KeyTableItem(key));
        }

        int curv = currentKey_->value();
        if(cursorStack_.size() == curPos_){
            cursorStack_.push_back(res.cursorOut_);
            currentKey_->setValue(curv + size);
        }
        else{
            currentKey_->setValue(curv - size);
        }

        updateControls();
    }