From: Shane Synan Date: Fri, 1 Jun 2018 03:24:07 +0000 (-0500) Subject: client: Add keyboard shortcuts for formatting X-Git-Tag: travis-deploy-test~75 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=e9a02be2a4f3b8bb19d262b2b19f7dd0bfa10463 client: Add keyboard shortcuts for formatting Add keyboard shortcuts for formatting options as follows: * Apply foreground color: Ctrl-Shift-G * Apply background color: Ctrl-Shift-B * Clear formatting: Ctrl-Shift-C * Toggle bold: Ctrl-B (from QKeySequence::Bold) * Toggle italic: Ctrl-I (from QKeySequence::Italic) * Toggle underline: Ctrl-U (from QKeySequence::Underline) --- diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 8eefba18..ff4c81a1 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -479,6 +479,38 @@ void MainWin::setupActions() coll->addAction("HideCurrentBuffer", new Action(tr("Hide Current Buffer"), coll, this, SLOT(hideCurrentBuffer()), QKeySequence::Close)); + // Text formatting + coll = QtUi::actionCollection("TextFormat", tr("Text formatting")); + + coll->addAction("FormatApplyColor", new Action( + QIcon::fromTheme("format-text-color"), tr("Apply foreground color"), coll, + this, SLOT(on_inputFormatApplyColor_triggered()), + QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_G))); + + coll->addAction("FormatApplyColorFill", new Action( + QIcon::fromTheme("format-fill-color"), tr("Apply background color"), coll, + this, SLOT(on_inputFormatApplyColorFill_triggered()), + QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_B))); + + coll->addAction("FormatClear", new Action( + QIcon::fromTheme("edit-clear"), tr("Clear formatting"), coll, + this, SLOT(on_inputFormatClear_triggered()), + QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C))); + + coll->addAction("FormatBold", new Action( + QIcon::fromTheme("format-text-bold"), tr("Toggle bold"), coll, + this, SLOT(on_inputFormatBold_triggered()), + QKeySequence::Bold)); + + coll->addAction("FormatItalic", new Action( + QIcon::fromTheme("format-text-italic"), tr("Toggle italics"), coll, + this, SLOT(on_inputFormatItalic_triggered()), + QKeySequence::Italic)); + + coll->addAction("FormatUnderline", new Action( + QIcon::fromTheme("format-text-underline"), tr("Toggle underline"), coll, + this, SLOT(on_inputFormatUnderline_triggered()), QKeySequence::Underline)); + // Navigation coll = QtUi::actionCollection("Navigation", tr("Navigation")); @@ -1755,6 +1787,60 @@ void MainWin::connectOrDisconnectFromNet() } +void MainWin::on_inputFormatApplyColor_triggered() +{ + if (!_inputWidget) + return; + + _inputWidget->applyFormatActiveColor(); +} + + +void MainWin::on_inputFormatApplyColorFill_triggered() +{ + if (!_inputWidget) + return; + + _inputWidget->applyFormatActiveColorFill(); +} + + +void MainWin::on_inputFormatClear_triggered() +{ + if (!_inputWidget) + return; + + _inputWidget->clearFormat(); +} + + +void MainWin::on_inputFormatBold_triggered() +{ + if (!_inputWidget) + return; + + _inputWidget->toggleFormatBold(); +} + + +void MainWin::on_inputFormatItalic_triggered() +{ + if (!_inputWidget) + return; + + _inputWidget->toggleFormatItalic(); +} + + +void MainWin::on_inputFormatUnderline_triggered() +{ + if (!_inputWidget) + return; + + _inputWidget->toggleFormatUnderline(); +} + + void MainWin::on_jumpHotBuffer_triggered() { if (!_bufferHotList->rowCount()) diff --git a/src/qtui/mainwin.h b/src/qtui/mainwin.h index 431a3082..aa8aa946 100644 --- a/src/qtui/mainwin.h +++ b/src/qtui/mainwin.h @@ -143,6 +143,49 @@ private slots: void on_actionConfigureNetworks_triggered(); void on_actionConfigureViews_triggered(); void on_actionLockLayout_toggled(bool lock); + + /** + * Apply the active color to the input widget selected or typed text + * + * @seealso InputWidget::applyFormatActiveColor() + */ + void on_inputFormatApplyColor_triggered(); + + /** + * Apply the active fill color to the input widget selected or typed text background + * + * @seealso InputWidget::applyFormatActiveColorFill() + */ + void on_inputFormatApplyColorFill_triggered(); + + /** + * Toggle the boldness of the input widget selected or typed text + * + * @seealso InputWidget::toggleFormatBold() + */ + void on_inputFormatBold_triggered(); + + /** + * Toggle the italicness of the input widget selected or typed text + * + * @seealso InputWidget::toggleFormatItalic() + */ + void on_inputFormatItalic_triggered(); + + /** + * Toggle the underlining of the input widget selected or typed text + * + * @seealso InputWidget::toggleFormatUnderline() + */ + void on_inputFormatUnderline_triggered(); + + /** + * Clear the formatting of the input widget selected or typed text + * + * @seealso InputWidget::clearFormat() + */ + void on_inputFormatClear_triggered(); + void on_jumpHotBuffer_triggered(); void on_bufferSearch_triggered(); void on_actionDebugNetworkModel_triggered();