[QtUtils] Adopt window fade, path, bold font and confirmation helpers (#7622)
Some checks are pending
CodeQL / Analyze (cpp) (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
Build Desktop / Configure (push) Waiting to run
Build Desktop / Debian 13 (push) Blocked by required conditions
Build Desktop / Debian 12 (push) Blocked by required conditions
Build Desktop / Fedora 44 (push) Blocked by required conditions
Build Desktop / Fedora 43 (push) Blocked by required conditions
Build Desktop / Servatrice_Debian 12 (push) Blocked by required conditions
Build Desktop / Ubuntu 24.04 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 (push) Blocked by required conditions
Build Desktop / Arch (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 cover (push) Blocked by required conditions
Build Desktop / macOS 13 Intel (push) Blocked by required conditions
Build Desktop / macOS 14 (push) Blocked by required conditions
Build Desktop / macOS 15 (push) Blocked by required conditions
Build Desktop / macOS 26 Debug (push) Blocked by required conditions
Build Desktop / Windows 10 (push) Blocked by required conditions
Build Desktop / Prune caches (push) Waiting to run
Build Docker / Servatrice (arm) (push) Waiting to run
Build Docker / Servatrice (x86) (push) Waiting to run
Build Docker / Publish multi-platform Servatrice image (push) Blocked by required conditions

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-10-24 21:43:50 +02:00 • committed by GitHub
parent eac149656b
commit 11e2bb0d2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 78 additions and 125 deletions

View file

@ -41,6 +41,7 @@
#include <libcockatrice/protocol/pb/serverinfo_game.pb.h>
#include <libcockatrice/protocol/pending_command.h>
#include <libcockatrice/settings/interface_settings.h>
#include <libcockatrice/utility/qt_utils.h>
#include <qlogging.h>
#include <qnamespace.h>
#include <string>
@ -420,10 +421,8 @@ void GameSelector::joinGame(const ServerInfo_Game &game, const bool asSpectator,
// spectator join, so ask first instead of surprising the player.
const bool gameFull = game.player_count() == game.max_players();
if (gameFull && !asSpectator && !asJudge && !overrideRestrictions) {
const QMessageBox::StandardButton answer =
QMessageBox::question(this, tr("Join game"), tr("The game is full. Join as a spectator instead?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
if (answer != QMessageBox::Yes) {
if (!QtUtils::confirm(this, tr("Join game"), tr("The game is full. Join as a spectator instead?"),
QMessageBox::No)) {
return;
}
}

View file

@ -49,6 +49,7 @@
#include <libcockatrice/protocol/pb/response_warn_list.pb.h>
#include <libcockatrice/protocol/pb/session_commands.pb.h>
#include <libcockatrice/protocol/pending_command.h>
#include <libcockatrice/utility/qt_utils.h>
#include <qnamespace.h>
#include <string>
@ -685,10 +686,8 @@ void UserContextMenu::execRemoveFromIgnore(const QString &userName)
void UserContextMenu::execKick(int playerId)
{
auto result = QMessageBox::question(static_cast<QWidget *>(parent()), tr("Kick Player"),
tr("Are you sure you want to kick this player from the game?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
if (result == QMessageBox::Yes) {
if (QtUtils::confirm(static_cast<QWidget *>(parent()), tr("Kick Player"),
tr("Are you sure you want to kick this player from the game?"), QMessageBox::No)) {
Command_KickFromGame cmd;
cmd.set_player_id(playerId);

View file

@ -13,7 +13,6 @@
#include "user_list_painter.h"
#include "user_list_proxy.h"
#include <QAbstractAnimation>
#include <QAbstractItemModel>
#include <QApplication>
#include <QByteArray>
@ -41,7 +40,6 @@
#include <QPalette>
#include <QPoint>
#include <QPointF>
#include <QPropertyAnimation>
#include <QRect>
#include <QScreen>
#include <QScrollBar>
@ -58,6 +56,7 @@
#include <QWidget>
#include <QtGlobal>
#include <libcockatrice/settings/appearance_settings.h>
#include <libcockatrice/utility/qt_utils.h>
#include <qnamespace.h>
class QPixmap;
@ -895,11 +894,7 @@ void UserListWidget::showPopupForUser(UserListTWI *item)
return;
}
auto *fade = new QPropertyAnimation(userInfoPopup, "windowOpacity", userInfoPopup);
fade->setDuration(120);
fade->setStartValue(0.0);
fade->setEndValue(1.0);
fade->start(QAbstractAnimation::DeleteWhenStopped);
QtUtils::fadeWindow(userInfoPopup, 0.0, 1.0, 120);
}
void UserListWidget::positionPopup(UserListTWI *item)
@ -976,12 +971,7 @@ void UserListWidget::hidePopup(bool immediate)
}
// Fade out
auto *fade = new QPropertyAnimation(userInfoPopup, "windowOpacity", userInfoPopup);
fade->setDuration(100);
fade->setStartValue(userInfoPopup->windowOpacity());
fade->setEndValue(0.0);
connect(fade, &QPropertyAnimation::finished, userInfoPopup, &QWidget::hide);
fade->start(QAbstractAnimation::DeleteWhenStopped);
QtUtils::fadeWindow(userInfoPopup, userInfoPopup->windowOpacity(), 0.0, 100, true);
}
bool UserListWidget::isPressInsideListUi(const QWidget *widget) const