[Fix-Warnings] Remove redundant parentheses

This commit is contained in:
Brübach, Lukas 2025-11-29 09:23:11 +01:00
parent 858361e6d3
commit 8ddbdf31f9
75 changed files with 269 additions and 269 deletions

View file

@ -190,7 +190,7 @@ void StableReleaseChannel::tagListFinished()
QString shortHash = lastRelease->getCommitHash().left(GIT_SHORT_HASH_LEN);
QString myHash = QString(VERSION_COMMIT);
qCInfo(ReleaseChannelLog) << "Current hash=" << myHash << "update hash=" << shortHash;
const bool needToUpdate = (QString::compare(shortHash, myHash, Qt::CaseInsensitive) != 0);
const bool needToUpdate = QString::compare(shortHash, myHash, Qt::CaseInsensitive) != 0;
emit finishedCheck(needToUpdate, lastRelease->isCompatibleVersionFound(), lastRelease);
}
@ -284,7 +284,7 @@ void BetaReleaseChannel::fileListFinished()
QString myHash = QString(VERSION_COMMIT);
qCInfo(ReleaseChannelLog) << "Current hash=" << myHash << "update hash=" << shortHash;
bool needToUpdate = (QString::compare(shortHash, myHash, Qt::CaseInsensitive) != 0);
bool needToUpdate = QString::compare(shortHash, myHash, Qt::CaseInsensitive) != 0;
bool compatibleVersion = false;
QStringList resultUrlList{};

View file

@ -29,9 +29,9 @@ QColor CardCounterSettings::color(int counterId) const
defaultColor = QColor::fromHsv(counterId * 60, 150, 255);
} else {
// Future-proof support for more counters with pseudo-random colors
int h = (counterId * 37) % 360;
int s = 128 + 64 * qSin((counterId * 97) * 0.1); // 64-192
int v = 196 + 32 * qSin((counterId * 101) * 0.07); // 164-228
int h = counterId * 37 % 360;
int s = 128 + 64 * qSin(counterId * 97 * 0.1); // 64-192
int v = 196 + 32 * qSin(counterId * 101 * 0.07); // 164-228
defaultColor = QColor::fromHsv(h, s, v);
}
@ -48,7 +48,7 @@ QString CardCounterSettings::displayName(int counterId) const
str.resize(nChars);
for (auto it = str.rbegin(); it != str.rend(); ++it) {
*it = QChar('A' + (counterId) % 26);
*it = QChar('A' + counterId % 26);
counterId /= 26;
}

View file

@ -288,9 +288,9 @@ void AbstractCardItem::setFaceDown(bool _facedown)
void AbstractCardItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if ((event->modifiers() & Qt::AltModifier) && event->button() == Qt::LeftButton) {
if (event->modifiers() & Qt::AltModifier && event->button() == Qt::LeftButton) {
emit cardShiftClicked(cardRef.name);
} else if ((event->modifiers() & Qt::ControlModifier)) {
} else if (event->modifiers() & Qt::ControlModifier) {
setSelected(!isSelected());
} else if (!isSelected()) {
scene()->clearSelection();

View file

@ -136,7 +136,7 @@ void AbstractCounter::setValue(int _value)
void AbstractCounter::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if (isUnderMouse() && player->getPlayerInfo()->getLocalOrJudge()) {
if (event->button() == Qt::MiddleButton || (QApplication::keyboardModifiers() & Qt::ShiftModifier)) {
if (event->button() == Qt::MiddleButton || QApplication::keyboardModifiers() & Qt::ShiftModifier) {
if (menu)
menu->exec(event->screenPos());
event->accept();

View file

@ -182,7 +182,7 @@ void ArrowDragItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
if ((cursorItem != targetItem) && targetItem) {
if (cursorItem != targetItem && targetItem) {
targetItem->setBeingPointedAt(false);
targetItem->removeArrowTo(this);
}
@ -213,7 +213,7 @@ void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if (!startItem)
return;
if (targetItem && (targetItem != startItem)) {
if (targetItem && targetItem != startItem) {
CardZoneLogic *startZone = static_cast<CardItem *>(startItem)->getZone();
// For now, we can safely assume that the start item is always a card.
// The target item can be a player as well.
@ -291,7 +291,7 @@ void ArrowAttachItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
if ((cursorItem != targetItem) && targetItem) {
if (cursorItem != targetItem && targetItem) {
targetItem->setBeingPointedAt(false);
}
if (!cursorItem) {
@ -349,7 +349,7 @@ void ArrowAttachItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
child->setTargetLocked(true);
}
if (targetItem && (targetItem != startItem)) {
if (targetItem && targetItem != startItem) {
auto startCard = qgraphicsitem_cast<CardItem *>(startItem);
auto targetCard = qgraphicsitem_cast<CardItem *>(targetItem);
if (startCard && targetCard) {

View file

@ -110,7 +110,7 @@ void CardDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QList<CardDragItem *> dragItemList;
CardZoneLogic *startZone = static_cast<CardItem *>(item)->getZone();
if (currentZone && !(static_cast<CardItem *>(item)->getAttachedTo() && (startZone == currentZone->getLogic()))) {
if (currentZone && !(static_cast<CardItem *>(item)->getAttachedTo() && startZone == currentZone->getLogic())) {
if (!occupied) {
dragItemList.append(this);
}
@ -118,7 +118,7 @@ void CardDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
for (int i = 0; i < childDrags.size(); i++) {
CardDragItem *c = static_cast<CardDragItem *>(childDrags[i]);
if (!occupied &&
!(static_cast<CardItem *>(c->item)->getAttachedTo() && (startZone == currentZone->getLogic())) &&
!(static_cast<CardItem *>(c->item)->getAttachedTo() && startZone == currentZone->getLogic()) &&
!c->occupied) {
dragItemList.append(c);
}

View file

@ -358,7 +358,7 @@ void CardItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
int childIndex = 0;
for (const auto &item : scene()->selectedItems()) {
CardItem *card = static_cast<CardItem *>(item);
if ((card == this) || (card->getZone() != zone))
if (card == this || card->getZone() != zone)
continue;
++childIndex;
QPointF childPos;
@ -436,8 +436,8 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
return;
}
}
} else if ((event->modifiers() != Qt::AltModifier) && (event->button() == Qt::LeftButton) &&
(!SettingsCache::instance().getDoubleClickToPlay())) {
} else if (event->modifiers() != Qt::AltModifier && event->button() == Qt::LeftButton &&
!SettingsCache::instance().getDoubleClickToPlay()) {
handleClickedToPlay(event->modifiers().testFlag(Qt::ShiftModifier));
}
@ -449,8 +449,8 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
if ((event->modifiers() != Qt::AltModifier) && (event->buttons() == Qt::LeftButton) &&
(SettingsCache::instance().getDoubleClickToPlay())) {
if (event->modifiers() != Qt::AltModifier && event->buttons() == Qt::LeftButton &&
SettingsCache::instance().getDoubleClickToPlay()) {
handleClickedToPlay(event->modifiers().testFlag(Qt::ShiftModifier));
}
event->accept();
@ -464,11 +464,11 @@ bool CardItem::animationEvent()
rotation *= -1;
tapAngle += rotation;
if (tapped && (tapAngle > 90)) {
if (tapped && tapAngle > 90) {
tapAngle = 90;
animationIncomplete = false;
}
if (!tapped && (tapAngle < 0)) {
if (!tapped && tapAngle < 0) {
tapAngle = 0;
animationIncomplete = false;
}
@ -485,7 +485,7 @@ bool CardItem::animationEvent()
QVariant CardItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
if ((change == ItemSelectedHasChanged) && owner != nullptr) {
if (change == ItemSelectedHasChanged && owner != nullptr) {
if (value == true) {
owner->getGame()->setActiveCard(this);
owner->getPlayerMenu()->updateCardMenu(this);

View file

@ -289,7 +289,7 @@ void DeckViewCardContainer::rearrangeItems(const QList<QPair<int, int>> &rowsAnd
std::sort(row.begin(), row.end(), DeckViewCardContainer::sortCardsByName);
for (int j = 0; j < row.size(); ++j) {
DeckViewCard *card = row[j];
card->setPos(x + (j % tempCols) * CARD_WIDTH, yUntilNow + (j / tempCols) * CARD_HEIGHT);
card->setPos(x + j % tempCols * CARD_WIDTH, yUntilNow + j / tempCols * CARD_HEIGHT);
}
yUntilNow += tempRows * CARD_HEIGHT + paddingY;
}

View file

@ -118,7 +118,7 @@ void GameEventHandler::processGameEventContainer(const GameEventContainer &cont,
break;
}
} else {
if ((game->getGameState()->getClients().size() > 1) && (playerId != -1))
if (game->getGameState()->getClients().size() > 1 && playerId != -1)
if (game->getGameState()->getClients().at(playerId) != client)
continue;

View file

@ -235,7 +235,7 @@ QSizeF GameScene::computeSceneSizeAndPlayerLayout(const QList<Player *> &players
playersByColumn.append(QList<PlayerGraphicsItem *>());
columnWidth.append(0);
qreal thisColumnHeight = -playerAreaSpacing;
int rowsInColumn = rows - (playersPlaying.size() % columns) * col; // Adjust rows for uneven columns
int rowsInColumn = rows - playersPlaying.size() % columns * col; // Adjust rows for uneven columns
for (int j = 0; j < rowsInColumn; ++j) {
Player *player = playersIter.next();
@ -343,9 +343,9 @@ void GameScene::updateHover(const QPointF &scenePos)
void GameScene::updateHoveredCard(CardItem *newCard)
{
if (hoveredCard && (newCard != hoveredCard))
if (hoveredCard && newCard != hoveredCard)
hoveredCard->setHovered(false);
if (newCard && (newCard != hoveredCard))
if (newCard && newCard != hoveredCard)
newCard->setHovered(true);
hoveredCard = newCard;
}

View file

@ -298,7 +298,7 @@ void MessageLogWidget::logMoveCard(Player *player,
cardStr = cardLink(cardName);
}
if (ownerChanged && (startZone->getPlayer() == player)) {
if (ownerChanged && startZone->getPlayer() == player) {
appendHtmlServerMessage(tr("%1 gives %2 control over %3.")
.arg(sanitizeHtml(player->getPlayerInfo()->getName()))
.arg(sanitizeHtml(targetZone->getPlayer()->getPlayerInfo()->getName()))

View file

@ -62,7 +62,7 @@ void PhaseButton::setWidth(double _width)
void PhaseButton::setActive(bool _active)
{
if ((active == _active) || !highlightable)
if (active == _active || !highlightable)
return;
active = _active;

View file

@ -67,7 +67,7 @@ void PlayerActions::playCard(CardItem *card, bool faceDown)
cmd.set_x(0);
cmd.set_y(0);
} else if (!faceDown &&
((!playToStack && tableRow == 3) || ((playToStack && tableRow != 0) && currentZone != "stack"))) {
((!playToStack && tableRow == 3) || playToStack && tableRow != 0 && currentZone != "stack")) {
cmd.set_target_zone("stack");
cmd.set_x(-1);
cmd.set_y(0);
@ -1188,7 +1188,7 @@ void PlayerActions::setCardAttrHelper(const GameEventContext &context,
break;
}
case AttrDoesntUntap: {
bool value = (avalue == "1");
bool value = avalue == "1";
emit logSetDoesntUntap(player, card, value);
card->setDoesntUntap(value);
break;

View file

@ -269,7 +269,7 @@ void PlayerEventHandler::eventMoveCard(const Event_MoveCard &event, const GameEv
card->setCardRef({name, providerId});
}
if (card->getAttachedTo() && (startZone != targetZone)) {
if (card->getAttachedTo() && startZone != targetZone) {
CardItem *parentCard = card->getAttachedTo();
card->setAttachedTo(nullptr);
parentCard->getZone()->reorganizeCards();
@ -313,7 +313,7 @@ void PlayerEventHandler::eventMoveCard(const Event_MoveCard &event, const GameEv
QMapIterator<int, ArrowItem *> arrowIterator(p->getArrows());
while (arrowIterator.hasNext()) {
ArrowItem *arrow = arrowIterator.next().value();
if ((arrow->getStartItem() == card) || (arrow->getTargetItem() == card)) {
if (arrow->getStartItem() == card || arrow->getTargetItem() == card) {
if (startZone == targetZone) {
arrow->updatePath();
} else {
@ -409,7 +409,7 @@ void PlayerEventHandler::eventAttachCard(const Event_AttachCard &event)
startCard->setAttachedTo(targetCard);
startZone->reorganizeCards();
if ((startZone != targetZone) && targetZone) {
if (startZone != targetZone && targetZone) {
targetZone->reorganizeCards();
}
if (oldParent) {

View file

@ -26,7 +26,7 @@ bool PlayerListItemDelegate::editorEvent(QEvent *event,
const QStyleOptionViewItem &option,
const QModelIndex &index)
{
if ((event->type() == QEvent::MouseButtonPress) && index.isValid()) {
if (event->type() == QEvent::MouseButtonPress && index.isValid()) {
auto *const mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::RightButton) {
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
@ -135,8 +135,9 @@ void PlayerListWidget::updatePlayerProperties(const ServerInfo_PlayerProperties
if (prop.has_ready_start())
player->setData(2, Qt::UserRole + 1, prop.ready_start());
if (prop.has_conceded() || prop.has_ready_start())
player->setIcon(2, gameStarted ? (prop.conceded() ? concededIcon : QIcon())
: (prop.ready_start() ? readyIcon : notReadyIcon));
player->setIcon(2, gameStarted ? (prop.conceded() ? concededIcon : QIcon())
: prop.ready_start() ? readyIcon
: notReadyIcon);
}
if (prop.has_user_info()) {
player->setData(3, Qt::UserRole, prop.user_info().user_level());

View file

@ -75,18 +75,18 @@ void HandZone::reorganizeCards()
qreal cardWidth = getLogic()->getCards().at(0)->boundingRect().width();
const int xPadding = leftJustified ? cardWidth * 1.4 : 5;
qreal totalWidth =
leftJustified ? boundingRect().width() - (1 * xPadding) - 5 : boundingRect().width() - 2 * xPadding;
leftJustified ? boundingRect().width() - 1 * xPadding - 5 : boundingRect().width() - 2 * xPadding;
for (int i = 0; i < cardCount; i++) {
CardItem *c = getLogic()->getCards().at(i);
// If the total width of the cards is smaller than the available width,
// the cards do not need to overlap and are displayed in the center of the area.
if (cardWidth * cardCount > totalWidth)
c->setPos(xPadding + ((qreal)i) * (totalWidth - cardWidth) / (cardCount - 1), 5);
c->setPos(xPadding + (qreal)i * (totalWidth - cardWidth) / (cardCount - 1), 5);
else {
qreal xPosition =
leftJustified ? xPadding + ((qreal)i) * cardWidth
: xPadding + ((qreal)i) * cardWidth + (totalWidth - cardCount * cardWidth) / 2;
qreal xPosition = leftJustified
? xPadding + (qreal)i * cardWidth
: xPadding + (qreal)i * cardWidth + (totalWidth - cardCount * cardWidth) / 2;
c->setPos(xPosition, 5);
}
c->setRealZValue(i);
@ -100,7 +100,7 @@ void HandZone::reorganizeCards()
for (int i = 0; i < cardCount; i++) {
CardItem *card = getLogic()->getCards().at(i);
qreal x = (i % 2) ? x2 : x1;
qreal x = i % 2 ? x2 : x1;
qreal y = divideCardSpaceInZone(i, cardCount, boundingRect().height(),
getLogic()->getCards().at(0)->boundingRect().height());
card->setPos(x, y);

View file

@ -174,41 +174,40 @@ QString CardZoneLogic::getTranslatedName(bool theirOwn, GrammaticalCase gc) cons
{
QString ownerName = player->getPlayerInfo()->getName();
if (name == "hand")
return (theirOwn ? tr("their hand", "nominative") : tr("%1's hand", "nominative").arg(ownerName));
return theirOwn ? tr("their hand", "nominative") : tr("%1's hand", "nominative").arg(ownerName);
else if (name == "deck")
switch (gc) {
case CaseLookAtZone:
return (theirOwn ? tr("their library", "look at zone")
: tr("%1's library", "look at zone").arg(ownerName));
return theirOwn ? tr("their library", "look at zone")
: tr("%1's library", "look at zone").arg(ownerName);
case CaseTopCardsOfZone:
return (theirOwn ? tr("of their library", "top cards of zone,")
: tr("of %1's library", "top cards of zone").arg(ownerName));
return theirOwn ? tr("of their library", "top cards of zone,")
: tr("of %1's library", "top cards of zone").arg(ownerName);
case CaseRevealZone:
return (theirOwn ? tr("their library", "reveal zone")
: tr("%1's library", "reveal zone").arg(ownerName));
return theirOwn ? tr("their library", "reveal zone") : tr("%1's library", "reveal zone").arg(ownerName);
case CaseShuffleZone:
return (theirOwn ? tr("their library", "shuffle") : tr("%1's library", "shuffle").arg(ownerName));
return theirOwn ? tr("their library", "shuffle") : tr("%1's library", "shuffle").arg(ownerName);
default:
return (theirOwn ? tr("their library", "nominative") : tr("%1's library", "nominative").arg(ownerName));
return theirOwn ? tr("their library", "nominative") : tr("%1's library", "nominative").arg(ownerName);
}
else if (name == "grave")
return (theirOwn ? tr("their graveyard", "nominative") : tr("%1's graveyard", "nominative").arg(ownerName));
return theirOwn ? tr("their graveyard", "nominative") : tr("%1's graveyard", "nominative").arg(ownerName);
else if (name == "rfg")
return (theirOwn ? tr("their exile", "nominative") : tr("%1's exile", "nominative").arg(ownerName));
return theirOwn ? tr("their exile", "nominative") : tr("%1's exile", "nominative").arg(ownerName);
else if (name == "sb")
switch (gc) {
case CaseLookAtZone:
return (theirOwn ? tr("their sideboard", "look at zone")
: tr("%1's sideboard", "look at zone").arg(ownerName));
return theirOwn ? tr("their sideboard", "look at zone")
: tr("%1's sideboard", "look at zone").arg(ownerName);
case CaseNominative:
return (theirOwn ? tr("their sideboard", "nominative")
: tr("%1's sideboard", "nominative").arg(ownerName));
return theirOwn ? tr("their sideboard", "nominative")
: tr("%1's sideboard", "nominative").arg(ownerName);
default:
break;
}
else {
return (theirOwn ? tr("their custom zone '%1'", "nominative").arg(name)
: tr("%1's custom zone '%2'", "nominative").arg(ownerName).arg(name));
return theirOwn ? tr("their custom zone '%1'", "nominative").arg(name)
: tr("%1's custom zone '%2'", "nominative").arg(ownerName).arg(name);
}
return QString();
}

View file

@ -103,8 +103,7 @@ void PileZone::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
bool faceDown = event->modifiers().testFlag(Qt::ShiftModifier);
bool bottomCard = event->modifiers().testFlag(Qt::ControlModifier);
CardItem *card = bottomCard ? getLogic()->getCards().last() : getLogic()->getCards().first();
const int cardid =
getLogic()->contentsKnown() ? card->getId() : (bottomCard ? getLogic()->getCards().size() - 1 : 0);
const int cardid = getLogic()->contentsKnown() ? card->getId() : bottomCard ? getLogic()->getCards().size() - 1 : 0;
CardDragItem *drag = card->createDragItem(cardid, event->pos(), event->scenePos(), faceDown);
drag->grabMouse();
setCursor(Qt::OpenHandCursor);

View file

@ -97,7 +97,7 @@ void StackZone::reorganizeCards()
for (int i = 0; i < cardCount; i++) {
CardItem *card = getLogic()->getCards().at(i);
qreal x = (i % 2) ? x2 : x1;
qreal x = i % 2 ? x2 : x1;
qreal y = divideCardSpaceInZone(i, cardCount, boundingRect().height(),
getLogic()->getCards().at(0)->boundingRect().height());
card->setPos(x, y);

View file

@ -50,10 +50,10 @@ QRectF TableZone::boundingRect() const
bool TableZone::isInverted() const
{
return ((getLogic()->getPlayer()->getGraphicsItem()->getMirrored() &&
!SettingsCache::instance().getInvertVerticalCoordinate()) ||
return (getLogic()->getPlayer()->getGraphicsItem()->getMirrored() &&
!SettingsCache::instance().getInvertVerticalCoordinate()) ||
(!getLogic()->getPlayer()->getGraphicsItem()->getMirrored() &&
SettingsCache::instance().getInvertVerticalCoordinate()));
SettingsCache::instance().getInvertVerticalCoordinate());
}
void TableZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
@ -229,7 +229,7 @@ void TableZone::resizeToContents()
// Minimum width is the rightmost card position plus enough room for
// another card with padding, then margin.
currentMinimumWidth = xMax + (2 * CARD_WIDTH) + PADDING_X + MARGIN_RIGHT;
currentMinimumWidth = xMax + 2 * CARD_WIDTH + PADDING_X + MARGIN_RIGHT;
if (currentMinimumWidth < MIN_WIDTH)
currentMinimumWidth = MIN_WIDTH;
@ -291,7 +291,7 @@ QPointF TableZone::mapFromGrid(QPoint gridPoint) const
qreal x, y;
// Start with margin plus stacked card offset
x = MARGIN_LEFT + (gridPoint.x() % 3) * STACKED_CARD_OFFSET_X;
x = MARGIN_LEFT + gridPoint.x() % 3 * STACKED_CARD_OFFSET_X;
// Add in width of card stack plus padding for each column
for (int i = 0; i < gridPoint.x() / 3; ++i) {
@ -303,7 +303,7 @@ QPointF TableZone::mapFromGrid(QPoint gridPoint) const
gridPoint.setY(TABLEROWS - 1 - gridPoint.y());
// Start with margin plus stacked card offset
y = MARGIN_TOP + (gridPoint.x() % 3) * STACKED_CARD_OFFSET_Y;
y = MARGIN_TOP + gridPoint.x() % 3 * STACKED_CARD_OFFSET_Y;
// Add in card size and padding for each row
for (int i = 0; i < gridPoint.y(); ++i)
@ -342,7 +342,7 @@ QPoint TableZone::mapToGrid(const QPointF &mapPoint) const
int xStack = 0;
int xNextStack = 0;
int nextStackCol = 0;
while ((xNextStack <= x) && (xNextStack <= xMax)) {
while (xNextStack <= x && xNextStack <= xMax) {
xStack = xNextStack;
const int key = getCardStackMapKey(nextStackCol, gridPointY);
xNextStack += cardStackWidth.value(key, CARD_WIDTH) + PADDING_X;
@ -362,7 +362,7 @@ QPoint TableZone::mapToGrid(const QPointF &mapPoint) const
QPointF TableZone::closestGridPoint(const QPointF &point)
{
QPoint gridPoint = mapToGrid(point);
gridPoint.setX((gridPoint.x() / 3) * 3);
gridPoint.setX(gridPoint.x() / 3 * 3);
if (getCardFromGrid(gridPoint))
gridPoint.setX(gridPoint.x() + 1);
if (getCardFromGrid(gridPoint))

View file

@ -41,7 +41,7 @@ private:
/*
Minimum width of the table zone including margins.
*/
static const int MIN_WIDTH = MARGIN_LEFT + (5 * CARD_WIDTH) + MARGIN_RIGHT;
static const int MIN_WIDTH = MARGIN_LEFT + 5 * CARD_WIDTH + MARGIN_RIGHT;
/*
Offset sizes when cards are stacked on each other in the grid
@ -196,7 +196,7 @@ private:
*/
[[nodiscard]] int getCardStackMapKey(int x, int y) const
{
return x + (y * 1000);
return x + y * 1000;
}
};

View file

@ -88,7 +88,7 @@ void ZoneViewZone::initializeCards(const QList<const ServerInfo_Card *> &cardLis
getLogic()->getPlayer()->getPlayerActions()->sendGameCommand(pend);
} else {
const CardList &c = qobject_cast<ZoneViewZoneLogic *>(getLogic())->getOriginalZone()->getCards();
int number = numberCards == -1 ? c.size() : (numberCards < c.size() ? numberCards : c.size());
int number = numberCards == -1 ? c.size() : numberCards < c.size() ? numberCards : c.size();
for (int i = 0; i < number; i++) {
CardItem *card = c.at(i);
getLogic()->addCard(new CardItem(getLogic()->getPlayer(), this, card->getCardRef(), card->getId()), false,
@ -160,8 +160,8 @@ void ZoneViewZone::reorganizeCards()
// determine bounding rect
qreal aleft = 0;
qreal atop = 0;
qreal awidth = gridSize.cols * CARD_WIDTH + (CARD_WIDTH / 2) + HORIZONTAL_PADDING;
qreal aheight = (gridSize.rows * CARD_HEIGHT) / 3 + CARD_HEIGHT * 1.3;
qreal awidth = gridSize.cols * CARD_WIDTH + CARD_WIDTH / 2 + HORIZONTAL_PADDING;
qreal aheight = gridSize.rows * CARD_HEIGHT / 3 + CARD_HEIGHT * 1.3;
optimumRect = QRectF(aleft, atop, awidth, aheight);
updateGeometry();
@ -232,8 +232,8 @@ ZoneViewZone::GridSize ZoneViewZone::positionCardsForDisplay(CardList &cards, Ca
for (int i = 0; i < cardCount; i++) {
CardItem *c = cards.at(i);
qreal x = (i / rows) * CARD_WIDTH;
qreal y = (i % rows) * CARD_HEIGHT / 3;
qreal x = i / rows * CARD_WIDTH;
qreal y = i % rows * CARD_HEIGHT / 3;
c->setPos(HORIZONTAL_PADDING + x, VERTICAL_PADDING + y);
c->setRealZValue(i);
}

View file

@ -386,9 +386,9 @@ void ZoneViewWidget::expandWindow()
// reset window to initial max height if...
bool doResetSize =
// current height is less than that
(height < maxInitialHeight) ||
height < maxInitialHeight ||
// current height is at expanded max height
(height == maxExpandedHeight) ||
height == maxExpandedHeight ||
// current height is at actual max height, and actual max height is less than expanded max height
(height == maxHeight && height > maxInitialHeight && height < maxExpandedHeight);

View file

@ -38,12 +38,14 @@ void AbstractGraphicsItem::paintNumberEllipse(int number,
qreal yOffset = 20;
qreal spacing = 2;
if (position < 2)
textRect = QRectF(count == 1 ? ((boundingRect().width() - w) / 2.0)
: (position % 2 == 0 ? xOffset : (boundingRect().width() - xOffset - w)),
textRect = QRectF(count == 1 ? (boundingRect().width() - w) / 2.0
: position % 2 == 0 ? xOffset
: boundingRect().width() - xOffset - w,
yOffset, w, h);
else
textRect = QRectF(count == 3 ? ((boundingRect().width() - w) / 2.0)
: (position % 2 == 0 ? xOffset : (boundingRect().width() - xOffset - w)),
textRect = QRectF(count == 3 ? (boundingRect().width() - w) / 2.0
: position % 2 == 0 ? xOffset
: boundingRect().width() - xOffset - w,
yOffset + (spacing + h) * (position / 2), w, h);
}

View file

@ -307,8 +307,8 @@ QString DeckLoader::exportDeckToDecklist(const DeckList *deckList, DecklistWebsi
sideBoardCards.chop(3);
// if after we've called it for each card, and the strings are empty, we know that
// there were no non-token cards in the deck, so show an error message.
if ((QString::compare(mainBoardCards, "", Qt::CaseInsensitive) == 0) &&
(QString::compare(sideBoardCards, "", Qt::CaseInsensitive) == 0)) {
if (QString::compare(mainBoardCards, "", Qt::CaseInsensitive) == 0 &&
QString::compare(sideBoardCards, "", Qt::CaseInsensitive) == 0) {
return "";
}
// return a string with the url for decklist export
@ -672,7 +672,7 @@ void DeckLoader::printDeckListNode(QTextCursor *cursor, InnerDecklistNode *node)
QTextTable *table = cursor->insertTable(1, totalColumns, tableFormat);
for (int i = 0; i < node->size(); i++) {
QTextCursor cellCursor = table->cellAt(0, (i * totalColumns) / node->size()).lastCursorPosition();
QTextCursor cellCursor = table->cellAt(0, i * totalColumns / node->size()).lastCursorPosition();
printDeckListNode(&cellCursor, dynamic_cast<InnerDecklistNode *>(node->at(i)));
}
}

View file

@ -575,7 +575,7 @@ int FlowLayout::count() const
*/
QLayoutItem *FlowLayout::itemAt(const int index) const
{
return (index >= 0 && index < items.size()) ? items.value(index) : nullptr;
return index >= 0 && index < items.size() ? items.value(index) : nullptr;
}
/**
@ -585,7 +585,7 @@ QLayoutItem *FlowLayout::itemAt(const int index) const
*/
QLayoutItem *FlowLayout::takeAt(const int index)
{
return (index >= 0 && index < items.size()) ? items.takeAt(index) : nullptr;
return index >= 0 && index < items.size() ? items.takeAt(index) : nullptr;
}
/**
@ -594,7 +594,7 @@ QLayoutItem *FlowLayout::takeAt(const int index)
*/
int FlowLayout::horizontalSpacing() const
{
return (horizontalMargin >= 0) ? horizontalMargin : smartSpacing(QStyle::PM_LayoutHorizontalSpacing);
return horizontalMargin >= 0 ? horizontalMargin : smartSpacing(QStyle::PM_LayoutHorizontalSpacing);
}
/**
@ -603,7 +603,7 @@ int FlowLayout::horizontalSpacing() const
*/
int FlowLayout::verticalSpacing() const
{
return (verticalMargin >= 0) ? verticalMargin : smartSpacing(QStyle::PM_LayoutVerticalSpacing);
return verticalMargin >= 0 ? verticalMargin : smartSpacing(QStyle::PM_LayoutVerticalSpacing);
}
/**

View file

@ -107,7 +107,7 @@ int OverlapLayout::count() const
*/
QLayoutItem *OverlapLayout::itemAt(const int index) const
{
return (index >= 0 && index < itemList.size()) ? itemList.value(index) : nullptr;
return index >= 0 && index < itemList.size() ? itemList.value(index) : nullptr;
}
/**
@ -121,7 +121,7 @@ QLayoutItem *OverlapLayout::itemAt(const int index) const
*/
QLayoutItem *OverlapLayout::takeAt(const int index)
{
return (index >= 0 && index < itemList.size()) ? itemList.takeAt(index) : nullptr;
return index >= 0 && index < itemList.size() ? itemList.takeAt(index) : nullptr;
}
/**
@ -163,8 +163,8 @@ void OverlapLayout::setGeometry(const QRect &rect)
}
// Calculate the overlap offsets based on the layout direction and overlap percentage.
const int overlapOffsetWidth = (overlapDirection == Qt::Horizontal) ? (maxItemWidth * overlapPercentage / 100) : 0;
const int overlapOffsetHeight = (overlapDirection == Qt::Vertical) ? (maxItemHeight * overlapPercentage / 100) : 0;
const int overlapOffsetWidth = overlapDirection == Qt::Horizontal ? maxItemWidth * overlapPercentage / 100 : 0;
const int overlapOffsetHeight = overlapDirection == Qt::Vertical ? maxItemHeight * overlapPercentage / 100 : 0;
// Determine the number of columns based on layout constraints and available space.
int columns;
@ -275,8 +275,8 @@ QSize OverlapLayout::calculatePreferredSize() const
}
// Calculate the overlap offsets based on the layout direction and overlap percentage.
const int overlapOffsetWidth = (overlapDirection == Qt::Horizontal) ? (maxItemWidth * overlapPercentage / 100) : 0;
const int overlapOffsetHeight = (overlapDirection == Qt::Vertical) ? (maxItemHeight * overlapPercentage / 100) : 0;
const int overlapOffsetWidth = overlapDirection == Qt::Horizontal ? maxItemWidth * overlapPercentage / 100 : 0;
const int overlapOffsetHeight = overlapDirection == Qt::Vertical ? maxItemHeight * overlapPercentage / 100 : 0;
// Determine the number of columns based on layout constraints and available space.
int columns;
@ -321,11 +321,11 @@ QSize OverlapLayout::calculatePreferredSize() const
}
if (overlapDirection == Qt::Horizontal) {
return QSize(maxItemWidth + ((qCeil(itemList.size() / rows)) * (maxItemWidth - overlapOffsetWidth)),
return QSize(maxItemWidth + qCeil(itemList.size() / rows) * (maxItemWidth - overlapOffsetWidth),
rows * maxItemHeight);
} else {
return QSize(columns * maxItemWidth,
maxItemHeight + ((qCeil(itemList.size() / columns)) * (maxItemHeight - overlapOffsetHeight)));
maxItemHeight + qCeil(itemList.size() / columns) * (maxItemHeight - overlapOffsetHeight));
}
}
@ -467,7 +467,7 @@ int OverlapLayout::calculateMaxRows() const
}
// Calculate the effective height of each item with the overlap applied
const int overlapOffsetHeight = (maxItemHeight * (100 - overlapPercentage)) / 100;
const int overlapOffsetHeight = maxItemHeight * (100 - overlapPercentage) / 100;
const int availableHeight = parentWidget() ? parentWidget()->height() : 0;
// Determine the maximum number of rows that can fit

View file

@ -125,10 +125,10 @@ QPixmap PingPixmapGenerator::generatePixmap(int size, int value, int max)
pixmap.fill(Qt::transparent);
QPainter painter(&pixmap);
QColor color;
if ((max == -1) || (value == -1))
if (max == -1 || value == -1)
color = Qt::black;
else
color.setHsv(120 * (1.0 - ((double)value / max)), 255, 255);
color.setHsv(120 * (1.0 - (double)value / max), 255, 255);
QRadialGradient g(QPointF((double)pixmap.width() / 2, (double)pixmap.height() / 2),
qMin(pixmap.width(), pixmap.height()) / 2.0);

View file

@ -89,7 +89,7 @@ void ColorIdentityWidget::resizeEvent(QResizeEvent *event)
int spacing = layout->spacing();
int count = manaSymbols.size();
int availableWidth = totalWidth - (spacing * (count - 1));
int availableWidth = totalWidth - spacing * (count - 1);
int iconSize = qMin(availableWidth / count, totalHeight); // Ensure icons fit within the new height
for (ManaSymbolWidget *manaSymbol : manaSymbols) {

View file

@ -40,7 +40,7 @@ void ManaCostWidget::resizeEvent(QResizeEvent *event)
int count = manaSymbols.size();
// Available width minus total spacing
int availableWidth = totalWidth - (spacing * (count - 1));
int availableWidth = totalWidth - spacing * (count - 1);
int iconSize = qMin(50, availableWidth / count);
for (ManaSymbolWidget *manaSymbol : manaSymbols) {

View file

@ -25,7 +25,7 @@ QVariant DeckListStyleProxy::data(const QModelIndex &index, int role) const
if (isCard) {
const bool legal =
true; // TODO: Not implemented yet. QIdentityProxyModel::data(index, DeckRoles::IsLegalRole).toBool();
int base = 255 - (index.row() % 2) * 30;
int base = 255 - index.row() % 2 * 30;
return legal ? QBrush(QColor(base, base, base)) : QBrush(QColor(255, base / 3, base / 3));
} else {
int depth = src.data(DeckRoles::DepthRole).toInt();

View file

@ -272,7 +272,7 @@ void DlgConnect::updateDisplayInfo(const QString &saveName)
<< "";
}
bool savePasswordStatus = (_data.at(5) == "1");
bool savePasswordStatus = _data.at(5) == "1";
saveEdit->setText(_data.at(0));
hostEdit->setText(_data.at(1));

View file

@ -333,7 +333,7 @@ void WndSets::actToggleButtons(const QItemSelection &selected, const QItemSelect
aBottom->setDisabled(emptySelection || setOrderIsSorted);
int rows = view->selectionModel()->selectedRows().size();
rebuildMainLayout((rows > 1) ? SOME_SETS_SELECTED : NO_SETS_SELECTED);
rebuildMainLayout(rows > 1 ? SOME_SETS_SELECTED : NO_SETS_SELECTED);
}
void WndSets::selectRows(QSet<int> rows)

View file

@ -82,7 +82,7 @@ void BannerWidget::paintEvent(QPaintEvent *event)
QPainter painter(this);
// Calculate alpha based on transparency percentage
int alpha = (255 * transparency) / 100;
int alpha = 255 * transparency / 100;
// Determine gradient direction
QLinearGradient gradient;

View file

@ -16,7 +16,7 @@ QSize BarWidget::sizeHint() const
int valueHeight = metrics.height();
// Calculate the height dynamically based on the total
int barHeight = (total > 0) ? (value * 200 / total) : 20; // Scale height proportionally
int barHeight = total > 0 ? value * 200 / total : 20; // Scale height proportionally
int totalHeight = barHeight + labelHeight + valueHeight + 30; // Extra space for text
return QSize(60, totalHeight); // Allow width to expand
}
@ -32,7 +32,7 @@ void BarWidget::paintEvent(QPaintEvent *event)
// Calculate bar dimensions
int barWidth = widgetWidth * 0.8; // Use 80% of the available width
int fullBarHeight = widgetHeight - 40; // Leave space for labels
int valueBarHeight = (total > 0) ? (value * fullBarHeight / total) : 0;
int valueBarHeight = total > 0 ? value * fullBarHeight / total : 0;
// Draw full bar background (gray)
painter.setBrush(QColor(200, 200, 200));

View file

@ -60,7 +60,7 @@ float DynamicFontSizeLabel::getWidgetMaximumFontSize(QWidget *widget, const QStr
}
/* Only stop when step is small enough and new size is smaller than QWidget */
while (step > FONT_PRECISION || (currentHeight > widgetHeight) || (currentWidth > widgetWidth)) {
while (step > FONT_PRECISION || currentHeight > widgetHeight || currentWidth > widgetWidth) {
/* Keep last tested value */
lastTestedSize = currentSize;
@ -82,7 +82,7 @@ float DynamicFontSizeLabel::getWidgetMaximumFontSize(QWidget *widget, const QStr
currentWidth = newFontSizeRect.width();
/* If new font size is too big, decrease it */
if ((currentHeight > widgetHeight) || (currentWidth > widgetWidth)) {
if (currentHeight > widgetHeight || currentWidth > widgetWidth) {
// qDebug() << "-- contentsRect()" << label->contentsRect() << "rect"<< label->rect() << " newFontSizeRect"
// << newFontSizeRect << "Tight" << text << currentSize;
currentSize -= step;

View file

@ -22,7 +22,7 @@ void PercentBarWidget::paintEvent(QPaintEvent *event)
const double halfWidth = rect.width() / 2.0;
const int barLength = static_cast<int>((qAbs(valueToDisplay) / 100.0) * halfWidth);
const int barLength = static_cast<int>(qAbs(valueToDisplay) / 100.0 * halfWidth);
QRect fillRect;
if (valueToDisplay > 0.0) {
@ -40,7 +40,7 @@ void PercentBarWidget::paintEvent(QPaintEvent *event)
const int tickHeight = 4;
for (int percent = -100; percent <= 100; percent += 10) {
int x = midX + static_cast<int>((percent / 100.0) * halfWidth);
int x = midX + static_cast<int>(percent / 100.0 * halfWidth);
painter.drawLine(x, height - tickHeight, x, height);
}
}

View file

@ -160,7 +160,7 @@ void PrintingSelectorCardOverlayWidget::updatePinBadgeVisibility()
const auto &preferredProviderId =
SettingsCache::instance().cardOverrides().getCardPreferenceOverride(rootCard.getName());
const auto &cardProviderId = rootCard.getPrinting().getUuid();
const bool isPinned = (!preferredProviderId.isEmpty() && preferredProviderId == cardProviderId);
const bool isPinned = !preferredProviderId.isEmpty() && preferredProviderId == cardProviderId;
// Toggle the badge once; the pixmap was already rasterized in initializePinBadge().
pinBadge->setVisible(isPinned);

View file

@ -19,7 +19,7 @@ ReplayManager::ReplayManager(TabGame *parent, GameReplay *_replay)
const int eventCount = replay->event_list_size();
for (int i = 0; i < eventCount; ++i) {
int j = i + 1;
while ((j < eventCount) && (replay->event_list(j).seconds_elapsed() == lastEventTimestamp))
while (j < eventCount && replay->event_list(j).seconds_elapsed() == lastEventTimestamp)
++j;
const int numberEventsThisSecond = j - i;

View file

@ -152,7 +152,7 @@ void ReplayTimelineWidget::processNewEvents(PlaybackMode playbackMode)
{
currentProcessedTime = currentVisualTime;
while ((currentEvent < replayTimeline.size()) && (replayTimeline[currentEvent] < currentProcessedTime)) {
while (currentEvent < replayTimeline.size() && replayTimeline[currentEvent] < currentProcessedTime) {
EventProcessingOptions options;
// backwards skip => always skip reveal windows

View file

@ -103,9 +103,8 @@ void ChatView::appendHtmlServerMessage(const QString &html, bool optionalIsBold,
{
bool atBottom = verticalScrollBar()->value() >= verticalScrollBar()->maximum();
QString htmlText =
"<font color=" + ((optionalFontColor.size() > 0) ? optionalFontColor : serverMessageColor.name()) + ">" +
QDateTime::currentDateTime().toString("[hh:mm:ss] ") + html + "</font>";
QString htmlText = "<font color=" + (optionalFontColor.size() > 0 ? optionalFontColor : serverMessageColor.name()) +
">" + QDateTime::currentDateTime().toString("[hh:mm:ss] ") + html + "</font>";
if (optionalIsBold)
htmlText = "<b>" + htmlText + "</b>";
@ -326,7 +325,7 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, const QString
const static auto notALetterOrNumber = QRegularExpression("[^a-zA-Z0-9]");
int firstSpace = message.indexOf(' ');
QString fullMentionUpToSpaceOrEnd = (firstSpace == -1) ? message.mid(1) : message.mid(1, firstSpace - 1);
QString fullMentionUpToSpaceOrEnd = firstSpace == -1 ? message.mid(1) : message.mid(1, firstSpace - 1);
QString mentionIntact = fullMentionUpToSpaceOrEnd;
while (fullMentionUpToSpaceOrEnd.size()) {
@ -453,8 +452,8 @@ bool ChatView::isModeratorSendingGlobal(QFlags<ServerInfo_User::UserLevelFlag> u
QStringList getAttentionList;
getAttentionList << "/all"; // Send a message to all users
return (getAttentionList.contains(message) &&
(userLevel & ServerInfo_User::IsModerator || userLevel & ServerInfo_User::IsAdmin));
return getAttentionList.contains(message) &&
(userLevel & ServerInfo_User::IsModerator || userLevel & ServerInfo_User::IsAdmin);
}
void ChatView::actMessageClicked()
@ -540,7 +539,7 @@ QTextFragment ChatView::getFragmentUnderMouse(const QPoint &pos) const
QTextCursor cursor(cursorForPosition(pos));
QTextBlock block(cursor.block());
QTextBlock::iterator it;
for (it = block.begin(); !(it.atEnd()); ++it) {
for (it = block.begin(); !it.atEnd(); ++it) {
QTextFragment frag = it.fragment();
if (frag.contains(cursor.position()))
return frag;
@ -580,7 +579,7 @@ void ChatView::mousePressEvent(QMouseEvent *event)
{
switch (hoveredItemType) {
case HoveredCard: {
if ((event->button() == Qt::MiddleButton) || (event->button() == Qt::LeftButton))
if (event->button() == Qt::MiddleButton || event->button() == Qt::LeftButton)
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
emit showCardInfoPopup(event->globalPosition().toPoint(), {hoveredContent});
#else
@ -623,15 +622,16 @@ void ChatView::mousePressEvent(QMouseEvent *event)
void ChatView::mouseReleaseEvent(QMouseEvent *event)
{
if ((event->button() == Qt::MiddleButton) || (event->button() == Qt::LeftButton))
if (event->button() == Qt::MiddleButton || event->button() == Qt::LeftButton) {
emit deleteCardInfoPopup(QString("_"));
}
QTextBrowser::mouseReleaseEvent(event);
}
void ChatView::openLink(const QUrl &link)
{
if ((link.scheme() == "card") || (link.scheme() == "user"))
if (link.scheme() == "card" || link.scheme() == "user")
return;
QDesktopServices::openUrl(link);

View file

@ -76,7 +76,7 @@ QVariant GamesModel::data(const QModelIndex &index, int role) const
return index.row();
if (role != Qt::DisplayRole && role != SORT_ROLE && role != Qt::DecorationRole && role != Qt::TextAlignmentRole)
return QVariant();
if ((index.row() >= gameList.size()) || (index.column() >= columnCount()))
if (index.row() >= gameList.size() || index.column() >= columnCount())
return QVariant();
const ServerInfo_Game &gameentry = gameList[index.row()];
@ -212,7 +212,7 @@ QVariant GamesModel::data(const QModelIndex &index, int role) const
QVariant GamesModel::headerData(int section, Qt::Orientation /*orientation*/, int role) const
{
if ((role != Qt::DisplayRole) && (role != Qt::TextAlignmentRole))
if (role != Qt::DisplayRole && role != Qt::TextAlignmentRole)
return QVariant();
switch (section) {
case ROOM:

View file

@ -191,8 +191,8 @@ void UserContextMenu::banUserHistory_processResponse(const Response &resp)
}
table->resizeColumnsToContents();
table->setMinimumSize(table->horizontalHeader()->length() + (table->columnCount() * 5),
table->verticalHeader()->length() + (table->rowCount() * 3));
table->setMinimumSize(table->horizontalHeader()->length() + table->columnCount() * 5,
table->verticalHeader()->length() + table->rowCount() * 3);
table->show();
} else
QMessageBox::information(static_cast<QWidget *>(parent()), tr("Ban History"),
@ -227,8 +227,8 @@ void UserContextMenu::warnUserHistory_processResponse(const Response &resp)
}
table->resizeColumnsToContents();
table->setMinimumSize(table->horizontalHeader()->length() + (table->columnCount() * 5),
table->verticalHeader()->length() + (table->rowCount() * 3));
table->setMinimumSize(table->horizontalHeader()->length() + table->columnCount() * 5,
table->verticalHeader()->length() + table->rowCount() * 3);
table->show();
} else
QMessageBox::information(static_cast<QWidget *>(parent()), tr("Warning History"),
@ -396,20 +396,20 @@ void UserContextMenu::showContextMenu(const QPoint &pos,
menu->addSeparator();
if (userLevel.testFlag(ServerInfo_User::IsModerator) &&
(tabSupervisor->getUserInfo()->user_level() & ServerInfo_User::IsAdmin)) {
tabSupervisor->getUserInfo()->user_level() & ServerInfo_User::IsAdmin) {
menu->addAction(aDemoteFromMod);
} else if (userLevel.testFlag(ServerInfo_User::IsRegistered) &&
(tabSupervisor->getUserInfo()->user_level() & ServerInfo_User::IsAdmin)) {
tabSupervisor->getUserInfo()->user_level() & ServerInfo_User::IsAdmin) {
menu->addAction(aPromoteToMod);
}
if (userLevel.testFlag(ServerInfo_User::IsJudge) &&
(tabSupervisor->getUserInfo()->user_level() & ServerInfo_User::IsAdmin)) {
tabSupervisor->getUserInfo()->user_level() & ServerInfo_User::IsAdmin) {
menu->addAction(aDemoteFromJudge);
} else if (userLevel.testFlag(ServerInfo_User::IsRegistered) &&
(tabSupervisor->getUserInfo()->user_level() & ServerInfo_User::IsAdmin)) {
tabSupervisor->getUserInfo()->user_level() & ServerInfo_User::IsAdmin) {
menu->addAction(aPromoteToJudge);
}
}

View file

@ -267,7 +267,7 @@ QString BanDialog::getBanIP() const
int BanDialog::getMinutes() const
{
return permanentRadio->isChecked() ? 0
: (daysEdit->value() * 24 * 60 + hoursEdit->value() * 60 + minutesEdit->value());
: daysEdit->value() * 24 * 60 + hoursEdit->value() * 60 + minutesEdit->value();
}
QString BanDialog::getReason() const
@ -320,7 +320,7 @@ bool UserListItemDelegate::editorEvent(QEvent *event,
const QStyleOptionViewItem &option,
const QModelIndex &index)
{
if ((event->type() == QEvent::MouseButtonPress) && index.isValid()) {
if (event->type() == QEvent::MouseButtonPress && index.isValid()) {
QMouseEvent *const mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::RightButton) {
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
@ -514,7 +514,7 @@ void UserListWidget::setUserOnline(const QString &userName, bool online)
void UserListWidget::updateCount()
{
QString str = titleStr;
if ((type == BuddyList) || (type == IgnoreList))
if (type == BuddyList || type == IgnoreList)
str = str.arg(onlineCount);
setTitle(str.arg(userTree->topLevelItemCount()));
}

View file

@ -29,8 +29,8 @@
static bool canBeCommander(const CardInfoPtr &cardInfo)
{
return ((cardInfo->getCardType().contains("Legendary", Qt::CaseInsensitive) &&
cardInfo->getCardType().contains("Creature", Qt::CaseInsensitive))) ||
return (cardInfo->getCardType().contains("Legendary", Qt::CaseInsensitive) &&
cardInfo->getCardType().contains("Creature", Qt::CaseInsensitive)) ||
cardInfo->getText().contains("can be your commander", Qt::CaseInsensitive);
}

View file

@ -132,9 +132,9 @@ void TabMessage::processUserMessageEvent(const Event_UserMessage &event)
bool TabMessage::shouldShowSystemPopup(const Event_UserMessage &event)
{
return (QApplication::activeWindow() == 0 || QApplication::focusWidget() == 0 ||
(event.sender_name() == otherUserInfo->name() &&
tabSupervisor->currentIndex() != tabSupervisor->indexOf(this)));
return QApplication::activeWindow() == 0 || QApplication::focusWidget() == 0 ||
(event.sender_name() == otherUserInfo->name() &&
tabSupervisor->currentIndex() != tabSupervisor->indexOf(this));
}
void TabMessage::showSystemPopup(const Event_UserMessage &event)

View file

@ -454,7 +454,7 @@ void TabSupervisor::startLocal(const QList<AbstractClient *> &_clients)
*/
void TabSupervisor::stop()
{
if ((!client) && localClients.isEmpty())
if (!client && localClients.isEmpty())
return;
resetTabsMenu();
@ -655,7 +655,7 @@ void TabSupervisor::actTabAdmin(bool checked)
void TabSupervisor::openTabAdmin()
{
tabAdmin = new TabAdmin(this, client, (userInfo->user_level() & ServerInfo_User::IsAdmin));
tabAdmin = new TabAdmin(this, client, userInfo->user_level() & ServerInfo_User::IsAdmin);
connect(tabAdmin, &TabAdmin::adminLockChanged, this, &TabSupervisor::adminLockChanged);
myAddTab(tabAdmin, aTabAdmin);
connect(tabAdmin, &QObject::destroyed, this, [this] {

View file

@ -126,7 +126,7 @@ void LineEditCompleter::setCompletionList(QStringList completionList)
return;
QStringListModel *model;
model = (QStringListModel *)(c->model());
model = (QStringListModel *)c->model();
if (model == NULL)
model = new QStringListModel();
model->setStringList(completionList);

View file

@ -136,7 +136,7 @@ int SequenceEdit::translateModifiers(Qt::KeyboardModifiers state, const QString
int result = 0;
// The shift modifier only counts when it is not used to type a symbol
// that is only reachable using the shift key anyway
if ((state & Qt::ShiftModifier) &&
if (state & Qt::ShiftModifier &&
(text.isEmpty() || !text.at(0).isPrint() || text.at(0).isLetterOrNumber() || text.at(0).isSpace())) {
result |= Qt::SHIFT;
}

View file

@ -374,7 +374,7 @@ void VisualDeckEditorWidget::updateZoneWidgets()
void VisualDeckEditorWidget::updateDisplayType()
{
// Toggle the display type
currentDisplayType = (currentDisplayType == DisplayType::Overlap) ? DisplayType::Flat : DisplayType::Overlap;
currentDisplayType = currentDisplayType == DisplayType::Overlap ? DisplayType::Flat : DisplayType::Overlap;
// Update UI and emit signal
switch (currentDisplayType) {

View file

@ -480,18 +480,17 @@ QString MainWindow::extractInvalidUsernameMessage(QString &in)
out += tr("Your username must respect these rules:") + "<ul>";
out += "<li>" + tr("is %1 - %2 characters long").arg(rules.at(0)).arg(rules.at(1)) + "</li>";
out += "<li>" + tr("can %1 contain lowercase characters").arg((rules.at(2).toInt() > 0) ? "" : tr("NOT")) +
"</li>";
out += "<li>" + tr("can %1 contain uppercase characters").arg((rules.at(3).toInt() > 0) ? "" : tr("NOT")) +
"</li>";
out +=
"<li>" + tr("can %1 contain numeric characters").arg((rules.at(4).toInt() > 0) ? "" : tr("NOT")) + "</li>";
"<li>" + tr("can %1 contain lowercase characters").arg(rules.at(2).toInt() > 0 ? "" : tr("NOT")) + "</li>";
out +=
"<li>" + tr("can %1 contain uppercase characters").arg(rules.at(3).toInt() > 0 ? "" : tr("NOT")) + "</li>";
out += "<li>" + tr("can %1 contain numeric characters").arg(rules.at(4).toInt() > 0 ? "" : tr("NOT")) + "</li>";
if (rules.at(6).size() > 0)
out += "<li>" + tr("can contain the following punctuation: %1").arg(rules.at(6).toHtmlEscaped()) + "</li>";
out += "<li>" +
tr("first character can %1 be a punctuation mark").arg((rules.at(5).toInt() > 0) ? "" : tr("NOT")) +
tr("first character can %1 be a punctuation mark").arg(rules.at(5).toInt() > 0 ? "" : tr("NOT")) +
"</li>";
if (rules.size() == 9) {

View file

@ -191,7 +191,7 @@ int main(int argc, char *argv[])
const QByteArray configPath = "";
#endif
if (!qEnvironmentVariableIsSet(("QT_LOGGING_CONF"))) {
if (!qEnvironmentVariableIsSet("QT_LOGGING_CONF")) {
// Set the QT_LOGGING_CONF environment variable
qputenv("QT_LOGGING_CONF", configPath);
}