From e9f1992c7f1f804364b05fd4a1def796cc386fa1 Mon Sep 17 00:00:00 2001 From: SlightlyCircuitous <71394296+SlightlyCircuitous@users.noreply.github.com> Date: Sun, 11 Dec 2022 17:54:06 -0500 Subject: [PATCH] Add URL to explain message macros (#4712) * Add URL Link to Explain Message Macros * Add URL Link to Explain Message Macros * Revert custom shortcuts wiki link * Conform to formatting guidelines --- cockatrice/src/dlg_settings.cpp | 18 +++++++++++++----- cockatrice/src/dlg_settings.h | 3 ++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/cockatrice/src/dlg_settings.cpp b/cockatrice/src/dlg_settings.cpp index c2015372..0182f7c5 100644 --- a/cockatrice/src/dlg_settings.cpp +++ b/cockatrice/src/dlg_settings.cpp @@ -796,6 +796,9 @@ MessagesSettingsPage::MessagesSettingsPage() connect(&chatMentionCompleterCheckbox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setChatMentionCompleter(int))); + explainMessagesLabel.setTextInteractionFlags(Qt::LinksAccessibleByMouse); + explainMessagesLabel.setOpenExternalLinks(true); + ignoreUnregUsersMainChat.setChecked(SettingsCache::instance().getIgnoreUnregisteredUsers()); ignoreUnregUserMessages.setChecked(SettingsCache::instance().getIgnoreUnregisteredUserMessages()); connect(&ignoreUnregUsersMainChat, SIGNAL(stateChanged(int)), &SettingsCache::instance(), @@ -887,12 +890,15 @@ MessagesSettingsPage::MessagesSettingsPage() messageListLayout->addWidget(messageToolBar); messageListLayout->addWidget(messageList); - messageShortcuts = new QGroupBox; - messageShortcuts->setLayout(messageListLayout); + auto *messagesLayout = new QVBoxLayout; // combines the explainer label with the actual messages widget pieces + messagesLayout->addLayout(messageListLayout); + messagesLayout->addWidget(&explainMessagesLabel); - auto *mainLayout = new QVBoxLayout; + messageGroupBox = new QGroupBox; // draws a box around the above layout and allows it to be titled + messageGroupBox->setLayout(messagesLayout); - mainLayout->addWidget(messageShortcuts); + auto *mainLayout = new QVBoxLayout; // combines the messages groupbox with the rest of the menu + mainLayout->addWidget(messageGroupBox); mainLayout->addWidget(chatGroupBox); mainLayout->addWidget(highlightGroupBox); @@ -993,7 +999,9 @@ void MessagesSettingsPage::retranslateUi() highlightGroupBox->setTitle(tr("Custom alert words")); chatMentionCheckBox.setText(tr("Enable chat mentions")); chatMentionCompleterCheckbox.setText(tr("Enable mention completer")); - messageShortcuts->setTitle(tr("In-game message macros")); + messageGroupBox->setTitle(tr("In-game message macros")); + explainMessagesLabel.setText( + QString("%2").arg(WIKI_CUSTOM_SHORTCUTS).arg(tr("How to use in-game message macros"))); ignoreUnregUsersMainChat.setText(tr("Ignore chat room messages sent by unregistered users")); ignoreUnregUserMessages.setText(tr("Ignore private messages sent by unregistered users")); invertMentionForeground.setText(tr("Invert text color")); diff --git a/cockatrice/src/dlg_settings.h b/cockatrice/src/dlg_settings.h index 1bcbc1e3..416def89 100644 --- a/cockatrice/src/dlg_settings.h +++ b/cockatrice/src/dlg_settings.h @@ -202,13 +202,14 @@ private: QCheckBox roomHistory; QGroupBox *chatGroupBox; QGroupBox *highlightGroupBox; - QGroupBox *messageShortcuts; + QGroupBox *messageGroupBox; QLineEdit *mentionColor; QLineEdit *highlightColor; QLineEdit *customAlertString; QLabel hexLabel; QLabel hexHighlightLabel; QLabel customAlertStringLabel; + QLabel explainMessagesLabel; void storeSettings(); void updateMentionPreview();