Пример #1
0
EditWidget::EditWidget( QWidget * parent, const char * name )
: QWidget( parent )
{
	setWindowTitle( QString ( name ));
	
	_listBox = new QListWidget( this );

	_pbAdd = new QPushButton( this );
	_pbAdd->setText( tr( "Add" ) );
	FIXEDSIZE( _pbAdd );

	_pbEdit = new QPushButton( this );
	_pbEdit->setText( tr("Edit")  );
	FIXEDSIZE( _pbEdit );

	_pbDel = new QPushButton( this );
	_pbDel->setText( tr( "Del" ) );
	FIXEDSIZE( _pbDel );

	QGridLayout * layout = new QGridLayout( this );
	layout->setRowStretch( 3, 1 );
	layout->setColumnStretch( 0, 1 );
	layout->addWidget( _listBox, 0, 0, 3, 0 );
	layout->addWidget( _pbAdd, 0, 1 );
	layout->addWidget( _pbEdit, 1, 1 );
	layout->addWidget( _pbDel, 2, 1 );

	layout->activate();

}
Пример #2
0
QuestEditor::QuestEditor( QWidget * parent, const char * name )
: QDialog( parent )
{
	setWindowTitle( QString ( name ));
	_quest = 0;

	_name = new AskString( tr( "Name: " ), this );
	_description = new AskString( tr( "Description: " ), this );
	_type = new AskCombo( tr( "Type: " ), this );
	_type->insertItem( Quest::getTypeName( Quest::ONLY_ONE ) );
	_type->insertItem( Quest::getTypeName( Quest::ONE_PERPLAYER ) );
	_type->insertItem( Quest::getTypeName( Quest::ONE_PERLORD ) );
	_type->insertItem( Quest::getTypeName( Quest::ANYONE ) );
	_needConfirmation = new AskBool( tr( "Ask player confirmation of quest" ), this );
	_confirmationQuestion = new AskString( tr( "Confirmation question: " ), this );

	QPushButton * pbOk = new QPushButton( this );
	pbOk->setText( tr( "Ok" ) );
	FIXEDSIZE( pbOk );

	QPushButton * pbCancel = new QPushButton( this );
	pbCancel->setText( tr( "Cancel" ) );
	FIXEDSIZE( pbCancel );

	QHBoxLayout * layH = new QHBoxLayout();
	layH->addStretch( 1 );
	layH->addWidget( pbOk );
	layH->addStretch( 1 );
	layH->addWidget( pbCancel );
	layH->addStretch( 1 );

	_editStartCondition = new QuestConditionEditor( this );
	_editStartCondition->setTitle( tr( "Start condition: " ) );

	_editFailCondition = new QuestConditionEditor( this );
	_editFailCondition->setTitle( tr( "Fail condition: " ) );

	_editSuccessCondition = new QuestConditionEditor( this );
	_editSuccessCondition->setTitle( tr( "Success condition: " ) );

	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->setMargin( 5 );
	layout->setSpacing( 5 );
	layout->addWidget( _name );
	layout->addWidget( _description );
	layout->addWidget( _type );
	layout->addWidget( _needConfirmation );
	layout->addWidget( _confirmationQuestion );
	layout->addWidget( _editStartCondition );
	layout->addWidget( _editFailCondition );
	layout->addWidget( _editSuccessCondition );
	layout->addStretch( 1 );
	layout->addLayout( layH );
	layout->activate();

	connect( pbOk, SIGNAL( clicked() ), SLOT( accept() ) );
	connect( pbCancel, SIGNAL( clicked() ), SLOT( reject() ) );
	connect( _needConfirmation, SIGNAL( sig_changed() ), SLOT( slot_confirmation() ) );
	slot_confirmation();
}
Пример #3
0
DisplayArtefacts::DisplayArtefacts( Player * player, QWidget * parent, const char * /* name */ )
	: QFrame( parent )
{
	_player = player;
	_index = 0;
	uint i;

	QPalette palette;
	palette.setBrush(backgroundRole(), QBrush(QPixmap(IMAGE_PATH + "misc/artefactLord.png")));
	setPalette(palette);

	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->setMargin( 5 );
	layout->addStretch( 1 );

	QHBoxLayout * layH1 = new QHBoxLayout();

	QPushButton * pb1 = new QPushButton( this );
	pb1->setText( "<" );
	FIXEDSIZE( pb1 );
	layH1->addWidget( pb1 );

/// XXX : to remove cause use the old api for artefacts (no more used), leave it as example for a new
	/// function that match new api...
/*
	/// WIN: was "_used = new (IconArtefact *) [DataTheme.specifications.getArtefactNumber()];"
	_used = new IconArtefact * [DataTheme.specifications.getArtefactNumber()];
	SpecificationArtefact * temp;

	for( i = 0; i < DataTheme.specifications.getArtefactNumber(); i++ ) {
		temp = DataTheme.specifications.getArtefact( i );
		//_used[i] = new IconArtefact( this );
		//_used[i]->move( temp->getX(), temp->getY() );
	}
*/
	layH1->addStretch( 1 );

	for( i = 0; i < 3; i++ ) {
		_ico[i] = new IconArtefact( this );
		_ico[i]->clear();
		layH1->addWidget( _ico[i] );
	}

	layH1->addStretch( 1 );
	QPushButton * pb2 = new QPushButton( this );
	pb2->setText( ">" );
	FIXEDSIZE( pb2 );
	layH1->addWidget( pb2 );

	layout->addLayout( layH1 );

	layout->activate();

	connect( pb1, SIGNAL( clicked() ), SLOT( slot_prevArtefact() ) );
	connect( pb2, SIGNAL( clicked() ), SLOT( slot_nextArtefact() ) );
}
Пример #4
0
ServerWidget::ServerWidget( QWidget * parent, const char * name )
	: QWidget( parent, name )
{
	_group = new QVButtonGroup( this );

	QRadioButton * radio1 = new QRadioButton( _group );
	radio1->setText( "Demo 1 player" );
	radio1->setChecked( true );

	QRadioButton * radio2 = new QRadioButton( _group );
	radio2->setText( "Demo 2 players" );

	_radio3 = new ChooseFileRadioButton( _group );
	_radio3->slot_toggle( false );

	_playerList = new QListView( this );
	_playerList->addColumn( "Name" );
	_playerList->addColumn( "Address" );
	_playerList->setMinimumHeight( 50 );

	_groupBottom = new QHButtonGroup( this );

	QPushButton * butStart = new QPushButton( _groupBottom );
	butStart->setText( "Start" );
	FIXEDSIZE( butStart );

	QPushButton * butStop = new QPushButton( _groupBottom );
	butStop->setText( "Save" );
	FIXEDSIZE( butStop );

	QPushButton * butSave = new QPushButton( _groupBottom );
	butSave->setText( "End" );
	FIXEDSIZE( butSave );

	_groupBottom->find( 0 )->setEnabled( true );
	_groupBottom->find( 1 )->setEnabled( false );
	_groupBottom->find( 2 )->setEnabled( false );

	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->addWidget( _group );
	layout->addSpacing( 5 );
	layout->addWidget( _playerList, 1 );
	layout->addSpacing( 5 );
	layout->addWidget( _groupBottom );
	layout->activate();

	connect( _groupBottom, SIGNAL( clicked( int ) ), SLOT( slot_choice( int ) ) );
}
Пример #5
0
EditTroop::EditTroop( int num, QWidget * parent, const char * /* name*/ )
	: QFrame( parent )
{
	_unit = 0;
	setFrameStyle( QFrame::Panel | QFrame::Raised );
	
	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->setMargin( 5 );
	layout->setSpacing( 5 );
	
	QLabel * label = new QLabel( this );
	label->setText(  "Unit " + QString::number( num )  );
	FIXEDSIZE( label );
	layout->addWidget( label );

	_race = new AskCombo( tr( "Race : " ), this );
	_race->setCurrentItem( 0 );
	layout->addWidget( _race );

	_name = new AskCombo( tr( "Name : " ), this );
	layout->addWidget( _name );

	_number = new AskInt( tr( "Number : " ), this );
	layout->addWidget( _number );
	
	layout->addStretch( 1 );
	layout->activate();
	
	updateData();
	
	connect( _race, SIGNAL( sig_activated( int ) ), SLOT( slot_raceChanged( int ) ) );
}
Пример #6
0
void PresentationWidget::initLords( GenericLord * lordLeft, GenericLord * lordRight )
{
	_photoLeft->setPixmap( * ImageTheme.getLordPixmap( lordLeft->getId() ) );

	_photoRight->setPixmap( * ImageTheme.getLordPixmap( lordRight->getId() ) );

	QString title;
	title.sprintf( "Lord %s\nLevel %d of %s", lordLeft->getName().latin1(),
		       lordLeft->getLevel(), lordLeft->getCategoryName().latin1() );
	_titleLeft->setText( title );
	FIXEDSIZE( _titleLeft );

	title.sprintf( "Lord %s\nLevel %d of %s", lordRight->getName().latin1(),
		       lordRight->getLevel(), lordRight->getCategoryName().latin1() );
	_titleRight->setText( title );
	FIXEDSIZE( _titleRight );
}
Пример #7
0
PropertiesEvent::PropertiesEvent( GenericEvent * event, QWidget * parent, const char * /* name */ )
: QDialog( parent, Qt::Dialog )
{
	_event = event;

	createContentView();

	QPushButton * pbCondition = new QPushButton( this );
	pbCondition->setText( tr( "Condition" ) );
	FIXEDSIZE( pbCondition );

	QHBoxLayout * layH1 = new QHBoxLayout();
	layH1->addStretch( 1 );
	layH1->addWidget( pbCondition );
	layH1->addStretch( 1 );

	QPushButton * pbCan = new QPushButton( this );
	pbCan->setText( tr( "Cancel" ) );
	FIXEDSIZE( pbCan );

	QPushButton * pbOk = new QPushButton( this );
	pbOk->setText( tr( "Ok" ) );
	FIXEDSIZE( pbOk );

	QHBoxLayout * layH2 = new QHBoxLayout();
	layH2->addStretch( 1 );
	layH2->addWidget( pbCan );
	layH2->addStretch( 1 );
	layH2->addWidget( pbOk );
	layH2->addStretch( 1 );

	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->setSpacing( 5 );
	layout->setMargin( 5 );
	layout->addWidget( _content, 1 );
	layout->addLayout( layH1 );
	layout->addLayout( layH2 );
	layout->activate();

	connect( pbOk, SIGNAL( clicked() ), SLOT( slot_accept() ) );
	connect( pbCan, SIGNAL( clicked() ), SLOT( reject() ) );
}
Пример #8
0
void PropertiesBonus::displayResource()
{
	QLabel * labResource = new QLabel( this );
	labResource->setText( tr( "Resource: " ) + DataTheme.resources.getRessource( _bonus->getParam( 0 ) ) );
	FIXEDSIZE( labResource );

	_fixed = new AskInt( tr( "Fixed value: " ), this );
	_fixed->setMinValue( 0 );
	_fixed->setMaxValue( 10000 );
	_fixed->setValue( _bonus->getParam( 2 ) );
	FIXEDSIZE( _fixed );

	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->setMargin( 5 );
	layout->setSpacing( 5 );
	layout->addWidget( labResource );
	layout->addWidget( _fixed );
	layout->addStretch( 1 );
	layout->activate();
}
Пример #9
0
AskChest::AskChest()
: QDialog( 0, Qt::Dialog )
{
	_result = 0;
	
	QLabel * chooseLabel = new QLabel( this );
	chooseLabel->setText( tr( "Choose between earning Gold or Experience" ) );
	FIXEDSIZE( chooseLabel );
	
	QLabel * goldLabel = new QLabel(this);
	goldLabel->setText( QString::number( 1000 ) );
	
	QLabel * experienceLabel = new QLabel(this);
	experienceLabel->setText( QString::number( 2500 ) );
	
	QPushButton * goldButton = new QPushButton( this );
	goldButton->setText( tr( "Gold" ) );
	FIXEDSIZE( goldButton );
	
	QPushButton * experienceButton = new QPushButton( this );
	experienceButton->setText( tr( "Experience" ) );
	FIXEDSIZE( experienceButton );
	
	Icon * goldIcon = new Icon( this );
	goldIcon->setPixmap( QPixmap( *ImageTheme.getResourceIcon( 0 ) ) );
	
	Icon * experienceIcon = new Icon( this );
	experienceIcon->setPixmap( QPixmap(  *ImageTheme.getWidgetPixmap( ICO_EXPERIENCE ) ) );
	
	QGridLayout * layout = new QGridLayout(this);
	layout->addWidget(chooseLabel, 0, 0, 1, 2, Qt::AlignHCenter);
	layout->addWidget(goldIcon, 1, 0, Qt::AlignHCenter);
	layout->addWidget(experienceIcon, 1, 1, Qt::AlignHCenter);
	layout->addWidget(goldLabel, 2, 0, Qt::AlignHCenter);
	layout->addWidget(experienceLabel, 2, 1, Qt::AlignHCenter);
	layout->addWidget(goldButton, 3, 0, Qt::AlignHCenter);
	layout->addWidget(experienceButton, 3, 1, Qt::AlignHCenter);

	connect( goldButton, SIGNAL( clicked() ), SLOT( slot_gold() ) );
	connect( experienceButton, SIGNAL( clicked() ), SLOT( slot_experience() ) );
}
Пример #10
0
FillDialog::FillDialog( QWidget * parent, const char * name )
	:QDialog( parent, name, true )
{
	setCaption( "Choose tile" );
	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->setMargin( 5 );
	
	_combo = new QComboBox( this );
	for( uint i = 0; i < DataTheme.tiles.count(); i++ ) {
		QString name = QString::number( i ) + " - " + DataTheme.tiles.at( i )->getName();
		_combo->insertItem( name, i );
	}
	FIXEDSIZE( _combo );
	layout->addWidget( _combo );
	
	QHBoxLayout * layH1 = new QHBoxLayout();
	layH1->setMargin( 5 );
	layH1->addStretch( 1 );
	
	QPushButton * pb1 = new QPushButton( this );
	pb1->setText( "Ok" );
	FIXEDSIZE( pb1 );
	layH1->addWidget( pb1 );
	layH1->addStretch( 1 );
	
	QPushButton * pb2 = new QPushButton( this );
	pb2->setText( "Cancel" );
	FIXEDSIZE( pb2 );
	layH1->addWidget( pb2 );
	layH1->addStretch( 1 );
	
	layout->addStretch( 1 );
	layout->addLayout( layH1 );
	
	layout->activate();
	
	//setFixedSize();
	connect( pb1, SIGNAL( clicked() ), SLOT( accept() ) );
	connect( pb2, SIGNAL( clicked() ), SLOT( reject() ) );
}
Пример #11
0
SelectionWidget::SelectionWidget( QWidget * parent, const char * /*name*/ )
	: QFrame( parent )
{	
	QHBoxLayout * layout = new QHBoxLayout( this );
	setFrameStyle( QFrame::Box | QFrame::Raised );
	
	layout->addSpacing( 5 );
	
	QPushButton * butFirst = new QPushButton( "|<", this );
	FIXEDSIZE( butFirst );
	layout->addWidget( butFirst );
	
	QPushButton * butPrevious = new QPushButton( "<", this );
	FIXEDSIZE( butPrevious );
	layout->addWidget( butPrevious );
	layout->addSpacing( 5 );
	
	_labTitle = new QLabel( tr( "None" ), this );
	FIXEDSIZE( _labTitle );
	layout->addWidget( _labTitle );
	layout->addSpacing( 5 );
	
	QPushButton * butNext = new QPushButton( ">", this );
	FIXEDSIZE( butNext );
	layout->addWidget( butNext );

	QPushButton * butLast = new QPushButton( ">|", this );
	FIXEDSIZE( butLast );
	layout->addWidget( butLast );
	
	layout->addSpacing( 5 );
	layout->addStretch( 1 );
	
	QPushButton * butNew = new QPushButton( "New" , this );
	FIXEDSIZE( butNew );
	layout->addWidget( butNew );
	layout->addSpacing( 5 );
	
	QPushButton * butDel = new QPushButton( "Del", this );
	FIXEDSIZE( butDel );
	layout->addWidget( butDel );
	
	layout->addSpacing( 5 );
	layout->activate();
	
	setMinimumHeight( 40 );
	
	connect( butFirst, SIGNAL( clicked() ), SIGNAL( sig_first() ) );
	connect( butPrevious, SIGNAL( clicked() ), SIGNAL( sig_previous() ) );
	connect( butNext, SIGNAL( clicked() ), SIGNAL( sig_next() ) );
	connect( butLast, SIGNAL( clicked() ), SIGNAL( sig_last() ) );
	connect( butNew, SIGNAL( clicked() ), SIGNAL( sig_new() ) );
	connect( butDel, SIGNAL( clicked() ), SIGNAL( sig_del() ) );
}
Пример #12
0
void PropertiesBonus::displaySpell()
{
	QLabel * lab = new QLabel( this );
	lab->setText( tr( "Bonus for spells are not yet implemented" ) );
	FIXEDSIZE( lab );

	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->setMargin( 5 );
	layout->setSpacing( 5 );
	layout->addWidget( lab );
	layout->addStretch( 1 );
	layout->activate();
}
Пример #13
0
DisplayLordTabArtefacts::DisplayLordTabArtefacts( GenericPlayer * player, QWidget * parent, const char * /* name */)
: QWidget( parent )
{
	_player = player;
	_index = 0;
	uint i;

	QPushButton * pb1 = new QPushButton( this );
	pb1->setText( "<" );
	FIXEDSIZE( pb1 );

	QPushButton * pb2 = new QPushButton( this );
	pb2->setText( ">" );
	FIXEDSIZE( pb2 );

	QHBoxLayout * layH1 = new QHBoxLayout();
	layH1->addStretch( 1 );
	layH1->addWidget( pb1 );
	
	for( i = 0; i < 4; i++ ) {
		_ico[i] = new IconArtefact( this );
		_ico[i]->clear();
		layH1->addWidget( _ico[i] );
	}

	layH1->addWidget( pb2 );
	layH1->addStretch( 1 );
	
	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->setMargin( 5 );
	layout->setSpacing( 5 );
	layout->addLayout( layH1 );
	layout->addStretch( 1 );
	layout->activate();

	connect( pb1, SIGNAL( clicked() ), SLOT( slot_prevArtefact() ) );
	connect( pb2, SIGNAL( clicked() ), SLOT( slot_nextArtefact() ) );
}
Пример #14
0
PropertiesBuilding::PropertiesBuilding( QList<GenericPlayer *> * players, QWidget * parent, const char * /* name */ )
	: QDialog( parent, Qt::Dialog )
{
        setWindowTitle( tr( "building properties" ) );
	_building = 0;

	QLabel * ownerLabel = new QLabel( this );
	ownerLabel->setText( tr( "Owner:" ) );

	_name = new QLabel( this );
	
	_resBuil = new AskCost( tr( "Res Buil: " ), this );
	
	_ownerList = new QComboBox( this );
	refresh( players );

	_listBuilding = new QListWidget( this );

	QPushButton * pb = new QPushButton( this );
	pb->setText( tr( "Ok" ) );
	FIXEDSIZE( pb );

	QHBoxLayout * layH1 = new QHBoxLayout();
	layH1->setSpacing( 5 );
	layH1->addWidget( ownerLabel );
	layH1->addWidget( _ownerList, 1 );

	QHBoxLayout * layH2 = new QHBoxLayout();
	layH2->setSpacing( 5 );
	layH2->addWidget( _listBuilding, 1 );

	QHBoxLayout * layH = new QHBoxLayout();
	layH->setMargin( 5 );
	layH->addStretch( 1 );
	layH->addWidget( pb );

	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->setMargin( 5 );
	layout->setSpacing( 5 );
	layout->addLayout( layH1 );
	layout->addStretch( 1 );
	layout->addWidget( _name );
	layout->addWidget( _resBuil );
	layout->addWidget( _listBuilding );
	layout->addLayout( layH );
	layout->activate();

	connect( pb, SIGNAL( clicked() ), SLOT( slot_accept() ) );
	connect( _ownerList, SIGNAL( activated( int ) ), SLOT( slot_owner( int ) ) );
}
Пример #15
0
ChooseFileRadioButton::ChooseFileRadioButton( QWidget * parent, const char * name )
	:QRadioButton( parent, name )
{
	QHBoxLayout * layout = new QHBoxLayout( this );
	layout->addSpacing( 20 );
	
	_edit = new QLineEdit( this );
	layout->addWidget( _edit, 1 );
	layout->addSpacing( 10 );
	
	_choose = new QPushButton( this );
	_choose->setText( "Choose" );
	FIXEDSIZE( _choose );
	layout->addWidget( _choose );
	
	layout->activate();
	
	connect( _choose, SIGNAL( clicked() ), SLOT( slot_choose() ) );
	connect( this, SIGNAL( toggled( bool ) ), SLOT( slot_toggle( bool ) ) );
	setFixedHeight( _choose->size().height() + 4 );
}
Пример #16
0
CasualtiesReport::CasualtiesReport( CLASS_FIGHTER fighter, Fight * fight, QWidget * parent, const char * /*name*/ )
: QFrame( parent )
{
	GenericLord * lord = fight->getFighterLord( fighter );

	_fight = fight;
	_fighter = fighter;
	_list = new QListWidget( this );
	_list->setSelectionMode( QAbstractItemView::NoSelection );
	_photo = new Icon( this );

	if( lord ) {
		displayCasualtiesLord( lord );
	} else {
		uint race = fight->getCreatureRace();
		uint level = fight->getCreatureLevel();
		Creature * creature = DataTheme.creatures.at( race, level );
		displayCasualtiesCreature( creature );
	}

	QLabel * reportLabel = new QLabel( this );
	reportLabel->setText( _reportTitle );
	FIXEDSIZE( reportLabel );
	
	QHBoxLayout * layH1 = new QHBoxLayout();
	layH1->setSpacing( 5 );
	layH1->setMargin( 5 );
	layH1->addWidget( _photo, 0, Qt::AlignTop );
	layH1->addWidget( _list, 1 );

	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->setMargin( 5 );
	layout->setSpacing( 5 );
	layout->addWidget( reportLabel );
	layout->addLayout( layH1, 1 );
	layout->activate();
}
Пример #17
0
DialogCreatureAnimation::DialogCreatureAnimation( QWidget * parent, const char * /*name*/ )
: QDialog( parent, Qt::Dialog )
{
	_comboModif = new QComboBox( this );
	_comboModif->addItem( tr( "Moving" ) );
	_comboModif->addItem( tr( "Fighting" ) );
	_comboModif->addItem( tr( "Schooting" ) );
	_comboModif->addItem( tr( "SchootHigh" ) );
	_comboModif->addItem( tr( "SchootLow" ) );
	_comboModif->addItem( tr( "Defending" ) );
	_comboModif->addItem( tr( "StartMoving" ) );
	_comboModif->addItem( tr( "EndMoving" ) );
	_comboModif->addItem( tr( "Dying" ) );
	_comboModif->addItem( tr( "Dead" ) );
	_comboModif->addItem( tr( "AttackHigh" ) );
	_comboModif->addItem( tr( "AttackLow" ) );
	_comboModif->addItem( tr( "Selecting" ) );

	QLabel * labModif = new QLabel( tr( "Action: " ), this );
	FIXEDSIZE( labModif );

	QLabel * labFirst = new QLabel( tr( "Start Frame: " ), this );

	QLabel * labLast = new QLabel( tr( "End Frame: " ), this );
	
	_spinFirst = new QSpinBox( this );
	_spinFirst->setMinimum( 0 );

	_spinLast = new QSpinBox( this );
	_spinLast->setMaximum( 100000 );

	QGridLayout * grid = new QGridLayout();
	grid->addWidget( labModif, 2, 0 );
	grid->addWidget( _comboModif, 2, 1 );
	grid->addWidget( labFirst, 3, 0 );
	grid->addWidget( _spinFirst, 3, 1 );
	grid->addWidget( labLast, 4, 0 );
	grid->addWidget( _spinLast, 4, 1 );
	grid->addItem(new QSpacerItem(5, 0), 0, 0);
	grid->addItem(new QSpacerItem(5, 0), 0, 5);

	QPushButton * pbOk = new QPushButton( this );
	pbOk->setText( tr( "Ok" ) );
	FIXEDSIZE( pbOk );

	QPushButton * pbCan = new QPushButton( this );
	pbCan->setText( tr( "Cancel" ) );
	FIXEDSIZE( pbCan );

	QHBoxLayout * layH1 = new QHBoxLayout();
	layH1->addStretch( 1 );
	layH1->addWidget( pbCan );
	layH1->addStretch( 1 );
	layH1->addWidget( pbOk );
	layH1->addStretch( 1 );

	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->setSpacing( 5 );
	layout->setMargin( 5 );
	layout->addLayout( grid, 1 );
	layout->addLayout( layH1 );
	layout->activate();

	connect( pbOk, SIGNAL( clicked() ), SLOT( accept() ) );
	connect( pbCan, SIGNAL( clicked() ), SLOT( reject() ) );
	FIXEDSIZE( this );
}
Пример #18
0
DialogBuildingAction::DialogBuildingAction( QWidget * parent, const char * /*name*/ )
: QDialog( parent, Qt::Dialog )
{
	QLabel * labAction = new QLabel( tr( "Action type: " ), this );
	FIXEDSIZE( labAction );
	
	int i;
	QString string;

	_comboAction = new QComboBox( this );

	for( i = 0; i < Action::LAST; i++ ) {
		Action::ActionType atype = ( Action::ActionType)i;
		string = Action::getActionTypeString( atype );
		string.replace( 0, 1,  string[0].toUpper() );
		_comboAction->addItem( string );
	}
	FIXEDSIZE( _comboAction );
	
	_spinActValue = new QSpinBox( this );
	_spinActValue->setMaximum( 100000 );
	
	_labActValue = new QLabel( tr( "Coeff: " ), this );

	_comboModif = new QComboBox( this );
	for( i = 1; i < ElementaryAction::LAST; i++ ) {
		ElementaryAction::ElementaryType etype = ( ElementaryAction::ElementaryType)i;
		string = ElementaryAction::getElemTypeString( etype );
		string.replace( 0, 1,  string[0].toUpper() );
		_comboModif->addItem( string );
	}
	FIXEDSIZE( _comboAction );

	QLabel * labModif = new QLabel( tr( "Elementary Action: " ), this );
	FIXEDSIZE( labModif );

	_labParam = new QLabel( tr( "Arg0: " ), this );
	
	_labParam1 = new QLabel( tr( "Arg1: " ), this );

	_labValue = new QLabel( tr( "Coeff: " ), this );
	
	_spinParam = new QSpinBox( this );
	_spinParam->setMinimum( 0 );
	
	_spinParam1 = new QSpinBox( this );
	_spinParam1->setMinimum( 0 );

	_spinValue = new QSpinBox( this );
	_spinValue->setRange( -100000, 100000 );
			
	_labParam->hide();
	_labParam1->hide();
	_spinParam->hide();
	_spinParam1->hide();

	QGridLayout * grid = new QGridLayout();
	grid->addWidget( labAction, 1, 0 );
	grid->addWidget( _comboAction, 1, 1 );
	grid->addWidget( _labActValue, 2, 0 );
	grid->addWidget( _spinActValue, 2, 1 );
	grid->addWidget( labModif, 3, 0 );
	grid->addWidget( _comboModif, 3, 1 );
	grid->addWidget( _labParam, 4, 0 );
	grid->addWidget( _spinParam, 4, 1 );
	grid->addWidget( _labParam1, 5, 0 );
	grid->addWidget( _spinParam1, 5, 1 );
	grid->addWidget( _labValue, 6, 0 );
	grid->addWidget( _spinValue, 6, 1 );
	grid->addItem(new QSpacerItem(5, 0), 0, 0);
	grid->addItem(new QSpacerItem(5, 0), 0, 5);

	QPushButton * pbOk = new QPushButton( this );
	pbOk->setText( tr( "Ok" ) );
	FIXEDSIZE( pbOk );

	QPushButton * pbCan = new QPushButton( this );
	pbCan->setText( tr( "Cancel" ) );
	FIXEDSIZE( pbCan );

	QHBoxLayout * layH1 = new QHBoxLayout();
	layH1->addStretch( 1 );
	layH1->addWidget( pbCan );
	layH1->addStretch( 1 );
	layH1->addWidget( pbOk );
	layH1->addStretch( 1 );

	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->setSpacing( 5 );
	layout->setMargin( 5 );
	layout->addLayout( grid, 1 );
	layout->addLayout( layH1 );
	layout->activate();

	connect( pbOk, SIGNAL( clicked() ), SLOT( accept() ) );
	connect( pbCan, SIGNAL( clicked() ), SLOT( reject() ) );
	connect( _comboModif,SIGNAL( currentIndexChanged ( int )  ), SLOT( slot_modif( int ) ) );
	connect( _comboAction,SIGNAL( currentIndexChanged ( int ) ), SLOT( slot_action( int ) ) );
	FIXEDSIZE( this );
}
Пример #19
0
PropertiesCreature::PropertiesCreature (QWidget * parent, const char * name)
    :QDialog (parent, Qt::Dialog)
{
	setWindowTitle( QString ( name));
	_creaturePix = new QLabel( this );
	
	_resCrea= new AskCost( tr( "Res Crea: " ), this );

	_creatureBehaviour = new AskCombo( tr( "Behaviour of creatures: " ), this );
	_creatureBehaviour->insertItem( GenericMapCreature::getBehaviourString( GenericMapCreature::Obedient ) );
	_creatureBehaviour->insertItem( GenericMapCreature::getBehaviourString( GenericMapCreature::Friendly ) );
	_creatureBehaviour->insertItem( GenericMapCreature::getBehaviourString( GenericMapCreature::Neutral ) );
	_creatureBehaviour->insertItem( GenericMapCreature::getBehaviourString( GenericMapCreature::Aggressive ) );
	_creatureBehaviour->insertItem( GenericMapCreature::getBehaviourString( GenericMapCreature::Hostile ) );

	_creatureFlee = new AskBool( tr( "Never flee: " ), this );
	_lookingRight = new AskBool( tr( "Looking at right side: " ), this );
	
	_creatureGrowth = new AskCombo( tr( "Growth of creatures: " ), this );
	_creatureGrowth->insertItem( GenericMapCreature::getGrowthString( GenericMapCreature::Stable ) );
	_creatureGrowth->insertItem( GenericMapCreature::getGrowthString( GenericMapCreature::FixedPercentage ) );
	_creatureGrowth->insertItem( GenericMapCreature::getGrowthString( GenericMapCreature::VariablePercentage ) );
	
	_growthParam0 = new AskInt( tr( "Growth param 0: " ), this );
	_growthParam0->setMinValue( 0 ); 
	_growthParam0->setMaxValue( 1000 );
	_growthParam0->setEnabled( false );
	_growthParam1 = new AskInt( tr( "Growth param 1: " ), this );
	_growthParam1->setMinValue( 0 );
	_growthParam1->setMaxValue( 1000 );
	_growthParam0->setEnabled( false );

	QVBoxLayout * layV1 = new QVBoxLayout();
	layV1->setMargin( 5 );
	layV1->addWidget( _creaturePix, 1 );
	layV1->addSpacing( 10 );
	layV1->addWidget( _creatureBehaviour, 1 );
	layV1->addWidget( _creatureFlee, 1 );
	layV1->addWidget( _lookingRight, 1 );
	layV1->addWidget( _creatureGrowth, 1 );
	layV1->addWidget( _growthParam0, 1 );
	layV1->addWidget( _growthParam1, 1 );

	QVBoxLayout * layV2 = new QVBoxLayout();
	layV2->setMargin( 5 );
	layV2->setSpacing( 5 );
	layV2->addStretch( 1 );
	AskInt * stack;
	QString label;
	_creatureStacks.resize( MAX_UNIT );
	for( uint i = 0; i < MAX_UNIT; i++ ) {
		label = QString (tr( "Number of creatures in stack %1: " ).arg(i));
		stack = new AskInt( label, this );
		stack->setMinValue( 0 );
		stack->setMaxValue( 10000 );
		layV2->addWidget( stack );
		layV2->addStretch( 1 );
		if( _creatureStacks[ i] ) {
		 delete _creatureStacks[ i];
		}
		_creatureStacks[ i] = stack ;
	}

	QHBoxLayout * layH1 = new QHBoxLayout();
	layH1->setSpacing( 5 );
	layH1->setMargin( 5 );
	layH1->addLayout( layV1, 1 );
	layH1->addLayout( layV2, 1 );

	QPushButton * butOk = new QPushButton( this );
	butOk->setText( tr( "Ok" ) );
	FIXEDSIZE( butOk );

	QPushButton * butCan = new QPushButton( this );
	butCan->setText( tr( "Cancel" ) );
	FIXEDSIZE( butCan );

	QHBoxLayout * layH2 = new QHBoxLayout();
	layH2->setMargin( 5 );
	layH2->setSpacing( 5 );
	layH2->addStretch( 1 );
	layH2->addWidget( butOk );
	layH2->addStretch( 1 );
	layH2->addWidget( butCan );
	layH2->addStretch( 1 );

	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->setMargin( 5 );
	layout->setSpacing( 5 );
	layout->addLayout( layH1, 1 );
	layout->addWidget( _resCrea );
	layout->addLayout( layH2 );
	layout->activate();

	connect( butOk, SIGNAL( clicked() ), this, SLOT( slot_accept() ) );
	connect( butCan, SIGNAL( clicked() ), this, SLOT( reject() ) );
	connect( _creatureGrowth, SIGNAL( sig_activated( int ) ), SLOT( slot_growthMode( int ) ) );
}
Пример #20
0
    int cxId;			/* system metric ids for width/height... */
    int cyId;			/* ... or size if FIXEDSIZE bit set */
    Ttk_StateTable *stateMap;	/* map Tk states to Win32 flags */
    Ttk_Padding margins;	/* additional placement padding */
} FrameControlElementData;

#define _FIXEDSIZE  0x80000000L
#define _HALFMETRIC 0x40000000L
#define FIXEDSIZE(id) (id|_FIXEDSIZE)
#define HALFMETRIC(id) (id|_HALFMETRIC)
#define GETMETRIC(m) \
    ((m) & _FIXEDSIZE ? (int)((m) & ~_FIXEDSIZE) : GetSystemMetrics((m)&0x0fffffff))

static FrameControlElementData FrameControlElements[] = {
    { "Checkbutton.indicator",
	DFC_BUTTON, DFCS_BUTTONCHECK, FIXEDSIZE(13), FIXEDSIZE(13),
	checkbutton_statemap, {0,0,4,0} },
    { "Radiobutton.indicator",
    	DFC_BUTTON, DFCS_BUTTONRADIO, FIXEDSIZE(13), FIXEDSIZE(13),
	checkbutton_statemap, {0,0,4,0} },
    { "uparrow",
    	DFC_SCROLL, DFCS_SCROLLUP, SM_CXVSCROLL, SM_CYVSCROLL,
	arrow_statemap, {0,0,0,0} },
    { "downarrow",
    	DFC_SCROLL, DFCS_SCROLLDOWN, SM_CXVSCROLL, SM_CYVSCROLL,
	arrow_statemap, {0,0,0,0} },
    { "leftarrow",
	DFC_SCROLL, DFCS_SCROLLLEFT, SM_CXHSCROLL, SM_CYHSCROLL,
	arrow_statemap, {0,0,0,0} },
    { "rightarrow",
	DFC_SCROLL, DFCS_SCROLLRIGHT, SM_CXHSCROLL, SM_CYHSCROLL,
Пример #21
0
void SelectionWidget::setTitle( QString title )
{
	_labTitle->setText( title );
	FIXEDSIZE( _labTitle );
}
Пример #22
0
ScenarioInfo::ScenarioInfo( QWidget * parent, const char * /* name */ )
	: QDialog( parent, Qt::Dialog )
{
	setWindowTitle( tr( "General Scenario Informations" ) );

	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->setMargin( 5 );

	QLabel * title = new QLabel( tr( "General Information" ), this );
	title->setFont( QFont( "Helvetica", 20, QFont::Bold ) );
	title->setAlignment( Qt::AlignCenter );
	FIXEDSIZE( title );
	layout->addWidget( title );
	layout->addSpacing( 15 );

	QHBoxLayout * layH1 = new QHBoxLayout();

	QLabel * scenarName = new QLabel( tr( "Name: " ), this );
	FIXEDSIZE( scenarName );
	layH1->addWidget( scenarName );

	_name = new QLineEdit( this );
	_name->setFixedSize( 200, 20 );
	layH1->addWidget( _name );

	layH1->addStretch( 1 );

	layout->addLayout( layH1 );
	layout->addSpacing( 5 );

	QHBoxLayout * layH2 = new QHBoxLayout();

	QLabel * theme = new QLabel( tr( "Theme: " ), this );
	FIXEDSIZE( theme );
	layH2->addWidget( theme );

	_theme = new QComboBox( this );
	searchThemes( _theme );
	FIXEDSIZE( _theme );
	layH2->addWidget( _theme );
	layH2->addStretch( 1 );

	QLabel * nbPlayer = new QLabel( tr( "Number of players: " ), this );
	FIXEDSIZE( nbPlayer );
	layH2->addWidget( nbPlayer );

	_nbPlayers = new QSpinBox( this );
	FIXEDSIZE( _nbPlayers );
	layH2->addWidget( _nbPlayers );

	layH2->addStretch( 1 );

	layout->addLayout( layH2 );
	layout->addSpacing( 5 );

	QHBoxLayout * layH3 = new QHBoxLayout();

	QLabel * height = new QLabel( tr( "Map height: " ), this );
	FIXEDSIZE( height );
	layH3->addWidget( height );

	_editHeight = new QLineEdit( this );
	_editHeight->setFixedSize( 50, 20 );
	layH3->addWidget( _editHeight );
	layH3->addStretch( 1 );

	QLabel * width = new QLabel( tr( "Map width: " ), this );
	FIXEDSIZE( width );
	layH3->addWidget( width );

	_editWidth = new QLineEdit( this );
	_editWidth->setFixedSize( 50, 25 );
	layH3->addWidget( _editWidth );
	layH3->addStretch( 1 );

	layout->addLayout( layH3 );
	layout->addSpacing( 5 );
	
	QHBoxLayout * layH5 = new QHBoxLayout();
	
	QLabel * day = new QLabel( tr( "Day: " ), this );
	FIXEDSIZE( day );
	layH5->addWidget( day );

	_day = new QSpinBox( this );
	FIXEDSIZE( _day );
	layH5->addWidget( _day );
	_day->setValue( 1 );

	QLabel * week = new QLabel( tr( "Week: " ), this );
	FIXEDSIZE( week );
	layH5->addWidget( week );

	_week = new QSpinBox( this );
	FIXEDSIZE( _week );
	layH5->addWidget( _week );
	_week->setValue( 1 );
	
	QLabel * month = new QLabel( tr( "Month: " ), this );
	FIXEDSIZE( month );
	layH5->addWidget( month );

	_month = new QSpinBox( this );
	FIXEDSIZE( _month );
	layH5->addWidget( _month );
	_month->setValue( 1 );


	QLabel * year = new QLabel( tr( "Year: " ), this );
	FIXEDSIZE( year );
	layH5->addWidget( year );

	_year = new QSpinBox( this );
	_year->setMaximum( 9999 );
	_year->setValue( 1044 );
	FIXEDSIZE( _year );
	layH5->addWidget( _year );

	layH5->addStretch( 1 );

	layout->addLayout( layH5 );
	layout->addSpacing( 5 );


	QHBoxLayout * layH4 = new QHBoxLayout();

	QLabel * desc = new QLabel( tr( "Description: " ), this );
	FIXEDSIZE( desc );
	layH4->addWidget( desc );
	layH4->addStretch( 1 );

	layout->addLayout( layH4 );

	_desc = new QTextEdit( this );
	layout->addWidget( _desc, 1 );

	QPushButton * butOk = new QPushButton( this );
	butOk->setText( tr( "Ok" ) );
	FIXEDSIZE( butOk );
	QPushButton * butCan = new QPushButton( this );
	butCan->setText( tr( "Cancel" ) );
	FIXEDSIZE( butCan );

	QHBoxLayout * layH6 = new QHBoxLayout();
	layH6->addStretch( 1 );
	layH6->addWidget( butOk );
	layH6->addStretch( 1 );
	layH6->addWidget( butCan );
	layH6->addStretch( 1 );

	layout->addSpacing( 5 );
	layout->addLayout( layH6 );
	layout->activate();

	connect( butCan, SIGNAL( clicked() ), SLOT( reject() ) );
	connect( butOk, SIGNAL( clicked() ), SLOT( slot_ok() ) );

	setMapHeight( 50 );
	setMapWidth( 50 );
	setNbPlayer( 2 );
	setName( tr( "Map " ) + QString::number( _defaultVal ) );
	setDescription( tr( "Map for Attal" ) );
	setTheme( "medieval" );
	_defaultVal++;
}