Add reset font size shortcut

Summary:
Whenever I change the font size doing so is usually temporary and I usually go back to the default font size in after a short time. Currently I do so by changing to a different profile and discarding the change, which resets the font size to the default. I feel like there should be a shortcut for resetting the size.

I could not find an appropriate icon, so I left it without icon.
The default shortcut ctrl+r seemed reasonable and easy to type, 'r' reset.

Test Plan: Manual.

Reviewers: hindenburg, tcanabrava, #vdg, ngraham

Reviewed By: #vdg, ngraham

Subscribers: muhlenpfordt, ach, kvermette, rizzitello, lbergdoll, hindenburg, fabianr, dhaumann, kde-doc-english, z3ntu, ngraham, konsole-devel

Tags: #konsole, #documentation

Differential Revision: https://phabricator.kde.org/D15380
wilder-portage
Lukas Bergdoll 8 years ago committed by Tomaz Canabrava
parent 6330bb82bb
commit f6e432ab0c
  1. 3
      desktop/sessionui.rc
  2. 8
      doc/manual/index.docbook
  3. 9
      src/SessionController.cpp
  4. 3
      src/SessionController.h
  5. 12
      src/TerminalDisplay.cpp
  6. 3
      src/TerminalDisplay.h

@ -1,6 +1,6 @@
<!DOCTYPE kpartgui>
<kpartgui name="session" version="25">
<kpartgui name="session" version="26">
<MenuBar>
<Menu name="file">
<Action name="file_save_as" group="session-operations"/>
@ -32,6 +32,7 @@
<Action name="view-readonly" group="session-view-operations"/>
<Separator group="session-view-operations"/>
<Action name="enlarge-font" group="session-view-operations"/>
<Action name="reset-font-size" group="session-view-operations"/>
<Action name="shrink-font" group="session-view-operations"/>
<Action name="set-encoding" group="session-view-operations"/>
<Separator group="session-view-operations"/>

@ -768,6 +768,14 @@ drag and drop is disabled.
<listitem><para><action>Increases the text font size</action></para></listitem>
</varlistentry>
<varlistentry>
<term><menuchoice>
<shortcut><keycombo action="simul">&Ctrl;<keycap>0</keycap></keycombo></shortcut>
<guimenu>View</guimenu><guimenuitem>Reset Font Size</guimenuitem></menuchoice></term>
<listitem><para><action>Reset the text font size to the profile default</action></para></listitem>
</varlistentry>
<varlistentry>
<term><menuchoice>
<shortcut><keycombo action="simul">&Ctrl;<keycap>-</keycap></keycombo></shortcut>

@ -718,6 +718,9 @@ void SessionController::setupExtraActions()
action->setIcon(QIcon::fromTheme(QStringLiteral("format-font-size-less")));
collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::Key_Minus);
action = collection->addAction(QStringLiteral("reset-font-size"), this, SLOT(resetFontSize()));
action->setText(i18n("Reset Font Size"));
collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::ALT + Qt::Key_0);
// Send signal
KSelectAction* sendSignalActions = collection->add<KSelectAction>(QStringLiteral("send-signal"));
@ -1508,6 +1511,11 @@ void SessionController::decreaseFontSize()
_view->decreaseFontSize();
}
void SessionController::resetFontSize()
{
_view->resetFontSize();
}
void SessionController::monitorActivity(bool monitor)
{
_session->setMonitorActivity(monitor);
@ -2115,4 +2123,3 @@ QString SessionController::userTitle() const
return QString();
}
}

@ -219,6 +219,9 @@ public Q_SLOTS:
/** Decrease font size */
void decreaseFontSize();
/** Reset font size */
void resetFontSize();
private Q_SLOTS:
// menu item handlers
void openBrowser();

@ -336,6 +336,18 @@ void TerminalDisplay::decreaseFontSize()
setVTFont(font);
}
void TerminalDisplay::resetFontSize()
{
const qreal MinimumFontSize = 6;
QFont font = getVTFont();
Profile::Ptr currentProfile = SessionManager::instance()->sessionProfile(_sessionController->session());
const qreal defaultFontSize = currentProfile->font().pointSizeF();
font.setPointSizeF(qMax(defaultFontSize, MinimumFontSize));
setVTFont(font);
}
uint TerminalDisplay::lineSpacing() const
{
return _lineSpacing;

@ -427,6 +427,9 @@ public:
/** Decreases the font size */
void decreaseFontSize();
/** Reset the font size */
void resetFontSize();
/**
* Specified whether anti-aliasing of text in the terminal display
* is enabled or not. Defaults to enabled.

Loading…
Cancel
Save