mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #3360
Alexander Zhdanov (3): feat(genericchatform): add "Quote selected text" feature to chat window docs(user_manual_en.md): add some documentation about quotes docs(user_manual_en.md): fix documentation about quotes
This commit is contained in:
commit
8589f944aa
|
@ -6,6 +6,7 @@
|
||||||
* [Settings](#settings)
|
* [Settings](#settings)
|
||||||
* [Groupchats](#groupchats)
|
* [Groupchats](#groupchats)
|
||||||
* [Message Styling](#message-styling)
|
* [Message Styling](#message-styling)
|
||||||
|
* [Quotes](#quotes)
|
||||||
* [Multi Window Mode](#multi-window-mode)
|
* [Multi Window Mode](#multi-window-mode)
|
||||||
* [Keyboard Shortcuts](#keyboard-shortcuts)
|
* [Keyboard Shortcuts](#keyboard-shortcuts)
|
||||||
|
|
||||||
|
@ -239,6 +240,16 @@ Additionally, qTox supports three modes of Markdown parsing:
|
||||||
|
|
||||||
*Note that any change in Markdown preference will require a restart.*
|
*Note that any change in Markdown preference will require a restart.*
|
||||||
|
|
||||||
|
## Quotes
|
||||||
|
|
||||||
|
qTox has feature to quote selected text in chat window:
|
||||||
|
|
||||||
|
1. Select the text you want to quote.
|
||||||
|
2. Right-click on the selected text and choose "Quote selected text" in the
|
||||||
|
context menu. You also can use `ALT` + `q` shortcut.
|
||||||
|
3. Selected text will be automatically quoted into the message input area in a
|
||||||
|
pretty formatting.
|
||||||
|
|
||||||
## Multi Window Mode
|
## Multi Window Mode
|
||||||
|
|
||||||
In this mode, qTox will separate its main window into a single contact list and
|
In this mode, qTox will separate its main window into a single contact list and
|
||||||
|
@ -260,3 +271,4 @@ The following shortcuts are currently supported:
|
||||||
| `CTRL` + `Page Up` | Switch to the previous contact|
|
| `CTRL` + `Page Up` | Switch to the previous contact|
|
||||||
| `CTRL` + `TAB` | Switch to the next contact |
|
| `CTRL` + `TAB` | Switch to the next contact |
|
||||||
| `CTRL` + `SHIFT` + `TAB` | Switch to the previous contact|
|
| `CTRL` + `SHIFT` + `TAB` | Switch to the previous contact|
|
||||||
|
| `ALT` + `q` | Quote selected text |
|
||||||
|
|
|
@ -191,6 +191,10 @@ GenericChatForm::GenericChatForm(QWidget *parent)
|
||||||
QString(), this, SLOT(onSaveLogClicked()));
|
QString(), this, SLOT(onSaveLogClicked()));
|
||||||
clearAction = menu.addAction(QIcon::fromTheme("edit-clear"),
|
clearAction = menu.addAction(QIcon::fromTheme("edit-clear"),
|
||||||
QString(), this, SLOT(clearChatArea(bool)));
|
QString(), this, SLOT(clearChatArea(bool)));
|
||||||
|
|
||||||
|
quoteAction = menu.addAction(QIcon(),
|
||||||
|
QString(), this, SLOT(quoteSelectedText()));
|
||||||
|
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
connect(emoteButton, &QPushButton::clicked,
|
connect(emoteButton, &QPushButton::clicked,
|
||||||
|
@ -199,6 +203,7 @@ GenericChatForm::GenericChatForm(QWidget *parent)
|
||||||
this, &GenericChatForm::onChatContextMenuRequested);
|
this, &GenericChatForm::onChatContextMenuRequested);
|
||||||
|
|
||||||
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_L, this, SLOT(clearChatArea()));
|
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_L, this, SLOT(clearChatArea()));
|
||||||
|
new QShortcut(Qt::ALT + Qt::Key_Q, this, SLOT(quoteSelectedText()));
|
||||||
|
|
||||||
chatWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatArea.css"));
|
chatWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatArea.css"));
|
||||||
headWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatHead.css"));
|
headWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatHead.css"));
|
||||||
|
@ -562,6 +567,26 @@ void GenericChatForm::onShowMessagesClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenericChatForm::quoteSelectedText()
|
||||||
|
{
|
||||||
|
QString selectedText = chatWidget->getSelectedText();
|
||||||
|
|
||||||
|
if (selectedText.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// forming pretty quote text
|
||||||
|
// 1. insert "> " to the begining of quote;
|
||||||
|
// 2. replace all possible line terminators with "\n> ";
|
||||||
|
// 3. append new line to the end of quote.
|
||||||
|
QString quote = selectedText;
|
||||||
|
|
||||||
|
quote.insert(0, "> ");
|
||||||
|
quote.replace(QRegExp(QString("\r\n|[\r\n\u2028\u2029]")), QString("\n> "));
|
||||||
|
quote.append("\n");
|
||||||
|
|
||||||
|
msgEdit->append(quote);
|
||||||
|
}
|
||||||
|
|
||||||
void GenericChatForm::retranslateUi()
|
void GenericChatForm::retranslateUi()
|
||||||
{
|
{
|
||||||
QString callObjectName = callButton->objectName();
|
QString callObjectName = callButton->objectName();
|
||||||
|
@ -587,6 +612,7 @@ void GenericChatForm::retranslateUi()
|
||||||
screenshotButton->setToolTip(tr("Send a screenshot"));
|
screenshotButton->setToolTip(tr("Send a screenshot"));
|
||||||
saveChatAction->setText(tr("Save chat log"));
|
saveChatAction->setText(tr("Save chat log"));
|
||||||
clearAction->setText(tr("Clear displayed messages"));
|
clearAction->setText(tr("Clear displayed messages"));
|
||||||
|
quoteAction->setText(tr("Quote selected text"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericChatForm::showNetcam()
|
void GenericChatForm::showNetcam()
|
||||||
|
|
|
@ -91,6 +91,7 @@ protected slots:
|
||||||
void hideFileMenu();
|
void hideFileMenu();
|
||||||
void onShowMessagesClicked();
|
void onShowMessagesClicked();
|
||||||
void onSplitterMoved(int pos, int index);
|
void onSplitterMoved(int pos, int index);
|
||||||
|
void quoteSelectedText();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
@ -109,7 +110,7 @@ protected:
|
||||||
virtual bool eventFilter(QObject* object, QEvent* event) final override;
|
virtual bool eventFilter(QObject* object, QEvent* event) final override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QAction* saveChatAction, *clearAction;
|
QAction* saveChatAction, *clearAction, *quoteAction;
|
||||||
ToxId previousId;
|
ToxId previousId;
|
||||||
QDateTime prevMsgDateTime;
|
QDateTime prevMsgDateTime;
|
||||||
Widget *parent;
|
Widget *parent;
|
||||||
|
|
4
translations/ru.ts
vendored
4
translations/ru.ts
vendored
|
@ -1171,6 +1171,10 @@ will be sent to them when they appear online to you.</source>
|
||||||
<source>Clear displayed messages</source>
|
<source>Clear displayed messages</source>
|
||||||
<translation>Очистить показываемые сообщения</translation>
|
<translation>Очистить показываемые сообщения</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Quote selected text</source>
|
||||||
|
<translation>Цитировать выделенное</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Not sent</source>
|
<source>Not sent</source>
|
||||||
<translation>Не отправлено</translation>
|
<translation>Не отправлено</translation>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user