Ejemplo n.º 1
0
void RepoEditor::editEntry()
{
    QModelIndex repoMI = ui->tableView->model()->index(ui->tableView->currentIndex().row(), 1, QModelIndex());
    QModelIndex locationMI = ui->tableView->model()->index(ui->tableView->currentIndex().row(), 2, QModelIndex());
    addRepoDialog->setRepoName(ui->tableView->model()->data(repoMI).toString());

    // take the location
    QString location = ui->tableView->model()->data(locationMI).toString();

    // take the type and address
    QRegExp locationMatch("^(Server|Include)\\s*=\\s*(.+)");
    locationMatch.indexIn(location);
    location = locationMatch.cap(2);

    // fill remaining fields
    addRepoDialog->setRepoLocation(location);
    addRepoDialog->setLocationType(locationMatch.cap(1) == "Server" ? 1 : 0);

    if( addRepoDialog->exec() == QDialog::Accepted ) {
        ui->tableView->model()->setData( repoMI, addRepoDialog->getRepoName() );
        ui->tableView->model()->setData( locationMI, ( addRepoDialog->getLocationType() == 0 ? "Include = " : "Server = " ) + addRepoDialog->getRepoLocation() );
    }
}
Ejemplo n.º 2
0
/*
 * See if the event's mods match up with the contents of "basket".
 *
 * If we find a Count mod before rejecting an event, we decrement it.  We
 * need to do this even if later mods cause us to ignore the event.
 */
static bool modsMatch(JdwpState* state, JdwpEvent* pEvent, ModBasket* basket)
{
    JdwpEventMod* pMod = pEvent->mods;

    for (int i = pEvent->modCount; i > 0; i--, pMod++) {
        switch (pMod->modKind) {
        case MK_COUNT:
            assert(pMod->count.count > 0);
            pMod->count.count--;
            break;
        case MK_CONDITIONAL:
            assert(false);  // should not be getting these
            break;
        case MK_THREAD_ONLY:
            if (pMod->threadOnly.threadId != basket->threadId)
                return false;
            break;
        case MK_CLASS_ONLY:
            if (!dvmDbgMatchType(basket->classId, pMod->classOnly.refTypeId))
                return false;
            break;
        case MK_CLASS_MATCH:
            if (!patternMatch(pMod->classMatch.classPattern,
                    basket->className))
                return false;
            break;
        case MK_CLASS_EXCLUDE:
            if (patternMatch(pMod->classMatch.classPattern,
                    basket->className))
                return false;
            break;
        case MK_LOCATION_ONLY:
            if (!locationMatch(&pMod->locationOnly.loc, basket->pLoc))
                return false;
            break;
        case MK_EXCEPTION_ONLY:
            if (pMod->exceptionOnly.refTypeId != 0 &&
                !dvmDbgMatchType(basket->excepClassId,
                                 pMod->exceptionOnly.refTypeId))
                return false;
            if ((basket->caught && !pMod->exceptionOnly.caught) ||
                (!basket->caught && !pMod->exceptionOnly.uncaught))
                return false;
            break;
        case MK_FIELD_ONLY:
            if (!dvmDbgMatchType(basket->classId, pMod->fieldOnly.refTypeId) ||
                    pMod->fieldOnly.fieldId != basket->field)
                return false;
            break;
        case MK_STEP:
            if (pMod->step.threadId != basket->threadId)
                return false;
            break;
        case MK_INSTANCE_ONLY:
            if (pMod->instanceOnly.objectId != basket->thisPtr)
                return false;
            break;
        default:
            ALOGE("unhandled mod kind %d", pMod->modKind);
            assert(false);
            break;
        }
    }

    return true;
}