void GameCFGWidget::fullNetConfig() { ammoChanged(WeaponsName->currentIndex()); seedChanged(pMapContainer->getCurrentSeed()); templateFilterChanged(pMapContainer->getTemplateFilter()); QString t = pMapContainer->getCurrentTheme(); if(!t.isEmpty()) themeChanged(t); schemeChanged(GameSchemes->currentIndex()); scriptChanged(Scripts->currentIndex()); mapgenChanged(pMapContainer->get_mapgen()); maze_sizeChanged(pMapContainer->getMazeSize()); slMapFeatureSizeChanged(pMapContainer->getFeatureSize()); if(pMapContainer->get_mapgen() == 2) onDrawnMapChanged(pMapContainer->getDrawnMapData()); // map must be the last QString map = pMapContainer->getCurrentMap(); if (map.size()) mapChanged(map); }
void GameCFGWidget::fullNetConfig() { ammoChanged(WeaponsName->currentIndex()); seedChanged(pMapContainer->getCurrentSeed()); templateFilterChanged(pMapContainer->getTemplateFilter()); themeChanged(pMapContainer->getCurrentTheme()); schemeChanged(GameSchemes->currentIndex()); scriptChanged(Scripts->currentIndex()); mapgenChanged(pMapContainer->get_mapgen()); maze_sizeChanged(pMapContainer->getMazeSize()); // map must be the last QString map = pMapContainer->getCurrentMap(); if (map.size()) mapChanged(map); }
void HWMapContainer::intSetMapgen(MapGenerator m) { if (mapgen != m) { mapgen = m; switch (m) { case MAPGEN_REGULAR: m_mapInfo.type = MapModel::GeneratedMap; break; case MAPGEN_MAZE: m_mapInfo.type = MapModel::GeneratedMaze; break; case MAPGEN_PERLIN: m_mapInfo.type = MapModel::GeneratedPerlin; break; case MAPGEN_DRAWN: m_mapInfo.type = MapModel::HandDrawnMap; break; case MAPGEN_MAP: switch (m_mapInfo.type) { case MapModel::GeneratedMap: case MapModel::GeneratedMaze: case MapModel::GeneratedPerlin: case MapModel::HandDrawnMap: m_mapInfo.type = MapModel::Invalid; default: break; } break; } emit mapgenChanged(m); } }
GameCFGWidget::GameCFGWidget(QWidget* parent, bool randomWithoutDLC) : QGroupBox(parent) , mainLayout(this) , seedRegexp("\\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\}") { mainLayout.setMargin(0); setMinimumHeight(310); setMaximumHeight(447); setMinimumWidth(470); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_master = true; // Easy containers for the map/game options in either stacked or tabbed mode mapContainerFree = new QWidget(); mapContainerTabbed = new QWidget(); optionsContainerFree = new QWidget(); optionsContainerTabbed = new QWidget(); tabbed = false; // Container for when in tabbed mode tabs = new QTabWidget(this); tabs->setFixedWidth(470); tabs->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); tabs->addTab(mapContainerTabbed, tr("Map")); tabs->addTab(optionsContainerTabbed, tr("Game options")); tabs->setObjectName("gameCfgWidgetTabs"); mainLayout.addWidget(tabs, 1); tabs->setVisible(false); // Container for when in stacked mode StackContainer = new QWidget(); StackContainer->setObjectName("gameStackContainer"); mainLayout.addWidget(StackContainer, 1); QVBoxLayout * stackLayout = new QVBoxLayout(StackContainer); // Map options pMapContainer = new HWMapContainer(mapContainerFree); pMapContainer->setRandomWithoutDLC(randomWithoutDLC); stackLayout->addWidget(mapContainerFree, 0, Qt::AlignHCenter); pMapContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); pMapContainer->setFixedSize(width() - 14, 278); mapContainerFree->setFixedSize(pMapContainer->width(), pMapContainer->height()); // Horizontal divider QFrame * divider = new QFrame(); divider->setFrameShape(QFrame::HLine); divider->setFrameShadow(QFrame::Plain); stackLayout->addWidget(divider, 0, Qt::AlignBottom); //stackLayout->setRowMinimumHeight(1, 10); // Game options optionsContainerTabbed->setContentsMargins(0, 0, 0, 0); optionsContainerFree->setFixedSize(width() - 14, 140); stackLayout->addWidget(optionsContainerFree, 0, Qt::AlignHCenter); OptionsInnerContainer = new QWidget(optionsContainerFree); m_childWidgets << OptionsInnerContainer; OptionsInnerContainer->setFixedSize(optionsContainerFree->width(), optionsContainerFree->height()); OptionsInnerContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); GBoxOptionsLayout = new QGridLayout(OptionsInnerContainer); GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Style"), this), 1, 0); Scripts = new QComboBox(this); Scripts->setMaxVisibleItems(30); GBoxOptionsLayout->addWidget(Scripts, 1, 1); Scripts->setModel(DataManager::instance().gameStyleModel()); m_curScript = Scripts->currentText(); connect(Scripts, SIGNAL(currentIndexChanged(int)), this, SLOT(scriptChanged(int))); QWidget *SchemeWidget = new QWidget(this); GBoxOptionsLayout->addWidget(SchemeWidget, 2, 0, 1, 2); QGridLayout *SchemeWidgetLayout = new QGridLayout(SchemeWidget); SchemeWidgetLayout->setMargin(0); GameSchemes = new QComboBox(SchemeWidget); GameSchemes->setMaxVisibleItems(30); SchemeWidgetLayout->addWidget(GameSchemes, 0, 2); connect(GameSchemes, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeChanged(int))); SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Scheme"), SchemeWidget), 0, 0); QPixmap pmEdit(":/res/edit.png"); QPushButton * goToSchemePage = new QPushButton(SchemeWidget); goToSchemePage->setWhatsThis(tr("Edit schemes")); goToSchemePage->setIconSize(pmEdit.size()); goToSchemePage->setIcon(pmEdit); goToSchemePage->setMaximumWidth(pmEdit.width() + 6); SchemeWidgetLayout->addWidget(goToSchemePage, 0, 3); connect(goToSchemePage, SIGNAL(clicked()), this, SLOT(jumpToSchemes())); SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Weapons"), SchemeWidget), 1, 0); WeaponsName = new QComboBox(SchemeWidget); WeaponsName->setMaxVisibleItems(30); SchemeWidgetLayout->addWidget(WeaponsName, 1, 2); connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int))); QPushButton * goToWeaponPage = new QPushButton(SchemeWidget); goToWeaponPage->setWhatsThis(tr("Edit weapons")); goToWeaponPage->setIconSize(pmEdit.size()); goToWeaponPage->setIcon(pmEdit); goToWeaponPage->setMaximumWidth(pmEdit.width() + 6); SchemeWidgetLayout->addWidget(goToWeaponPage, 1, 3); connect(goToWeaponPage, SIGNAL(clicked()), this, SLOT(jumpToWeapons())); bindEntries = new QCheckBox(SchemeWidget); bindEntries->setWhatsThis(tr("Game scheme will auto-select a weapon")); bindEntries->setChecked(true); bindEntries->setMaximumWidth(42); bindEntries->setStyleSheet( "QCheckBox::indicator:checked { image: url(\":/res/lock.png\"); }" "QCheckBox::indicator:unchecked { image: url(\":/res/unlock.png\"); }" ); SchemeWidgetLayout->addWidget(bindEntries, 0, 1, 0, 1, Qt::AlignVCenter); connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SLOT(seedChanged(const QString &))); connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SLOT(mapChanged(const QString &))); connect(pMapContainer, SIGNAL(mapgenChanged(MapGenerator)), this, SLOT(mapgenChanged(MapGenerator))); connect(pMapContainer, SIGNAL(mazeSizeChanged(int)), this, SLOT(maze_sizeChanged(int))); connect(pMapContainer, SIGNAL(mapFeatureSizeChanged(int)), this, SLOT(slMapFeatureSizeChanged(int))); connect(pMapContainer, SIGNAL(themeChanged(const QString &)), this, SLOT(themeChanged(const QString &))); connect(pMapContainer, SIGNAL(newTemplateFilter(int)), this, SLOT(templateFilterChanged(int))); connect(pMapContainer, SIGNAL(drawMapRequested()), this, SIGNAL(goToDrawMap())); connect(pMapContainer, SIGNAL(drawnMapChanged(const QByteArray &)), this, SLOT(onDrawnMapChanged(const QByteArray &))); connect(&DataManager::instance(), SIGNAL(updated()), this, SLOT(updateModelViews())); }
void HWMapContainer::changeMapType(MapModel::MapType type, const QModelIndex & newMap) { staticMapList->hide(); missionMapList->hide(); lblMapList->hide(); generationStyles->hide(); mazeStyles->hide(); lblDesc->hide(); btnLoadMap->hide(); btnEditMap->hide(); switch (type) { case MapModel::GeneratedMap: mapgen = MAPGEN_REGULAR; setMapInfo(MapModel::MapInfoRandom); lblMapList->setText(tr("Map size:")); lblMapList->show(); generationStyles->show(); break; case MapModel::GeneratedMaze: mapgen = MAPGEN_MAZE; setMapInfo(MapModel::MapInfoMaze); lblMapList->setText(tr("Maze style:")); lblMapList->show(); mazeStyles->show(); break; case MapModel::GeneratedPerlin: mapgen = MAPGEN_PERLIN; setMapInfo(MapModel::MapInfoPerlin); lblMapList->setText(tr("Style:")); lblMapList->show(); mazeStyles->show(); break; case MapModel::HandDrawnMap: mapgen = MAPGEN_DRAWN; setMapInfo(MapModel::MapInfoDrawn); btnLoadMap->show(); btnEditMap->show(); break; case MapModel::MissionMap: setupMissionMapsView(); mapgen = MAPGEN_MAP; missionMapChanged(newMap.isValid() ? newMap : missionMapList->currentIndex()); lblMapList->setText(tr("Mission:")); lblMapList->show(); missionMapList->show(); lblDesc->setText(m_mapInfo.desc); lblDesc->show(); emit mapChanged(m_curMap); break; case MapModel::StaticMap: setupStaticMapsView(); mapgen = MAPGEN_MAP; staticMapChanged(newMap.isValid() ? newMap : staticMapList->currentIndex()); lblMapList->setText(tr("Map:")); lblMapList->show(); staticMapList->show(); emit mapChanged(m_curMap); break; default: break; } // Update theme button size updateThemeButtonSize(); // Update cType combobox for (int i = 0; i < cType->count(); i++) { if ((MapModel::MapType)cType->itemData(i).toInt() == type) { cType->setCurrentIndex(i); break; } } repaint(); emit mapgenChanged(mapgen); }