summaryrefslogtreecommitdiffstats
path: root/src/gui/styles
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2010-10-29 09:52:21 (GMT)
committerSami Merila <sami.merila@nokia.com>2010-10-29 09:55:47 (GMT)
commit177960b77ce7b02b853c45278b7c7068783be49f (patch)
tree25fd09457ded57454743933843fa2c186b07eea1 /src/gui/styles
parentd7e1ed1c505f61ab9b9a9874bcbdf9bd94965a27 (diff)
downloadQt-177960b77ce7b02b853c45278b7c7068783be49f.zip
Qt-177960b77ce7b02b853c45278b7c7068783be49f.tar.gz
Qt-177960b77ce7b02b853c45278b7c7068783be49f.tar.bz2
Support tactile feeedback from QS60Style for QWidgets
Currently tactile feedback is not given for QWidgets running on Symbian even if the native side supports this (Sym^3 and 5th Edition devices). This task adds support for QWidgets having QS60Style. The tactile feedback has been implemented as a plugin that the style loads when instantiating itself for touch devices. NOTE that the feedback is NOT supported by the emulated style, nor is the plugin interface public, so it cannot be used outside of style. The implementation is simplistic, since we only want to provide stop-gap solution until 4.8 when real Qt feedback implementation is ready. The implementation will only give feedback for touch-down events for visible, interactive and enabled widgets. Sliders and scrollbars will use sensitive feedback (slightly less aggressive) and all others will use basic feedback. Note that Sym^3 adds tens of different feedback categories, which this plugin ignores as we want to share the same implementation for Sym^3 and 5th ed. In distributed Qt package there is no tactile feedback for 5th edition, due to package creation limitations. Support can be added manually by re-compiling Qt on top of 5th Edition SDK. Task-number: QT-4037 Reviewed-by: Jani Hautakangas Reviewed-by: Janne Koskinen
Diffstat (limited to 'src/gui/styles')
-rw-r--r--src/gui/styles/qs60style.cpp5
-rw-r--r--src/gui/styles/qs60style_feedbackinterface_p.h50
-rw-r--r--src/gui/styles/qs60style_p.h4
-rw-r--r--src/gui/styles/qs60style_s60.cpp24
4 files changed, 81 insertions, 2 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index ca3a9d0..d39a2ba 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -3424,8 +3424,11 @@ bool QS60Style::eventFilter(QObject *object, QEvent *event)
qobject_cast<QCheckBox *>(w))
d->m_pressedWidget = w;
- if ( d->m_pressedWidget)
+ if (d->m_pressedWidget)
d->m_pressedWidget->update();
+#ifdef Q_WS_S60
+ d->touchFeedback(event, w);
+#endif
}
break;
}
diff --git a/src/gui/styles/qs60style_feedbackinterface_p.h b/src/gui/styles/qs60style_feedbackinterface_p.h
new file mode 100644
index 0000000..81fcdc3
--- /dev/null
+++ b/src/gui/styles/qs60style_feedbackinterface_p.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QObject>
+
+class TactileFeedbackInterface : public QObject
+{
+ public:
+ virtual void touchFeedback(QEvent *event, const QWidget *widget) = 0;
+};
+
+Q_DECLARE_INTERFACE(TactileFeedbackInterface, "com.trolltech.Qt.TactileFeedbackInterface/1.0")
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index b3f4160..b46f75e 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -387,6 +387,7 @@ private: //data members
class QFocusFrame;
class QProgressBar;
class QS60StyleAnimation;
+class TactileFeedbackInterface;
// Private class
#ifdef Q_OS_SYMBIAN
@@ -572,6 +573,8 @@ public:
void stopAnimation(QS60StyleEnums::SkinParts animation);
static QS60StyleAnimation* animationDefinition(QS60StyleEnums::SkinParts part);
static void removeAnimations();
+ //No support for tactile feedback in emulated style
+ void touchFeedback(QEvent *event, const QWidget *widget);
#endif
@@ -626,6 +629,7 @@ private:
#ifdef Q_WS_S60
//list of progress bars having animation running
QList<QProgressBar *> m_bars;
+ TactileFeedbackInterface *m_feedbackPlugin;
#endif
};
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 5dda42e..a1ea308 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -49,6 +49,10 @@
#include "private/qcore_symbian_p.h"
#include "qapplication.h"
+#include "qpluginloader.h"
+#include "qlibraryinfo.h"
+#include "private/qs60style_feedbackinterface_p.h"
+
#include <w32std.h>
#include <AknsConstants.h>
#include <aknconsts.h>
@@ -1143,13 +1147,25 @@ void QS60StylePrivate::setActiveLayout()
Q_GLOBAL_STATIC(QList<QS60StyleAnimation *>, m_animations)
-QS60StylePrivate::QS60StylePrivate()
+QS60StylePrivate::QS60StylePrivate() : m_feedbackPlugin(0)
{
//Animation defaults need to be created when style is instantiated
QS60StyleAnimation* progressBarAnimation = new QS60StyleAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim, 7, 100);
m_animations()->append(progressBarAnimation);
// No need to set active layout, if dynamic metrics API is available
setActiveLayout();
+
+ //Tactile feedback plugin is only available for touch devices.
+ if (isTouchSupported()) {
+ QString pluginsPath = QLibraryInfo::location(QLibraryInfo::PluginsPath);
+ pluginsPath += QLatin1String("/feedback/qtactilefeedback.dll");
+
+ // Create plugin loader
+ QPluginLoader pluginLoader(pluginsPath);
+ // Load plugin and store pointer to the plugin implementation
+ if (pluginLoader.load())
+ m_feedbackPlugin = qobject_cast<TactileFeedbackInterface*>(pluginLoader.instance());
+ }
}
void QS60StylePrivate::removeAnimations()
@@ -1439,6 +1455,12 @@ void QS60StylePrivate::stopAnimation(QS60StyleEnums::SkinParts animationPart)
}
}
+void QS60StylePrivate::touchFeedback(QEvent *event, const QWidget *widget)
+{
+ if (m_feedbackPlugin)
+ m_feedbackPlugin->touchFeedback(event, widget);
+}
+
QVariant QS60StyleModeSpecifics::themeDefinition(
QS60StyleEnums::ThemeDefinitions definition, QS60StyleEnums::SkinParts part)
{