void manager::showTreeGame() {
    std::cout << "showTreeGame()" << std::endl;

//    std::string out = tree_.Print();
    if (gameTreeView) {
        gameTreeView->raise();
        gameTreeView->activateWindow();
        return;
    }
    //create new window
//    std::string out = tree_.Print();
    std::cout << "GTREE" << std::endl
              << tree_.Print()
              << std::endl
              << "END" << std::endl;
    gameTreeView = new GAME_View(tree_);

//    connect();
//    connect();
    connect(this, SIGNAL(movePlayed()), gameTreeView, SLOT(updateTree()));
    connect(gameTreeView, SIGNAL(moveChanged()), this, SLOT(changeCurrent()));
    connect(gameTreeView, SIGNAL(finished(int)), this, SLOT(closeTreeGame()));

    gameTreeView->show();
}
Example #2
0
void ChessGame::stop(bool emitMoveChanged)
{
	if (m_finished)
		return;

	m_finished = true;
	emit humanEnabled(false);
	if (!m_gameInProgress)
	{
		m_result = Chess::Result();
		finish();
		return;
	}
	
	initializePgn();
	m_gameInProgress = false;
	const QVector<PgnGame::MoveData>& moves(m_pgn->moves());
	int plies = moves.size();

	m_pgn->setTag("PlyCount", QString::number(plies));
	m_pgn->setResult(m_result);
	m_pgn->setResultDescription(m_result.description());

	if (emitMoveChanged && plies > 1)
	{
		const PgnGame::MoveData& md(moves.at(plies - 1));
		emit moveChanged(plies - 1, md.move, md.moveString, md.comment);
	}

	m_player[Chess::Side::White]->endGame(m_result);
	m_player[Chess::Side::Black]->endGame(m_result);

	connect(this, SIGNAL(playersReady()), this, SLOT(finish()), Qt::QueuedConnection);
	syncPlayers();
}
Example #3
0
void QDeclarativeBasePositioner::setMove(QDeclarativeTransition *mt)
{
    Q_D(QDeclarativeBasePositioner);
    if (mt == d->moveTransition)
        return;
    d->moveTransition = mt;
    emit moveChanged();
}