Exemplo n.º 1
0
void AnalysisWidget::slotReconfigure()
{
    QString oldEngineName = ui.engineList->currentText();
    if(oldEngineName.isEmpty())
    {
        QString key = QString("/") + objectName() + "/Engine";
        oldEngineName = AppSettings->value(key).toString();
    }

    EngineList enginesList;
    enginesList.restore();
    QStringList names = enginesList.names();
    ui.engineList->clear();
    ui.engineList->insertItems(0,	names);
    int index = names.indexOf(oldEngineName);
    if(index != -1)
    {
        ui.engineList->setCurrentIndex(index);
    }
    else
    {
        ui.engineList->setCurrentIndex(0);
        stopEngine();
    }

    int fontSize = AppSettings->getValue("/General/ListFontSize").toInt();
    QFont f = ui.variationText->font();
    f.setPointSize(fontSize);
    setFont(f);
    ui.variationText->setFont(f);
}
Exemplo n.º 2
0
bool PlayGameEngine::createEngine_()
{
    SB_PLAY_DEBUG("PlayGameEngine::createEngine_()");

    stopBetweenMoves_ = AppSettings->getValue("/PlayGame/restartEngineBetweenMoves").toBool();

    if (engine_)
        destroyEngine_();

    EngineList elist;
    elist.restore();

    int i = elist.names().indexOf(name_);
    if (i >= 0)
    {
        engine_ = Engine::newEngine(i);

        connect(engine_, SIGNAL(activated()), SLOT(engineActivated_()));
        connect(engine_, SIGNAL(readyOk()), SLOT(engineReadyOk_()));
        connect(engine_, SIGNAL(error(QProcess::ProcessError)),
                        SLOT(engineError_(QProcess::ProcessError)));
        connect(engine_, SIGNAL(deactivated()), SLOT(engineDeactivated_()));
        connect(engine_, SIGNAL(analysisUpdated(Analysis)),
                                    SLOT(engineAnalysis_(const Analysis&)));
        connect(engine_, SIGNAL(bestMoveSend(SHATRA::Move)),
                        SLOT(engineBestMove_(SHATRA::Move)));

        // debug
        if (engineDebug_)
        {
            connect(engine_, SIGNAL(engineDebug(Engine*,Engine::DebugType,QString)),
                    engineDebug_, SLOT(slotEngineDebug(Engine*,Engine::DebugType,QString)));
        }
        connect(engine_, SIGNAL(engineDebug(Engine*,Engine::DebugType,QString)),
                         SIGNAL(engineDebug(Engine*,Engine::DebugType,QString)));

        //if (!stopBetweenMoves_)
            engine_->activate();

        SB_PLAY_DEBUG("PlayGameEngine::createEngine_(): created Engine " << name_);
        return true;
    }
    else
    {
        SB_PLAY_DEBUG("PlayGameEngine::createEngine_(): unknown Engine name " << name_);
        return false;
    }
}