void CMapiFolderList::EnsureUniqueName( CMapiFolder *pFolder) { // For everybody in the array before me with the SAME // depth, my name must be unique CMapiFolder * pCurrent; int i; BOOL done; nsString name; nsString cName; pFolder->GetDisplayName( name); do { done = TRUE; i = m_array.Count() - 1; while (i >= 0) { pCurrent = (CMapiFolder *)GetAt(i); if (pCurrent->GetDepth() == pFolder->GetDepth()) { pCurrent->GetDisplayName(cName); if (cName.Equals(name, nsCaseInsensitiveStringComparator())) { ChangeName(name); pFolder->SetDisplayName(name.get()); done = FALSE; break; } } else if (pCurrent->GetDepth() < pFolder->GetDepth()) break; i--; } } while (!done); }
CSequenserForm::CSequenserForm(IDevice* Device, QWidget *parent) : CSoftSynthsForm(Device,true,parent), ui(new Ui::CSequenserForm) { ui->setupUi(this); PlayListMenu=new QMenu(this); PlayListMenu->addAction("Add...",this,SLOT(MenuAddPatternClick())); PlayListMenu->addAction("Remove",this,SLOT(MenuRemovePatternClick())); PlayListMenu->addAction("Edit...",this,SLOT(MenuEditPatternClick())); connect(ui->AddPattern,SIGNAL(clicked()),this,SLOT(AddPatternClick())); connect(ui->RemovePattern,SIGNAL(clicked()),this,SLOT(RemovePatternClick())); connect(ui->NameEdit,SIGNAL(textEdited(QString)),this,SLOT(ChangeName())); connect(ui->TempoSpin,SIGNAL(valueChanged(int)),this,SLOT(ChangeTempo(int))); connect(ui->BeatsSpin,SIGNAL(valueChanged(int)),this,SLOT(ChangeNumOfBeats(int))); connect(ui->PatternList,SIGNAL(currentRowChanged(int)),this,SLOT(ChangePatternIndex())); connect(ui->PatternPlayList,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(PlayListPopup(QPoint))); connect(ui->PatternPlayList,SIGNAL(currentRowChanged(int)),this,SLOT(ChangeListIndex(int))); UpdatePatterns(); UpdateBeats(); UpdatePatternlist(); }
FString AGameModeBase::InitNewPlayer(APlayerController* NewPlayerController, const FUniqueNetIdRepl& UniqueId, const FString& Options, const FString& Portal) { PRAGMA_DISABLE_DEPRECATION_WARNINGS // Try calling deprecated version first FString DeprecatedError = InitNewPlayer(NewPlayerController, UniqueId.GetUniqueNetId(), Options, Portal); if (DeprecatedError != TEXT("DEPRECATED")) { // This means it was implemented in subclass return DeprecatedError; } PRAGMA_ENABLE_DEPRECATION_WARNINGS check(NewPlayerController); FString ErrorMessage; // Register the player with the session GameSession->RegisterPlayer(NewPlayerController, UniqueId.GetUniqueNetId(), UGameplayStatics::HasOption(Options, TEXT("bIsFromInvite"))); // Find a starting spot AActor* const StartSpot = FindPlayerStart(NewPlayerController, Portal); if (StartSpot != nullptr) { // Set the player controller / camera in this new location FRotator InitialControllerRot = StartSpot->GetActorRotation(); InitialControllerRot.Roll = 0.f; NewPlayerController->SetInitialLocationAndRotation(StartSpot->GetActorLocation(), InitialControllerRot); NewPlayerController->StartSpot = StartSpot; } else { ErrorMessage = FString::Printf(TEXT("Failed to find PlayerStart")); } // Set up spectating bool bSpectator = FCString::Stricmp(*UGameplayStatics::ParseOption(Options, TEXT("SpectatorOnly")), TEXT("1")) == 0; if (bSpectator || MustSpectate(NewPlayerController)) { NewPlayerController->StartSpectatingOnly(); } // Init player's name FString InName = UGameplayStatics::ParseOption(Options, TEXT("Name")).Left(20); if (InName.IsEmpty()) { InName = FString::Printf(TEXT("%s%i"), *DefaultPlayerName.ToString(), NewPlayerController->PlayerState->PlayerId); } ChangeName(NewPlayerController, InName, false); return ErrorMessage; }
// guildgumpinput() result branching for those niffy little gump text fields // Called by: gumpinput() void cGuildStone::GumpInput(UOXSOCKET s, int type, int index, char *text) { if (type == 100) { switch (index) { case 1: ChangeName(s,text); return; // Guild name requester case 2: ChangeAbbreviation(s,text); return; // Guild abbreviation requester case 3: ChangeTitle(s,text); return; // Guild master title requester case 4: ChangeTitle(s,text); return; // Guild member title requester case 5: ChangeCharter(s,text); return; // Guild charter requester case 6: ChangeWebpage(s,text); return; // Guild webpage requester } } }
void OptionMenu::getText(const char c) { static auto validChar = [](const char c) -> bool { return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == ' '); }; if (c == '\b') { std::string tmp = textField->getText(); textField->setText(tmp.substr(0, tmp.size() - 1)); } else if (c == '\n' || c == '\r') { ChangeName(); } else if (validChar(c) && textField->getText().size() < 16) textField->setText(textField->getText() + c); }