void User::setGender(QString gender) { if(myGender != gender) { myGender = gender; updateGender(gender); calculateBMR(); emit genderChanged(); } }
void MemberProfile::updateParticularsMenu(string& tempUser) { int options; int location = index(tempUser); do { cout << "--------------------------------------------------" << endl; cout << "Which particulars do you want to update/amend?" << endl; cout << "--------------------------------------------------" << endl; cout << endl; cout << " 1) Update username" << endl; cout << " 2) Update password" << endl; cout << " 3) Update name" << endl; cout << " 4) Update nric" << endl; cout << " 5) Update date of birth" << endl; cout << " 6) Update gender " << endl; cout << " 7) Update address" << endl; cout << " 8) Update booking preference" << endl; cout << " 9) Want notification?" << endl; cout << " 10) Back to main menu" << endl; cout << endl; cout << "Options: "; cin >> options; cin.clear(); cin.ignore(300,'\n'); cout << endl; switch (options) { case 1: updateUsername(location, tempUser); break; case 2: updatePassword(location); break; case 3: updateName(location); break; case 4: updateNric(location); break; case 5: updateDOB(location); break; case 6: updateGender(location); break; case 7: updateAddress(location); break; case 8: cout << "To be updated" << endl;; break; case 9: wantNotification(location); break; default: cout << "Please enter a valid option" << endl; } } while (options != 10); }
void TB_PokemonBody::connectWithAdvanced(TB_Advanced *ptr) { connect(ptr, SIGNAL(abilityChanged()), this, SLOT(updateAbility())); connect(ptr, SIGNAL(levelChanged()), this, SLOT(updateLevel())); connect(ptr, SIGNAL(imageChanged()), this, SLOT(updateImage())); connect(ptr, SIGNAL(genderChanged()), this, SLOT(updateGender())); connect(ptr, SIGNAL(genderChanged()), this, SLOT(updateImage())); connect(ptr, SIGNAL(statChanged()), this, SLOT(updateEVs())); connect(ptr, SIGNAL(pokeFormeChanged(Pokemon::uniqueId)), this, SLOT(changeForme(Pokemon::uniqueId)), Qt::QueuedConnection); connect(this, SIGNAL(EVChanged(int)), ptr, SLOT(updateStat(int))); connect(this, SIGNAL(natureChanged()), ptr, SLOT(updateStats())); connect(this, SIGNAL(pokeImageChanged()), ptr, SLOT(updatePokeImage())); connect(ptr, SIGNAL(levelChanged()), this, SIGNAL(levelChanged())); }
PokeEdit::PokeEdit(TeamBuilderWidget *master, PokeTeam *poke, QAbstractItemModel *pokeModel, QAbstractItemModel *itemsModel, QAbstractItemModel *natureModel) : ui(new Ui::PokeEdit), pokemonModel(pokeModel), m_poke(poke), master(master) { ui->setupUi(this); ui->itemSprite->raise(); ui->item->setModel(itemsModel); ui->nature->setModel(natureModel); ui->levelSettings->setPoke(poke); ui->evbox->setPoke(poke); ui->ivbox->setPoke(poke); if (0) { master->getDock(EVDock)->setWidget(ui->evbox); master->getDock(IVDock)->setWidget(ui->ivbox); master->getDock(LevelDock)->setWidget(ui->levelSettings); master->getDock(MoveDock)->setWidget(ui->moveContainer); } else { QCloseDockWidget *hi = new QCloseDockWidget(tr("Advanced"), this); hi->setObjectName("AdvancedTab"); hi->setWidget(ui->ivbox); hi->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable); ui->horizontalMove->addWidget(hi); if (advancedWindowClosed) { hi->close(); } connect(hi, SIGNAL(closed()), SIGNAL(closeAdvanced())); // QDockWidget *hi2 = new QDockWidget(tr("Level"), this); // hi2->setWidget(ui->levelSettings); // hi2->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable); // ui->horizontalPoke->addWidget(hi2); } QSortFilterProxyModel *pokeFilter = new QSortFilterProxyModel(this); pokeFilter->setFilterRegExp("."); pokeFilter->setSourceModel(pokemonModel); QCompleter *completer = new QCompleter(pokeFilter, ui->nickname); completer->setCompletionColumn(1); completer->setCompletionRole(Qt::DisplayRole); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setCompletionMode(QCompleter::PopupCompletion); ui->nickname->setCompleter(completer); connect(completer, SIGNAL(activated(QString)), SLOT(setNum(QString))); /* 20 characters for the name. Longest name: Vivillon-Archipelago = 20 characters */ ui->nickname->setValidator(new QNickValidator(ui->nickname, 20)); fillMoves(); connect(ui->levelSettings, SIGNAL(levelUpdated()), this, SLOT(updateStats())); connect(ui->levelSettings, SIGNAL(levelUpdated()), ui->ivbox, SLOT(updateStats())); connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updatePicture())); connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updateGender())); connect(ui->ivbox, SIGNAL(genderUpdated()), SLOT(updateGender())); connect(ui->ivbox, SIGNAL(genderUpdated()), ui->levelSettings, SLOT(updateGender())); connect(ui->ivbox, SIGNAL(shinyUpdated()), SLOT(updatePicture())); connect(ui->happiness, SIGNAL(valueChanged(int)), this, SLOT(changeHappiness(int))); connect(ui->nature, SIGNAL(currentIndexChanged(int)), this, SLOT(changeNature(int))); connect(ui->item, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeItem(QString))); connect(ui->evbox, SIGNAL(natureChanged(int)), this, SLOT(setNature(int))); connect(ui->evbox, SIGNAL(natureBoostChanged()), ui->ivbox, SLOT(updateStats())); connect(ui->ivbox, SIGNAL(statsUpdated()), ui->evbox, SLOT(updateEVs())); updateAll(); }
PokeEdit::PokeEdit(PokeTeam *poke, QAbstractItemModel *pokeModel, QAbstractItemModel *itemsModel, QAbstractItemModel *natureModel) : ui(new Ui::PokeEdit), pokemonModel(pokeModel), m_poke(poke) { ui->setupUi(this); ui->itemSprite->raise(); ui->item->setModel(itemsModel); ui->nature->setModel(natureModel); ui->levelSettings->setPoke(poke); ui->evbox->setPoke(poke); ui->ivbox->setPoke(poke); movesModel = new PokeMovesModel(poke->num(), poke->gen(), this); QSortFilterProxyModel *filter = new QSortFilterProxyModel(this); filter->setSourceModel(movesModel); ui->moveChoice->setModel(filter); ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::PP, QHeaderView::ResizeToContents); ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Pow, QHeaderView::ResizeToContents); ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Acc, QHeaderView::ResizeToContents); ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Name, QHeaderView::Fixed); ui->moveChoice->horizontalHeader()->resizeSection(PokeMovesModel::Name, 125); ui->moveChoice->horizontalHeader()->resizeSection(PokeMovesModel::Type, Theme::TypePicture(Type::Normal).width()+5); ui->moveChoice->setIconSize(Theme::TypePicture(Type::Normal).size()); ui->moveChoice->sortByColumn(PokeMovesModel::Name, Qt::AscendingOrder); m_moves[0] = ui->move1; m_moves[1] = ui->move2; m_moves[2] = ui->move3; m_moves[3] = ui->move4; connect(ui->speciesLabel, SIGNAL(clicked()), SLOT(on_pokemonFrame_clicked())); connect(ui->moveChoice, SIGNAL(activated(QModelIndex)), SLOT(moveEntered(QModelIndex))); /* the four move choice items */ for (int i = 0; i < 4; i++) { QCompleter *completer = new QCompleter(m_moves[i]); completer->setModel(ui->moveChoice->model()); completer->setCompletionColumn(PokeMovesModel::Name); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setCompletionMode(QCompleter::PopupCompletion); completer->setCompletionRole(Qt::DisplayRole); m_moves[i]->setCompleter(completer); completer->setProperty("move", i); m_moves[i]->setProperty("move", i); connect(completer, SIGNAL(activated(QString)), SLOT(changeMove())); connect(m_moves[i], SIGNAL(returnPressed()), SLOT(changeMove())); connect(m_moves[i], SIGNAL(editingFinished()), SLOT(changeMove())); } connect(ui->levelSettings, SIGNAL(levelUpdated()), this, SLOT(updateStats())); connect(ui->levelSettings, SIGNAL(levelUpdated()), ui->ivbox, SLOT(updateStats())); connect(ui->levelSettings, SIGNAL(shinyUpdated()), this, SLOT(updatePicture())); connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updatePicture())); connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updateGender())); connect(ui->ivbox, SIGNAL(genderUpdated()), SLOT(updateGender())); connect(ui->ivbox, SIGNAL(genderUpdated()), ui->levelSettings, SLOT(updateGender())); connect(ui->ivbox, SIGNAL(shinyUpdated()), SLOT(updatePicture())); connect(ui->ivbox, SIGNAL(shinyUpdated()), ui->levelSettings, SLOT(updateShiny())); connect(ui->happiness, SIGNAL(valueChanged(int)), this, SLOT(changeHappiness(int))); connect(ui->nature, SIGNAL(currentIndexChanged(int)), this, SLOT(changeNature(int))); connect(ui->item, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeItem(QString))); connect(ui->evbox, SIGNAL(natureChanged(int)), this, SLOT(setNature(int))); connect(ui->evbox, SIGNAL(natureBoostChanged()), ui->ivbox, SLOT(updateStats())); connect(ui->ivbox, SIGNAL(statsUpdated()), ui->evbox, SLOT(updateEVs())); updateAll(); }