[kde-doc-english] playground/utils/synaptiks
Sebastian Wiesner
basti.wiesner at gmx.net
Fri Mar 5 18:00:04 CET 2010
SVN commit 1099474 by swiesner:
FEATURE: Added two-finger scrolling settings
GUI: Added configuration options for two-finger scrolling to kcmodule
Added verticalTwoFingerScrolling and horizontalTwoFingerScrolling properties to Touchpad
M +12 -0 daemon/org.kde.Touchpad.xml
M +1 -0 daemon/synaptiksdaemon.cpp
M +30 -0 daemon/touchpad.cpp
M +62 -0 daemon/touchpad.h
M +18 -0 daemon/touchpadadaptor.cpp
M +6 -0 daemon/touchpadadaptor.h
M +11 -0 kcmodule/synaptikswidgets.cpp
M +25 -2 kcmodule/ui/scrollingpage.ui
M +8 -0 synaptiks.kcfg
--- trunk/playground/utils/synaptiks/daemon/org.kde.Touchpad.xml #1099473:1099474
@@ -22,6 +22,18 @@
<method name="setCircularScrollingTrigger">
<arg name="trigger" type="y" direction="in"/>
</method>
+ <method name="horizontalTwoFingerScrolling">
+ <arg type="b" direction="out"/>
+ </method>
+ <method name="setHorizontalTwoFingerScrolling">
+ <arg name="enabled" type="b" direction="in"/>
+ </method>
+ <method name="verticalTwoFingerScrolling">
+ <arg type="b" direction="out"/>
+ </method>
+ <method name="setVerticalTwoFingerScrolling">
+ <arg name="enabled" type="b" direction="in"/>
+ </method>
<method name="horizontalEdgeScrolling">
<arg type="b" direction="out"/>
</method>
--- trunk/playground/utils/synaptiks/daemon/synaptiksdaemon.cpp #1099473:1099474
@@ -236,6 +236,7 @@
// handle all simple items first
QList<QString> names;
names << "CircularScrolling" << "CircularScrollingTrigger"
+ << "HorizontalTwoFingerScrolling" << "VerticalTwoFingerScrolling"
<< "HorizontalEdgeScrolling" << "VerticalEdgeScrolling";
foreach (const QString &name, names) {
KConfigSkeletonItem *item = d->config->findItem(name);
--- trunk/playground/utils/synaptiks/daemon/touchpad.cpp #1099473:1099474
@@ -44,6 +44,7 @@
static const char CAPABILITIES[] = "Synaptics Capabilities";
static const char TAP_ACTION[] = "Synaptics Tap Action";
static const char FAST_TAP[] = "Synaptics Tap FastTap";
+static const char TWO_FINGER_SCROLLING[] = "Synaptics Two-Finger Scrolling";
enum EdgeSrollingItem {
@@ -59,7 +60,12 @@
LeftBottomItem = 3
};
+enum TwoFingerScrollingItem {
+ VerticalScrollingItem = 0,
+ HorizontalScrollingItem = 1
+};
+
using namespace synaptiks;
@@ -133,6 +139,30 @@
d->device->property<uchar>(CIRCULAR_SCROLLING_TRIGGER, 0));
}
+bool Touchpad::horizontalTwoFingerScrolling() const {
+ Q_D(const Touchpad);
+ return d->device->property<bool>(
+ TWO_FINGER_SCROLLING, HorizontalScrollingItem);
+}
+
+void Touchpad::setHorizontalTwoFingerScrolling(bool enabled) {
+ Q_D(Touchpad);
+ d->device->setProperty(TWO_FINGER_SCROLLING, enabled,
+ HorizontalScrollingItem);
+}
+
+bool Touchpad::verticalTwoFingerScrolling() const {
+ Q_D(const Touchpad);
+ return d->device->property<bool>(
+ TWO_FINGER_SCROLLING, VerticalScrollingItem);
+}
+
+void Touchpad::setVerticalTwoFingerScrolling(bool enabled) {
+ Q_D(Touchpad);
+ d->device->setProperty(TWO_FINGER_SCROLLING, enabled,
+ VerticalScrollingItem);
+}
+
void Touchpad::setCircularScrollingTrigger(
CircularScrollingTrigger trigger) {
Q_D(Touchpad);
--- trunk/playground/utils/synaptiks/daemon/touchpad.h #1099473:1099474
@@ -148,6 +148,32 @@
READ circularScrollingTrigger
WRITE setCircularScrollingTrigger DESIGNABLE false)
+ /** @brief Whether horizontal scrolling with two fingres is enabled
+ * or not.
+ *
+ * If this property is @c true, one can scroll horizontally by
+ * dragging with two fingers anywhere on the touchpad.
+ *
+ * @sa setHorizontalTwoFingerScrolling(bool)
+ * @sa horizontalTwoFingerScrolling()
+ */
+ Q_PROPERTY(bool horizontalTwoFingerScrolling
+ READ horizontalTwoFingerScrolling
+ WRITE setHorizontalTwoFingerScrolling DESIGNABLE false);
+
+ /** @brief Whether vertical scrolling with two fingres is enabled
+ * or not.
+ *
+ * If this property is @c true, one can scroll vertically by
+ * dragging with two fingers anywhere on the touchpad.
+ *
+ * @sa setVerticalTwoFingerScrolling(bool)
+ * @sa verticalTwoFingerScrolling()
+ */
+ Q_PROPERTY(bool verticalTwoFingerScrolling
+ READ verticalTwoFingerScrolling
+ WRITE setVerticalTwoFingerScrolling DESIGNABLE false);
+
/**
* @brief Whether horizontal scrolling at the bottom edge of the
* touchpad is enabled or not.
@@ -548,6 +574,42 @@
CircularScrollingTrigger trigger);
/**
+ * @brief Is horizontal two-finger scrolling enabled?
+ *
+ * @return @c true, if horizontal two-finger scrolling is enabled,
+ * @c false otherwise.
+ * @sa horizontalTwoFingerScrolling
+ */
+ Q_SCRIPTABLE bool horizontalTwoFingerScrolling() const;
+
+ /**
+ * @brief Enable or disable horizontal two-finger scrolling.
+ *
+ * @param enabled if @c true, enable horizontal two-finger
+ * scrolling, otherwise disable it
+ * @sa horizontalTwoFingerScrolling
+ */
+ Q_SCRIPTABLE void setHorizontalTwoFingerScrolling(bool enabled);
+
+ /**
+ * @brief Is vertical two-finger scrolling enabled?
+ *
+ * @return @c true, if vertical two-finger scrolling is enabled,
+ * @c false otherwise.
+ * @sa verticalTwoFingerScrolling
+ */
+ Q_SCRIPTABLE bool verticalTwoFingerScrolling() const;
+
+ /**
+ * @brief Enable or disable vertical two-finger scrolling.
+ *
+ * @param enabled if @c true, enable vertical two-finger
+ * scrolling, otherwise disable it
+ * @sa verticalTwoFingerScrolling
+ */
+ Q_SCRIPTABLE void setVerticalTwoFingerScrolling(bool enabled);
+
+ /**
* @brief Is horizontal scrolling at the bottom edge enabled?
*
* @return @c true, if horizontal edge scrolling is enabled, @c
--- trunk/playground/utils/synaptiks/daemon/touchpadadaptor.cpp #1099473:1099474
@@ -81,6 +81,24 @@
}
}
+bool TouchpadAdaptor::horizontalTwoFingerScrolling() const {
+ return this->propertyOrDBusError(
+ "horizontalTwoFingerScrolling").toBool();
+}
+
+void TouchpadAdaptor::setHorizontalTwoFingerScrolling(bool enabled) {
+ this->setPropertyOrDBusError("horizontalTwoFingerScrolling", enabled);
+}
+
+bool TouchpadAdaptor::verticalTwoFingerScrolling() const {
+ return this->propertyOrDBusError(
+ "verticalTwoFingerScrolling").toBool();
+}
+
+void TouchpadAdaptor::setVerticalTwoFingerScrolling(bool enabled) {
+ this->setPropertyOrDBusError("verticalTwoFingerScrolling", enabled);
+}
+
bool TouchpadAdaptor::horizontalEdgeScrolling() const {
return this->propertyOrDBusError("horizontalEdgeScrolling").toBool();
}
--- trunk/playground/utils/synaptiks/daemon/touchpadadaptor.h #1099473:1099474
@@ -62,6 +62,12 @@
uchar circularScrollingTrigger() const;
void setCircularScrollingTrigger(uchar trigger);
+ bool horizontalTwoFingerScrolling() const;
+ void setHorizontalTwoFingerScrolling(bool enabled);
+
+ bool verticalTwoFingerScrolling() const;
+ void setVerticalTwoFingerScrolling(bool enabled);
+
bool horizontalEdgeScrolling() const;
void setHorizontalEdgeScrolling(bool enabled);
--- trunk/playground/utils/synaptiks/kcmodule/synaptikswidgets.cpp #1099473:1099474
@@ -111,6 +111,17 @@
ScrollingPage::ScrollingPage(QWidget *parent): QWidget(parent) {
this->setupUi(this);
+ QDBusInterface touchpad("org.kde.synaptiks", "/Touchpad",
+ "org.kde.Touchpad");
+ if (!touchpad.isValid()) {
+ return;
+ }
+ QDBusReply<int> fingers = touchpad.call("fingerDetection");
+ if (fingers.isValid()) {
+ if (fingers.value() < 2) {
+ this->twoFingerScrollingGroup->setEnabled(false);
+ }
+ }
}
void ScrollingPage::on_kcfg_CoastingSpeed_valueChanged(double value) {
--- trunk/playground/utils/synaptiks/kcmodule/ui/scrollingpage.ui #1099473:1099474
@@ -7,8 +7,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>599</width>
- <height>363</height>
+ <width>462</width>
+ <height>416</height>
</rect>
</property>
<property name="windowTitle">
@@ -87,6 +87,29 @@
</widget>
</item>
<item>
+ <widget class="QGroupBox" name="twoFingerScrollingGroup">
+ <property name="title">
+ <string>Scrolling with two fingers</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QCheckBox" name="kcfg_HorizontalTwoFingerScrolling">
+ <property name="text">
+ <string comment="@option:check">Horizontal scrolling with two fingers</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="kcfg_VerticalTwoFingerScrolling">
+ <property name="text">
+ <string comment="@option:check">Vertical scrolling with two fingers</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string comment="@title:group">Edge scrolling</string>
--- trunk/playground/utils/synaptiks/synaptiks.kcfg #1099473:1099474
@@ -66,6 +66,14 @@
<choice name="TopLeftCornerTrigger"/>
</choices>
</entry>
+ <entry name="HorizontalTwoFingerScrolling" type="Bool">
+ <label>Enable horizontal scrolling with two fingers</label>
+ <default>true</default>
+ </entry>
+ <entry name="VerticalTwoFingerScrolling" type="Bool">
+ <label>Enable vertical scrolling with two fingers</label>
+ <default>true</default>
+ </entry>
<entry name="HorizontalEdgeScrolling" type="Bool">
<label>Enable horizontal scrolling at the bottom edge</label>
<default>true</default>
More information about the kde-doc-english
mailing list