Пример #1
0
void
XMLEditPlugin::UpdateWindowContents()
{
    BlockAllSignals(true);

    if (xmldoc->docType == "Plugin")
    {
        attpluginGroup->button(0)->setChecked(true);
        name->setText(xmldoc->plugin->name);
        label->setText(xmldoc->plugin->label);
        version->setText(xmldoc->plugin->version);
        varTypeMesh->setChecked(false);
        varTypeScalar->setChecked(false);
        varTypeVector->setChecked(false);
        varTypeMaterial->setChecked(false);
        varTypeSubset->setChecked(false);
        varTypeSpecies->setChecked(false);
        varTypeCurve->setChecked(false);
        varTypeTensor->setChecked(false);
        varTypeSymmetricTensor->setChecked(false);
        varTypeLabel->setChecked(false);
        varTypeArray->setChecked(false);
        createExpressions->setChecked(false);
        inOpVarTypeMesh->setChecked(false);
        inOpVarTypeScalar->setChecked(false);
        inOpVarTypeVector->setChecked(false);
        inOpVarTypeMaterial->setChecked(false);
        inOpVarTypeSubset->setChecked(false);
        inOpVarTypeSpecies->setChecked(false);
        inOpVarTypeCurve->setChecked(false);
        inOpVarTypeTensor->setChecked(false);
        inOpVarTypeSymmetricTensor->setChecked(false);
        inOpVarTypeLabel->setChecked(false);
        inOpVarTypeArray->setChecked(false);
        outOpVarTypeMesh->setChecked(false);
        outOpVarTypeScalar->setChecked(false);
        outOpVarTypeVector->setChecked(false);
        outOpVarTypeMaterial->setChecked(false);
        outOpVarTypeSubset->setChecked(false);
        outOpVarTypeSpecies->setChecked(false);
        outOpVarTypeCurve->setChecked(false);
        outOpVarTypeTensor->setChecked(false);
        outOpVarTypeSymmetricTensor->setChecked(false);
        outOpVarTypeLabel->setChecked(false);
        outOpVarTypeArray->setChecked(false);
        enabledByDefault->setChecked(xmldoc->plugin->enabledByDefault);

        dbType->setCurrentIndex(0);
        filePatterns->setText("");
        if (xmldoc->plugin->type == "plot")
        {
            iconFile->setText(xmldoc->plugin->iconFile);
            hasIcon->setChecked(xmldoc->plugin->iconFile.length() > 0);
            pluginType->setCurrentIndex(1);
            std::vector<QString> types = SplitValues(xmldoc->plugin->vartype);
            for (size_t i=0; i<types.size(); i++)
            {
                if      (types[i] == "mesh")
                    varTypeMesh->setChecked(true);
                else if (types[i] == "scalar")
                    varTypeScalar->setChecked(true);
                else if (types[i] == "vector")
                    varTypeVector->setChecked(true);
                else if (types[i] == "material")
                    varTypeMaterial->setChecked(true);
                else if (types[i] == "subset")
                    varTypeSubset->setChecked(true);
                else if (types[i] == "species")
                    varTypeSpecies->setChecked(true);
                else if (types[i] == "curve")
                    varTypeCurve->setChecked(true);
                else if (types[i] == "tensor")
                    varTypeTensor->setChecked(true);
                else if (types[i] == "symmetrictensor")
                    varTypeSymmetricTensor->setChecked(true);
                else if (types[i] == "label")
                    varTypeLabel->setChecked(true);
                else if (types[i] == "array")
                    varTypeArray->setChecked(true);
            }
        }
        else if (xmldoc->plugin->type == "operator")
        {
            iconFile->setText(xmldoc->plugin->iconFile);
            hasIcon->setChecked(xmldoc->plugin->iconFile.length() > 0);
            createExpressions->setChecked(xmldoc->plugin->createExpression);
            std::vector<QString> types = SplitValues(xmldoc->plugin->exprInType);
            for (size_t i=0; i<types.size(); i++)
            {
                if      (types[i] == "mesh")
                    inOpVarTypeMesh->setChecked(true);
                else if (types[i] == "scalar")
                    inOpVarTypeScalar->setChecked(true);
                else if (types[i] == "vector")
                    inOpVarTypeVector->setChecked(true);
                else if (types[i] == "material")
                    inOpVarTypeMaterial->setChecked(true);
                else if (types[i] == "subset")
                    inOpVarTypeSubset->setChecked(true);
                else if (types[i] == "species")
                    inOpVarTypeSpecies->setChecked(true);
                else if (types[i] == "curve")
                    inOpVarTypeCurve->setChecked(true);
                else if (types[i] == "tensor")
                    inOpVarTypeTensor->setChecked(true);
                else if (types[i] == "symmetrictensor")
                    inOpVarTypeSymmetricTensor->setChecked(true);
                else if (types[i] == "label")
                    inOpVarTypeLabel->setChecked(true);
                else if (types[i] == "array")
                    inOpVarTypeArray->setChecked(true);
            }
            types = SplitValues(xmldoc->plugin->exprOutType);
            for (size_t i=0; i<types.size(); i++)
            {
                if      (types[i] == "mesh")
                    outOpVarTypeMesh->setChecked(true);
                else if (types[i] == "scalar")
                    outOpVarTypeScalar->setChecked(true);
                else if (types[i] == "vector")
                    outOpVarTypeVector->setChecked(true);
                else if (types[i] == "material")
                    outOpVarTypeMaterial->setChecked(true);
                else if (types[i] == "subset")
                    outOpVarTypeSubset->setChecked(true);
                else if (types[i] == "species")
                    outOpVarTypeSpecies->setChecked(true);
                else if (types[i] == "curve")
                    outOpVarTypeCurve->setChecked(true);
                else if (types[i] == "tensor")
                    outOpVarTypeTensor->setChecked(true);
                else if (types[i] == "symmetrictensor")
                    outOpVarTypeSymmetricTensor->setChecked(true);
                else if (types[i] == "label")
                    outOpVarTypeLabel->setChecked(true);
                else if (types[i] == "array")
                    outOpVarTypeArray->setChecked(true);
            }
            pluginType->setCurrentIndex(2);
        }
        else if (xmldoc->plugin->type == "database")
        {
            iconFile->setText("");
            hasIcon->setChecked(false);
            hasWriter->setChecked(xmldoc->plugin->haswriter);
            hasOptions->setChecked(xmldoc->plugin->hasoptions);
            filePatternsStrict->setChecked(xmldoc->plugin->filePatternsStrict);
            opensWholeDirectory->setChecked(xmldoc->plugin->opensWholeDirectory);

            pluginType->setCurrentIndex(3);
            filePatterns->setText(JoinValues(xmldoc->plugin->filePatterns, ' '));
            if      (xmldoc->plugin->dbtype == "STSD")
                dbType->setCurrentIndex(1);
            else if (xmldoc->plugin->dbtype == "MTSD")
                dbType->setCurrentIndex(2);
            else if (xmldoc->plugin->dbtype == "STMD")
                dbType->setCurrentIndex(3);
            else if (xmldoc->plugin->dbtype == "MTMD")
                dbType->setCurrentIndex(4);
            else if (xmldoc->plugin->dbtype == "Custom")
                dbType->setCurrentIndex(5);
        }
        else
        {
            iconFile->setText("");
            hasIcon->setChecked(false);
            hasWriter->setChecked(false);
            hasOptions->setChecked(false);
            enabledByDefault->setChecked(true);
            pluginType->setCurrentIndex(0);
        }
    }
    else
    {
        attpluginGroup->button(1)->setChecked(true);
        name->setText(xmldoc->attribute->name);
        label->setText("");
        version->setText("");
        varTypeMesh->setChecked(false);
        varTypeScalar->setChecked(false);
        varTypeVector->setChecked(false);
        varTypeMaterial->setChecked(false);
        varTypeSubset->setChecked(false);
        varTypeSpecies->setChecked(false);
        varTypeCurve->setChecked(false);
        varTypeTensor->setChecked(false);
        varTypeSymmetricTensor->setChecked(false);
        varTypeLabel->setChecked(false);
        varTypeArray->setChecked(false);
        hasIcon->setChecked(false);
        iconFile->setText("");
        hasWriter->setChecked(false);
        hasOptions->setChecked(false);
        pluginType->setCurrentIndex(0);
        dbType->setCurrentIndex(0);
        filePatterns->setText("");
        filePatternsStrict->setChecked(false);
        opensWholeDirectory->setChecked(false);
        enabledByDefault->setChecked(true);
    }

    UpdateWindowSensitivity();

    BlockAllSignals(false);
}
Пример #2
0
// ****************************************************************************
//  Method:  XMLEditMakefile::UpdateWindowContents
//
//  Purpose:
//    Update the window based on the current state.
//
//  Programmer:  Jeremy Meredith
//  Creation:    October 17, 2002
//
//  Modifications:
//    Sean Ahern, Fri Nov 15 15:25:23 PST 2002
//    Added "widget files" so we can have custom GUI elements.
//
//    Jeremy Meredith, Wed Jul  7 17:08:03 PDT 2004
//    Allow for mdserver-specific code in a plugin's source files.
//
//    Brad Whitlock, Fri Feb 23 17:49:59 PST 2007
//    Added viewer widgets.
//
//    Cyrus Harrison, Wed Mar  7 09:07:37 PST 2007
//    Allow for engine-specific code in a plugin's source files.
//
//    Cyrus Harrison, Fri Sep 19 13:58:39 PDT 2008
//    Added support for custom libs for gui,engine,mdserver, and viewer libs.
//
// ****************************************************************************
void
XMLEditMakefile::UpdateWindowContents()
{
    BlockAllSignals(true);

    if (xmldoc->docType == "Plugin")
    {
        Plugin *p = xmldoc->plugin;
        CXXFLAGS->setText(JoinValues(p->cxxflags, ' '));
        LDFLAGS->setText(JoinValues(p->ldflags, ' '));
        LIBS->setText(JoinValues(p->libs, ' '));
        // gui
        if (p->customgfiles)
            GFiles->setText(JoinValues(p->gfiles, ' '));
        else
            GFiles->setText(JoinValues(p->defaultgfiles, ' '));
        customGFiles->setChecked(p->customgfiles);
        // scripting
        if (p->customglibs)
            GLibs->setText(JoinValues(p->glibs, ' '));
        customGLibs->setChecked(p->customglibs);
        if (p->customsfiles)
            SFiles->setText(JoinValues(p->sfiles, ' '));
        else
            SFiles->setText(JoinValues(p->defaultsfiles, ' '));
        customSFiles->setChecked(p->customsfiles);
        // viewer
        if (p->customvfiles)
            VFiles->setText(JoinValues(p->vfiles, ' '));
        else
            VFiles->setText(JoinValues(p->defaultvfiles, ' '));
        customVFiles->setChecked(p->customvfiles);
        if (p->customvlibs)
            VLibs->setText(JoinValues(p->vlibs, ' '));
        customVLibs->setChecked(p->customvlibs);
        // mdserver
        if (p->custommfiles)
            MFiles->setText(JoinValues(p->mfiles, ' '));
        else
            MFiles->setText(JoinValues(p->defaultmfiles, ' '));
        customMFiles->setChecked(p->custommfiles);
        if (p->custommlibs)
            MLibs->setText(JoinValues(p->mlibs, ' '));
        customMLibs->setChecked(p->custommlibs);
        // engine
        if (p->customefiles)
            EFiles->setText(JoinValues(p->efiles, ' '));
        else
            EFiles->setText(JoinValues(p->defaultefiles, ' '));
        customEFiles->setChecked(p->customefiles);
        if (p->customelibsSer)
            ELibsSer->setText(JoinValues(p->elibsSer, ' '));
        customELibsSer->setChecked(p->customelibsSer);
        if (p->customelibsPar)
            ELibsPar->setText(JoinValues(p->elibsPar, ' '));
        customELibsPar->setChecked(p->customelibsPar);
        // widgets
        if (p->customwfiles)
            WFiles->setText(JoinValues(p->wfiles, ' '));
        else
            WFiles->setText(JoinValues(p->defaultwfiles, ' '));
        customWFiles->setChecked(p->customwfiles);
        // viewer widgets
        if (p->customvwfiles)
            VWFiles->setText(JoinValues(p->vwfiles, ' '));
        else
            VWFiles->setText("");
        customVWFiles->setChecked(p->customvwfiles);
        // engine spec code
        engSpecificCode->setChecked(p->hasEngineSpecificCode);
        // only allow mdserver-specific code if this is a database plugin
        if(xmldoc->plugin->type !="database")
            p->has_MDS_specific_code=false;

        mdSpecificCode->setChecked(p->has_MDS_specific_code);
    }
    else
    {
        mdSpecificCode->setChecked(false);
        engSpecificCode->setChecked(false);
    }

    UpdateWindowSensitivity();

    BlockAllSignals(false);
}