Esempio n. 1
0
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);
    }
void BattleCommunicator::battleConnected()
{
    emit info("Connected to battle server!");
    wasConnected = true;
    changeMod(mod);
}