SelectUnitDialog::SelectUnitDialog( QWidget* parent, const UnitList &unitList, OptionFlag showEmpty ) : KDialog( parent), m_showEmpty(showEmpty) { setButtons( KDialog::Ok | KDialog::Cancel ); setDefaultButton( KDialog::Ok ); setCaption(i18nc( "@title:window", "Choose Unit" ) ); setModal( true ); KVBox *page = new KVBox(this ); setMainWidget( page ); box = new Q3GroupBox( page ); box->setTitle( i18nc( "@title:group", "Choose Unit" ) ); box->setColumnLayout( 0, Qt::Vertical ); QVBoxLayout *boxLayout = new QVBoxLayout( box->layout() ); unitChooseView = new K3ListView( box ); KConfigGroup config( KGlobal::config(), "Advanced" ); bool show_id = config.readEntry( "ShowID", false ); unitChooseView->addColumn( i18nc( "@title:column", "Id" ) , show_id ? -1 : 0 ); unitChooseView->addColumn( i18nc( "@title:column", "Unit" ) ); unitChooseView->setSorting(1); unitChooseView->setGeometry( QRect( 5, 30, 180, 250 ) ); unitChooseView->setAllColumnsShowFocus( true ); boxLayout->addWidget( unitChooseView ); resize( QSize( 200, 350 ) ); loadUnits( unitList ); }
SelectPropertyDialog::SelectPropertyDialog( QWidget* parent, int ingID, RecipeDB *database, OptionFlag showEmpty ) : KDialog( parent), m_showEmpty(showEmpty), ingredientID(ingID), db(database) { setModal( true ); setButtons(KDialog::Ok | KDialog::Cancel); setDefaultButton( KDialog::Ok); setCaption(i18nc( "@title:window", "Choose Property" )); // Initialize internal variables unitListBack = new UnitList; // Initialize Widgets KVBox *page = new KVBox( this ); setMainWidget( page ); box = new Q3GroupBox( page ); box->setTitle( i18nc( "@title:group", "Choose Property" ) ); box->setColumnLayout( 0, Qt::Vertical ); box->layout() ->setSpacing( 6 ); box->layout() ->setMargin( 11 ); QVBoxLayout *boxLayout = new QVBoxLayout( box->layout() ); boxLayout->setAlignment( Qt::AlignTop ); propertyChooseView = new K3ListView( box ); KConfigGroup config( KGlobal::config(), "Advanced" ); bool show_id = config.readEntry( "ShowID", false ); propertyChooseView->addColumn( i18nc( "@title:column", "Id" ), show_id ? -1 : 0 ); propertyChooseView->addColumn( i18nc( "@title:column", "Property" ) ); propertyChooseView->setSorting(1); propertyChooseView->setAllColumnsShowFocus( true ); boxLayout->addWidget( propertyChooseView ); QHBoxLayout *layout2 = new QHBoxLayout; perUnitsLabel = new QLabel( box ); perUnitsLabel->setGeometry( QRect( 5, 285, 100, 30 ) ); perUnitsLabel->setText( i18nc( "@label:textbox", "Per units:" ) ); layout2->addWidget( perUnitsLabel ); perUnitsBox = new KComboBox( true, box ); perUnitsBox->setInsertPolicy( QComboBox::NoInsert ); layout2->addWidget( perUnitsBox ); boxLayout->addLayout( layout2 ); resize( QSize( 400, 400 ).expandedTo( minimumSizeHint() ) ); //TODO port kde4 //clearWState( WState_Polished ); IngredientPropertyList propertyList; db->loadProperties( &propertyList ); UnitList unitList; db->loadPossibleUnits( ingredientID, &unitList ); // Load data loadProperties( &propertyList ); loadUnits( &unitList ); }
/** Loads a map from an INI-File. */ void INIMapEditorLoader::load() { checkFeatures(); loadMap(); loadHouses(); loadUnits(); loadStructures(); loadReinforcements(); loadChoam(); loadTeams(); pMapEditor->informPlayersChanged(); }
bool App::init() { _scene = new Scene; _core = new Core; _core->initialize(); connect(_core, SIGNAL(exit()), this, SLOT(quit())); // delete later _background = new GraphicObject; _background->setSurface(_core->getSurface("background.png")); SDL_Rect backRect = {0, 0, 1500, 843}; _background->setRect(backRect); qsrand(time(NULL)); _scene->setBack(_background); connect(_core->getEH(), SIGNAL(eventMsg(SDL_Event*)), this, SLOT(event(SDL_Event*))); // creating state ------------------------------ Battle *battle = new Battle; Scene *batScene = new Scene; battle->setScene(_scene); loadUnits(battle); // gates SDL_Rect gateRect; gateRect.x = 0; gateRect.y = 0; gateRect.w = 30; gateRect.h = 30; CombinedAnimation gateAnLeft; gateAnLeft.setSurface(_core->getSurface("leftgate.png")); gateAnLeft.setFrameLines(2); gateAnLeft.setMaxFrames(7); gateAnLeft.setFrames(0, 4); gateAnLeft.setFrames(1, 7); CombinedAnimation gateAnRight; gateAnRight.setSurface(_core->getSurface("rightgate.png")); gateAnRight.setFrameLines(2); gateAnRight.setMaxFrames(7); gateAnRight.setFrames(0, 4); gateAnRight.setFrames(1, 7); gateAnRight.flipHorizontal(); DamageableItem g1(1000, Position(310, SPAWN_LINE),Size(100, 90), 9); DamageableItem g2(1000, Position(1200, SPAWN_LINE),Size(100, 90), 19); // left castle SDL_Rect wallRect = {0, 0, 297, 230}; Animation leftWallAn; leftWallAn.setSurface(_core->getSurface("castle.png")); leftWallAn.setFrames(1); leftWallAn.setRect(wallRect); leftWallAn.flipHorizontal(); AreaItem leftWallItem(147, SPAWN_LINE, 220, 195); QSharedPointer<Castle> lCastle = QSharedPointer<Castle>(new Castle(leftWallItem, g1, leftWallAn, gateAnLeft, Position(100, SPAWN_LINE), 5, 1, 1500)); battle->setLeftCastle(lCastle); // right castle Animation wallAn; wallAn.setSurface(_core->getSurface("castle.png")); wallAn.setFrames(1); wallAn.setRect(wallRect); AreaItem wallItem(1365, SPAWN_LINE, 220, 195); QSharedPointer<Castle> rCastle = QSharedPointer<Castle>(new Castle(wallItem, g2, wallAn, gateAnRight, Position(1400, SPAWN_LINE), 5, 0, 1500)); battle->setRightCastle(rCastle); // Player stats QList<SDL_Surface*> iconSurfs; iconSurfs << _core->getSurface("warrior_icon.png"); iconSurfs << _core->getSurface("ranger_icon.png"); iconSurfs << _core->getSurface("rangerwall_icon.png"); iconSurfs << _core->getSurface("knight_icon.png"); iconSurfs << _core->getSurface("evilwarrior_icon.png"); iconSurfs << _core->getSurface("evilranger_icon.png"); iconSurfs << _core->getSurface("evilrangerwall_icon.png"); iconSurfs << _core->getSurface("evilknight_icon.png"); PlayerStats *stats = new PlayerStats(iconSurfs); battle->setPlayerStats(stats); // barrier floor QSharedPointer<AreaItem> floor = QSharedPointer<AreaItem>(new AreaItem(450, SPAWN_LINE + 700, 3000, 699, 0, true, true)); battle->setFloor(floor); // win sets GraphicObject *right = new GraphicObject(); GraphicObject *left = new GraphicObject(); GraphicObject *draw = new GraphicObject(); right->setSurface(_core->getSurface("rightwin.png")); left->setSurface(_core->getSurface("leftwin.png")); draw->setSurface(_core->getSurface("draw.png")); SDL_Rect winrect = {500, 300, 500, 200}; right->setRect(winrect); left->setRect(winrect); draw->setRect(winrect); battle->setWinPics(*left, *right, *draw); // starting _core->pushState(battle); _core->startStateTimer(17); int id = _core->addTimer(); _core->getTimer(id)->start(17); connect(_core->getTimer(id), SIGNAL(timeout()), this, SLOT(draw())); //---------------------------------------------- return true; }