mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-12 04:50:01 -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue