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(); }
void DriverStation::setTeamNumber (int team) { if (m_manager->isValid()) m_manager->currentProtocol()->setTeam (team); emit teamChanged (team); }
void TeamMenu::tabIconChanged() { int slot = sender()->property("slot").toInt(); ui->pokemonTabs->setTabIcon(slot, PokemonInfo::Icon(team().team().poke(slot).num())); emit teamChanged(); }
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; }
void TeamMenu::switchToTab(int index) { if (ui->pokemonTabs->currentIndex() != index) { /* The signal/slot connection will call us again, thus we return */ ui->pokemonTabs->setCurrentIndex(index); return; } if (!ui->pokemons.contains(index)) { ui->stack->addWidget(ui->pokemons[index]= new PokeEdit(this, &team().team().poke(index), ui->pokemonModel, ui->itemsModel, ui->natureModel)); ui->pokemons[index]->setProperty("slot", index); connect(ui->pokemons[index], SIGNAL(switchToTrainer()), SIGNAL(switchToTrainer())); connect(ui->pokemons[index], SIGNAL(numChanged()), SLOT(tabIconChanged())); connect(ui->pokemons[index], SIGNAL(nameChanged()), SIGNAL(teamChanged())); connect(ui->pokemons[index], SIGNAL(itemChanged()), SIGNAL(teamChanged())); } ui->stack->setCurrentWidget(ui->pokemons[index]); }
void TrainerMenu::on_removeTeam_clicked() { team().removeTeam(); updateTeamButtons(); updateTeam(); emit teamChanged(); }
void TeamMenu::createIndexIfNeeded(int index) { if (index < 6) { if (!ui->pokemons.contains(index)) { ui->stack->addWidget(ui->pokemons[index]= new PokeEdit(this, &team().team().poke(index), ui->pokemonModel, ui->itemsModel, ui->natureModel)); ui->pokemons[index]->setProperty("slot", index); connect(ui->pokemons[index], SIGNAL(numChanged()), SLOT(tabIconChanged())); connect(ui->pokemons[index], SIGNAL(nameChanged()), SIGNAL(teamChanged())); connect(ui->pokemons[index], SIGNAL(itemChanged()), SIGNAL(teamChanged())); } } else if (index == 6) { if (!ui->boxes) { ui->stack->addWidget(ui->boxes = new PokeBoxes(this, &team())); connect(ui->boxes, SIGNAL(teamChanged()), SLOT(updatePokemons())); connect(ui->boxes, SIGNAL(teamChanged()), SIGNAL(teamChanged())); } } }
void TrainerMenu::changeCurrentTeam(int t) { if (t == team().currentTeam()) { return; } teamButtons[t]->setChecked(true); team().setCurrent(t); updateTeam(); emit teamChanged(); }
/** Sets the team for the trip */ void cwTrip::setTeam(cwTeam* team) { if(team != Team) { if(Team != NULL) { Team->deleteLater(); //Delete the old team } Team = team; if(Team != NULL) { Team->setParent(this); } emit teamChanged(); } }
void TrainerMenu::updateCurrentTeamAndNotify() { updateTeam(); emit teamChanged(); }
WorldView::WorldView(QWidget* parent) : portals::Module(), QWidget(parent), commThread("comm", COMM_FRAME_LENGTH_uS), wviewComm(16,0), sharedBallOut(base()), locOut(base()), wviewShared(1), newTeam(0), mutex() { commThread.addModule(*this); commThread.addModule(wviewComm); commThread.addModule(wviewShared); #ifdef USE_LAB_FIELD fieldPainter = new WorldViewPainter(this, 2.); #else fieldPainter = new WorldViewPainter(this, 1.); #endif QHBoxLayout *mainLayout = new QHBoxLayout(this); QHBoxLayout *field = new QHBoxLayout(); field->addWidget(fieldPainter); QVBoxLayout *rightBar = new QVBoxLayout(); QVBoxLayout *options = new QVBoxLayout(); options->setAlignment(Qt::AlignTop); startButton = new QPushButton(QString("Start World Viewer")); flipButton = new QPushButton(QString("FLIP")); options->addWidget(flipButton); options->addWidget(startButton); QHBoxLayout *teamLayout = new QHBoxLayout(); QLabel *teamLabel = new QLabel(tr("Listening to Team: ")); teamSelector = new QLineEdit(tr("16")); QValidator *teamVal = new QIntValidator(1, 255); teamSelector->setValidator(teamVal); teamLayout->addWidget(teamLabel); teamLayout->addWidget(teamSelector); options->addLayout(teamLayout); connect(teamSelector, SIGNAL(editingFinished()), this, SLOT(teamChanged())); QVBoxLayout *stateLayout = new QVBoxLayout(); stateLayout->setAlignment(Qt::AlignTop); QGroupBox *stateBox = new QGroupBox(tr("Robot States")); QVBoxLayout *boxLayout = new QVBoxLayout(); for (int i = 0; i < NUM_PLAYERS_PER_TEAM; ++i) { roleLabels[i] = new QLabel(tr("Inactive")); } QHBoxLayout *p1Layout = new QHBoxLayout(); QLabel *p1Label = new QLabel(tr("Player 1: ")); QHBoxLayout *p2Layout = new QHBoxLayout(); QLabel *p2Label = new QLabel(tr("Player 2: ")); QHBoxLayout *p3Layout = new QHBoxLayout(); QLabel *p3Label = new QLabel(tr("Player 3: ")); QHBoxLayout *p4Layout = new QHBoxLayout(); QLabel *p4Label = new QLabel(tr("Player 4: ")); QHBoxLayout *p5Layout = new QHBoxLayout(); QLabel *p5Label = new QLabel(tr("Player 5: ")); p1Layout->addWidget(p1Label); p1Layout->addWidget(roleLabels[0]); p2Layout->addWidget(p2Label); p2Layout->addWidget(roleLabels[1]); p3Layout->addWidget(p3Label); p3Layout->addWidget(roleLabels[2]); p4Layout->addWidget(p4Label); p4Layout->addWidget(roleLabels[3]); p5Layout->addWidget(p5Label); p5Layout->addWidget(roleLabels[4]); boxLayout->addLayout(p1Layout); boxLayout->addLayout(p2Layout); boxLayout->addLayout(p3Layout); boxLayout->addLayout(p4Layout); boxLayout->addLayout(p5Layout); boxLayout->setSpacing(20); stateBox->setFlat(false); stateBox->setLayout(boxLayout); stateLayout->addWidget(stateBox); rightBar->addLayout(options); rightBar->addLayout(stateLayout); mainLayout->addLayout(field); mainLayout->addLayout(rightBar); this->setLayout(mainLayout); connect(startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked())); connect(flipButton, SIGNAL(clicked()), this, SLOT(flipButtonClicked())); for (int i = 0; i < NUM_PLAYERS_PER_TEAM; ++i) { commIn[i].wireTo(wviewComm._worldModels[i]); wviewShared.worldModelIn[i].wireTo(wviewComm._worldModels[i]); } wviewShared.ballIn.wireTo(&sharedBallOut,true); wviewShared.locIn.wireTo(&locOut,true); sharedIn.wireTo(&wviewShared.sharedBallOutput); }