mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 12:03:25 -08:00
Apply else-after-return across the tree (#7884)
This commit is contained in:
parent
e97d3e5519
commit
c27b5e9fcf
22 changed files with 48 additions and 25 deletions
|
|
@ -37,7 +37,8 @@ bool parseDeckUrl(const QString &url, ParsedDeckInfo &outInfo)
|
|||
.fullUrl = TAPPEDOUT_BASE + slug + TAPPEDOUT_SUFFIX,
|
||||
.provider = DeckProvider::TappedOut};
|
||||
return true;
|
||||
} else if ((match = rxArchidekt.match(url)).hasMatch()) {
|
||||
}
|
||||
if ((match = rxArchidekt.match(url)).hasMatch()) {
|
||||
QString deckID = match.captured(1);
|
||||
outInfo = ParsedDeckInfo{.baseUrl = ARCHIDEKT_BASE,
|
||||
.deckID = deckID,
|
||||
|
|
|
|||
|
|
@ -251,7 +251,8 @@ bool ThemeManager::isDarkMode(const QString &themeDirPath) const
|
|||
const ThemeConfig themeConfig = loadColorSchemeConfig(themeDirPath, systemThemeDir);
|
||||
if (themeConfig.colorScheme.compare("Dark", Qt::CaseInsensitive) == 0) {
|
||||
return true;
|
||||
} else if (themeConfig.colorScheme.compare("Light", Qt::CaseInsensitive) == 0) {
|
||||
}
|
||||
if (themeConfig.colorScheme.compare("Light", Qt::CaseInsensitive) == 0) {
|
||||
return false;
|
||||
} else {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
|
|
|
|||
|
|
@ -180,7 +180,8 @@ bool ResizablePanel::eventFilter(QObject *obj, QEvent *event)
|
|||
dragButton->setCursor(Qt::ClosedHandCursor);
|
||||
}
|
||||
return false;
|
||||
} else if (event->type() == QEvent::MouseMove) {
|
||||
}
|
||||
if (event->type() == QEvent::MouseMove) {
|
||||
auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent->buttons() & Qt::LeftButton) {
|
||||
QPoint currentPos = mouseEvent->globalPosition().toPoint();
|
||||
|
|
@ -207,7 +208,8 @@ bool ResizablePanel::eventFilter(QObject *obj, QEvent *event)
|
|||
resizeStartHeight = currentHeight;
|
||||
resizeHandle->grabMouse();
|
||||
return true;
|
||||
} else if (event->type() == QEvent::MouseMove && isResizing) {
|
||||
}
|
||||
if (event->type() == QEvent::MouseMove && isResizing) {
|
||||
auto *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
int deltaY = mouseEvent->globalPosition().y() - resizeStartY;
|
||||
int newHeight = resizeStartHeight + deltaY;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ void DlgEditPassword::actOk()
|
|||
if (newPasswordEdit->text().length() < 8) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Your password is too short."));
|
||||
return;
|
||||
} else if (newPasswordEdit->text() != newPasswordEdit2->text()) {
|
||||
}
|
||||
if (newPasswordEdit->text() != newPasswordEdit2->text()) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("The new passwords don't match."));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,8 @@ void DlgForgotPasswordReset::actOk()
|
|||
if (newpasswordEdit->text().length() < 8) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Your password is too short."));
|
||||
return;
|
||||
} else if (newpasswordEdit->text() != newpasswordverifyEdit->text()) {
|
||||
}
|
||||
if (newpasswordEdit->text() != newpasswordverifyEdit->text()) {
|
||||
QMessageBox::critical(this, tr("Reset Password Error"), tr("The passwords do not match."));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -521,7 +521,8 @@ void DlgRegister::actOk()
|
|||
if (passwordEdit->text().length() < 8) {
|
||||
QMessageBox::critical(this, tr("Registration Warning"), tr("Your password is too short."));
|
||||
return;
|
||||
} else if (passwordEdit->text() != passwordConfirmationEdit->text()) {
|
||||
}
|
||||
if (passwordEdit->text() != passwordConfirmationEdit->text()) {
|
||||
QMessageBox::critical(this, tr("Registration Warning"), tr("Your passwords do not match, please try again."));
|
||||
return;
|
||||
} else if (emailConfirmationEdit->text() != emailEdit->text()) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ TipsOfTheDay::TipsOfTheDay(QString xmlPath, QObject *parent) : QAbstractListMode
|
|||
if (!QFile::exists(xmlPath)) {
|
||||
errorStream << tr("File does not exist.\n");
|
||||
return;
|
||||
} else if (!xmlFile.open(QIODevice::ReadOnly)) {
|
||||
}
|
||||
if (!xmlFile.open(QIODevice::ReadOnly)) {
|
||||
errorStream << tr("Failed to open file.\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,7 +172,8 @@ static QString zoneLogName(const QString &zone)
|
|||
{
|
||||
if (zone == DECK_ZONE_MAIN) {
|
||||
return "mainboard";
|
||||
} else if (zone == DECK_ZONE_SIDE) {
|
||||
}
|
||||
if (zone == DECK_ZONE_SIDE) {
|
||||
return "sideboard";
|
||||
} else if (zone == DECK_ZONE_TOKENS) {
|
||||
return "tokens";
|
||||
|
|
|
|||
|
|
@ -121,7 +121,8 @@ void UserContextMenu::gamesOfUserReceived(const Response &resp, const CommandCon
|
|||
if (resp.response_code() == Response::RespNameNotFound) {
|
||||
QMessageBox::critical(static_cast<QWidget *>(parent()), tr("Error"), tr("This user does not exist."));
|
||||
return;
|
||||
} else if (resp.response_code() == Response::RespInIgnoreList) {
|
||||
}
|
||||
if (resp.response_code() == Response::RespInIgnoreList) {
|
||||
QMessageBox::critical(
|
||||
static_cast<QWidget *>(parent()), tr("Error"),
|
||||
tr("You are being ignored by %1 and can't see their games.").arg(QString::fromStdString(cmd.user_name())));
|
||||
|
|
|
|||
|
|
@ -296,7 +296,8 @@ bool UserListTWI::operator<(const QTreeWidgetItem &other) const
|
|||
if (lhsUserLevelFlags.testFlag(userLevelEntry) &&
|
||||
lhsUserLevelFlags.testFlag(userLevelEntry) == rhsUserLevelFlags.testFlag(userLevelEntry)) {
|
||||
return collator.compare(data(2, Qt::UserRole).toString(), other.data(2, Qt::UserRole).toString()) < 0;
|
||||
} else if (lhsUserLevelFlags.testFlag(userLevelEntry) != rhsUserLevelFlags.testFlag(userLevelEntry)) {
|
||||
}
|
||||
if (lhsUserLevelFlags.testFlag(userLevelEntry) != rhsUserLevelFlags.testFlag(userLevelEntry)) {
|
||||
return lhsUserLevelFlags.testFlag(userLevelEntry) > rhsUserLevelFlags.testFlag(userLevelEntry);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -621,7 +621,8 @@ bool AbstractTabDeckEditor::confirmClose()
|
|||
int ret = createSaveConfirmationWindow()->exec();
|
||||
if (ret == QMessageBox::Save) {
|
||||
return actSaveDeck();
|
||||
} else if (ret == QMessageBox::Cancel) {
|
||||
}
|
||||
if (ret == QMessageBox::Cancel) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,7 +360,8 @@ void TabRoom::sendMessage()
|
|||
}
|
||||
if (sayEdit->text().isEmpty()) {
|
||||
return;
|
||||
} else if (sayEdit->hasVisibleCompleterPopup()) {
|
||||
}
|
||||
if (sayEdit->hasVisibleCompleterPopup()) {
|
||||
sayEdit->hideCompleterPopups();
|
||||
return;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1447,9 +1447,10 @@ void TabSupervisor::processUserMessageEvent(const Event_UserMessage &event)
|
|||
!userLevel.testFlag(ServerInfo_User::IsRegistered)) {
|
||||
// Flags are additive, so reg/mod/admin are all IsRegistered
|
||||
return;
|
||||
} else if (SettingsCache::instance().chat().getIgnoreNonBuddyUserMessages() &&
|
||||
!userListManager->isUserBuddy(senderName) && !userLevel.testFlag(ServerInfo_User::IsModerator) &&
|
||||
!userLevel.testFlag(ServerInfo_User::IsAdmin)) {
|
||||
}
|
||||
if (SettingsCache::instance().chat().getIgnoreNonBuddyUserMessages() &&
|
||||
!userListManager->isUserBuddy(senderName) && !userLevel.testFlag(ServerInfo_User::IsModerator) &&
|
||||
!userLevel.testFlag(ServerInfo_User::IsAdmin)) {
|
||||
// Ignore private messages from non-buddies
|
||||
// Moderator/Admin messages are exempt to ensure warnings reach users
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -265,7 +265,8 @@ static QString zoneForClickModifiers(const Qt::KeyboardModifiers &modifiers)
|
|||
{
|
||||
if (modifiers.testFlag(Qt::ControlModifier)) {
|
||||
return DECK_ZONE_SIDE;
|
||||
} else if (modifiers.testFlag(Qt::ShiftModifier)) {
|
||||
}
|
||||
if (modifiers.testFlag(Qt::ShiftModifier)) {
|
||||
return DECK_ZONE_MAYBEBOARD;
|
||||
} else {
|
||||
return DECK_ZONE_MAIN;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ QVariant CardInfoComparator::getProperty(const CardInfoPtr &card, const QString
|
|||
// Check if the property exists in the main fields of the class
|
||||
if (property == "name") {
|
||||
return card->getName();
|
||||
} else if (property == "text") {
|
||||
}
|
||||
if (property == "text") {
|
||||
return card->getText();
|
||||
} else if (property == "isToken") {
|
||||
return card->getIsToken();
|
||||
|
|
|
|||
|
|
@ -154,7 +154,8 @@ void CardSetList::defaultSort()
|
|||
// Sort by priority, then by release date, then by short name
|
||||
if (a->getPriority() != b->getPriority()) {
|
||||
return a->getPriority() < b->getPriority(); // lowest first
|
||||
} else if (a->getReleaseDate() != b->getReleaseDate()) {
|
||||
}
|
||||
if (a->getReleaseDate() != b->getReleaseDate()) {
|
||||
return a->getReleaseDate() > b->getReleaseDate(); // most recent first
|
||||
} else {
|
||||
return a->getShortName() < b->getShortName(); // alphabetically
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ QString InnerDecklistNode::visibleNameFromName(const QString &_name)
|
|||
{
|
||||
if (_name == DECK_ZONE_MAIN) {
|
||||
return QObject::tr("Maindeck");
|
||||
} else if (_name == DECK_ZONE_SIDE) {
|
||||
}
|
||||
if (_name == DECK_ZONE_SIDE) {
|
||||
return QObject::tr("Sideboard");
|
||||
} else if (_name == DECK_ZONE_TOKENS) {
|
||||
return QObject::tr("Tokens");
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ AbstractClient *AbstractGame::getClientForPlayer(int playerId) const
|
|||
}
|
||||
|
||||
return gameState->getClients().at(playerId);
|
||||
} else if (gameState->getClients().isEmpty()) {
|
||||
}
|
||||
if (gameState->getClients().isEmpty()) {
|
||||
return nullptr;
|
||||
} else {
|
||||
return gameState->getClients().first();
|
||||
|
|
|
|||
|
|
@ -254,7 +254,8 @@ void PlayerLogic::deleteCard(CardState *card)
|
|||
{
|
||||
if (card == nullptr) {
|
||||
return;
|
||||
} else if (dialogSemaphore) {
|
||||
}
|
||||
if (dialogSemaphore) {
|
||||
cardsToDelete.append(card);
|
||||
} else {
|
||||
card->deleteView();
|
||||
|
|
|
|||
|
|
@ -194,7 +194,8 @@ QString CardZoneLogic::getTranslatedName(bool theirOwn, GrammaticalCase gc) cons
|
|||
QString ownerName = player->getPlayerInfo()->getName();
|
||||
if (name == ZoneNames::HAND) {
|
||||
return (theirOwn ? tr("their hand", "nominative") : tr("%1's hand", "nominative").arg(ownerName));
|
||||
} else if (name == ZoneNames::DECK) {
|
||||
}
|
||||
if (name == ZoneNames::DECK) {
|
||||
switch (gc) {
|
||||
case CaseLookAtZone:
|
||||
return (theirOwn ? tr("their library", "look at zone")
|
||||
|
|
|
|||
|
|
@ -128,7 +128,8 @@ int CardDatabaseDisplayModel::lessThanNumerically(QStringView left, QStringView
|
|||
if (okLeft && okRight) {
|
||||
if (leftNum < rightNum) {
|
||||
return -1;
|
||||
} else if (leftNum > rightNum) {
|
||||
}
|
||||
if (leftNum > rightNum) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ double Expression::eval(const peg::Ast &ast)
|
|||
const auto &nodes = ast.nodes;
|
||||
if (ast.name == "NUMBER") {
|
||||
return stod(std::string(ast.token));
|
||||
} else if (ast.name == "FUNCTION") {
|
||||
}
|
||||
if (ast.name == "FUNCTION") {
|
||||
QString name = QString::fromStdString(std::string(nodes[0]->token));
|
||||
if (!fns.contains(name)) {
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue