void PageEditTeam::connectSignals() { connect(this, SIGNAL(pageLeave()), this, SLOT(saveTeam())); signalMapper1 = new QSignalMapper(this); signalMapper2 = new QSignalMapper(this); connect(signalMapper1, SIGNAL(mapped(int)), this, SLOT(fixHHname(int))); connect(signalMapper2, SIGNAL(mapped(int)), this, SLOT(setRandomHogName(int))); for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) { connect(HHNameEdit[i], SIGNAL(editingFinished()), signalMapper1, SLOT(map())); signalMapper1->setMapping(HHNameEdit[i], i); connect(btnRandomHogName[i], SIGNAL(clicked()), signalMapper2, SLOT(map())); signalMapper2->setMapping(btnRandomHogName[i], i); } connect(btnRandomTeam, SIGNAL(clicked()), this, SLOT(setRandomTeam())); connect(btnRandomNames, SIGNAL(clicked()), this, SLOT(setRandomHogNames())); connect(btnRandomHats, SIGNAL(clicked()), this, SLOT(setRandomHats())); connect(CBTeamLvl, SIGNAL(currentIndexChanged(const int)), this, SLOT(CBTeamLvl_activated(const int))); connect(btnRandomTeamName, SIGNAL(clicked()), this, SLOT(setRandomTeamName())); connect(btnRandomGrave, SIGNAL(clicked()), this, SLOT(setRandomGrave())); connect(btnRandomFlag, SIGNAL(clicked()), this, SLOT(setRandomFlag())); connect(btnRandomVoice, SIGNAL(clicked()), this, SLOT(setRandomVoice())); connect(btnRandomFort, SIGNAL(clicked()), this, SLOT(setRandomFort())); connect(btnTestSound, SIGNAL(clicked()), this, SLOT(testSound())); connect(CBFort, SIGNAL(currentIndexChanged(const int)), this, SLOT(CBFort_activated(const int))); }
QMenuBar *TeamBuilder::createMenuBar(MainEngine *w) { QMenuBar *menuBar = new QMenuBar(); menuBar->setObjectName("TeamBuilder"); QMenu *fileMenu = menuBar->addMenu(tr("&File")); fileMenu->addAction(tr("&New"),this,SLOT(newTeam()),tr("Ctrl+N", "New")); fileMenu->addAction(tr("&Save all"),this,SLOT(saveAll()),tr("Ctrl+S", "Save all")); fileMenu->addAction(tr("&Load all"),this,SLOT(openLoadWindow()),tr("Ctrl+L", "Load all")); fileMenu->addSeparator(); fileMenu->addAction(tr("&Quit"),qApp,SLOT(quit()),tr("Ctrl+Q", "Quit")); QMenu *teamMenu = menuBar->addMenu(tr("&Team")); if (currentWidget() && currentWidget() == this->teamMenu) { teamMenu->addAction(tr("Choose pokemon"), this->teamMenu, SLOT(choosePokemon()), tr("Alt+E", "Choose Pokemon")); } teamMenu->addAction(tr("Trainer Menu"), this, SLOT(switchToTrainer()), tr("Ctrl+B", "Trainer Menu")); teamMenu->addSeparator(); teamMenu->addAction(tr("&Add team"), this, SLOT(addTeam()), tr("Ctrl+A", "Add team")); teamMenu->addAction(tr("&Load team"), this, SLOT(openTeam()), tr("Ctrl+Shift+L", "Load team")); teamMenu->addAction(tr("&Save team"), this, SLOT(saveTeam()), tr("Ctrl+Shift+S", "Save team")); teamMenu->addAction(tr("&Import team"), this, SLOT(importTeam()), tr("Ctrl+I", "Import team")); teamMenu->addAction(tr("&Export team"), this, SLOT(exportTeam()), tr("Ctrl+E", "Export team")); teamMenu->addSeparator(); teamMenu->addAction(tr("Import from Android"), this, SLOT(importAndroid()), tr("Ctrl+Shift+I", "Import from Android")); teamMenu->addAction(tr("Export to Android"), this, SLOT(exportAndroid()), tr("Ctrl+Shift+E", "Export to Android")); currentWidget()->addMenus(menuBar); /* Loading mod menu */ QMenu *menuMods = menuBar->addMenu(tr("&Mods")); QActionGroup *group = new QActionGroup(menuMods); QString currentMod = PokemonInfoConfig::currentMod(); // No mod option. QAction *noMod = menuMods->addAction(tr("&No mod"), this, SLOT(setNoMod())); noMod->setCheckable(true); noMod->setChecked(currentMod.length()==0); group->addAction(noMod); menuMods->addSeparator(); QStringList mods = PokemonInfoConfig::availableMods(); foreach(QString smod, mods) { QAction *mod = menuMods->addAction(smod, this, SLOT(changeMod())); mod->setProperty("name", smod); mod->setCheckable(true); mod->setChecked(currentMod == smod); group->addAction(mod); }