Esempio n. 1
0
TeamBuilder::TeamBuilder(ClientPluginManager *p, TeamHolder *team, bool load) : m_team(team), teamMenu(nullptr)
{
//    QStringList undone;
//    for (int i = 1;i <= 718; i++) {
//        if (!PokemonInfo::Exists(i, 6))
//            undone.push_back(PokemonInfo::Name(i));
//    }
    ui = new _ui();
    ui->stack = new QStackedWidget();
    setCentralWidget(ui->stack);

    setDockNestingEnabled(true);
    setWindowFlags(Qt::Widget);

    setWindowTitle(tr("Teambuilder"));

    ui->stack->addWidget(trainer = new TrainerMenu(team));
    trainer->setMainWindow(this);
    pokemonModel = new PokeTableModel(team->team().gen(), this);

    if (load) {
        loadSettings(this, defaultSize());
    }

    connect(trainer, SIGNAL(teamChanged()), SLOT(markTeamUpdated()));
    connect(trainer, SIGNAL(done()), SIGNAL(done()));
    connect(trainer, SIGNAL(openBoxes()), SLOT(openBoxes()));
    connect(trainer, SIGNAL(editPoke(int)), SLOT(editPoke(int)));

    p->launchTeambuilder(this);
    pluginManager = p;
}
Esempio n. 2
0
TrainerMenu::TrainerMenu(TeamHolder *team) :
    ui(new Ui::TrainerMenu), m_team(team)
{
    ui->setupUi(this);
    Theme::ToolButtonIcon(ui->teamFolderButton, Theme::ChangeTeamFolder);
    Theme::ToolButtonIcon(ui->removeTeam, Theme::DeleteTeam);
    Theme::ToolButtonIcon(ui->saveTeam, Theme::SaveTeam);
    Theme::ToolButtonIcon(ui->loadTeam, Theme::LoadTeam);
    Theme::ToolButtonIcon(ui->importTeam, Theme::ImportTeam);
    Theme::ToolButtonIcon(ui->addTeam, Theme::AddTeam);
    ui->name->setValidator(new QNickValidator(this));
    ui->close->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogCloseButton));

    QPushButton *buttons[6] = {ui->team1, ui->team2, ui->team3, ui->team4, ui->team5, ui->team6};
    memcpy(teamButtons, buttons, sizeof(buttons));

    QButtonGroup *bg = new QButtonGroup(this);
    for (int i = 0; i < 6; i++) {
        buttons[i]->setCheckable(true);
        bg->addButton(buttons[i], i);
    }
    buttons[0]->setChecked(true);

    connect(bg, SIGNAL(buttonClicked(int)), SLOT(changeCurrentTeam(int)));

    connect(ui->pokemonButtons, SIGNAL(teamChanged()), SIGNAL(teamChanged()));
    connect(ui->boxCenter, SIGNAL(clicked()), SIGNAL(openBoxes()));
    //connect(ui->pokemonButtons, SIGNAL(doubleClicked(int)), SIGNAL(editPoke(int)));
    connect(ui->pokemonButtons, SIGNAL(clicked(int)), SIGNAL(editPoke(int))); //I prefer double click, but for newbies...
    connect(ui->teambuilderLabel, SIGNAL(clicked()), SLOT(openTeam()));

    loadProfileList();
    setupData();
}