From e53d52d8030a76b2f395e58a5a7d04df715b704c Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Wed, 26 Mar 2014 11:07:11 +0100 Subject: [PATCH] Add more visible/accessible font zooming in Linguist Makes font zooming more visible by adding it to the view-menu. In addition to Ctrl-+/- or Ctrl-ScrollWheel for controlling font size it is now possible to control it by using the two new menu items, increase and decrease, in the View->Zoom menu. The font size can also be reset by using Ctrl-0 or a menu-item. Task-number: QTBUG-37561 Change-Id: Ie3e61a138d007ea5435ef67e111aaa845f126081 Reviewed-by: Friedemann Kleint Reviewed-by: Oswald Buddenhagen --- src/linguist/linguist/mainwindow.cpp | 3 +++ src/linguist/linguist/mainwindow.ui | 35 +++++++++++++++++++++++++++++++++ src/linguist/linguist/messageeditor.cpp | 6 ++++++ src/linguist/linguist/messageeditor.h | 5 +++-- 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/linguist/linguist/mainwindow.cpp b/src/linguist/linguist/mainwindow.cpp index 8717bfd..d1d6b5d 100644 --- a/src/linguist/linguist/mainwindow.cpp +++ b/src/linguist/linguist/mainwindow.cpp @@ -1909,6 +1909,9 @@ void MainWindow::setupMenuBar() connect(m_ui.actionStatistics, SIGNAL(triggered()), this, SLOT(toggleStatistics())); connect(m_ui.actionVisualizeWhitespace, SIGNAL(triggered()), this, SLOT(toggleVisualizeWhitespace())); connect(m_ui.menuView, SIGNAL(aboutToShow()), this, SLOT(updateViewMenu())); + connect(m_ui.actionIncreaseZoom, SIGNAL(triggered()), m_messageEditor, SLOT(increaseFontSize())); + connect(m_ui.actionDecreaseZoom, SIGNAL(triggered()), m_messageEditor, SLOT(decreaseFontSize())); + connect(m_ui.actionResetZoomToDefault, SIGNAL(triggered()), m_messageEditor, SLOT(resetFontSize())); m_ui.menuViewViews->addAction(m_contextDock->toggleViewAction()); m_ui.menuViewViews->addAction(m_messagesDock->toggleViewAction()); m_ui.menuViewViews->addAction(m_phrasesDock->toggleViewAction()); diff --git a/src/linguist/linguist/mainwindow.ui b/src/linguist/linguist/mainwindow.ui index 6bf16d7..a1d01ad 100644 --- a/src/linguist/linguist/mainwindow.ui +++ b/src/linguist/linguist/mainwindow.ui @@ -113,12 +113,23 @@ &Toolbars + + + &Zoom + + + + + + + + @@ -898,6 +909,30 @@ Toggle visualize whitespace in editors + + + Increase + + + Ctrl++ + + + + + Decrease + + + Ctrl+- + + + + + Reset to default + + + Ctrl+0 + + diff --git a/src/linguist/linguist/messageeditor.cpp b/src/linguist/linguist/messageeditor.cpp index 1c81cbe..553614b 100644 --- a/src/linguist/linguist/messageeditor.cpp +++ b/src/linguist/linguist/messageeditor.cpp @@ -950,4 +950,10 @@ void MessageEditor::decreaseFontSize() } } +void MessageEditor::resetFontSize() +{ + m_fontSize = font().pointSize(); + applyFontSize(); +} + QT_END_NAMESPACE diff --git a/src/linguist/linguist/messageeditor.h b/src/linguist/linguist/messageeditor.h index e966d49..81471df 100644 --- a/src/linguist/linguist/messageeditor.h +++ b/src/linguist/linguist/messageeditor.h @@ -90,8 +90,6 @@ public: void setVisualizeWhitespace(bool value); void setFontSize(const float fontSize); float fontSize(); - void increaseFontSize(); - void decreaseFontSize(); signals: void translationChanged(const QStringList &translations); @@ -120,6 +118,9 @@ public slots: void setEditorFocus(); void setTranslation(int latestModel, const QString &translation); void setLengthVariants(bool on); + void increaseFontSize(); + void decreaseFontSize(); + void resetFontSize(); private slots: void editorCreated(QTextEdit *); -- 2.7.4