void LIB_MANAGER_ADAPTER::Sync( bool aForce, std::function<void(int, int, const wxString&)> aProgressCallback )
{
    wxLongLong nextUpdate = wxGetUTCTimeMillis() + (PROGRESS_INTERVAL_MILLIS / 2);

    int libMgrHash = m_libMgr->GetHash();

    if( !aForce && m_lastSyncHash == libMgrHash )
        return;

    m_lastSyncHash = libMgrHash;
    int i = 0, max = GetLibrariesCount();

    // Process already stored libraries
    for( auto it = m_tree.Children.begin(); it != m_tree.Children.end(); /* iteration inside */ )
    {
        const wxString& name = it->get()->Name;

        if( wxGetUTCTimeMillis() > nextUpdate )
        {
            aProgressCallback( i, max, name );
            nextUpdate = wxGetUTCTimeMillis() + PROGRESS_INTERVAL_MILLIS;
        }

        if( !m_libMgr->LibraryExists( name, true ) )
        {
            it = deleteLibrary( it );
            continue;
        }
        else if( m_libMgr->GetLibraryHash( name ) != m_libHashes[name] )
        {
            updateLibrary( *(CMP_TREE_NODE_LIB*) it->get() );
        }

        ++it;
        ++i;
    }

    // Look for new libraries
    for( const auto& libName : m_libMgr->GetLibraryNames() )
    {
        if( m_libHashes.count( libName ) == 0 )
        {
            if( wxGetUTCTimeMillis() > nextUpdate )
            {
                aProgressCallback( i++, max, libName );
                nextUpdate = wxGetUTCTimeMillis() + PROGRESS_INTERVAL_MILLIS;
            }

            SYMBOL_LIB_TABLE_ROW* library = m_libMgr->GetLibrary( libName );

            auto& lib_node = m_tree.AddLib( libName, library->GetDescr() );
            updateLibrary( lib_node );
            m_tree.AssignIntrinsicRanks();
        }
    }
}
void Foam::codedFixedValueFvPatchField<Type>::evaluate
(
    const Pstream::commsTypes commsType
)
{
    // Make sure library containing user-defined fvPatchField is up-to-date
    updateLibrary(redirectType_);

    const fvPatchField<Type>& fvp = redirectPatchField();

    const_cast<fvPatchField<Type>&>(fvp).evaluate(commsType);

    fixedValueFvPatchField<Type>::evaluate(commsType);
}
void Foam::codedFixedValuePointPatchField<Type>::evaluate
(
    const Pstream::commsTypes commsType
)
{
    // Make sure library containing user-defined pointPatchField is up-to-date
    updateLibrary(name_, context_);

    const pointPatchField<Type>& fvp = redirectPatchField();

    const_cast<pointPatchField<Type>&>(fvp).evaluate(commsType);

    fixedValuePointPatchField<Type>::evaluate(commsType);
}
void Foam::fv::CodedSource<Type>::correct
(
    GeometricField<Type, fvPatchField, volMesh>& field
)
{
    if (debug)
    {
        Info<< "CodedSource<"<< pTraits<Type>::typeName
            << ">::correct for source " << name_ << endl;
    }

    updateLibrary(name_);
    redirectFvOption().correct(field);
}
Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
(
    const fvPatch& p,
    const DimensionedField<Type, volMesh>& iF,
    const dictionary& dict
)
:
    fixedValueFvPatchField<Type>(p, iF, dict),
    codedBase(),
    dict_(dict),
    redirectType_(dict.lookup("redirectType")),
    redirectPatchFieldPtr_()
{
    updateLibrary(redirectType_);
}
void Foam::fv::CodedSource<Type>::constrain
(
    fvMatrix<Type>& eqn,
    const label fieldi
)
{
    if (debug)
    {
        Info<< "CodedSource<"<< pTraits<Type>::typeName
            << ">::constrain for source " << name_ << endl;
    }

    updateLibrary(name_);
    redirectFvOption().constrain(eqn, fieldi);
}
void Foam::fv::CodedSource<Type>::addSup
(
    const volScalarField& rho,
    fvMatrix<Type>& eqn,
    const label fieldi
)
{
    if (debug)
    {
        Info<< "CodedSource<"<< pTraits<Type>::typeName
            << ">::addSup for source " << name_ << endl;
    }

    updateLibrary(name_);
    redirectFvOption().addSup(rho, eqn, fieldi);
}
Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
(
    const pointPatch& p,
    const DimensionedField<Type, pointMesh>& iF,
    const dictionary& dict,
    const bool valueRequired
)
:
    fixedValuePointPatchField<Type>(p, iF, dict, valueRequired),
    codedBase(),
    dict_(dict),
    redirectType_(dict.lookup("redirectType")),
    redirectPatchFieldPtr_()
{
    updateLibrary(redirectType_);
}
Ejemplo n.º 9
0
void Foam::codedMixedFvPatchField<Type>::evaluate
(
    const Pstream::commsTypes commsType
)
{
    // Make sure library containing user-defined fvPatchField is up-to-date
    updateLibrary(name_);

    const mixedFvPatchField<Type>& fvp = redirectPatchField();

    // - updates the value of fvp (though not used)
    // - resets the updated() flag
    const_cast<mixedFvPatchField<Type>&>(fvp).evaluate(commsType);

    // Update the value (using the coefficients) locally
    mixedFvPatchField<Type>::evaluate(commsType);
}
Ejemplo n.º 10
0
Foam::codedFunctionObject::codedFunctionObject
(
    const word& name,
    const Time& time,
    const dictionary& dict
)
:
    functionObject(name),
    codedBase(),
    time_(time),
    dict_(dict)
{
    read(dict_);

    updateLibrary(name_);
    redirectFunctionObject();
}
void Foam::codedFixedValueFvPatchField<Type>::updateCoeffs()
{
    if (this->updated())
    {
        return;
    }

    // Make sure library containing user-defined fvPatchField is up-to-date
    updateLibrary(redirectType_);

    const fvPatchField<Type>& fvp = redirectPatchField();

    const_cast<fvPatchField<Type>&>(fvp).updateCoeffs();

    // Copy through value
    this->operator==(fvp);

    fixedValueFvPatchField<Type>::updateCoeffs();
}
Ejemplo n.º 12
0
Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
(
    const fvPatch& p,
    const DimensionedField<Type, volMesh>& iF,
    const dictionary& dict
)
:
    mixedFvPatchField<Type>(p, iF, dict),
    codedBase(),
    dict_(dict),
    name_
    (
        dict.found("redirectType")
      ? dict.lookup("redirectType")
      : dict.lookup("name")
    ),
    redirectPatchFieldPtr_()
{
    updateLibrary(name_);
}
Ejemplo n.º 13
0
void Foam::codedMixedFvPatchField<Type>::updateCoeffs()
{
    if (this->updated())
    {
        return;
    }

    // Make sure library containing user-defined fvPatchField is up-to-date
    updateLibrary(name_);

    const mixedFvPatchField<Type>& fvp = redirectPatchField();

    const_cast<mixedFvPatchField<Type>&>(fvp).updateCoeffs();

    // Copy through coefficients
    this->refValue() = fvp.refValue();
    this->refGrad() = fvp.refGrad();
    this->valueFraction() = fvp.valueFraction();

    mixedFvPatchField<Type>::updateCoeffs();
}
FriendsLibraryDialog::FriendsLibraryDialog(QWidget *parent)
    : QWidget(parent) {
    /* Invoke the Qt Designer generated object setup routine */
    ui.setupUi(this);

    connect(ui.updateLibraryButton, SIGNAL(clicked()), this, SLOT(updateLibrary()));
    connect(librarymixerconnect, SIGNAL(downloadedFriendsLibrary()), this, SLOT(updatedLibrary()), Qt::QueuedConnection);

    /* Setup LibraryFriendModel */
    LibraryFriendModel* libraryFriendModel = new LibraryFriendModel(ui.libraryList, this);
    LibrarySearchModel* librarySearchModel = new LibrarySearchModel(ui.searchBar, this);
    librarySearchModel->setSourceModel(libraryFriendModel);
    ui.libraryList->setModel(librarySearchModel);

    /* Setup OffLMFriendModel */
    OffLMFriendModel* friendModel = new OffLMFriendModel(ui.offLMList, this);
    OffLMSearchModel* searchableFriendModel = new OffLMSearchModel(ui.searchBar, this);
    searchableFriendModel->setSourceModel(friendModel);
    friendModel->setContainingSearchModel(searchableFriendModel);
    ui.offLMList->setModel(searchableFriendModel);
}
Ejemplo n.º 15
0
bool CProject::update()
{
	if (!isValid())
		return false;

	settingsFileInfo.refresh();
	if (lastUpdateTime >= settingsFileInfo.lastModified()) {
		return true;
	}

	updateStr();
	updateInclude();
	updateLibrary();
	updateLdPath();
	updateMainSources();
	updateMainSourceDepend();
	updateTargets();
	lastUpdateTime = settingsFileInfo.lastModified();
	emit updated(nameStr);

	return true;
}
Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
(
    const pointPatch& p,
    const DimensionedField<Type, pointMesh>& iF,
    const dictionary& dict,
    const bool valueRequired
)
:
    fixedValuePointPatchField<Type>(p, iF, dict, valueRequired),
    codedBase(),
    dict_(dict),
    name_
    (
        dict.found("redirectType")
      ? dict.lookup("redirectType")
      : dict.lookup("name")
    ),
    redirectPatchFieldPtr_()
{
    // Compilation options
    context_.addFilterVariable(false, dict, "codeOptions");
    context_.addFilterVariable(false, dict, "codeLibs");

    // From looking through the fixedValuePointPatchFieldTemplate*[CH] :
    context_.addFilterVariables
    (
        dynamicCode::resolveTemplate(codeTemplateC),
        dict
    );
    context_.addFilterVariables
    (
        dynamicCode::resolveTemplate(codeTemplateH),
        dict
    );

    updateLibrary(name_, context_);
}
Ejemplo n.º 17
0
bool Foam::codedFunctionObject::end()
{
    updateLibrary(name_);
    return redirectFunctionObject().end();
}
Ejemplo n.º 18
0
bool Foam::codedFunctionObject::execute(const bool forceWrite)
{
    updateLibrary();
    return redirectFunctionObject().execute(forceWrite);
}
Ejemplo n.º 19
0
bool Foam::codedFunctionObject::start()
{
    updateLibrary();
    return redirectFunctionObject().start();
}
Ejemplo n.º 20
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    itptr=new SLangWrapper();

    waitImgs << ":/progress/prog0.png"
             << ":/progress/prog1.png"
             << ":/progress/prog2.png"
             << ":/progress/prog3.png"
             << ":/progress/prog4.png"
             << ":/progress/prog5.png"
             << ":/progress/prog6.png"
             << ":/progress/prog7.png";



    waitTimer = new QTimer(this);
    waitTimer->setInterval(100);
    waitTimer->setSingleShot(false);

    connect(waitTimer,SIGNAL(timeout()),this,SLOT(onProgressTimerTick()));


    connect(itptr,SIGNAL(executionStarted()),this,SLOT(onScriptRunning()));
    connect(itptr,SIGNAL(executionEnded()),this,SLOT(onScriptStoped()));
    connect(ui->lwApi,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(on_pbExecute_clicked()));

    ce = new CodeEditor(this);

    ui->wtPanel->insertTab(1,ce,tr("Code"));
    ui->wtPanel->setCurrentIndex(0);

    codeFileManager = new CodeFile(this);

    connect(codeFileManager,SIGNAL(setFilenameIndicator(QString)),this,SLOT(onFilenameIndicatorChanged(QString)));


    PlaneTextConsoleInterface * cis = new PlaneTextConsoleInterface();

    cis->setParent(this);

    cis->setPlaneTextEdit(ui->consoleView);
    cis->setProgressBar(ui->progressBar);

    itptr->setConsoleInterface(cis);
    ci=cis;


    hfm = new HexFilesMenager(this);

    hfm->setTabWidget(ui->twHex);
    hfm->setInfoLine(ui->hexInfoLine);

    itptr->setMemoryInterface(hfm);

    imp = new ImportExportMenager(this);
    imp->setHexFilesMenager(hfm);
    imp->setConsoleInterfaceMenager(ci);

    onScriptStoped();

    driverWindow = new DriverDialog(this);
    driverWindow->setModal(true);

    cis->print("Hardware configuration:\n");
    cis->print("COM port: "+driverWindow->getCurrentComPort()->description()+"\n");
    cis->print("LPT port: "+driverWindow->getCurrentLptPort()->description()+"\n");
    cis->print("I2C port: "+driverWindow->getCurrentI2cPort()->description()+"\n");

    optionWindow = new OptionsDialog(this);
    optionWindow->setModal(true);


    codeFileManager->setCodeEditor(ce);
    codeFileManager->setSelectTreeWidget(ui->twScriptCatalog);
    connect(optionWindow,SIGNAL(updateScriptLibrary(QStringList)),codeFileManager,SLOT(updateLibrary(QStringList)));
    optionWindow->sendPathList();


    //connect(ti,SIGNAL(addPageSignal(QByteArray,QString)),this,SLOT(addNewHexPage(QByteArray,QString)));
    //connect(ti,SIGNAL(overwritePageSignal(QByteArray*)),this,SLOT(overwriteHexPage(QByteArray*)),Qt::QueuedConnection);

    connect(hfm,SIGNAL(enableFilePrcessing(bool)),ui->menuHex,SLOT(setEnabled(bool)));

    connect(ce,SIGNAL(textChanged()),this,SLOT(scriptChanged()));


    use_settings;



    if (settings.value("saveGui",0).toInt()==2)
    {

    settings.beginGroup("Window");
    this->setGeometry(settings.value("Geometry",this->geometry()).toRect());
    this->restoreState(settings.value("State",this->saveState()).toByteArray());
    settings.endGroup();

    }




    installEventFilter(this);


    helpWindow = new HelpWindow(this);
    emit hexPageCountChange();


}
Ejemplo n.º 21
0
bool Foam::codedFunctionObject::timeSet()
{
    updateLibrary(redirectType_);
    return redirectFunctionObject().timeSet();
}