[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bwacomtablet=5D_src/kcmodule=3A_create_extra_tab_pag?=
From:       Jörg_Ehrichs <Joerg.Ehrichs () gmx ! de>
Date:       2011-03-30 17:33:14
Message-ID: 20110330173314.ACAC7A609B () git ! kde ! org
[Download RAW message or body]

Git commit bf8bb36e83f1518417c854b0ac5f0855f04d1556 by Jörg Ehrichs.
Committed on 30/03/2011 at 19:33.
Pushed by jehrichs into branch 'master'.

create extra tab page for the touch features

M  +2    -0    src/kcmodule/CMakeLists.txt     
M  +0    -51   src/kcmodule/generalwidget.cpp     
M  +1    -176  src/kcmodule/generalwidget.ui     
M  +113  -96   src/kcmodule/tabletwidget.cpp     
M  +2    -0    src/kcmodule/tabletwidget.h     
A  +107  -0    src/kcmodule/touchwidget.cpp         [License: GPL (v2+)]
A  +78   -0    src/kcmodule/touchwidget.h         [License: GPL (v2+)]
A  +201  -0    src/kcmodule/touchwidget.ui         [License: UNKNOWN]  *

The files marked with a * at the end have a non valid license. Please read: \
http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are \
listed at that page.


http://commits.kde.org/wacomtablet/bf8bb36e83f1518417c854b0ac5f0855f04d1556

diff --git a/src/kcmodule/CMakeLists.txt b/src/kcmodule/CMakeLists.txt
index 1bf4bc8..970764b 100644
--- a/src/kcmodule/CMakeLists.txt
+++ b/src/kcmodule/CMakeLists.txt
@@ -13,6 +13,7 @@ set( kcm_tablet_SRCS
      selectkeystroke.cpp
      tabletwidget.cpp
      calibrationdialog.cpp
+     touchwidget.cpp
 )
 
 kde4_add_ui_files( kcm_tablet_SRCS
@@ -26,6 +27,7 @@ kde4_add_ui_files( kcm_tablet_SRCS
                    selectkeybutton.ui
                    selectkeystroke.ui
                    tabletwidget.ui
+                   touchwidget.ui
 )
 
 kde4_add_plugin(kcm_wacomtablet ${kcm_tablet_SRCS})
diff --git a/src/kcmodule/generalwidget.cpp b/src/kcmodule/generalwidget.cpp
index e3b4058..cd0645a 100644
--- a/src/kcmodule/generalwidget.cpp
+++ b/src/kcmodule/generalwidget.cpp
@@ -49,53 +49,10 @@ GeneralWidget::~GeneralWidget()
 
 void GeneralWidget::saveToProfile()
 {
-    KConfigGroup padConfig = m_profileManagement->configGroup(QLatin1String( "touch" \
                ));
-    
-    if(m_ui->touchEventsCheckBox->isChecked() ) {
-        padConfig.writeEntry("Touch", "on");
-    }
-    else {
-        padConfig.writeEntry("Touch", "off");
-    }
-    
-    if(m_ui->gesturesCheckBox->isChecked() ) {
-        padConfig.writeEntry("Gesture", "on");
-    }
-    else {
-        padConfig.writeEntry("Gesture", "off");
-    }
-
-    padConfig.writeEntry("ZoomDistance", m_ui->zoomDistanceBox->value());
-    padConfig.writeEntry("ScrollDistance", m_ui->scrollDistanceBox->value());
-    
-    padConfig.sync();
 }
 
 void GeneralWidget::loadFromProfile()
 {
-    KConfigGroup touchConfig = m_profileManagement->configGroup(QLatin1String( \
                "touch" ));
-    
-    QString touch = touchConfig.readEntry(QLatin1String("Touch"));
-    if(touch == QLatin1String("on")) {
-        m_ui->touchEventsCheckBox->setChecked(true);
-    }
-    else {
-        m_ui->touchEventsCheckBox->setChecked(false);
-    }
-    
-    QString gesture = touchConfig.readEntry(QLatin1String("Gesture"));
-    if(gesture == QLatin1String("on")) {
-        m_ui->gesturesCheckBox->setChecked(true);
-    }
-    else {
-        m_ui->gesturesCheckBox->setChecked(false);
-    }
-    
-    int zoomDistance = touchConfig.readEntry(QLatin1String("ZoomDistance")).toInt();
-    m_ui->zoomDistanceBox->setValue(zoomDistance);
-    
-    int scrollDistance = \
                touchConfig.readEntry(QLatin1String("ScrollDistance")).toInt();
-    m_ui->scrollDistanceBox->setValue(scrollDistance);
 }
 
 void GeneralWidget::profileChanged()
@@ -118,12 +75,4 @@ void GeneralWidget::reloadWidget()
     m_ui->comapnyName->setText(companyName);
     m_ui->tabletName->setText(deviceName);
     m_ui->deviceList->setText(inputDevices.value().join( QLatin1String( "\n" )));
-
-    // show or hide touch settings
-    QDBusReply<QString> touchName = m_deviceInterface->call( QLatin1String( \
                "touchName" ) );
-
-    QString validName = touchName.value();
-    if( validName.isEmpty() ) {
-        m_ui->touchGroupBox->hide();
-    }
 }
diff --git a/src/kcmodule/generalwidget.ui b/src/kcmodule/generalwidget.ui
index 1e38480..f2d1500 100644
--- a/src/kcmodule/generalwidget.ui
+++ b/src/kcmodule/generalwidget.ui
@@ -148,185 +148,10 @@
      </layout>
     </widget>
    </item>
-   <item>
-    <widget class="QGroupBox" name="touchGroupBox">
-     <property name="title">
-      <string>Touch Settings</string>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout">
-      <item>
-       <widget class="QCheckBox" name="touchEventsCheckBox">
-        <property name="toolTip">
-         <string>Turns on/off Touch events (default is enable/on).</string>
-        </property>
-        <property name="text">
-         <string>Touch events</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QCheckBox" name="gesturesCheckBox">
-        <property name="toolTip">
-         <string>Turns on/off multi-touch gesture events (default is enable/on). \
                </string>
-        </property>
-        <property name="text">
-         <string>Multi-Touch Gestures</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_3">
-        <item>
-         <spacer name="horizontalSpacer">
-          <property name="orientation">
-           <enum>Qt::Horizontal</enum>
-          </property>
-          <property name="sizeType">
-           <enum>QSizePolicy::Fixed</enum>
-          </property>
-          <property name="sizeHint" stdset="0">
-           <size>
-            <width>40</width>
-            <height>20</height>
-           </size>
-          </property>
-         </spacer>
-        </item>
-        <item>
-         <layout class="QFormLayout" name="formLayout_2">
-          <property name="fieldGrowthPolicy">
-           <enum>QFormLayout::ExpandingFieldsGrow</enum>
-          </property>
-          <item row="1" column="0">
-           <widget class="QLabel" name="label_2">
-            <property name="toolTip">
-             <string>Minimum motion before sending a scroll gesture (default is \
                20).</string>
-            </property>
-            <property name="text">
-             <string>Scroll Distance:</string>
-            </property>
-           </widget>
-          </item>
-          <item row="1" column="1">
-           <widget class="KIntSpinBox" name="scrollDistanceBox">
-            <property name="maximum">
-             <number>200</number>
-            </property>
-           </widget>
-          </item>
-          <item row="0" column="0">
-           <widget class="QLabel" name="label">
-            <property name="toolTip">
-             <string>Minimum distance for a zoom gesture (default is 50).</string>
-            </property>
-            <property name="text">
-             <string>Zoom Distance:</string>
-            </property>
-           </widget>
-          </item>
-          <item row="0" column="1">
-           <widget class="KIntSpinBox" name="zoomDistanceBox">
-            <property name="maximum">
-             <number>200</number>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </item>
-        <item>
-         <spacer name="horizontalSpacer_2">
-          <property name="orientation">
-           <enum>Qt::Horizontal</enum>
-          </property>
-          <property name="sizeHint" stdset="0">
-           <size>
-            <width>40</width>
-            <height>20</height>
-           </size>
-          </property>
-         </spacer>
-        </item>
-       </layout>
-      </item>
-     </layout>
-    </widget>
-   </item>
   </layout>
  </widget>
- <customwidgets>
-  <customwidget>
-   <class>KIntSpinBox</class>
-   <extends>QSpinBox</extends>
-   <header>knuminput.h</header>
-  </customwidget>
- </customwidgets>
  <resources/>
- <connections>
-  <connection>
-   <sender>touchEventsCheckBox</sender>
-   <signal>clicked()</signal>
-   <receiver>GeneralWidget</receiver>
-   <slot>profileChanged()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>101</x>
-     <y>243</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>141</x>
-     <y>173</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>gesturesCheckBox</sender>
-   <signal>clicked()</signal>
-   <receiver>GeneralWidget</receiver>
-   <slot>profileChanged()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>154</x>
-     <y>268</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>292</x>
-     <y>173</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>scrollDistanceBox</sender>
-   <signal>valueChanged(QString)</signal>
-   <receiver>GeneralWidget</receiver>
-   <slot>profileChanged()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>174</x>
-     <y>323</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>-1</x>
-     <y>308</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>zoomDistanceBox</sender>
-   <signal>valueChanged(QString)</signal>
-   <receiver>GeneralWidget</receiver>
-   <slot>profileChanged()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>190</x>
-     <y>293</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>406</x>
-     <y>174</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
+ <connections/>
  <slots>
   <slot>profileChanged()</slot>
  </slots>
diff --git a/src/kcmodule/tabletwidget.cpp b/src/kcmodule/tabletwidget.cpp
index 3a92090..4489877 100644
--- a/src/kcmodule/tabletwidget.cpp
+++ b/src/kcmodule/tabletwidget.cpp
@@ -25,6 +25,7 @@
 #include "padbuttonwidget.h"
 #include "padmapping.h"
 #include "penwidget.h"
+#include "touchwidget.h"
 
 //KDE includes
 #include <KDE/KInputDialog>
@@ -39,10 +40,10 @@
 
 using namespace Wacom;
 
-TabletWidget::TabletWidget(QWidget *parent)
-    : QWidget(parent),
-    m_ui(new Ui::TabletWidget),
-    m_profileChanged(false)
+TabletWidget::TabletWidget( QWidget *parent )
+    : QWidget( parent ),
+      m_ui( new Ui::TabletWidget ),
+      m_profileChanged( false )
 {
     init();
     loadTabletInformation();
@@ -59,62 +60,65 @@ TabletWidget::~TabletWidget()
     delete m_padButtonPage;
     delete m_padMappingPage;
     delete m_penPage;
+    delete m_touchPage;
 }
 
 void TabletWidget::init()
 {
-    m_tabletInterface = new QDBusInterface(QLatin1String( "org.kde.Wacom" ), \
                QLatin1String( "/Tablet" ), QLatin1String( "org.kde.Wacom" ));
-    m_deviceInterface = new QDBusInterface(QLatin1String( "org.kde.Wacom" ), \
QLatin1String( "/Device" ), QLatin1String( "org.kde.WacomDevice" )); +    \
m_tabletInterface = new QDBusInterface( QLatin1String( "org.kde.Wacom" ), \
QLatin1String( "/Tablet" ), QLatin1String( "org.kde.Wacom" ) ); +    \
m_deviceInterface = new QDBusInterface( QLatin1String( "org.kde.Wacom" ), \
QLatin1String( "/Device" ), QLatin1String( "org.kde.WacomDevice" ) );  
-    if (!m_tabletInterface->isValid() || !m_deviceInterface->isValid()) {
+    if( !m_tabletInterface->isValid() || !m_deviceInterface->isValid() ) {
         kDebug() << "DBus interface not available";
     }
 
-    m_profileManagement = new ProfileManagement(m_deviceInterface);
-
-    m_generalPage = new GeneralWidget(m_deviceInterface, m_profileManagement);
-    m_padButtonPage = new PadButtonWidget(m_profileManagement);
-    m_padMappingPage = new PadMapping(m_deviceInterface, m_profileManagement);
-    m_penPage = new PenWidget(m_profileManagement);
-    m_ui->setupUi(this);
-    m_ui->addProfileButton->setIcon(KIcon( QLatin1String( "document-new" )));
-    m_ui->delProfileButton->setIcon(KIcon( QLatin1String( "edit-delete-page" )));
-
-    connect(m_ui->addProfileButton, SIGNAL(clicked(bool)), SLOT(addProfile()));
-    connect(m_ui->delProfileButton, SIGNAL(clicked(bool)), SLOT(delProfile()));
-    connect(m_ui->profileSelector, SIGNAL(currentIndexChanged(const QString)), \
                SLOT(switchProfile(const QString)));
-    connect(m_padButtonPage, SIGNAL(changed()), SLOT(profileChanged()));
-    connect(m_padMappingPage, SIGNAL(changed()), SLOT(profileChanged()));
-    connect(m_penPage, SIGNAL(changed()), SLOT(profileChanged()));
-    connect(m_generalPage, SIGNAL(changed()), SLOT(profileChanged()));
+    m_profileManagement = new ProfileManagement( m_deviceInterface );
+
+    m_generalPage = new GeneralWidget( m_deviceInterface, m_profileManagement );
+    m_padButtonPage = new PadButtonWidget( m_profileManagement );
+    m_padMappingPage = new PadMapping( m_deviceInterface, m_profileManagement );
+    m_penPage = new PenWidget( m_profileManagement );
+    m_touchPage = new TouchWidget( m_profileManagement );
+    m_ui->setupUi( this );
+    m_ui->addProfileButton->setIcon( KIcon( QLatin1String( "document-new" ) ) );
+    m_ui->delProfileButton->setIcon( KIcon( QLatin1String( "edit-delete-page" ) ) );
+
+    connect( m_ui->addProfileButton, SIGNAL( clicked( bool ) ), SLOT( addProfile() ) \
); +    connect( m_ui->delProfileButton, SIGNAL( clicked( bool ) ), SLOT( \
delProfile() ) ); +    connect( m_ui->profileSelector, SIGNAL( currentIndexChanged( \
const QString ) ), SLOT( switchProfile( const QString ) ) ); +    connect( \
m_padButtonPage, SIGNAL( changed() ), SLOT( profileChanged() ) ); +    connect( \
m_padMappingPage, SIGNAL( changed() ), SLOT( profileChanged() ) ); +    connect( \
m_penPage, SIGNAL( changed() ), SLOT( profileChanged() ) ); +    connect( \
m_touchPage, SIGNAL( changed() ), SLOT( profileChanged() ) ); +    connect( \
m_generalPage, SIGNAL( changed() ), SLOT( profileChanged() ) );  //DBus signals
-    connect(m_tabletInterface, SIGNAL(tabletAdded()), \
                SLOT(loadTabletInformation()));
-    connect(m_tabletInterface, SIGNAL(tabletRemoved()), \
SLOT(loadTabletInformation())); +    connect( m_tabletInterface, SIGNAL( \
tabletAdded() ), SLOT( loadTabletInformation() ) ); +    connect( m_tabletInterface, \
SIGNAL( tabletRemoved() ), SLOT( loadTabletInformation() ) );  
-    m_profilesConfig = KSharedConfig::openConfig(QLatin1String( "tabletprofilesrc" \
), KConfig::SimpleConfig); +    m_profilesConfig = KSharedConfig::openConfig( \
QLatin1String( "tabletprofilesrc" ), KConfig::SimpleConfig );  }
 
 void TabletWidget::loadTabletInformation()
 {
     //check if a tablet is connected
-    QDBusReply<bool> isAvailable = m_tabletInterface->call(QLatin1String( \
"tabletAvailable" )); +    QDBusReply<bool> isAvailable = m_tabletInterface->call( \
QLatin1String( "tabletAvailable" ) );  
-    if (!isAvailable.isValid()) {
-        QString errmsg = i18n("D-Bus connection to the kded daemon not \
available.\n\nPlease start the Wacom tablet daemon and try again.\nThe daemon is \
                responsible for tablet detection and profile support.");
-        showError(errmsg);
+    if( !isAvailable.isValid() ) {
+        QString errmsg = i18n( "D-Bus connection to the kded daemon not \
available.\n\nPlease start the Wacom tablet daemon and try again.\nThe daemon is \
responsible for tablet detection and profile support." ); +        showError( errmsg \
);  kError() << "DBus reply tabletAvailable failed";
         return;
     }
 
-    if (!isAvailable) {
-        QString errmsg = i18n("No tablet device was found.\n\nPlease connect the \
device before you start this module.\nIf the device is already connected refer to the \
                help file for any further information.");
-        showError(errmsg);
+    if( !isAvailable ) {
+        QString errmsg = i18n( "No tablet device was found.\n\nPlease connect the \
device before you start this module.\nIf the device is already connected refer to the \
help file for any further information." ); +        showError( errmsg );
         return;
     }
 
-    if (m_deviceError) {
-        m_deviceError->setVisible(false);
-        m_ui->verticalLayout->removeWidget(m_deviceError);
+    if( m_deviceError ) {
+        m_deviceError->setVisible( false );
+        m_ui->verticalLayout->removeWidget( m_deviceError );
     }
 
     m_profileManagement->reload();
@@ -122,70 +126,80 @@ void TabletWidget::loadTabletInformation()
     m_padButtonPage->reloadWidget();
     m_padMappingPage->reloadWidget();
     m_penPage->reloadWidget();
+    m_touchPage->reloadWidget();
 
     // ok we found a device, lets add all necessary information
-    m_ui->profileSelector->setEnabled(true);
-    m_ui->addProfileButton->setEnabled(true);
-    m_ui->delProfileButton->setEnabled(true);
-    m_ui->deviceTabWidget->setEnabled(true);
-    m_ui->deviceTabWidget->setVisible(true);
+    m_ui->profileSelector->setEnabled( true );
+    m_ui->addProfileButton->setEnabled( true );
+    m_ui->delProfileButton->setEnabled( true );
+    m_ui->deviceTabWidget->setEnabled( true );
+    m_ui->deviceTabWidget->setVisible( true );
 
     // load available profiles and create a default one if no profile exist;
     KConfigGroup deviceGroup = m_profileManagement->availableProfiles();
 
-    if (deviceGroup.groupList().isEmpty()) {
+    if( deviceGroup.groupList().isEmpty() ) {
         m_profileManagement->createNewProfile();
         // set the state of the kcm and kded to the new default profile
-        m_profileManagement->setProfileName(QLatin1String("default"));
+        m_profileManagement->setProfileName( QLatin1String( "default" ) );
         applyProfile();
         //load the list of profiles again, will update to have the default profile
         deviceGroup = m_profileManagement->availableProfiles();
     }
 
     // fill combobox with all available profiles
-    m_ui->profileSelector->blockSignals(true);
+    m_ui->profileSelector->blockSignals( true );
     m_ui->profileSelector->clear();
-    m_ui->profileSelector->addItems(deviceGroup.groupList());
-    m_ui->profileSelector->blockSignals(false);
+    m_ui->profileSelector->addItems( deviceGroup.groupList() );
+    m_ui->profileSelector->blockSignals( false );
 
     // add all tab pages
-    m_ui->deviceTabWidget->addTab(m_generalPage, i18nc("Basic overview page for the \
                tablet hardware", "General"));
-    m_ui->deviceTabWidget->addTab(m_penPage, i18n("Pen"));
-    m_ui->deviceTabWidget->addTab(m_padMappingPage, i18n("Pad Mapping"));
-    QDBusReply<bool> hasPadButtons = m_deviceInterface->call(QLatin1String( \
                "hasPadButtons" ));
-    if (hasPadButtons) {
-        m_ui->deviceTabWidget->addTab(m_padButtonPage, i18n("Pad Buttons"));
+    m_ui->deviceTabWidget->addTab( m_generalPage, i18nc( "Basic overview page for \
the tablet hardware", "General" ) ); +    m_ui->deviceTabWidget->addTab( m_penPage, \
i18n( "Pen" ) ); +
+    QDBusReply<bool> hasPadButtons = m_deviceInterface->call( QLatin1String( \
"hasPadButtons" ) ); +    if( hasPadButtons ) {
+        m_ui->deviceTabWidget->addTab( m_padButtonPage, i18n( "Pad Buttons" ) );
+    }
+
+    QDBusReply<QString> touchAvailable = m_deviceInterface->call( QLatin1String( \
"touchName" ) ); +    QString touchName = touchAvailable.value();
+    if( !touchName.isEmpty() ) {
+        m_ui->deviceTabWidget->addTab( m_touchPage, i18n( "Touch" ) );
     }
 
+    m_ui->deviceTabWidget->addTab( m_padMappingPage, i18n( "Pad Mapping" ) );
+
     // switch to the current active profile
-    QDBusReply<QString> profile = m_tabletInterface->call(QLatin1String( "profile" \
                ));
-    if(profile.isValid()) {
-        m_ui->profileSelector->setCurrentItem(profile);
-        switchProfile(profile);
+    QDBusReply<QString> profile = m_tabletInterface->call( QLatin1String( "profile" \
) ); +    if( profile.isValid() ) {
+        m_ui->profileSelector->setCurrentItem( profile );
+        switchProfile( profile );
     }
 }
 
 void TabletWidget::addProfile()
 {
     bool ok;
-    QString text = KInputDialog::getText(i18n("Add new profile"),
-                                         i18n("Profile name:"), QString(), &ok, \
                this);
-    if (ok && !text.isEmpty()) {
-        m_profileManagement->createNewProfile(text);
-    } else {
+    QString text = KInputDialog::getText( i18n( "Add new profile" ),
+                                          i18n( "Profile name:" ), QString(), &ok, \
this ); +    if( ok && !text.isEmpty() ) {
+        m_profileManagement->createNewProfile( text );
+    }
+    else {
         return;
     }
 
     // refill combobox with all available profiles
     KConfigGroup deviceGroup = m_profileManagement->availableProfiles();
-    m_ui->profileSelector->blockSignals(true);
+    m_ui->profileSelector->blockSignals( true );
     m_ui->profileSelector->clear();
-    m_ui->profileSelector->addItems(deviceGroup.groupList());
-    int index = m_ui->profileSelector->findText(text);
-    m_ui->profileSelector->setCurrentIndex(index);
-    m_ui->profileSelector->blockSignals(false);
+    m_ui->profileSelector->addItems( deviceGroup.groupList() );
+    int index = m_ui->profileSelector->findText( text );
+    m_ui->profileSelector->setCurrentIndex( index );
+    m_ui->profileSelector->blockSignals( false );
 
-    switchProfile(text);
+    switchProfile( text );
 }
 
 void TabletWidget::delProfile()
@@ -193,12 +207,12 @@ void TabletWidget::delProfile()
     // currently selected profile
     m_profileManagement->deleteProfile();
     KConfigGroup deviceGroup = m_profileManagement->availableProfiles();
-    m_ui->profileSelector->blockSignals(true);
+    m_ui->profileSelector->blockSignals( true );
     m_ui->profileSelector->clear();
-    m_ui->profileSelector->addItems(deviceGroup.groupList());
-    m_ui->profileSelector->blockSignals(false);
+    m_ui->profileSelector->addItems( deviceGroup.groupList() );
+    m_ui->profileSelector->blockSignals( false );
 
-    switchProfile(m_ui->profileSelector->currentText());
+    switchProfile( m_ui->profileSelector->currentText() );
 }
 
 void TabletWidget::saveProfile()
@@ -207,40 +221,42 @@ void TabletWidget::saveProfile()
     m_padButtonPage->saveToProfile();
     m_padMappingPage->saveToProfile();
     m_penPage->saveToProfile();
+    m_touchPage->saveToProfile();
 
     m_profileChanged = false;
-    emit changed(false);
+    emit changed( false );
 
     applyProfile();
 }
 
-void TabletWidget::switchProfile(const QString &profile)
+void TabletWidget::switchProfile( const QString &profile )
 {
-    if (m_profileChanged) {
+    if( m_profileChanged ) {
         QPointer<KDialog> saveDialog = new KDialog();
         Ui::SaveProfile askToSave;
-        QWidget *widget = new QWidget(this);
-        askToSave.setupUi(widget);
-        saveDialog->setMainWidget(widget);
-        saveDialog->setButtons(KDialog::Apply | KDialog::Cancel);
-        connect(saveDialog, SIGNAL(applyClicked()), saveDialog, SLOT(accept()));
+        QWidget *widget = new QWidget( this );
+        askToSave.setupUi( widget );
+        saveDialog->setMainWidget( widget );
+        saveDialog->setButtons( KDialog::Apply | KDialog::Cancel );
+        connect( saveDialog, SIGNAL( applyClicked() ), saveDialog, SLOT( accept() ) \
);  int ret;
         ret = saveDialog->exec();
 
-        if (ret == KDialog::Accepted) {
+        if( ret == KDialog::Accepted ) {
             saveProfile();
         }
     }
 
-    m_profileManagement->setProfileName(profile);
+    m_profileManagement->setProfileName( profile );
 
     m_generalPage->loadFromProfile();
     m_padButtonPage->loadFromProfile();
     m_padMappingPage->loadFromProfile();
     m_penPage->loadFromProfile();
+    m_touchPage->loadFromProfile();
 
     m_profileChanged = false;
-    emit changed(false);
+    emit changed( false );
 
     applyProfile();
 }
@@ -251,35 +267,36 @@ void TabletWidget::reloadProfile()
     m_padButtonPage->loadFromProfile();
     m_padMappingPage->loadFromProfile();
     m_penPage->loadFromProfile();
+    m_touchPage->loadFromProfile();
 
     m_profileChanged = false;
-    emit changed(false);
+    emit changed( false );
 }
 
 void TabletWidget::applyProfile()
 {
-    m_tabletInterface->call(QLatin1String( "setProfile" ), \
m_profileManagement->profileName()); +    m_tabletInterface->call( QLatin1String( \
"setProfile" ), m_profileManagement->profileName() );  }
 
 void TabletWidget::profileChanged()
 {
     m_profileChanged = true;
-    emit changed(true);
+    emit changed( true );
 }
 
-void TabletWidget::showError(const QString & errMsg)
+void TabletWidget::showError( const QString &errMsg )
 {
     delete m_deviceError;
 
     m_deviceError = new QWidget();
     Ui::ErrorWidget ew;
-    ew.setupUi(m_deviceError);
-    ew.errorImage->setPixmap(KIconLoader::global()->loadIcon(QLatin1String( \
                "dialog-warning" ), KIconLoader::NoGroup, 128));
-    ew.errorText->setText(errMsg);
-    m_ui->deviceTabWidget->setVisible(false);
-    m_ui->verticalLayout->addWidget(m_deviceError);
-
-    m_ui->profileSelector->setEnabled(false);
-    m_ui->addProfileButton->setEnabled(false);
-    m_ui->delProfileButton->setEnabled(false);
+    ew.setupUi( m_deviceError );
+    ew.errorImage->setPixmap( KIconLoader::global()->loadIcon( QLatin1String( \
"dialog-warning" ), KIconLoader::NoGroup, 128 ) ); +    ew.errorText->setText( errMsg \
); +    m_ui->deviceTabWidget->setVisible( false );
+    m_ui->verticalLayout->addWidget( m_deviceError );
+
+    m_ui->profileSelector->setEnabled( false );
+    m_ui->addProfileButton->setEnabled( false );
+    m_ui->delProfileButton->setEnabled( false );
 }
diff --git a/src/kcmodule/tabletwidget.h b/src/kcmodule/tabletwidget.h
index 76abdb3..9aace59 100644
--- a/src/kcmodule/tabletwidget.h
+++ b/src/kcmodule/tabletwidget.h
@@ -43,6 +43,7 @@ class PadButtonWidget;
 class PadMapping;
 class ScreenWidget;
 class PenWidget;
+class TouchWidget;
 
 /**
   * This class implements the tabletwidget.ui designer file
@@ -155,6 +156,7 @@ private:
     PadButtonWidget    *m_padButtonPage;       /**< Widget for the pad button \
                settings */
     PadMapping         *m_padMappingPage;      /**< Widget for the pad rotation and \
                working area */
     PenWidget          *m_penPage;             /**< Widget for the pen settings \
(stylus/eraser) */ +    TouchWidget        *m_touchPage;           /**< Widget for \
                the touch settings */
     bool                m_profileChanged;      /**< True if the profile was changed \
                and not saved yet */
     QPointer<QWidget>   m_deviceError;         /**< Shows the error widget */
 };
diff --git a/src/kcmodule/touchwidget.cpp b/src/kcmodule/touchwidget.cpp
new file mode 100644
index 0000000..1716a78
--- /dev/null
+++ b/src/kcmodule/touchwidget.cpp
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2011 Jörg Ehrichs <joerg.ehichs@gmx.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "touchwidget.h"
+#include "ui_touchwidget.h"
+
+#include "profilemanagement.h"
+
+//Qt includes
+#include <QtCore/QStringList>
+#include <QtDBus/QDBusInterface>
+#include <QtDBus/QDBusReply>
+
+using namespace Wacom;
+
+TouchWidget::TouchWidget(ProfileManagement *profileManager, QWidget *parent)
+        : QWidget(parent),
+        m_ui(new Ui::TouchWidget),
+        m_profileManagement(profileManager)
+{
+    m_ui->setupUi(this);
+
+    reloadWidget();
+}
+
+TouchWidget::~TouchWidget()
+{
+    delete m_ui;
+}
+
+void TouchWidget::saveToProfile()
+{
+    KConfigGroup touchConfig = m_profileManagement->configGroup(QLatin1String( \
"touch" )); +
+    if(m_ui->touchEventsCheckBox->isChecked() ) {
+        touchConfig.writeEntry("Touch", "on");
+    }
+    else {
+        touchConfig.writeEntry("Touch", "off");
+    }
+
+    if(m_ui->gesturesCheckBox->isChecked() ) {
+        touchConfig.writeEntry("Gesture", "on");
+    }
+    else {
+        touchConfig.writeEntry("Gesture", "off");
+    }
+
+    touchConfig.writeEntry("ZoomDistance", m_ui->zoomDistanceBox->value());
+    touchConfig.writeEntry("ScrollDistance", m_ui->scrollDistanceBox->value());
+    touchConfig.writeEntry("TapTime", m_ui->tapTimeBox->value());
+
+    touchConfig.sync();
+}
+
+void TouchWidget::loadFromProfile()
+{
+    KConfigGroup touchConfig = m_profileManagement->configGroup(QLatin1String( \
"touch" )); +
+    QString touch = touchConfig.readEntry(QLatin1String("Touch"));
+    if(touch == QLatin1String("on")) {
+        m_ui->touchEventsCheckBox->setChecked(true);
+    }
+    else {
+        m_ui->touchEventsCheckBox->setChecked(false);
+    }
+
+    QString gesture = touchConfig.readEntry(QLatin1String("Gesture"));
+    if(gesture == QLatin1String("on")) {
+        m_ui->gesturesCheckBox->setChecked(true);
+    }
+    else {
+        m_ui->gesturesCheckBox->setChecked(false);
+    }
+
+    int zoomDistance = touchConfig.readEntry(QLatin1String("ZoomDistance")).toInt();
+    m_ui->zoomDistanceBox->setValue(zoomDistance);
+
+    int scrollDistance = \
touchConfig.readEntry(QLatin1String("ScrollDistance")).toInt(); +    \
m_ui->scrollDistanceBox->setValue(scrollDistance); +
+    int tapTime = touchConfig.readEntry(QLatin1String("ScrollDistance")).toInt();
+    m_ui->tapTimeBox->setValue(tapTime);
+}
+
+void TouchWidget::profileChanged()
+{
+    emit changed();
+}
+
+void TouchWidget::reloadWidget()
+{
+}
diff --git a/src/kcmodule/touchwidget.h b/src/kcmodule/touchwidget.h
new file mode 100644
index 0000000..5ee5d04
--- /dev/null
+++ b/src/kcmodule/touchwidget.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2011 Jörg Ehrichs <joerg.ehichs@gmx.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TOUCHWIDGET_H
+#define TOUCHWIDGET_H
+
+#include <QtGui/QWidget>
+
+namespace Ui
+{
+class TouchWidget;
+}
+
+namespace Wacom
+{
+class ProfileManagement;
+
+class TouchWidget : public QWidget
+{
+    Q_OBJECT
+public:
+    TouchWidget(ProfileManagement *profileManager, QWidget *parent = 0);
+    /**
+      * default destructor
+      */
+    ~TouchWidget();
+
+    /**
+      * Saves all values to the current profile
+      */
+    void saveToProfile();
+
+public slots:
+    /**
+      * When called the widget information will be refreshed
+      */
+    void reloadWidget();
+
+    /**
+      * Called whenever the profile is switched or the widget needs to be \
reinitialized. +      *
+      * Updates all values on the widget to the values from the profile.
+      */
+    void loadFromProfile();
+
+    /**
+      * Called whenever a value is changed.
+      * Fires the changed() signal afterwards to inform the main widget that unsaved \
changes are available. +      */
+    void profileChanged();
+
+signals:
+    /**
+      * Used to inform the main widget that unsaved changes in the current profile \
are available. +      */
+    void changed();
+
+private:
+    Ui::TouchWidget *m_ui;              /**< Handler to the generalwidget.ui file */
+    ProfileManagement *m_profileManagement; /**< Handler for the profile config \
connection */ +};
+
+}
+#endif // TOUCHWIDGET_H
diff --git a/src/kcmodule/touchwidget.ui b/src/kcmodule/touchwidget.ui
new file mode 100644
index 0000000..82d25b3
--- /dev/null
+++ b/src/kcmodule/touchwidget.ui
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>TouchWidget</class>
+ <widget class="QWidget" name="TouchWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>330</width>
+    <height>171</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Touch Settings</string>
+  </property>
+  <layout class="QFormLayout" name="formLayout">
+   <property name="horizontalSpacing">
+    <number>5</number>
+   </property>
+   <property name="verticalSpacing">
+    <number>5</number>
+   </property>
+   <property name="margin">
+    <number>8</number>
+   </property>
+   <item row="0" column="0" colspan="2">
+    <widget class="QCheckBox" name="touchEventsCheckBox">
+     <property name="toolTip">
+      <string>Turns on/off Touch events (default is enable/on).</string>
+     </property>
+     <property name="text">
+      <string>Touch events</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0" colspan="2">
+    <widget class="QCheckBox" name="gesturesCheckBox">
+     <property name="toolTip">
+      <string>Turns on/off multi-touch gesture events (default is enable/on). \
</string> +     </property>
+     <property name="text">
+      <string>Multi-Touch Gestures</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <widget class="QLabel" name="label">
+     <property name="toolTip">
+      <string>Minimum distance for a zoom gesture (default is 50).</string>
+     </property>
+     <property name="text">
+      <string>Zoom Distance:</string>
+     </property>
+     <property name="buddy">
+      <cstring>zoomDistanceBox</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="KIntSpinBox" name="zoomDistanceBox">
+     <property name="maximum">
+      <number>200</number>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0">
+    <widget class="QLabel" name="label_2">
+     <property name="toolTip">
+      <string>Minimum motion before sending a scroll gesture (default is \
20).</string> +     </property>
+     <property name="text">
+      <string>Scroll Distance:</string>
+     </property>
+     <property name="buddy">
+      <cstring>scrollDistanceBox</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="1">
+    <widget class="KIntSpinBox" name="scrollDistanceBox">
+     <property name="maximum">
+      <number>200</number>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="0">
+    <widget class="QLabel" name="label_3">
+     <property name="toolTip">
+      <string>Minimum time between taps for a right click (default is 250)</string>
+     </property>
+     <property name="text">
+      <string>Tap time:</string>
+     </property>
+     <property name="buddy">
+      <cstring>tapTimeBox</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="1">
+    <widget class="KIntSpinBox" name="tapTimeBox">
+     <property name="maximum">
+      <number>1000</number>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KIntSpinBox</class>
+   <extends>QSpinBox</extends>
+   <header>knuminput.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>touchEventsCheckBox</sender>
+   <signal>clicked()</signal>
+   <receiver>TouchWidget</receiver>
+   <slot>profileChanged()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>80</x>
+     <y>21</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>262</x>
+     <y>33</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>gesturesCheckBox</sender>
+   <signal>clicked()</signal>
+   <receiver>TouchWidget</receiver>
+   <slot>profileChanged()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>151</x>
+     <y>43</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>301</x>
+     <y>60</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>zoomDistanceBox</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>TouchWidget</receiver>
+   <slot>profileChanged()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>138</x>
+     <y>70</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>236</x>
+     <y>75</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>scrollDistanceBox</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>TouchWidget</receiver>
+   <slot>profileChanged()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>134</x>
+     <y>99</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>300</x>
+     <y>101</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>tapTimeBox</sender>
+   <signal>valueChanged(int)</signal>
+   <receiver>TouchWidget</receiver>
+   <slot>profileChanged()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>133</x>
+     <y>127</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>289</x>
+     <y>132</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+ <slots>
+  <slot>profileChanged()</slot>
+ </slots>
+</ui>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic