[kde-doc-english] [konsole] src: Add option to disable ctrl+<mouse-wheel> zooming
Kurt Hindenburg
kurt.hindenburg at gmail.com
Fri Dec 28 15:01:25 UTC 2012
Git commit 417af269e556cba6330a736b0b3089a053bff07f by Kurt Hindenburg.
Committed on 28/12/2012 at 15:51.
Pushed by hindenburg into branch 'master'.
Add option to disable ctrl+<mouse-wheel> zooming
The built-in behavior of Ctrl+<Mouse Wheel> to zoom in/out the terminal
can not be disabled. This patch adds an option to disable this
behavior. (Default to the original behavior).
Original patch by Yichao Yu yyc1992 at gmail.com
I made some changes - bugs are mine as usual
REVIEW: 107281
FIXED-IN: 4.11
GUI:
M +11 -0 src/EditProfileDialog.cpp
M +1 -0 src/EditProfileDialog.h
M +10 -0 src/EditProfileDialog.ui
M +2 -0 src/Profile.cpp
M +10 -1 src/Profile.h
M +2 -2 src/TerminalDisplay.cpp
M +17 -0 src/TerminalDisplay.h
M +3 -0 src/ViewManager.cpp
http://commits.kde.org/konsole/417af269e556cba6330a736b0b3089a053bff07f
diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp
index 00066e1..74b0237 100644
--- a/src/EditProfileDialog.cpp
+++ b/src/EditProfileDialog.cpp
@@ -471,6 +471,9 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr profile)
_ui->boldIntenseButton->setChecked(profile->boldIntense());
connect(_ui->boldIntenseButton, SIGNAL(toggled(bool)), this,
SLOT(setBoldIntense(bool)));
+ _ui->enableMouseWheelZoomButton->setChecked(profile->mouseWheelZoomEnabled());
+ connect(_ui->enableMouseWheelZoomButton, SIGNAL(toggled(bool)), this,
+ SLOT(toggleMouseWheelZoom(bool)));
}
void EditProfileDialog::setAntialiasText(bool enable)
{
@@ -486,6 +489,10 @@ void EditProfileDialog::setBoldIntense(bool enable)
preview(Profile::BoldIntense, enable);
updateTempProfileProperty(Profile::BoldIntense, enable);
}
+void EditProfileDialog::toggleMouseWheelZoom(bool enable)
+{
+ updateTempProfileProperty(Profile::MouseWheelZoomEnabled, enable);
+}
void EditProfileDialog::colorSchemeAnimationUpdate()
{
QAbstractItemModel* model = _ui->colorSchemeList->model();
@@ -1032,6 +1039,10 @@ void EditProfileDialog::setupMousePage(const Profile::Ptr profile)
SLOT(TripleClickModeChanged(int)));
_ui->openLinksByDirectClickButton->setEnabled(_ui->underlineLinksButton->isChecked());
+
+ _ui->enableMouseWheelZoomButton->setChecked(profile->mouseWheelZoomEnabled());
+ connect(_ui->enableMouseWheelZoomButton, SIGNAL(toggled(bool)), this,
+ SLOT(toggleMouseWheelZoom(bool)));
}
void EditProfileDialog::setupAdvancedPage(const Profile::Ptr profile)
{
diff --git a/src/EditProfileDialog.h b/src/EditProfileDialog.h
index c85bd11..30d72e5 100644
--- a/src/EditProfileDialog.h
+++ b/src/EditProfileDialog.h
@@ -129,6 +129,7 @@ private slots:
void colorSchemeSelected();
void previewColorScheme(const QModelIndex& index);
void fontSelected(const QFont&);
+ void toggleMouseWheelZoom(bool enable);
void colorSchemeAnimationUpdate();
diff --git a/src/EditProfileDialog.ui b/src/EditProfileDialog.ui
index 45eafcc..6cbf6a2 100644
--- a/src/EditProfileDialog.ui
+++ b/src/EditProfileDialog.ui
@@ -893,6 +893,16 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="enableMouseWheelZoomButton">
+ <property name="toolTip">
+ <string>Pressing Ctrl+<mouse-wheel> will increase/decrease the text size.</string>
+ </property>
+ <property name="text">
+ <string>Allow Ctrl+<mouse-wheel> to zoom text size</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
diff --git a/src/Profile.cpp b/src/Profile.cpp
index e81433f..4995d90 100644
--- a/src/Profile.cpp
+++ b/src/Profile.cpp
@@ -111,6 +111,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = {
, { PasteFromSelectionEnabled , "PasteFromSelectionEnabled" , INTERACTION_GROUP , QVariant::Bool }
, { PasteFromClipboardEnabled , "PasteFromClipboardEnabled" , INTERACTION_GROUP , QVariant::Bool }
, { MiddleClickPasteMode, "MiddleClickPasteMode" , INTERACTION_GROUP , QVariant::Int }
+ , { MouseWheelZoomEnabled, "MouseWheelZoomEnabled", INTERACTION_GROUP, QVariant::Bool }
// Encoding
, { DefaultEncoding , "DefaultEncoding" , ENCODING_GROUP , QVariant::String }
@@ -159,6 +160,7 @@ FallbackProfile::FallbackProfile()
setProperty(SilenceSeconds, 10);
setProperty(TerminalColumns, 80);
setProperty(TerminalRows, 40);
+ setProperty(MouseWheelZoomEnabled, true);
setProperty(KeyBindings, "default");
setProperty(ColorScheme, "Linux"); //use DarkPastels when is start support blue ncurses UI properly
diff --git a/src/Profile.h b/src/Profile.h
index ab154c0..6ba9bf5 100644
--- a/src/Profile.h
+++ b/src/Profile.h
@@ -245,7 +245,11 @@ public:
*
* In future, the format might be #.#.# to account for levels
*/
- MenuIndex
+ MenuIndex,
+ /** (bool) If true, mouse wheel scroll with Ctrl key pressed
+ * increases/decreases the terminal font size.
+ */
+ MouseWheelZoomEnabled
};
/**
@@ -423,6 +427,11 @@ public:
return property<bool>(Profile::BlinkingTextEnabled);
}
+ /** Convenience method for property<bool>(Profile::MouseWheelZoomEnabled) */
+ bool mouseWheelZoomEnabled() const {
+ return property<bool>(Profile::MouseWheelZoomEnabled);
+ }
+
/** Convenience method for property<bool>(Profile::BlinkingCursorEnabled) */
bool blinkingCursorEnabled() const {
return property<bool>(Profile::BlinkingCursorEnabled);
diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp
index 57e77a3..c5f6bc5 100644
--- a/src/TerminalDisplay.cpp
+++ b/src/TerminalDisplay.cpp
@@ -2392,8 +2392,8 @@ void TerminalDisplay::wheelEvent(QWheelEvent* ev)
const int modifiers = ev->modifiers();
const int delta = ev->delta();
- // ctrl+<wheel> for zomming, like in konqueror and firefox
- if (modifiers & Qt::ControlModifier) {
+ // ctrl+<wheel> for zooming, like in konqueror and firefox
+ if ((modifiers & Qt::ControlModifier) && mouseWheelZoom()) {
if (delta > 0) {
// wheel-up for increasing font size
increaseFontSize();
diff --git a/src/TerminalDisplay.h b/src/TerminalDisplay.h
index 8e246b8..1843e31 100644
--- a/src/TerminalDisplay.h
+++ b/src/TerminalDisplay.h
@@ -335,6 +335,22 @@ public:
void visualBell();
/**
+ * Specified whether zoom terminal on Ctrl+<mouse wheel> is enabled or not.
+ * Defaults to enabled.
+ */
+ void setMouseWheelZoom(bool value) {
+ _mouseWheelZoom = value;
+ };
+ /**
+ * Returns the whether zoom terminal on Ctrl+<mouse wheel> is enabled.
+ *
+ * See setMouseWheelZoom()
+ */
+ bool mouseWheelZoom() {
+ return _mouseWheelZoom;
+ };
+
+ /**
* Reimplemented. Has no effect. Use setVTFont() to change the font
* used to draw characters in the display.
*/
@@ -856,6 +872,7 @@ private:
SessionController* _sessionController;
bool _trimTrailingSpaces; // trim trailing spaces in selected text
+ bool _mouseWheelZoom; // enable mouse wheel zooming or not
friend class TerminalDisplayAccessible;
};
diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp
index faa1395..f9e5841 100644
--- a/src/ViewManager.cpp
+++ b/src/ViewManager.cpp
@@ -841,6 +841,9 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
// bell mode
view->setBellMode(profile->property<int>(Profile::BellMode));
+
+ // mouse wheel zoom
+ view->setMouseWheelZoom(profile->mouseWheelZoomEnabled());
}
void ViewManager::updateViewsForSession(Session* session)
More information about the kde-doc-english
mailing list