[kde-doc-english] playground/utils/synaptiks

Sebastian Wiesner basti.wiesner at gmx.net
Thu Mar 11 00:23:06 CET 2010


SVN commit 1101804 by swiesner:

FEATURE: Added tap-and-drag gesture configuration
GUI: Added tap-and-drag gesture settings to tapping page
Added tapAndDragGesture, lockedDrags and lockedDragsTimeout properties to Touchpad

 M  +18 -0     daemon/org.kde.Touchpad.xml  
 M  +4 -1      daemon/synaptiksdaemon.cpp  
 M  +33 -0     daemon/touchpad.cpp  
 M  +103 -0    daemon/touchpad.h  
 M  +24 -0     daemon/touchpadadaptor.cpp  
 M  +9 -0      daemon/touchpadadaptor.h  
 M  +69 -3     kcmodule/ui/tappingpage.ui  
 M  +18 -0     synaptiks.kcfg  


--- trunk/playground/utils/synaptiks/daemon/org.kde.Touchpad.xml #1101803:1101804
@@ -34,6 +34,24 @@
     <method name="setEdgeMotionAlways">
       <arg name="enabled" type="b" direction="in"/>
     </method>
+    <method name="tapAndDragGesture">
+      <arg type="b" direction="out"/>
+    </method>
+    <method name="setTapAndDragGesture">
+      <arg name="enabled" type="b" direction="in"/>
+    </method>
+    <method name="lockedDrags">
+      <arg type="b" direction="out"/>
+    </method>
+    <method name="setLockedDrags">
+      <arg name="enabled" type="b" direction="in"/>
+    </method>
+    <method name="lockedDragsTimeout">
+      <arg type="i" direction="out"/>
+    </method>
+    <method name="setLockedDragsTimeout">
+      <arg name="timeout" type="i" direction="in"/>
+    </method>
     <method name="circularScrolling">
       <arg type="b" direction="out"/>
     </method>
--- trunk/playground/utils/synaptiks/daemon/synaptiksdaemon.cpp #1101803:1101804
@@ -246,7 +246,7 @@
         << "HorizontalTwoFingerScrolling" << "VerticalTwoFingerScrolling"
         << "HorizontalEdgeScrolling" << "VerticalEdgeScrolling"
         // tapping configuration
-        << "FastTaps";
+        << "FastTaps" << "TapAndDragGesture" << "LockedDrags";
     foreach (const QString &name, names) {
         KConfigSkeletonItem *item = d->config->findItem(name);
         Q_ASSERT(item);
@@ -268,6 +268,9 @@
     // circular scrolling distance in degrees must be converted to radians
     double radians = (d->config->circularScrollingDistance()*M_PI)/180.0;
     this->setTouchpadProperty("circularScrollingDistance", radians);
+    // LockedDragsTimeout scaled to milliseconds
+    this->setTouchpadProperty("lockedDragsTimeout",
+                              d->config->lockedDragsTimeout() * 1000);
     // corner and finger button settings composed from single items
     QByteArray buttons;
     for (int i=0; i < 4; i++) {
--- trunk/playground/utils/synaptiks/daemon/touchpad.cpp #1101803:1101804
@@ -38,6 +38,9 @@
 static const char OFF[] = "Synaptics Off";
 static const char MOVE_SPEED[] = "Synaptics Move Speed";
 static const char EDGE_MOTION_ALWAYS[] = "Synaptics Edge Motion Always";
+static const char GESTURES[] = "Synaptics Gestures";
+static const char LOCKED_DRAGS[] = "Synaptics Locked Drags";
+static const char LOCKED_DRAGS_TIMEOUT[] = "Synaptics Locked Drags Timeout";
 static const char CIRCULAR_SCROLLING[] = "Synaptics Circular Scrolling";
 static const char CIRCULAR_SCROLLING_TRIGGER[] =
     "Synaptics Circular Scrolling Trigger";
@@ -173,6 +176,36 @@
     d->device->setProperty(EDGE_MOTION_ALWAYS, enabled);
 }
 
+bool Touchpad::tapAndDragGesture() const {
+    Q_D(const Touchpad);
+    return d->device->property<bool>(GESTURES, 0);
+}
+
+void Touchpad::setTapAndDragGesture(bool enabled) {
+    Q_D(Touchpad);
+    d->device->setProperty(GESTURES, enabled);
+}
+
+bool Touchpad::lockedDrags() const {
+    Q_D(const Touchpad);
+    return d->device->property<bool>(LOCKED_DRAGS, 0);
+}
+
+void Touchpad::setLockedDrags(bool enabled) {
+    Q_D(Touchpad);
+    d->device->setProperty(LOCKED_DRAGS, enabled);
+}
+
+int Touchpad::lockedDragsTimeout() const {
+    Q_D(const Touchpad);
+    return d->device->property<int>(LOCKED_DRAGS_TIMEOUT, 0);
+}
+
+void Touchpad::setLockedDragsTimeout(int timeout) {
+    Q_D(Touchpad);
+    d->device->setProperty(LOCKED_DRAGS_TIMEOUT, timeout);
+}
+
 bool Touchpad::circularScrolling() const {
     Q_D(const Touchpad);
     return d->device->property<bool>(CIRCULAR_SCROLLING, 0);
--- trunk/playground/utils/synaptiks/daemon/touchpad.h #1101803:1101804
@@ -183,6 +183,58 @@
                    WRITE setEdgeMotionAlways DESIGNABLE false)
 
         /**
+         * @brief Enable or disable the tap-and-drag gesture.
+         *
+         * The tap-and-drag gesture provides an alternative way of dragging.
+         * A tap-and-drag gesture is performed by tapping the touchpad, and
+         * then immediately touching the touchpad and moving the finger on
+         * it.  With this gesture, items can be dragged by tapping only,
+         * without using the mouse buttons of the touchpad.
+         *
+         * @see setTapAndDragGesture(bool)
+         * @see tapAndDragGesture() const
+         * @see lockedDrags
+         * @see lockedDragsTimeout
+         */
+        Q_PROPERTY(bool tapAndDragGesture READ tapAndDragGesture
+                   WRITE setTapAndDragGesture DESIGNABLE false)
+
+        /**
+         * @brief Continue a tap-and-drag gesture after releasing the finger.
+         *
+         * If this property is @c false, a tap-and-drag gesture ends, when
+         * the finger is released from the touchpad (just like drags end,
+         * when the mouse button is released).  By setting this property to
+         * @c true, the gesture continues even after releasing the finger
+         * until the touchpad is tapped again or #lockedDragsTimeout
+         * expires.
+         *
+         * @see setLockedDrags(bool)
+         * @see lockedDrags() const
+         * @see tapAndDragGesture
+         * @see lockedDragsTimeout
+         */
+        Q_PROPERTY(bool lockedDrags READ lockedDrags WRITE setLockedDrags
+                   DESIGNABLE false)
+
+        /**
+         * @brief The timeout of locked drag mode in milliseconds.
+         *
+         * If this timeout expires in locked drag mode, the tap-and-drag
+         * gesture will automatically end, even if the touchpad was not yet
+         * tapped.
+         *
+         * If #lockedDrags is @c false, this property has no effect.
+         *
+         * @see setLockedDragsTimeout(int)
+         * @see lockedDragsTimeout() const
+         * @see tapAndDragGesture
+         * @see lockedDrags
+         */
+        Q_PROPERTY(int lockedDragsTimeout READ lockedDragsTimeout
+                   WRITE setLockedDragsTimeout DESIGNABLE false)
+
+        /**
          * @brief Whether circular scrolling is enabled or not.
          *
          * If circular scrolling is enabled, the user can scroll by moving
@@ -716,6 +768,57 @@
         Q_SCRIPTABLE void setEdgeMotionAlways(bool enabled);
 
         /**
+         * @brief Is the tap-and-drag gesture enabled?
+         *
+         * @return @c true, if the tap-and-drag gesture is enabled, @c false
+         *         otherwise
+         * @see tapAndDragGesture
+         */
+        Q_SCRIPTABLE bool tapAndDragGesture() const;
+
+        /**
+         * @brief Enable or disable the tap-and-drag gesture.
+         *
+         * @param enabled if @c true, enable the gesture, otherwise disable
+         *        it
+         * @see tapAndDragGesture
+         */
+        Q_SCRIPTABLE void setTapAndDragGesture(bool enabled);
+
+        /**
+         * @brief Are locked drags enabled?
+         *
+         * @return @c true, if locked drags are enabled, @c false otherwise
+         * @see lockedDrags
+         */
+        Q_SCRIPTABLE bool lockedDrags() const;
+
+        /**
+         * @brief Enable or disable locked drags.
+         *
+         * @param enabled if @c true, enable locked drags, otherwise disable
+         *        them
+         * @see lockedDrags
+         */
+        Q_SCRIPTABLE void setLockedDrags(bool enabled);
+
+        /**
+         * @brief Get the timeout for a lock drag to expire.
+         *
+         * @return the timeout in milliseconds
+         * @see lockedDragsTimeout
+         */
+        Q_SCRIPTABLE int lockedDragsTimeout() const;
+
+        /**
+         * @brief Set the timeout for a locked drag to expire.
+         *
+         * @param timeout the timeout in milliseconds
+         * @see lockedDragsTimeout
+         */
+        Q_SCRIPTABLE void setLockedDragsTimeout(int timeout);
+
+        /**
          * @brief Is circular scrolling enabled?
          *
          * @return @c true, if circular scrolling is enabled, @c false
--- trunk/playground/utils/synaptiks/daemon/touchpadadaptor.cpp #1101803:1101804
@@ -88,6 +88,30 @@
     this->setPropertyOrDBusError("edgeMotionAlways", enabled);
 }
 
+bool TouchpadAdaptor::tapAndDragGesture() const {
+    return this->propertyOrDBusError("tapAndDragGesture").toBool();
+}
+
+void TouchpadAdaptor::setTapAndDragGesture(bool enabled) {
+    this->setPropertyOrDBusError("tapAndDragGesture", enabled);
+}
+
+bool TouchpadAdaptor::lockedDrags() const {
+    return this->propertyOrDBusError("lockedDrags").toBool();
+}
+
+void TouchpadAdaptor::setLockedDrags(bool enabled) {
+    this->setPropertyOrDBusError("lockedDrags", enabled);
+}
+
+int TouchpadAdaptor::lockedDragsTimeout() const {
+    return this->propertyOrDBusError("lockedDragsTimeout").toInt();
+}
+
+void TouchpadAdaptor::setLockedDragsTimeout(int timeout) {
+    this->setPropertyOrDBusError("lockedDragsTimeout", timeout);
+}
+
 bool TouchpadAdaptor::circularScrolling() const {
     return this->propertyOrDBusError("circularScrolling").toBool();
 }
--- trunk/playground/utils/synaptiks/daemon/touchpadadaptor.h #1101803:1101804
@@ -68,6 +68,15 @@
         bool edgeMotionAlways() const;
         void setEdgeMotionAlways(bool enabled);
 
+        bool tapAndDragGesture() const;
+        void setTapAndDragGesture(bool enabled);
+
+        bool lockedDrags() const;
+        void setLockedDrags(bool enabled);
+
+        int lockedDragsTimeout() const;
+        void setLockedDragsTimeout(int timeout);
+
         bool circularScrolling() const;
         void setCircularScrolling(bool enabled);
 
--- trunk/playground/utils/synaptiks/kcmodule/ui/tappingpage.ui #1101803:1101804
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>674</width>
-    <height>481</height>
+    <width>546</width>
+    <height>707</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -251,15 +251,81 @@
      </layout>
     </widget>
    </item>
+   <item>
+    <widget class="QGroupBox" name="kcfg_TapAndDragGesture">
+     <property name="title">
+      <string comment="@option:check">Drag items by tapping the touchpad and then immediately touching it again</string>
+     </property>
+     <property name="checkable">
+      <bool>true</bool>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_5">
+      <item>
+       <widget class="QCheckBox" name="kcfg_LockedDrags">
+        <property name="text">
+         <string comment="@option:check">Continue dragging when release the finger until touchpad the touchpad again</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="KDoubleNumInput" name="kcfg_LockedDragsTimeout">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="label">
+         <string comment="@label:spinbox">Timeout to automatically stop dragging</string>
+        </property>
+        <property name="maximum">
+         <double>10.000000000000000</double>
+        </property>
+        <property name="singleStep">
+         <double>0.100000000000000</double>
+        </property>
+        <property name="suffix">
+         <string comment="@label:spinbox seconds"> s</string>
+        </property>
+        <property name="decimals">
+         <number>2</number>
+        </property>
+        <property name="sliderEnabled">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
   </layout>
  </widget>
  <customwidgets>
   <customwidget>
+   <class>KDoubleNumInput</class>
+   <extends>QWidget</extends>
+   <header>knuminput.h</header>
+  </customwidget>
+  <customwidget>
    <class>synaptiks::MouseButtonComboBox</class>
    <extends>QComboBox</extends>
    <header>mousebuttoncombobox.h</header>
   </customwidget>
  </customwidgets>
  <resources/>
- <connections/>
+ <connections>
+  <connection>
+   <sender>kcfg_LockedDrags</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>kcfg_LockedDragsTimeout</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>100</x>
+     <y>656</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>100</x>
+     <y>672</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
 </ui>
--- trunk/playground/utils/synaptiks/synaptiks.kcfg #1101803:1101804
@@ -177,5 +177,23 @@
       <label>Enable fast tapping</label>
       <default>false</default>
     </entry>
+    <entry name="TapAndDragGesture" type="Bool">
+      <label>Enable the tap-and-drag gesture, which enables dragging by
+tapping the touchpad and the immdiately touchpad and moving on the
+touchpad.</label>
+      <default>true</default>
+    </entry>
+    <entry name="LockedDrags" type="Bool">
+      <label>If true, a tap-and-drag gesture will remain active, if the
+finger is released, until the touchpad is touched again or the timeout
+expires.</label>
+      <default>false</default>
+    </entry>
+    <entry name="LockedDragsTimeout" type="Double">
+      <label>The timeout of a locked drag to expire in seconds.</label>
+      <default>2</default>
+      <min>0</min>
+      <max>5</max>
+    </entry>
   </group>
 </kcfg>



More information about the kde-doc-english mailing list