예제 #1
0
QWidget * QDialogFotoProperties::createFotoProperties()
{
	// Beschrijving

	QGroupBox *boxBeschr = new QGroupBox("Beschrijving");
	m_pBeschr = new QLineEdit("Dit is een foto!");
	QVBoxLayout *layoutBeschr = new QVBoxLayout(boxBeschr);
	layoutBeschr->addWidget(m_pBeschr);

	// Locatie

	QGroupBox *boxFoto = new QGroupBox("Locatie");
	m_pLocatie = new QLineEdit("C:\\");
	m_pLocatie->setMinimumWidth(300);
	
	QPushButton *btnBrowse = new QPushButton("Browse");
	QObject::connect(btnBrowse, SIGNAL(clicked()), this, SLOT(getNewLocation()));

	QVBoxLayout *layoutFoto = new QVBoxLayout(boxFoto);
	layoutFoto->addWidget(m_pLocatie);
	layoutFoto->addWidget(btnBrowse, 0, Qt::AlignRight);

	// Zet dit in een widget om te gebruiken een in tab

	QVBoxLayout *vbox = new QVBoxLayout();
	vbox->addWidget(boxBeschr, 0, Qt::AlignTop);
	vbox->addWidget(boxFoto, 0, Qt::AlignTop);

	QWidget *widget = new QWidget();
	widget->setLayout(vbox);

	// En geef deze widget nu terug

	return widget;
}
예제 #2
0
// Fills the trail array with the location ids of the last 6 turns
void getHistory(GameView currentView, PlayerID player,
        LocationID trail[TRAIL_SIZE])
{
    assert(currentView != NULL);
    assert(0 <= player && player < NUM_PLAYERS);
    assert(trail != NULL);

    int i;

    // last round this player made a move in
    Round lastRoundPlayed;
    if(getCurrentPlayer(currentView) > player) {
        // moved this round already
        lastRoundPlayed = getRound(currentView);
    } else {
        // haven't yet made a move this round
        lastRoundPlayed = getRound(currentView) - 1;
    }

    // iterate over past moves
    for(i=0;i<TRAIL_SIZE;i++) {
        // round we're considering
        Round curRound = (Round)(lastRoundPlayed-i);

        if(curRound >= FIRST_ROUND) {
            // number of the turn (NOT type Round since it's a turn not a round)
            int turnNo = (curRound * NUM_PLAYERS) + player;

            // pointer to the start of the play; some pointer arithmetic
            char *startOfPlay = (currentView->pastPlays) + 
                                (turnNo * CHARS_PER_PLAY_BLOCK);

            // get id from the abbreviation (located in the first two characters of
            // start of play and store it in the trail
            trail[i] = (LocationID)(getNewLocation(startOfPlay +
                                                   LOC_ABBREV_INDEX));
        } else {
            // no previous location
            trail[i] = UNKNOWN_LOCATION;
        }
//        D("trail for player %d: %d rounds ago: %d [round %d]\n",player, i, trail[i], curRound);
    }
}