In-game message macros available immediately in active games (#5113)

* In-game message macros available immediately in active games

* fix formatting

* init sayMenu actions with sayMenu as parent
This commit is contained in:
Alexander Choi 2024-10-09 15:08:57 -06:00 committed by GitHub
parent 500b694cc6
commit b4bfa17cee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 2 deletions

View file

@ -419,6 +419,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
if (local) {
sayMenu = playerMenu->addMenu(QString());
connect(&SettingsCache::instance().messages(), SIGNAL(messageMacrosChanged()), this, SLOT(initSayMenu()));
initSayMenu();
}
@ -1036,7 +1037,7 @@ void Player::initSayMenu()
sayMenu->setEnabled(count > 0);
for (int i = 0; i < count; ++i) {
auto *newAction = new QAction(SettingsCache::instance().messages().getMessageAt(i), this);
auto *newAction = new QAction(SettingsCache::instance().messages().getMessageAt(i), sayMenu);
if (i < 10) {
newAction->setShortcut(QKeySequence("Ctrl+" + QString::number((i + 1) % 10)));
}