Add message formatting help beside Join with a fenced code example

This commit is contained in:
evgeny committed 2026-11-03 00:28:09 +01:00
1 parent be7421e6e2
commit f147f346d5
3 files changed
+34

No files matched your search

+24
View File
@@ -20,6 +20,7 @@
#include <QUrl>
#include <QSignalBlocker>
#include <QToolTip>
#include <QMessageBox>
extern "C" {
#include "../../lib/debug_config.h"
@@ -281,6 +282,29 @@ ChannelList::ChannelList(DbManager* db, QWidget *parent)
plusBtn->setStyleSheet(actionStyle);
connect(plusBtn, &QPushButton::clicked, this, [this] { emit joinRequested(); });
fl->addWidget(plusBtn);
auto* helpBtn = new QPushButton(QStringLiteral("?"), footer);
helpBtn->setObjectName("messageFormattingHelpButton"); helpBtn->setFixedSize(34, 34);
helpBtn->setCursor(Qt::PointingHandCursor); helpBtn->setProperty("instantTooltip", true);
helpBtn->setToolTip(QCoreApplication::translate("ChatGui", "Message formatting"));
helpBtn->setAccessibleName(helpBtn->toolTip()); helpBtn->setStyleSheet(actionStyle + "font-size: 22px; font-weight: bold;");
fl->addWidget(helpBtn);
connect(helpBtn, &QPushButton::clicked, this, [this] {
auto* help = new QMessageBox(QMessageBox::Information, QCoreApplication::translate("ChatGui", "Message formatting"),
QCoreApplication::translate("ChatGui",
"**text** — bold\n"
"__text__ — italic\n"
"~~text~~ — strikethrough\n\n"
"Use paired tags on one line, without spaces next to the text.\n\n"
"Code blocks: put ``` on separate lines, as shown:\n"
"```cpp\n"
"int value = 42;\n"
"```\n\n"
"The language after ``` is optional: the chat will try to detect it.\n"
"Use ```text to disable highlighting. Copy copies the whole block."), QMessageBox::Ok, this);
help->setObjectName("messageFormattingHelp"); help->setAttribute(Qt::WA_DeleteOnClose);
help->setTextFormat(Qt::PlainText); help->setTextInteractionFlags(Qt::TextSelectableByMouse); help->open();
DEBUG_INFO(DEBUG_CATEGORY_CHAT, "message formatting help opened");
});
DEBUG_DEBUG(DEBUG_CATEGORY_CHAT,
"channel actions initialized icons=group-plus/enter icon_px=28 button=40x38 background=transparent tooltip_delay_ms=0");
DEBUG_DEBUG(DEBUG_CATEGORY_CHAT, "connection monitor button initialized icon=diagnostics icon_px=24 button=34x34 tooltip_delay_ms=0");
+5
View File
@@ -3,6 +3,11 @@
<TS version="2.1" language="en_US" sourcelanguage="en_US">
<context>
<name>ChatGui</name>
<message><source>Message formatting</source><translation>Message formatting</translation></message>
<message>
<source>**text** — bold&#10;__text__ — italic&#10;~~text~~ — strikethrough&#10;&#10;Use paired tags on one line, without spaces next to the text.&#10;&#10;Code blocks: put ``` on separate lines, as shown:&#10;```cpp&#10;int value = 42;&#10;```&#10;&#10;The language after ``` is optional: the chat will try to detect it.&#10;Use ```text to disable highlighting. Copy copies the whole block.</source>
<translation>**text** — bold&#10;__text__ — italic&#10;~~text~~ — strikethrough&#10;&#10;Use paired tags on one line, without spaces next to the text.&#10;&#10;Code blocks: put ``` on separate lines, as shown:&#10;```cpp&#10;int value = 42;&#10;```&#10;&#10;The language after ``` is optional: the chat will try to detect it.&#10;Use ```text to disable highlighting. Copy copies the whole block.</translation>
</message>
<message><source>Device group name</source><translation>Device group name</translation></message>
<message><source>Could not rename device group</source><translation>Could not rename device group</translation></message>
<message><source>Expand devices</source><translation>Expand devices</translation></message>
+5
View File
@@ -3,6 +3,11 @@
<TS version="2.1" language="ru_RU" sourcelanguage="en_US">
<context>
<name>ChatGui</name>
<message><source>Message formatting</source><translation>Форматирование сообщений</translation></message>
<message>
<source>**text** — bold&#10;__text__ — italic&#10;~~text~~ — strikethrough&#10;&#10;Use paired tags on one line, without spaces next to the text.&#10;&#10;Code blocks: put ``` on separate lines, as shown:&#10;```cpp&#10;int value = 42;&#10;```&#10;&#10;The language after ``` is optional: the chat will try to detect it.&#10;Use ```text to disable highlighting. Copy copies the whole block.</source>
<translation>**текст** — жирный&#10;__текст__ — курсив&#10;~~текст~~ — зачёркнутый&#10;&#10;Ставьте парные теги в одной строке, без пробелов рядом с текстом.&#10;&#10;Блок кода: ``` должны быть на отдельных строках, как в примере:&#10;```cpp&#10;int value = 42;&#10;```&#10;&#10;Язык после ``` необязателен: чат попробует определить его сам.&#10;Укажите ```text для кода без подсветки. Copy копирует весь блок.</translation>
</message>
<message><source>Device group name</source><translation>Имя группы устройств</translation></message>
<message><source>Could not rename device group</source><translation>Не удалось переименовать группу устройств</translation></message>
<message><source>Expand devices</source><translation>Развернуть устройства</translation></message>