--- a/bwins/ganeswidgetsu.def Fri Sep 17 15:55:58 2010 +0300
+++ b/bwins/ganeswidgetsu.def Wed Oct 06 14:53:41 2010 +0300
@@ -101,4 +101,6 @@
?emptySpacePressed@HgGrid@@IAEXXZ @ 100 NONAME ; void HgGrid::emptySpacePressed(void)
?pinchLevels@HgGrid@@QBE?AU?$QPair@HH@@W4Orientation@Qt@@@Z @ 101 NONAME ; struct QPair<int, int> HgGrid::pinchLevels(enum Qt::Orientation) const
?rowCount@HgGrid@@QBEHW4Orientation@Qt@@@Z @ 102 NONAME ; int HgGrid::rowCount(enum Qt::Orientation) const
+ ?reflectionsEnabled@HgGrid@@QBE_NXZ @ 103 NONAME ; bool HgGrid::reflectionsEnabled(void) const
+ ?setReflectionsEnabled@HgGrid@@QAEX_N@Z @ 104 NONAME ; void HgGrid::setReflectionsEnabled(bool)
--- a/bwins/hgcacheproxymodelu.def Fri Sep 17 15:55:58 2010 +0300
+++ b/bwins/hgcacheproxymodelu.def Wed Oct 06 14:53:41 2010 +0300
@@ -136,4 +136,6 @@
?sourceModelAboutToBeReset@HgCacheProxyModel@@AAEXXZ @ 135 NONAME ; void HgCacheProxyModel::sourceModelAboutToBeReset(void)
?qt_metacall@HgDataProviderModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 136 NONAME ; int HgDataProviderModel::qt_metacall(enum QMetaObject::Call, int, void * *)
?filterKeyColumn@HgCacheProxyModel@@QBEHXZ @ 137 NONAME ; int HgCacheProxyModel::filterKeyColumn(void) const
+ ?isCached@HgCacheProxyModel@@UBE_NH@Z @ 138 NONAME ; bool HgCacheProxyModel::isCached(int) const
+ ?isCached@HgDataProviderModel@@IBE_NH@Z @ 139 NONAME ; bool HgDataProviderModel::isCached(int) const
--- a/eabi/ganeswidgetsu.def Fri Sep 17 15:55:58 2010 +0300
+++ b/eabi/ganeswidgetsu.def Wed Oct 06 14:53:41 2010 +0300
@@ -110,4 +110,6 @@
_ZNK6HgGrid11pinchLevelsEN2Qt11OrientationE @ 109 NONAME
_ZNK6HgGrid12pinchEnabledEv @ 110 NONAME
_ZNK6HgGrid8rowCountEN2Qt11OrientationE @ 111 NONAME
+ _ZN6HgGrid21setReflectionsEnabledEb @ 112 NONAME
+ _ZNK6HgGrid18reflectionsEnabledEv @ 113 NONAME
--- a/eabi/hgcacheproxymodelu.def Fri Sep 17 15:55:58 2010 +0300
+++ b/eabi/hgcacheproxymodelu.def Wed Oct 06 14:53:41 2010 +0300
@@ -134,4 +134,7 @@
_ZThn12_N17HgCacheProxyModel11dataUpdatedEii @ 133 NONAME
_ZThn8_N17HgCacheProxyModel7releaseEii @ 134 NONAME
_ZThn8_N17HgCacheProxyModel7requestEiiN23HgBufferManagerObserver14HgRequestOrderE @ 135 NONAME
+ _ZNK17HgCacheProxyModel8isCachedEi @ 136 NONAME
+ _ZNK19HgDataProviderModel8isCachedEi @ 137 NONAME
+ _ZThn12_NK17HgCacheProxyModel8isCachedEi @ 138 NONAME
--- a/ganeswidgets/ganeswidgets.pro Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/ganeswidgets.pro Wed Oct 06 14:53:41 2010 +0300
@@ -9,7 +9,6 @@
# Contributors:
# Description:
-symbian:TARGET.UID3 = 0x10207C66
TEMPLATE = lib
CONFIG += hb
TARGET = ganeswidgets
@@ -19,15 +18,21 @@
DEPENDPATH += .
INCLUDEPATH += . \
inc \
- $$MW_LAYER_SYSTEMINCLUDE
+ $$MW_LAYER_SYSTEMINCLUDE \
+ /epoc32/include/mw/hb/hbfeedback
LIBS += -lestor.dll \
-lhbcore \
+ -lhbfeedback \
-lhbwidgets \
-llibOpenVG.dll \
-llibOpenVGU.dll
-symbian {
+symbian {
+ TARGET.UID3 = 0x10207C66
TARGET.EPOCALLOWDLLDATA = 1
+ #Symmetric Multi-Processing safety
+ MMP_RULES += SMPSAFE
+
#the def files are located in the root of hgwidgets so this is needed
defFilePath=..
}
@@ -57,9 +62,9 @@
src/hgtransformedquadrenderer.cpp \
src/hgcenteritemarea.cpp
HEADERS = inc/trace.h \
- ../hgwidgets_plat/ganeswidgets_api/inc/hgwidgets.h \
- ../hgwidgets_plat/ganeswidgets_api/inc/hggrid.h \
- ../hgwidgets_plat/ganeswidgets_api/inc/hgmediawall.h \
+ ../hgwidgets_pub/ganeswidgets_api/inc/hgwidgets.h \
+ ../hgwidgets_pub/ganeswidgets_api/inc/hggrid.h \
+ ../hgwidgets_pub/ganeswidgets_api/inc/hgmediawall.h \
inc/hgwidgets_p.h \
inc/hggrid_p.h \
inc/hgmediawall_p.h \
--- a/ganeswidgets/inc/hgcontainer.h Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/inc/hgcontainer.h Wed Oct 06 14:53:41 2010 +0300
@@ -67,9 +67,9 @@
void itemDataChanged(const QModelIndex &firstIndex, const QModelIndex &lastIndex);
- void addItems(int start, int end);
- void removeItems(int start, int end);
- void moveItems(int start, int end, int destination);
+ virtual void addItems(int start, int end);
+ virtual void removeItems(int start, int end);
+ virtual void moveItems(int start, int end, int destination);
bool getItemPoints(int index, QPolygonF& points);
@@ -94,6 +94,9 @@
qreal scrollPosition() const;
void setHandleLongPress(bool handleLongPress);
+
+ // Overrides the type of HbWidget
+ virtual int type() const;
signals:
@@ -225,6 +228,7 @@
bool mIgnoreGestureAction;
bool mHandleLongPress;
bool mEmitScrollingEnded;
+ bool mReflectionsEnabled;
};
#endif
--- a/ganeswidgets/inc/hggridcontainer.h Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/inc/hggridcontainer.h Wed Oct 06 14:53:41 2010 +0300
@@ -47,6 +47,9 @@
void setRowCount(int count, Qt::Orientation scrollDirection = Qt::Horizontal);
int rowCount(Qt::Orientation scrollDirection) const;
+ void setReflectionsEnabled(bool reflectionsEnabled);
+ bool reflectionsEnabled() const;
+
signals:
void emptySpacePressed();
@@ -75,6 +78,12 @@
void handlePinchEnd();
void handlePinchUpdate(HbPinchGesture* pinch);
+ void updateReflections(bool enable, int start, int end);
+
+ virtual void addItems(int start, int end);
+ virtual void removeItems(int start, int end);
+ virtual void moveItems(int start, int end, int destination);
+
public slots:
void effectFinished();
--- a/ganeswidgets/inc/hgimage.h Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/inc/hgimage.h Wed Oct 06 14:53:41 2010 +0300
@@ -29,12 +29,13 @@
virtual ~HgImage() {}
virtual void setAlpha(qreal alpha) { mAlpha = alpha; }
virtual qreal alpha() const { return mAlpha; }
- virtual void setImage(const QImage& image)=0;
- virtual void setPixmap(const QPixmap& pixmap)=0;
- virtual QImage getQImage() const=0;
- virtual void releaseImage()=0;
+ virtual void setPixmap(const QPixmap& pixmap, bool createMirror=false)=0;
+ virtual void updateMirror(bool enabled) = 0;
+ virtual void releaseImages()=0;
virtual int width() const = 0;
virtual int height() const = 0;
+ virtual void setMirrorPixmap(const QPixmap& pixmap) = 0;
+ virtual QPixmap pixmap() const = 0;
private:
qreal mAlpha;
};
--- a/ganeswidgets/inc/hgqtquadrenderer.h Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/inc/hgqtquadrenderer.h Wed Oct 06 14:53:41 2010 +0300
@@ -45,7 +45,7 @@
Qt::Orientation orientation,
const QTransform& sceneTransform);
virtual HgImage* createNativeImage();
- virtual void setDefaultImage(QImage defaultImage);
+ virtual void setDefaultImage(QPixmap defaultImage);
// new functions
HgQtImage* defaultImage();
--- a/ganeswidgets/inc/hgquad.h Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/inc/hgquad.h Wed Oct 06 14:53:41 2010 +0300
@@ -23,6 +23,8 @@
#include <QQuaternion>
#include <QVariant>
+static const qreal ReflectionHeight(0.5);
+
class HgImage;
/**
--- a/ganeswidgets/inc/hgquadrenderer.h Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/inc/hgquadrenderer.h Wed Oct 06 14:53:41 2010 +0300
@@ -19,7 +19,7 @@
#define HGQUADRENDERER_H
#include <QList>
-#include <QImage>
+#include <QPixmap>
#include <QVector2D>
class HgQuad;
@@ -96,7 +96,7 @@
/**
*
*/
- virtual void setDefaultImage(QImage defaultImage);
+ virtual void setDefaultImage(QPixmap defaultImage);
/**
*
@@ -111,7 +111,7 @@
/**
*
*/
- virtual QImage getDefaultImage() const;
+ virtual QPixmap defaultImage() const;
/**
*
@@ -128,7 +128,7 @@
QList<HgQuad*> mQuads;
qreal mMirroringPlaneY;
- QImage mDefaultImage;
+ QPixmap mDefaultImage;
QVector2D mTranslation;
bool mReflectionsEnabled;
};
--- a/ganeswidgets/inc/hgwidgetitem.h Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/inc/hgwidgetitem.h Wed Oct 06 14:53:41 2010 +0300
@@ -55,6 +55,8 @@
bool visibility() const;
void setVisibility(bool visible);
+ void enableReflection(bool enabled);
+
private:
QString mTitle;
@@ -64,7 +66,8 @@
HgImage* mHgImage;
HgQuadRenderer* mRenderer;
bool mVisibility;
-
+ bool mReflectionEnabled;
+
Q_DISABLE_COPY(HgWidgetItem)
};
--- a/ganeswidgets/sis/ganeswidgets.pkg Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/sis/ganeswidgets.pkg Wed Oct 06 14:53:41 2010 +0300
@@ -19,7 +19,7 @@
&EN
; standard SIS file header
-#{"GanesWidgets"},(0x10207C66),10,10,0, TYPE=SA, RU
+#{"GanesWidgets"},(0x10207C66),10,0,0, TYPE=SA, RU
;Localised Vendor name
%{"Nokia"}
--- a/ganeswidgets/src/hgcontainer.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/src/hgcontainer.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -65,7 +65,8 @@
mOrientation(Qt::Vertical),
mDelayedScrollToIndex(),
mIgnoreGestureAction(false),
- mHandleLongPress(false)
+ mHandleLongPress(false),
+ mReflectionsEnabled(false)
{
FUNC_LOG;
@@ -94,6 +95,12 @@
mItems.clear();
for (int i=0; i<itemCount; i++) {
HgWidgetItem* item = new HgWidgetItem(mQuadRenderer);
+
+ if ( mReflectionsEnabled && (mRenderer->coverflowModeEnabled() ||
+ (scrollDirection() == Qt::Horizontal))) {
+ // Reflection image is created only for bottom row in grid mode.
+ item->enableReflection((i+1)%currentRowCount() == 0);
+ }
mItems.append(item);
}
}
@@ -955,8 +962,11 @@
{
HgQuadRenderer *renderer = mRenderer->getRenderer();
if (renderer) {
- QImage scaled = defaultImage.scaled(mRenderer->getImageSize().toSize());
- renderer->setDefaultImage(scaled);
+ QImage temp = defaultImage;
+ if(!temp.isNull()) {
+ temp = defaultImage.scaled(mRenderer->getImageSize().toSize());
+ }
+ renderer->setDefaultImage(QPixmap::fromImage(temp));
}
}
@@ -1060,10 +1070,10 @@
if (!selectedPixmap.isNull() && !unselectedPixmap.isNull()) {
if (mMarkImageOn) {
- mMarkImageOn->setPixmap(selectedPixmap);
+ mMarkImageOn->setPixmap(selectedPixmap, true);
}
if (mMarkImageOff) {
- mMarkImageOff->setPixmap(unselectedPixmap);
+ mMarkImageOff->setPixmap(unselectedPixmap, true);
}
}
}
@@ -1121,8 +1131,15 @@
handled = false;
break;
}
-
+
return handled;
}
+// This is added to be able to get feedback (audio and tactile)
+// when tapping items in both mediawall and grid.
+int HgContainer::type() const
+{
+ return Hb::ItemType_GridViewItem;
+}
+
// EOF
--- a/ganeswidgets/src/hgcoverflowcontainer.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/src/hgcoverflowcontainer.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -18,6 +18,7 @@
#include <QGesture>
#include <QGraphicsSceneResizeEvent>
#include <QPainter>
+#include <HbWidgetFeedback>
#include "hgcoverflowcontainer.h"
#include "hgmediawallrenderer.h"
#include "hgwidgetitem.h"
@@ -230,13 +231,14 @@
void HgCoverflowContainer::enableReflections(bool enabled)
{
+ mReflectionsEnabled = enabled;
if (mRenderer)
mRenderer->enableReflections(enabled);
}
bool HgCoverflowContainer::reflectionsEnabled() const
{
- return mRenderer ? mRenderer->reflectionsEnabled() : false;
+ return mReflectionsEnabled;
}
void HgCoverflowContainer::setCenterItemArea(HgCenterItemArea *centerItemArea)
@@ -267,8 +269,9 @@
HgWidgetItem* hitItem = getItemAt(pos,hitItemIndex);
switch (state)
{
+
case Qt::GestureStarted:
- {
+ {
mIgnoreGestureAction = false;
if (mHandleLongPress && !mSpring.isActive()) {
@@ -282,7 +285,11 @@
break;
}
case Qt::GestureFinished:
+ {
+ // This enables tactile and audio feedback
+ HbWidgetFeedback::triggered(this, Hb::InstantPressed, 0);
handleGesture = handleTapAction(pos,hitItem,hitItemIndex);
+ }
case Qt::GestureUpdated:
case Qt::GestureCanceled:
default:
--- a/ganeswidgets/src/hggrid.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/src/hggrid.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -90,5 +90,17 @@
return d->container()->pinchLevels(scrollDirection);
}
+void HgGrid::setReflectionsEnabled(bool reflectionsEnabled)
+{
+ Q_D( HgGrid );
+ d->container()->setReflectionsEnabled(reflectionsEnabled);
+}
+
+bool HgGrid::reflectionsEnabled() const
+{
+ Q_D( const HgGrid );
+ return d->container()->reflectionsEnabled();
+}
+
// EOF
--- a/ganeswidgets/src/hggridcontainer.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/src/hggridcontainer.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -32,6 +32,7 @@
#include "hglongpressvisualizer.h"
#include <HbPinchGesture>
#include <QGraphicsSceneMouseEvent>
+#include <HbWidgetFeedback>
static const qreal KCameraMaxYAngle(20);
static const qreal KSpringVelocityToCameraYAngleFactor(2);
@@ -46,13 +47,13 @@
mTempRowCount(-1),
mPinchEndAlreadyHandled(false),
mReactToOnlyPanGestures(false),
- mHorizontalRowCount(3),
+ mHorizontalRowCount(2),
mVerticalColumnCount(3),
mHorizontalPinchLevels(QPair<int,int>(2,3)),
mVerticalPinchLevels(QPair<int,int>(2,5))
{
mUserItemSize = QSize(120,120);
- mUserItemSpacing = QSize(0,0);
+ mUserItemSpacing = QSize(1,1);
}
HgGridContainer::~HgGridContainer()
@@ -124,15 +125,13 @@
HgMediaWallRenderer* HgGridContainer::createRenderer(Qt::Orientation scrollDirection)
{
-
HgMediaWallRenderer* renderer = new HgMediaWallRenderer(this, scrollDirection, scrollDirection, false);
renderer->enableCoverflowMode(false);
renderer->setImageSize(mUserItemSize);
const int rowCount = scrollDirection == Qt::Horizontal ? mHorizontalRowCount : mVerticalColumnCount;
renderer->setRowCount(rowCount, renderer->getImageSize(), false);
- renderer->enableReflections(false);
+ renderer->enableReflections(mReflectionsEnabled && scrollDirection == Qt::Horizontal);
renderer->setSpacing(mUserItemSpacing);
- renderer->setFrontCoverElevationFactor(0.5);
return renderer;
}
@@ -157,7 +156,12 @@
{
Q_UNUSED(pos)
- if (mSelectionMode != HgWidget::NoSelection) {
+ if (!mIgnoreGestureAction) {
+ // This enables tactile and audio feedback
+ HbWidgetFeedback::triggered(this, Hb::InstantPressed, 0);
+ }
+
+ if (!mIgnoreGestureAction && mSelectionMode != HgWidget::NoSelection) {
return handleItemSelection(hitItem);
}
@@ -230,7 +234,7 @@
switch (state)
{
case Qt::GestureStarted:
- {
+ {
// TODO IS THIS IF REALLY NEEDED
if(mSpring.isActive()) {
qreal springPos = mSpring.pos().x();
@@ -363,6 +367,7 @@
QGesture* pinchGesture = event->gesture(Qt::PinchGesture);
if(mPinchEnabled && !mReactToOnlyPanGestures && pinchGesture)
{
+ mIgnoreGestureAction = true;
HbPinchGesture* pinch = static_cast<HbPinchGesture *>(pinchGesture);
switch (pinch->state())
{
@@ -376,6 +381,11 @@
iTargetRowCountList.clear();
mPinchingOngoing = true;
mPinchEndAlreadyHandled = false;
+ stopLongPressWatcher();
+ if (mSpring.isActive()) {
+ mSpring.cancel();
+ emit scrollingEnded();
+ }
break;
case Qt::GestureCanceled:
mPinchingOngoing = false;
@@ -512,13 +522,16 @@
if (iFadeAnimation.direction() == QAbstractAnimation::Forward) {
mRenderer->setRowCount(mTargetRowCount, mTargetImageSize);
mRenderer->setImageSize(mTargetImageSize);
-// mSpring.setDamping( mTargetRowCount != 3 ?
-// KSpringDampingScrolling*(mTargetRowCount-3)*4 : KSpringDampingScrolling );
-// mSpring.setK( mTargetRowCount != 3 ?
-// KSpringKScrolling/((mTargetRowCount-3)*4) : KSpringKScrolling );
scrollTo(mSelectionModel->currentIndex());
iFadeAnimation.setDirection(QAbstractAnimation::Backward);
- iFadeAnimation.start();
+ iFadeAnimation.start();
+
+ // Reflections are drawn only in horizontal scrolling mode.
+ const bool reflectionsEnabled = mReflectionsEnabled &&
+ scrollDirection() == Qt::Horizontal;
+ // reflections need to be recreated since row count changes.
+ // reflections are created only to the bottom row.
+ updateReflections(reflectionsEnabled,0,mItems.count());
}
}
@@ -538,23 +551,23 @@
void HgGridContainer::setOrientation(Qt::Orientation orientation, bool animate)
{
- HgContainer::setOrientation(orientation, animate);
+ const int newRowCount = orientation == Qt::Horizontal ?
+ mHorizontalRowCount : mVerticalColumnCount;
+ const bool rowCountChanges = currentRowCount() != newRowCount;
- if (orientation == Qt::Horizontal) {
- mRenderer->enableReflections(false);
- mRenderer->setImageSize(mUserItemSize);
- if (currentRowCount() != mHorizontalRowCount) {
- mRenderer->setRowCount(mHorizontalRowCount, mUserItemSize, false);
- scrollTo(mSelectionModel->currentIndex());
- }
- } else {
- mRenderer->enableReflections(false);
- mRenderer->setImageSize(mUserItemSize);
- if (currentRowCount() != mVerticalColumnCount) {
- mRenderer->setRowCount(mVerticalColumnCount, mUserItemSize, false);
- scrollTo(mSelectionModel->currentIndex());
- }
+ // Disable orientation change animation if the row count also changes.
+ HgContainer::setOrientation(orientation, animate && !rowCountChanges);
+
+ mRenderer->setImageSize(mUserItemSize);
+ if (rowCountChanges) {
+ mRenderer->setRowCount(newRowCount, mUserItemSize, false);
+ scrollTo(mSelectionModel->currentIndex());
}
+
+ // Reflections are drawn only in horizontal scrolling mode.
+ const bool reflectionsEnabled = mReflectionsEnabled && orientation == Qt::Horizontal;
+ mRenderer->enableReflections(reflectionsEnabled);
+ updateReflections(reflectionsEnabled,0,mItems.count());
}
void HgGridContainer::setPinchLevels(QPair<int,int> levels, Qt::Orientation scrollDirection)
@@ -572,4 +585,50 @@
mHorizontalPinchLevels : mVerticalPinchLevels;
}
+void HgGridContainer::setReflectionsEnabled(bool reflectionsEnabled)
+{
+ mReflectionsEnabled = reflectionsEnabled;
+ mRenderer->enableReflections(reflectionsEnabled);
+}
+
+bool HgGridContainer::reflectionsEnabled() const
+{
+ return mReflectionsEnabled;
+}
+
+void HgGridContainer::updateReflections(bool enable, int start, int end)
+{
+ int first = qBound(0, start, mItems.count()-1);
+ int last = qBound(0, end, mItems.count()-1);
+ const int rowCount = currentRowCount();
+ for(;first<=last; first++){
+ HgWidgetItem* item = mItems.at(first);
+ item->enableReflection(enable && ((first+1)%rowCount == 0));
+ }
+}
+
+void HgGridContainer::addItems(int start, int end)
+{
+ HgContainer::addItems(start, end);
+ if (mReflectionsEnabled && scrollDirection() == Qt::Horizontal) {
+ updateReflections(true,start,mItems.count());
+ }
+}
+
+void HgGridContainer::removeItems(int start, int end)
+{
+ HgContainer::removeItems(start,end);
+ if (mReflectionsEnabled && scrollDirection() == Qt::Horizontal) {
+ updateReflections(true,start,mItems.count());
+ }
+}
+
+void HgGridContainer::moveItems(int start, int end, int destination)
+{
+ HgContainer::moveItems(start,end,destination);
+ if (mReflectionsEnabled && scrollDirection() == Qt::Horizontal) {
+ updateReflections(true,start,destination+(end-start));
+ }
+}
+
// End of file
--- a/ganeswidgets/src/hgmediawallrenderer.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/src/hgmediawallrenderer.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -584,13 +584,20 @@
mProjMatrix = proj;
qreal mirrorPlaneY;
+
+ // with factor 0.375 mirroring plane moves to correct pos. In grid we want to draw
+ // the reflections little below the bottom row. This value needs to be changed
+ // if reflection's height factor changes, so this in not really robust. Currently
+ // reflection's height is half from the image height.
+ const qreal factor(0.375);
if (mCoverflowMode)
{
- mirrorPlaneY = -mImageSize3D.height()/2;
+ mirrorPlaneY = -mImageSize3D.height()*factor;
}
else // grid
{
- mirrorPlaneY = getRowPosY(mRowCount-1)-mImageSize3D.height()/2;
+ // we want to add some space between the bottom row and the reflection.
+ mirrorPlaneY = getRowPosY(mRowCount-1)-mImageSize3D.height()*(factor+0.025);
}
mRenderer->setMirroringPlaneY(mirrorPlaneY);
--- a/ganeswidgets/src/hgqtquadrenderer.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/src/hgqtquadrenderer.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -40,106 +40,74 @@
{
}
- int width() const
- {
+ int width() const {
return mPixmap.width();
}
- int height() const
- {
+ int height() const {
return mPixmap.height();
}
- int mirrorImageWidth() const
- {
- return width();
+ int mirrorPixmapWidth() const {
+ return mMirrorPixmap.width();
}
- int mirrorImageHeight() const
- {
- return height();
- }
-
- void setImage(const QImage& image)
- {
- mPixmap = QPixmap::fromImage(image);
- //mMirrorPixmap = QPixmap();
+ int mirrorPixmapHeight() const {
+ return mMirrorPixmap.height();
}
- void setPixmap(const QPixmap& pixmap)
- {
- mPixmap = pixmap;
- //mMirrorPixmap = QPixmap();
+ void setPixmap(const QPixmap& pixmap, bool createMirror) {
+ mPixmap = pixmap;
+ if (createMirror) {
+ createMirrorPixmap(mPixmap);
+ } else {
+ mMirrorPixmap = QPixmap();
+ }
}
- void releaseImage()
- {
- //mPixmap = QPixmap();
- //mMirrorPixmap = QPixmap();
+ void releaseImages() {
+ mPixmap = QPixmap();
+ mMirrorPixmap = QPixmap();
}
-
- QImage getQImage() const
- {
- return mPixmap.toImage();
- }
-
- const QPixmap& pixmap() const
- {
+
+ QPixmap pixmap() const {
return mPixmap;
}
- const QPixmap& mirrorPixmap(QPainter* painter)
- {
- Q_UNUSED(painter)
-
- return mPixmap;
-/*
- if (mPixmap.isNull())
- return mPixmap;
-
- if (mMirrorPixmap.isNull())
- {
- QImage img = mPixmap.toImage();
- QImage mirrorImage = img.scaled(QSize(img.width()/3,img.height()/3)).convertToFormat(QImage::Format_ARGB32);
-
- // apply gradient to alpha channel so that mirror image looks like
- // it fades under the floor
- for (int i = 0; i < mirrorImage.height(); i++)
- {
- qreal t = qreal(i) / qreal(mirrorImage.height());
- int a = (int)(t * 255.0);
- uchar* scanline = mirrorImage.scanLine(i);
- for (int j = 0; j < mirrorImage.width(); j++)
- {
- scanline[j*4+0] /= 3;
- scanline[j*4+1] /= 3;
- scanline[j*4+2] /= 3;
- scanline[j*4+3] = 255;
- }
- }
-
- mMirrorPixmap = QPixmap::fromImage(mirrorImage);
-
- QPaintDevice* device = painter->device();
- painter->end();
-
- mMirrorPixmap = mPixmap.scaled(100,100);
- int w = mMirrorPixmap.width();
- int h = mMirrorPixmap.height();
- //QPainter p;
- painter->begin(&mMirrorPixmap);
- painter->fillRect(0,0,w, h, QColor::fromRgbF(0, 0, 0, 0.5f));
- painter->end();
-
- painter->begin(device);
-
- }
-
-
- return mMirrorPixmap;*/
+ QPixmap mirrorPixmap() {
+ return mMirrorPixmap;
}
+ void setMirrorPixmap(const QPixmap& mirrorPixmap) {
+ mMirrorPixmap = mirrorPixmap;
+ }
+
+ void createMirrorPixmap(const QPixmap& source) {
+ if (!source.isNull()) {
+ mMirrorPixmap = source.copy(QRect(0,source.height()*ReflectionHeight,source.width(),source.height()));
+ QPainter painter(&mMirrorPixmap);
+ painter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
+ QLinearGradient gradient(0.5,0.0,0.5,1);
+ gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ gradient.setColorAt(1, QColor::fromRgb(0,0,0,128));
+ gradient.setColorAt(0, QColor::fromRgb(0,0,0,0));
+ QBrush brush(gradient);
+ painter.setBrush(brush);
+ painter.setPen(Qt::NoPen);
+ painter.drawRect(mMirrorPixmap.rect());
+ }
+ }
+
+ void updateMirror(bool enabled) {
+ if (enabled && !mPixmap.isNull() && mMirrorPixmap.isNull()) {
+ createMirrorPixmap(mPixmap);
+ } else if(!enabled) {
+ mMirrorPixmap = QPixmap();
+ }
+ }
+
QPixmap mPixmap;
+ QPixmap mMirrorPixmap;
};
class HgQtQuad : public HgTransformedQuad
@@ -198,14 +166,17 @@
void drawImage(QPainter* painter, HgQtImage* image, const QRectF& rect, const QTransform& transform)
{
- const QPixmap& pixmap = image->pixmap();
+ QPixmap pixmap = image->pixmap();
if (pixmap.isNull())
return;
+
const QVector2D* points = mTransformedPoints;
- if (mRenderer->isReflection() && quad()->mirrorImageEnabled())
+ if (mRenderer->isReflection() && quad()->mirrorImageEnabled()) {
points = mMirroredPoints;
+ pixmap = image->mirrorPixmap();
+ }
QPolygonF poly;
poly << points[0].toPointF();
@@ -217,9 +188,10 @@
return;
}
- computeWarpMatrix(mTransform, image->width(), image->height(), points);
+ computeWarpMatrix(mTransform, pixmap.width(), pixmap.height(), points);
painter->setTransform(mTransform * transform);
+
painter->drawPixmap(QPointF(0,0), pixmap);
}
@@ -235,9 +207,9 @@
{
// initialize base class to the end.
init(maxQuads);
- QImage image(QSize(200,200), QImage::Format_RGB16);
+ QImage image(QSize(250,250), QImage::QImage::Format_ARGB32_Premultiplied);
image.fill(0xFFFFFFFF);
- setDefaultImage(image);
+ setDefaultImage(QPixmap::fromImage(image));
QPixmapCache::setCacheLimit(2048);
}
@@ -289,7 +261,7 @@
return mDefaultQtImage;
}
-void HgQtQuadRenderer::setDefaultImage(QImage defaultImage)
+void HgQtQuadRenderer::setDefaultImage(QPixmap defaultImage)
{
HgQuadRenderer::setDefaultImage(defaultImage);
@@ -297,8 +269,7 @@
mDefaultQtImage = 0;
mDefaultQtImage = static_cast<HgQtImage*>(createNativeImage());
- mDefaultQtImage->setImage(mDefaultImage);
-
+ mDefaultQtImage->setPixmap(mDefaultImage, true);
}
HgTransformedQuad* HgQtQuadRenderer::createNativeQuad()
@@ -313,9 +284,7 @@
void HgQtQuadRenderer::drawFloor(QPainter* painter, const QRectF& rect)
{
- QRectF floorRect(0, rect.height()/2, rect.width(), rect.height()/2);
- QBrush brush(QColor::fromRgbF(0,0,0,0.5f));
- painter->setBrush(brush);
- painter->drawRect(floorRect);
+ Q_UNUSED(painter);
+ Q_UNUSED(rect);
}
--- a/ganeswidgets/src/hgquadrenderer.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/src/hgquadrenderer.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -49,7 +49,7 @@
mMirroringPlaneY = mirroringPlaneY;
}
-void HgQuadRenderer::setDefaultImage(QImage defaultImage)
+void HgQuadRenderer::setDefaultImage(QPixmap defaultImage)
{
mDefaultImage = defaultImage;
}
@@ -70,7 +70,7 @@
return NULL;
}
-QImage HgQuadRenderer::getDefaultImage() const
+QPixmap HgQuadRenderer::defaultImage() const
{
return mDefaultImage;
}
--- a/ganeswidgets/src/hgtransformedquad.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/src/hgtransformedquad.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -106,16 +106,17 @@
QMatrix4x4 mirror = trans;
+ QVector2D temp = quad->scale();
qreal distToPlane = qAbs(quad->position().y() - mirroringPlaneY);
- mirror.translate(quad->position().x(), mirroringPlaneY - distToPlane/1, quad->position().z());
- mirror.scale(quad->scale().x(), -quad->scale().y()/1);
+ mirror.translate(quad->position().x(), mirroringPlaneY - distToPlane, quad->position().z());
+ mirror.scale(quad->scale().x(), -temp.y()*ReflectionHeight);
mirror.rotate(quad->rotation());
QMatrix4x4 modelViewProjMatrix = projView * mirror;
perspectiveTransformPoints(mMirroredPoints, modelViewProjMatrix, center, windowSize);
-
+
for (int i = 0; i < 4; i++)
mMirroredPoints[i] += translate;
--- a/ganeswidgets/src/hgwidgetitem.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/src/hgwidgetitem.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -28,7 +28,8 @@
mDescription(""),
mValidData(false),
mHgImage(NULL),
-mRenderer(renderer)
+mRenderer(renderer),
+mReflectionEnabled(false)
{
}
@@ -53,16 +54,7 @@
void HgWidgetItem::setImage(const QImage &image)
{
- if (!mHgImage)
- {
- mHgImage = mRenderer->createNativeImage();
- }
-
- mHgImage->setImage(image);
-
- if (!mVisibility)
- mHgImage->setAlpha(0);
-
+ setPixmap(QPixmap::fromImage(image));
}
void HgWidgetItem::setPixmap(const QPixmap &pixmap)
@@ -72,13 +64,22 @@
mHgImage = mRenderer->createNativeImage();
}
- mHgImage->setPixmap(pixmap);
-
+ mHgImage->setPixmap(pixmap,mReflectionEnabled);
+
if (!mVisibility)
mHgImage->setAlpha(0);
}
+void HgWidgetItem::enableReflection(bool enabled)
+{
+ if (mReflectionEnabled != enabled ) {
+ mReflectionEnabled = enabled;
+ if (mHgImage) {
+ mHgImage->updateMirror(enabled);
+ }
+ }
+}
void HgWidgetItem::setTitle( QString title )
{
@@ -209,7 +210,7 @@
mDescription = "";
mValidData = false;
if (mHgImage)
- mHgImage->releaseImage();
+ mHgImage->releaseImages();
delete mHgImage;
mHgImage = 0;
--- a/hgcacheproxymodel/hgcacheproxymodel.pro Fri Sep 17 15:55:58 2010 +0300
+++ b/hgcacheproxymodel/hgcacheproxymodel.pro Wed Oct 06 14:53:41 2010 +0300
@@ -33,8 +33,8 @@
# Input
HEADERS += \
- ../hgwidgets_plat/hgcacheproxymodel_api/inc/hgcacheproxymodel.h \
- ../hgwidgets_plat/hgcacheproxymodel_api/inc/hgdataprovidermodel.h \
+ ../hgwidgets_pub/hgcacheproxymodel_api/inc/hgcacheproxymodel.h \
+ ../hgwidgets_pub/hgcacheproxymodel_api/inc/hgdataprovidermodel.h \
inc/hgbuffermanager.h \
inc/hglogger.h
--- a/hgcacheproxymodel/inc/hgbuffermanager.h Fri Sep 17 15:55:58 2010 +0300
+++ b/hgcacheproxymodel/inc/hgbuffermanager.h Wed Oct 06 14:53:41 2010 +0300
@@ -40,6 +40,7 @@
void removedItem(int pos);
void aboutToInsertItem(int pos);
void insertedItem(int pos);
+ bool isCached(int idx) const;
private:
void calculate();
--- a/hgcacheproxymodel/src/hgbuffermanager.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/hgcacheproxymodel/src/hgbuffermanager.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -317,4 +317,8 @@
}
}
+bool HgBufferManager::isCached(int idx) const
+{
+ return ((idx>=mBufferPosition) && (idx<mBufferPosition+mBufferSize));
+}
//eof
--- a/hgcacheproxymodel/src/hgcacheproxymodel.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/hgcacheproxymodel/src/hgcacheproxymodel.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -707,4 +707,13 @@
}
}
+bool HgCacheProxyModel::isCached(int idx) const
+{
+ bool res = false;
+ if (mBufferManager) {
+ res = mBufferManager->isCached(mapFromDataProviderIndex(idx));
+ }
+ return res;
+}
+
//eof
--- a/hgcacheproxymodel/src/hgdataprovidermodel.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/hgcacheproxymodel/src/hgdataprovidermodel.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -457,4 +457,9 @@
return res;
}
+bool HgDataProviderModel::isCached(int idx) const
+{
+ return mObserver->isCached(idx);
+}
+
//eof
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/hgcacheproxymodeltestapp.css Wed Oct 06 14:53:41 2010 +0300
@@ -0,0 +1,39 @@
+/*
+hgcacheproxymodeltestapp_list-1 from widgetml is not working.
+*/
+/*
+HbListViewItem[layoutName="hgcacheproxymodeltestapp_list"]{
+ layout:hgcacheproxymodeltestapp_list-1;
+}
+*/
+HbListViewItem::text-1[layoutName="hgcacheproxymodeltestapp_list"]{
+ text-height: var(hb-param-text-height-primary);
+ font-variant: primary;
+ text-align: Right;
+ text-line-count-min:1;
+ text-line-count-max:2;
+ fixed-height: 57px;
+}
+
+HbListViewItem::icon-1[layoutName="hgcacheproxymodeltestapp_list"]{
+ fixed-height: 57px;
+ fixed-width: 57px;
+}
+/*
+HbGridViewItem[layoutName="hgcacheproxymodeltestapp_grid"]{
+ layout:hgcacheproxymodeltestapp_grid-1;
+}
+
+HbGridViewItem::text-1[layoutName="hgcacheproxymodeltestapp_grid"]{
+ text-height: var(hb-param-text-height-primary);
+ font-variant: primary;
+ text-align: Right;
+ text-line-count-min:1;
+ text-line-count-max:2;
+}
+*/
+
+HbGridViewItem::icon-1[layoutName="hgcacheproxymodeltestapp_grid"]{
+ fixed-height: 57px;
+ fixed-width: 57px;
+}
\ No newline at end of file
--- a/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/hgcacheproxymodeltestapp.qrc Fri Sep 17 15:55:58 2010 +0300
+++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/hgcacheproxymodeltestapp.qrc Wed Oct 06 14:53:41 2010 +0300
@@ -1,6 +1,11 @@
<RCC>
- <qresource prefix="/icons" >
+ <qresource prefix="/icons">
<file>default.png</file>
<file>noIcon.png</file>
</qresource>
+ <qresource prefix="/layout">
+ <file>hgcacheproxymodeltestapp.css</file>
+ <file>hgcacheproxymodeltestapp.widgetml</file>
+ </qresource>
+
</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/hgcacheproxymodeltestapp.widgetml Wed Oct 06 14:53:41 2010 +0300
@@ -0,0 +1,18 @@
+<hbwidget version="0.1" type="HbListViewItem">
+ <layout name="hgcacheproxymodeltestapp_list-1" type="mesh">
+ <meshitem src="text-1" srcEdge="TOP" dst="" dstEdge="TOP"/>
+ <meshitem src="text-1" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
+ <meshitem src="text-1" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
+ <meshitem src="text-1" srcEdge="RIGHT" dst="icon-1" dstEdge="LEFT"/>
+
+ <meshitem src="icon-1" srcEdge="TOP" dst="" dstEdge="TOP"/>
+ <meshitem src="icon-1" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
+ <meshitem src="icon-1" srcEdge="LEFT" dst="text-1" dstEdge="RIGHT"/>
+ <meshitem src="icon-1" srcEdge="RIGHT" dst="" dstEdge="RIGHT"/>
+
+ <meshitem src="text-2" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
+ <meshitem src="text-3" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
+ <meshitem src="icon-2" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
+ </layout>
+</hbwidget>
+
--- a/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mydataprovider.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mydataprovider.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -26,7 +26,6 @@
MyDataProvider::MyDataProvider(QObject *parent) :
HgDataProviderModel(parent),
-mDefaultIcon(QIcon(QPixmap(":/icons/default.png"))),
mScheduler(new CActiveSchedulerWait()),
mWrapper( new ThumbnailManager() ),
mThumbnailRequestPending(false),
@@ -34,11 +33,21 @@
mThumbnailRequestID(-1),
mThumbnailsize(ThumbnailManager::ThumbnailMedium),
mMDSLoadInProgress(false),
-mMode(0),
-mNoIcon(QIcon(QPixmap(":/icons/noIcon.png")))
+mMode(0)
{
// TX_ENTRY
Q_UNUSED(parent);
+ QPixmap defaultPixmap(":/icons/default.png");
+ mDefaultIcon.insert(HgDataProviderIconHbIcon, HbIcon(":/icons/default.png"));
+ mDefaultIcon.insert(HgDataProviderIconQIcon, QIcon(defaultPixmap));
+ mDefaultIcon.insert(HgDataProviderIconQImage, defaultPixmap.toImage());
+ mDefaultIcon.insert(HgDataProviderIconQPixmap, defaultPixmap);
+
+ QPixmap noIconPixmap(":/icons/noIcon.png");
+ mNoIcon.insert(HgDataProviderIconHbIcon, HbIcon(":/icons/noIcon.png"));
+ mNoIcon.insert(HgDataProviderIconQIcon, QIcon(noIconPixmap));
+ mNoIcon.insert(HgDataProviderIconQImage, noIconPixmap.toImage());
+ mNoIcon.insert(HgDataProviderIconQPixmap, noIconPixmap);
mWrapper->setThumbnailSize( mThumbnailsize );
mWrapper->setQualityPreference( ThumbnailManager::OptimizeForPerformance );
@@ -108,7 +117,7 @@
mThumbnailRequestIndex = i;
mThumbnailRequestPending = true;
} else {
- updateIcon(i, mNoIcon, true);
+ updateIcon(i, mNoIcon[iconMode()], true);
getNextThumbnail();
}
}
@@ -124,14 +133,13 @@
{
// TX_ENTRY
Q_UNUSED(id);
+ int idx = reinterpret_cast<int>(data);
if (!error && pixmap.rect().height()>0 && pixmap.rect().width()>0 ) {
- int idx = reinterpret_cast<int>(data);
TX_LOG_ARGS(QString("thumbnailReady idx = %0").arg(idx));
-// updateIcon(idx, HbIcon( QIcon( pixmap ) ) );
-// update(idx, HbIcon( QIcon( pixmap ) ), Qt::DecorationRole, false);
updateIcon(idx, createIcon(idx, pixmap));
} else {
- TX_LOG_ARGS(QString("error:%0 id:%0").arg(error).arg(id));
+ updateIcon(idx, mNoIcon[iconMode()], true);
+ TX_LOG_ARGS(QString("error:%0 id:%0").arg(error).arg(idx));
}
mThumbnailRequestIndex = -1;
mThumbnailRequestID = -1;
@@ -167,7 +175,8 @@
QVariant MyDataProvider::defaultIcon() const
{
- return mDefaultIcon;
+ MyDataProvider* me = const_cast<MyDataProvider*>(this);
+ return mDefaultIcon[me->iconMode()];
}
void MyDataProvider::HandleSessionOpened(CMdESession& aSession, TInt aError)
--- a/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mydataprovider.h Fri Sep 17 15:55:58 2010 +0300
+++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mydataprovider.h Wed Oct 06 14:53:41 2010 +0300
@@ -19,15 +19,15 @@
#define MYDATAPROVIDER2_H
#include <QtGui>
-
-#include <thumbnailmanager_qt.h>
-#include <hgwidgets/hgdataprovidermodel.h>
-#include <HbIcon>
#include <QList>
#include <QPair>
+#include <QMap>
+#include <HbIcon>
+#include <hgwidgets/hgdataprovidermodel.h>
#include <mdesession.h>
#include <mdequery.h>
#include "flogger.h"
+#include <thumbnailmanager_qt.h>
class CMdESession;
class CActiveSchedulerWait;
@@ -69,7 +69,9 @@
void testInsertItem(int pos, QList< QPair< QVariant, int > >* data);
private:
- QVariant mDefaultIcon;
+ QMap<HgDataProviderIconMode, QVariant> mDefaultIcon;
+ QMap<HgDataProviderIconMode, QVariant> mNoIcon;
+
CActiveSchedulerWait* mScheduler;
ThumbnailManager* mWrapper;
QList<int> mWaitingThumbnails;
@@ -79,7 +81,6 @@
ThumbnailManager::ThumbnailSize mThumbnailsize;
bool mMDSLoadInProgress;
int mMode;
- HbIcon mNoIcon;
};
#endif // MYDATAPROVIDER2_H
--- a/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mywindow.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mywindow.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -16,11 +16,6 @@
* Version : %version: 8 %
*/
#include "mywindow.h"
-#include <HbMenu>
-#include <HbAction>
-#include <HbMainWindow>
-#include <HbSlider>
-#include <HbScrollBar>
#include <QTimer>
#include <QtGui>
#include <QDebug>
@@ -28,10 +23,16 @@
#include <QApplication>
#include <QGraphicsLinearLayout>
#include <QCoreApplication>
+#include <QFileSystemWatcher>
#include <HbGridView>
#include <HbInstance>
#include <HbInputDialog>
-#include <QFileSystemWatcher>
+#include <HbMenu>
+#include <HbAction>
+#include <HbMainWindow>
+#include <HbSlider>
+#include <HbScrollBar>
+#include <hbstyleloader.h>
#include <hgwidgets/hgcacheproxymodel.h>
#include <hgwidgets/hgmediawall.h>
#include <hgwidgets/hggrid.h>
@@ -47,6 +48,8 @@
const int KScrollTo546 = 6;
const int KScrollTo875 = 7;
const int KScrollToEnd = 8;
+const int KToogleStyle = 9;
+const int KToogleFriction = 10;
const int KSort1Command = 1101;
const int KSort2Command = 1102;
@@ -86,6 +89,7 @@
const int KResetCommand = 10000;
+
MyWindow::MyWindow()
: HbMainWindow(),
mCurrentWidget(0),
@@ -100,7 +104,9 @@
mFilterTestTimer(new QTimer(this)),
mFilterTestVal(-1),
mResetTestTimer(new QTimer(this)),
- mResetTestVal(-1)
+ mResetTestVal(-1),
+ mUseStyles(false),
+ mEnableFriction(true)
{
mMainView = new HbView();
addView( mMainView );
@@ -116,7 +122,7 @@
connect(mResetTestTimer, SIGNAL(timeout()), this, SLOT(resetTestTimeout()));
HbAction action;
- action.setData ( QVariant(KListViewCommand) ); //select Grid
+ action.setData ( QVariant(KListViewCommand) ); //select List
processAction(&action);
}
@@ -171,6 +177,11 @@
action = viewSubMenu->addAction("Scroll to bottom");
action->setData(QVariant(KScrollToEnd));
+ action = viewSubMenu->addAction("Enable styles usage");
+ action->setData(QVariant(KToogleStyle));
+ action = viewSubMenu->addAction("Disable friction");
+ action->setData(QVariant(KToogleFriction));
+
}
void MyWindow::addCacheProxyModelMenu(HbMenu* parent)
@@ -277,11 +288,16 @@
switch (command){
case KGridViewCommand : {
mMainView->setWidget( NULL ); //this will delete old Widget
+ mGridWidget = NULL;
+ mListWidget = NULL;
+ mMediaWallWidget = NULL;
+ mHgGridWidget = NULL;
mGridWidget = new HbGridView();
+ if (mUseStyles) mGridWidget->setLayoutName( "hgcacheproxymodeltestapp_grid" );
if ( orientation() == Qt::Horizontal ) {
mGridWidget->setColumnCount( 5 );
mGridWidget->setRowCount( 3 );
- }else {
+ } else {
mGridWidget->setColumnCount( 3 );
mGridWidget->setRowCount( 5 );
}
@@ -289,6 +305,7 @@
mGridWidget->setItemRecycling( true );
mGridWidget->verticalScrollBar()->setInteractive(true);
mGridWidget->verticalScrollBar()->setVisible(true);
+ mGridWidget->setFrictionEnabled(mEnableFriction);
mMainView->setWidget( mGridWidget );
mGridWidget->setModel(mModel);
mCurrentWidget = mGridWidget;
@@ -296,11 +313,17 @@
}
case KListViewCommand : {
mMainView->setWidget( NULL ); //this will delete old Widget
+ mGridWidget = NULL;
+ mListWidget = NULL;
+ mMediaWallWidget = NULL;
+ mHgGridWidget = NULL;
mListWidget = new HbListView();
+ if (mUseStyles) mListWidget->setLayoutName( "hgcacheproxymodeltestapp_list" );
mListWidget->setUniformItemSizes( true );
mListWidget->setItemRecycling( true );
mListWidget->verticalScrollBar()->setInteractive(true);
mListWidget->verticalScrollBar()->setVisible(true);
+ mListWidget->setFrictionEnabled(mEnableFriction);
mMainView->setWidget( mListWidget );
mListWidget->setModel(mModel);
mCurrentWidget = mListWidget;
@@ -308,6 +331,10 @@
}
case KMediaWallViewCommand : {
mMainView->setWidget( NULL ); //this will delete old Widget
+ mGridWidget = NULL;
+ mListWidget = NULL;
+ mMediaWallWidget = NULL;
+ mHgGridWidget = NULL;
mMediaWallWidget = new HgMediawall();
mMediaWallWidget->scrollBar()->setInteractive(true);
mMediaWallWidget->scrollBar()->setVisible(true);
@@ -318,6 +345,10 @@
}
case KHgGridViewCommand : {
mMainView->setWidget( NULL ); //this will delete old Widget
+ mGridWidget = NULL;
+ mListWidget = NULL;
+ mMediaWallWidget = NULL;
+ mHgGridWidget = NULL;
mHgGridWidget = new HgGrid(orientation());
connect(this, SIGNAL(orientationChanged(Qt::Orientation)), mHgGridWidget, SLOT(orientationChanged(Qt::Orientation)));
mHgGridWidget->scrollBar()->setInteractive(true);
@@ -343,6 +374,66 @@
scrollTo(mMyDataProvider->rowCount()-1);
break;
}
+ case KToogleStyle : {
+ bool oldVal = mUseStyles;
+ if ( !mUseStyles ) {
+ bool widgetmlLoaded = HbStyleLoader::registerFilePath("f:/hgcacheproxymodeltestapp.widgetml");
+ if (!widgetmlLoaded) {
+ widgetmlLoaded = HbStyleLoader::registerFilePath(":/layout/hgcacheproxymodeltestapp.widgetml");
+ }
+ bool cssLoaded = HbStyleLoader::registerFilePath("f:/hgcacheproxymodeltestapp.css");
+ if (!cssLoaded) {
+ cssLoaded = HbStyleLoader::registerFilePath(":/layout/hgcacheproxymodeltestapp.css");
+ }
+ if (widgetmlLoaded && cssLoaded) {
+ mUseStyles = true;
+ } else { //unload all, no layout files
+ HbStyleLoader::unregisterFilePath("f:/hgcacheproxymodeltestapp.widgetml");
+ HbStyleLoader::unregisterFilePath("f:/hgcacheproxymodeltestapp.css");
+ HbStyleLoader::unregisterFilePath(":/layout/hgcacheproxymodeltestapp.widgetml");
+ HbStyleLoader::unregisterFilePath(":/layout/hgcacheproxymodeltestapp.css");
+ mUseStyles = false;
+ }
+ } else {
+ HbStyleLoader::unregisterFilePath("f:/hgcacheproxymodeltestapp.widgetml");
+ HbStyleLoader::unregisterFilePath("f:/hgcacheproxymodeltestapp.css");
+ HbStyleLoader::unregisterFilePath(":/layout/hgcacheproxymodeltestapp.widgetml");
+ HbStyleLoader::unregisterFilePath(":/layout/hgcacheproxymodeltestapp.css");
+ mUseStyles = false;
+ }
+
+ if (oldVal != mUseStyles){
+ if (mUseStyles) {
+ action->setText("Disable styles usage");
+ } else {
+ action->setText("Enable styles usage");
+ }
+
+ HbAction newAction;
+ if (mGridWidget) {
+ newAction.setData ( QVariant(KGridViewCommand) ); //select hbgrid
+ } else if (mListWidget) {
+ newAction.setData ( QVariant(KListViewCommand) ); //select hblist
+ } else {
+ newAction.setData ( QVariant());
+ }
+ if (newAction.data().isValid()) processAction(&newAction); //don't change view for mediawall and hggrid
+ }
+ break;
+ }
+ case KToogleFriction : {
+ mEnableFriction = !mEnableFriction;
+ if (mGridWidget) mGridWidget->setFrictionEnabled(mEnableFriction);
+ if (mListWidget) mListWidget->setFrictionEnabled(mEnableFriction);
+
+ if (mEnableFriction) {
+ action->setText("Disable friction");
+ } else {
+ action->setText("Enable friction");
+ }
+
+ break;
+ }
case KSort1Command : {
mModel->setSortRole(Qt::UserRole+2);
mModel->sort(0);
--- a/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mywindow.h Fri Sep 17 15:55:58 2010 +0300
+++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mywindow.h Wed Oct 06 14:53:41 2010 +0300
@@ -61,10 +61,11 @@
private:
HbMenu *createMainMenu();
-
void addChangeViewMenu(HbMenu* parent);
void addCacheProxyModelMenu(HbMenu* parent);
void addDataProviderMenu(HbMenu* parent);
+
+
void scrollTo(int pos);
private:
@@ -87,7 +88,9 @@
QTimer *mResetTestTimer;
int mResetTestVal;
-
+
+ bool mUseStyles;
+ bool mEnableFriction;
};
#endif // CONTENTWIDGET_H
--- a/hgcacheproxymodel/tsrc/unit/dataproviderhelper.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/hgcacheproxymodel/tsrc/unit/dataproviderhelper.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -372,6 +372,11 @@
mObserverDataUpdated.append(p);
}
+bool DataProviderHelper::isCached(int idx) const
+{
+ return HgDataProviderModel::isCached(idx);
+}
+
void DataProviderHelper::slotDataUpdated(QModelIndex from,QModelIndex to)
{
QPair< int, int > p;
--- a/hgcacheproxymodel/tsrc/unit/dataproviderhelper.h Fri Sep 17 15:55:58 2010 +0300
+++ b/hgcacheproxymodel/tsrc/unit/dataproviderhelper.h Wed Oct 06 14:53:41 2010 +0300
@@ -93,7 +93,8 @@
//from HgDataProviderModelObserver
public:
virtual void dataUpdated(int from, int to);
-
+ virtual bool isCached(int idx) const;
+
private slots:
void slotDataUpdated(QModelIndex,QModelIndex);
void slotRowsAboutToBeInserted(QModelIndex,int,int);
--- a/hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.cpp Fri Sep 17 15:55:58 2010 +0300
+++ b/hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.cpp Wed Oct 06 14:53:41 2010 +0300
@@ -1414,6 +1414,81 @@
}
+void TestCacheProxy::testCP_IsCached()
+{
+ cp = new HgCacheProxyModel();
+ dph = new DataProviderHelper(1000);
+ cp->setDataProvider(dph);
+
+ QModelIndex idx = cp->index(0, 0);
+ QVariant res = cp->data(idx, Qt::DisplayRole); //this will move buffer to 0-119
+ int begin = 0;
+ int end = 120;
+ int size = dph->getCount();
+ for (int i=0; i<size; i++){
+ QVERIFY2((dph->isCached(i))==((i>=begin)&& (i<end)), QString("begin:%1 end:%2 size:%3 i:%4").arg(begin).arg(end).arg(size).arg(i).toLatin1().data() );
+ }
+
+ idx = cp->index(50, 0);
+ cp->data(idx, Qt::DisplayRole); //don't move buffer yet
+ for (int i=0; i<size; i++){
+ QVERIFY2((dph->isCached(i))==((i>=begin)&& (i<end)), QString("begin:%1 end:%2 size:%3 i:%4").arg(begin).arg(end).arg(size).arg(i).toLatin1().data() );
+ }
+
+ idx = cp->index(89, 0);//don't move buffer yet
+ cp->data(idx, Qt::DisplayRole);
+ for (int i=0; i<size; i++){
+ QVERIFY2((dph->isCached(i))==((i>=begin)&& (i<end)), QString("begin:%1 end:%2 size:%3 i:%4").arg(begin).arg(end).arg(size).arg(i).toLatin1().data() );
+ }
+
+ idx = cp->index(100, 0); //now move buffer
+ cp->data(idx, Qt::DisplayRole);
+ begin = 40;
+ end = 160;
+ for (int i=0; i<size; i++){
+ QVERIFY2((dph->isCached(i))==((i>=begin)&& (i<end)), QString("begin:%1 end:%2 size:%3 i:%4").arg(begin).arg(end).arg(size).arg(i).toLatin1().data() );
+ }
+
+ idx = cp->index(500, 0); //move buffer
+ cp->data(idx, Qt::DisplayRole);
+ begin = 440;
+ end = 560;
+ for (int i=0; i<size; i++){
+ QVERIFY2((dph->isCached(i))==((i>=begin)&& (i<end)), QString("begin:%1 end:%2 size:%3 i:%4").arg(begin).arg(end).arg(size).arg(i).toLatin1().data() );
+ }
+
+ idx = cp->index(980, 0); //move buffer
+ cp->data(idx, Qt::DisplayRole);
+ begin = 880;
+ end = 1000;
+ for (int i=0; i<size; i++){
+ QVERIFY2((dph->isCached(i))==((i>=begin)&& (i<end)), QString("begin:%1 end:%2 size:%3 i:%4").arg(begin).arg(end).arg(size).arg(i).toLatin1().data() );
+ }
+
+ idx = cp->index(920, 0); //move buffer
+ cp->data(idx, Qt::DisplayRole);
+ begin = 880;
+ end = 1000;
+ for (int i=0; i<size; i++){
+ QVERIFY2((dph->isCached(i))==((i>=begin)&& (i<end)), QString("begin:%1 end:%2 size:%3 i:%4").arg(begin).arg(end).arg(size).arg(i).toLatin1().data() );
+ }
+
+ idx = cp->index(890, 0); //move buffer
+ cp->data(idx, Qt::DisplayRole);
+ begin = 830;
+ end = 950;
+ for (int i=0; i<size; i++){
+ QVERIFY2((dph->isCached(i))==((i>=begin)&& (i<end)), QString("begin:%1 end:%2 size:%3 i:%4").arg(begin).arg(end).arg(size).arg(i).toLatin1().data() );
+ }
+
+ idx = cp->index(10, 0); //move buffer
+ cp->data(idx, Qt::DisplayRole);
+ begin = 0;
+ end = 120;
+ for (int i=0; i<size; i++){
+ QVERIFY2((dph->isCached(i))==((i>=begin)&& (i<end)), QString("begin:%1 end:%2 size:%3 i:%4").arg(begin).arg(end).arg(size).arg(i).toLatin1().data() );
+ }
+}
#ifdef _CACHEPROXYDATAMODEL_UNITTEST_LOG_TO_C
int main (int argc, char* argv[])
@@ -1436,6 +1511,7 @@
if ( !file.exists(s) ){
file.mkpath(s);
}
+ break;
}
}
--- a/hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.h Fri Sep 17 15:55:58 2010 +0300
+++ b/hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.h Wed Oct 06 14:53:41 2010 +0300
@@ -64,6 +64,7 @@
void testCP_Data();
void testCP_Sort();
void testCP_Filter();
+ void testCP_IsCached();
private:
BMHelper* bmh;
--- a/hgwidgets.pro Fri Sep 17 15:55:58 2010 +0300
+++ b/hgwidgets.pro Wed Oct 06 14:53:41 2010 +0300
@@ -21,6 +21,6 @@
CONFIG += ordered
-SUBDIRS += hgwidgets_plat/hgwidgets_plat.pro
+SUBDIRS += hgwidgets_pub/hgwidgets_pub.pro
SUBDIRS += ganeswidgets/ganeswidgets.pro
SUBDIRS += hgcacheproxymodel/hgcacheproxymodel.pro
--- a/hgwidgets_plat/ganeswidgets_api/bld.inf Fri Sep 17 15:55:58 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-WINSCW ARMV5
-
-PRJ_EXPORTS
-inc/hgwidgets.h MW_LAYER_PUBLIC_EXPORT_PATH(hgwidgets/hgwidgets.h)
-inc/hggrid.h MW_LAYER_PUBLIC_EXPORT_PATH(hgwidgets/hggrid.h)
-inc/hgmediawall.h MW_LAYER_PUBLIC_EXPORT_PATH(hgwidgets/hgmediawall.h)
--- a/hgwidgets_plat/ganeswidgets_api/ganeswidgets_api.pri Fri Sep 17 15:55:58 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-# Contributors:
-# Description:
-
-PUBLIC_HEADERS += ganeswidgets_api/inc/hgwidgets.h \
- ganeswidgets_api/inc/hggrid.h \
- ganeswidgets_api/inc/hgmediawall.h
-
\ No newline at end of file
--- a/hgwidgets_plat/ganeswidgets_api/inc/hggrid.h Fri Sep 17 15:55:58 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef HGGRID_H
-#define HGGRID_H
-
-#include <hgwidgets/hgwidgets.h>
-
-class HgGridPrivate;
-
-class HG_WIDGETS_EXPORT HgGrid : public HgWidget
-{
- Q_OBJECT
- Q_PROPERTY(bool effect3dEnabled READ effect3dEnabled WRITE setEffect3dEnabled )
- Q_PROPERTY(bool pinchEnabled READ pinchEnabled WRITE setPinchEnabled )
- Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount )
-public:
-
- explicit HgGrid(Qt::Orientation scrollDirection, QGraphicsItem *parent = 0 );
- virtual ~HgGrid();
-
- bool effect3dEnabled() const;
- void setEffect3dEnabled(bool effect3dEnabled);
-
- bool pinchEnabled() const;
- void setPinchEnabled(bool pinchEnabled);
-
- void setPinchLevels(QPair<int,int> levels, Qt::Orientation scrollDirection);
- QPair<int,int> pinchLevels(Qt::Orientation scrollDirection) const;
-
- void setRowCount(int count, Qt::Orientation scrollDirection = Qt::Horizontal);
- int rowCount(Qt::Orientation scrollDirection = Qt::Horizontal) const;
-
-signals:
-
- void emptySpacePressed();
-
-protected:
- HgGrid(Qt::Orientation scrollDirection, HgGridPrivate &dd, QGraphicsItem *parent);
-
-private:
- Q_DECLARE_PRIVATE_D(p_ptr, HgGrid)
- Q_DISABLE_COPY(HgGrid)
-};
-
-#endif //HGGRID_H
-
--- a/hgwidgets_plat/ganeswidgets_api/inc/hgmediawall.h Fri Sep 17 15:55:58 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef HGMEDIAWALL_H
-#define HGMEDIAWALL_H
-
-#include <hgwidgets/hgwidgets.h>
-
-class HgMediawallPrivate;
-
-class HG_WIDGETS_EXPORT HgMediawall : public HgWidget
-{
- Q_OBJECT
- Q_PROPERTY(HbFontSpec titleFontSpec READ titleFontSpec WRITE setTitleFontSpec)
- Q_PROPERTY(HbFontSpec descriptionFontSpec READ descriptionFontSpec WRITE setDescriptionFontSpec)
- Q_PROPERTY(QPointF frontItemPositionDelta READ frontItemPositionDelta WRITE setFrontItemPositionDelta)
- Q_PROPERTY(bool reflectionsEnabled READ reflectionsEnabled WRITE enableReflections)
-
-public:
-
- explicit HgMediawall(QGraphicsItem *parent = 0 );
- virtual ~HgMediawall();
-
- void setTitleFontSpec(const HbFontSpec &fontSpec);
- HbFontSpec titleFontSpec() const;
- void setDescriptionFontSpec(const HbFontSpec &fontSpec);
- HbFontSpec descriptionFontSpec() const;
-
- void setFrontItemPositionDelta(const QPointF& position);
- QPointF frontItemPositionDelta() const;
-
- void enableReflections(bool enabled);
- bool reflectionsEnabled() const;
-
-signals:
-
- void animationAboutToEnd(const QModelIndex& targetIndex);
-
-protected:
- HgMediawall(HgMediawallPrivate &dd, QGraphicsItem *parent);
- void polish(HbStyleParameters& params);
-
-private:
- Q_DECLARE_PRIVATE_D(p_ptr, HgMediawall)
- Q_DISABLE_COPY(HgMediawall)
-};
-
-#endif //HGMEDIAWALL_H
-
--- a/hgwidgets_plat/ganeswidgets_api/inc/hgwidgets.h Fri Sep 17 15:55:58 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef HGWIDGET_H
-#define HGWIDGET_H
-
-#include <QItemSelectionModel>
-#include <HbGlobal>
-#include <hbnamespace.h>
-#include <HbWidget>
-
-#ifdef BUILD_HG_WIDGETS
-# define HG_WIDGETS_EXPORT Q_DECL_EXPORT
-# define HG_WIDGETS_PRIVATE_EXPORT Q_DECL_EXPORT
-#else
-# define HG_WIDGETS_EXPORT Q_DECL_IMPORT
-# define HG_WIDGETS_PRIVATE_EXPORT Q_DECL_IMPORT
-#endif // BUILD_HG_WIDGETS
-
-class HgWidgetPrivate;
-class HbScrollBar;
-
-class HG_WIDGETS_EXPORT HgWidget : public HbWidget
-{
- Q_OBJECT
- Q_PROPERTY(bool longPressEnabled READ longPressEnabled WRITE setLongPressEnabled )
- Q_PROPERTY(ScrollBarPolicy scrollBarPolicy READ scrollBarPolicy WRITE setScrollBarPolicy)
- Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode)
- Q_PROPERTY(IndexFeedbackPolicy IndexFeedbackPolicy READ indexFeedbackPolicy WRITE setIndexFeedbackPolicy)
- Q_PROPERTY(ItemSizePolicy ItemSizePolicy READ itemSizePolicy WRITE setItemSizePolicy)
- Q_PROPERTY(QSizeF itemSize READ itemSize WRITE setItemSize)
- Q_PROPERTY(QSizeF itemSpacing READ itemSpacing WRITE setItemSpacing)
- Q_ENUMS(ScrollBarPolicy)
- Q_ENUMS(HgWidgetType)
- Q_ENUMS(SelectionMode)
- Q_ENUMS(IndexFeedbackPolicy)
- Q_ENUMS(ItemSizePolicy)
-public:
-
- enum HgDataRole
- {
- HgVisibilityRole = Qt::UserRole + 1
- };
-
- enum IndexFeedbackPolicy {
- IndexFeedbackNone = 0,
- IndexFeedbackSingleCharacter,
- IndexFeedbackThreeCharacter,
- IndexFeedbackString
- };
-
- enum ScrollBarPolicy {
- ScrollBarAsNeeded = Qt::ScrollBarAsNeeded,
- ScrollBarAlwaysOff = Qt::ScrollBarAlwaysOff,
- ScrollBarAlwaysOn = Qt::ScrollBarAlwaysOn,
- ScrollBarAutoHide
- };
-
- enum ItemSizePolicy {
- ItemSizeAutomatic,
- ItemSizeUserDefined
- };
-
- explicit HgWidget (QGraphicsItem *parent = 0);
- virtual ~HgWidget ();
-
- virtual void setModel(QAbstractItemModel *model);
- QAbstractItemModel *model() const;
-
- void setSelectionModel(QItemSelectionModel *selectionModel);
- QItemSelectionModel *selectionModel() const;
-
- enum SelectionMode {
- NoSelection = 0,
- SingleSelection,
- MultiSelection,
- ContiguousSelection
- };
-
- SelectionMode selectionMode() const;
- void setSelectionMode(SelectionMode mode, bool resetSelection = true);
- void selectAll();
- void clearSelection();
-
- QModelIndex currentIndex() const;
- void setCurrentIndex(const QModelIndex &index,
- QItemSelectionModel::SelectionFlags selectionFlag=QItemSelectionModel::NoUpdate);
-
- void scrollTo(const QModelIndex &index);
-
- bool longPressEnabled() const;
- void setLongPressEnabled(bool value);
-
- ScrollBarPolicy scrollBarPolicy() const;
- void setScrollBarPolicy(ScrollBarPolicy policy);
- HbScrollBar *scrollBar() const;
- void setScrollBar(HbScrollBar *scrollBar);
-
- bool getItemOutline(const QModelIndex& index, QPolygonF& points);
- Qt::Orientation scrollDirection() const;
-
- QList<QModelIndex> getVisibleItemIndices() const;
-
- void setIndexFeedbackPolicy( IndexFeedbackPolicy policy);
- IndexFeedbackPolicy indexFeedbackPolicy() const;
-
- void setDefaultImage(QImage defaultImage);
-
- void setItemSizePolicy(ItemSizePolicy policy);
- ItemSizePolicy itemSizePolicy() const;
-
- void setItemSize(const QSizeF& size);
- QSizeF itemSize() const;
-
- void setItemSpacing(const QSizeF& spacing);
- QSizeF itemSpacing() const;
-
-signals:
- void activated(const QModelIndex &index);
- void longPressed(const QModelIndex &index, const QPointF &coords);
- void scrollingStarted();
- void scrollingEnded();
-public slots:
-
- void aboutToChangeOrientation();
- void orientationChanged(Qt::Orientation orientation);
-
-protected slots:
-
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
-
-protected:
- HgWidgetPrivate * const p_ptr;
- HgWidget(HgWidgetPrivate &dd, QGraphicsItem *parent);
-
- bool eventFilter(QObject *obj,QEvent *event);
-
- bool event(QEvent *event);
-
-private:
- Q_DECLARE_PRIVATE_D(p_ptr, HgWidget)
- Q_DISABLE_COPY(HgWidget)
- Q_PRIVATE_SLOT(d_func(), void _q_scrollPositionChanged(qreal index, bool scrollBarAnimation))
- Q_PRIVATE_SLOT(d_func(), void _q_releaseItems(int releaseStart, int releaseEnd))
- Q_PRIVATE_SLOT(d_func(), void _q_requestItems(int requestStart, int requestEnd))
- Q_PRIVATE_SLOT(d_func(), void _q_hideScrollBars() )
- Q_PRIVATE_SLOT(d_func(), void _q_thumbPositionChanged(qreal value, Qt::Orientation orientation))
- Q_PRIVATE_SLOT(d_func(), void _q_insertRows(const QModelIndex &parent, int start, int end))
- Q_PRIVATE_SLOT(d_func(), void _q_removeRows(const QModelIndex &parent, int start, int end))
- Q_PRIVATE_SLOT(d_func(), void _q_moveRows(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow))
- Q_PRIVATE_SLOT(d_func(), void _q_groovePressed(qreal, Qt::Orientation))
- Q_PRIVATE_SLOT(d_func(), void _q_modelReset())
- Q_PRIVATE_SLOT(d_func(), void _q_updateCurrentItem(const QModelIndex ¤t, const QModelIndex &previous))
- Q_PRIVATE_SLOT(d_func(), void _q_themeChanged())
-};
-
-#endif //HGWIDGET_H
-
--- a/hgwidgets_plat/hgcacheproxymodel_api/bld.inf Fri Sep 17 15:55:58 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-WINSCW ARMV5
-
-PRJ_EXPORTS
-inc/hgcacheproxymodel.h MW_LAYER_PUBLIC_EXPORT_PATH(hgwidgets/hgcacheproxymodel.h)
-inc/hgdataprovidermodel.h MW_LAYER_PUBLIC_EXPORT_PATH(hgwidgets/hgdataprovidermodel.h)
--- a/hgwidgets_plat/hgcacheproxymodel_api/hgcacheproxymodel_api.pri Fri Sep 17 15:55:58 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-# Contributors:
-# Description:
-
-PUBLIC_HEADERS += hgcacheproxymodel_api/inc/hgcacheproxymodel.h \
- hgcacheproxymodel_api/inc/hgdataprovidermodel.h
-
\ No newline at end of file
--- a/hgwidgets_plat/hgcacheproxymodel_api/inc/hgcacheproxymodel.h Fri Sep 17 15:55:58 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-* Version : %version: 6 %
-*/
-
-#ifndef HGCACHEPROXYMODEL_H_
-#define HGCACHEPROXYMODEL_H_
-
-#include <QAbstractItemModel>
-#include <QSortFilterProxyModel>
-
-#include <hgwidgets/hgdataprovidermodel.h>
-
-#ifdef BUILD_CACHEPROXYMODEL
-#define CACHEPROXYMODEL_EXPORT Q_DECL_EXPORT
-#else
-#define CACHEPROXYMODEL_EXPORT Q_DECL_IMPORT
-#endif
-
-class HgBufferManager;
-
-const int KDefaultCacheSize = 120;
-const int KDefaultCacheTreshold = 30;
-
-class HgBufferManagerObserver
-{
-public:
- enum HgRequestOrder {
- HgRequestOrderAscending,
- HgRequestOrderDescending
- };
-
- virtual void release(int start, int end) = 0;
- virtual void request(int start, int end, HgRequestOrder order = HgRequestOrderAscending) = 0;
-};
-
-class CACHEPROXYMODEL_EXPORT HgCacheProxyModel : public QAbstractItemModel, public HgBufferManagerObserver, public HgDataProviderModelObserver
-{
- Q_OBJECT
-public:
- HgCacheProxyModel(QObject *parent = 0);
- ~HgCacheProxyModel();
-
- void setDataProvider(HgDataProviderModel *dataProvider, int cacheSize = KDefaultCacheSize, int cacheTreshold = KDefaultCacheTreshold);
- HgDataProviderModel* DataProvider();
- void resizeCache(int newSize, int newTreshold);
-
-//from QAbstractItemModel
- virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- virtual QModelIndex parent(const QModelIndex &child) const;
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
- virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
- virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole);
- virtual QMap<int, QVariant> itemData(const QModelIndex &index) const;
- virtual bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles);
- virtual QStringList mimeTypes() const;
- virtual QMimeData *mimeData(const QModelIndexList &indexes) const;
- virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
- virtual Qt::DropActions supportedDropActions() const;
- virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
- virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex());
- virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
- virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex());
- virtual void fetchMore(const QModelIndex &parent);
- virtual bool canFetchMore(const QModelIndex &parent) const;
- virtual Qt::ItemFlags flags(const QModelIndex &index) const;
- virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
- virtual QModelIndex buddy(const QModelIndex &index) const;
- virtual QModelIndexList match(const QModelIndex &start, int role,
- const QVariant &value, int hits = 1,
- Qt::MatchFlags flags =
- Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const;
- virtual QSize span(const QModelIndex &index) const;
-
-// for sorting
- Qt::CaseSensitivity sortCaseSensitivity() const;
- void setSortCaseSensitivity(Qt::CaseSensitivity cs);
- bool isSortLocaleAware() const;
- void setSortLocaleAware(bool on);
- int sortColumn() const;
- Qt::SortOrder sortOrder() const;
- bool dynamicSortFilter() const;
- void setDynamicSortFilter(bool enable);
- int sortRole() const;
- void setSortRole(int role);
-
-//for filtering
- QRegExp filterRegExp() const;
- void setFilterRegExp(const QRegExp ®Exp);
- int filterKeyColumn() const;
- void setFilterKeyColumn(int column);
- Qt::CaseSensitivity filterCaseSensitivity() const;
- void setFilterCaseSensitivity(Qt::CaseSensitivity cs);
- int filterRole() const;
- void setFilterRole(int role);
-
-public slots:
- virtual bool submit();
- virtual void revert();
-
-public:
-//from HgBufferManagerObserver
- virtual void release(int start, int end);
- virtual void request(int start, int end, HgRequestOrder order = HgRequestOrderAscending);
-
-private:
- int count()const;
- QModelIndex mapToSource(const QModelIndex &index)const;
- QModelIndex mapToSource(int row, int col) const;
- int mapToDataProviderIndex(int myIndex) const;
- int mapFromDataProviderIndex(int myIndex) const;
- void releaseAll();
- void setBufferPosition(int pos) const;
-
-private slots:
- void sourceColumnsAboutToBeInserted( const QModelIndex & parent, int start, int end);
- void sourceColumnsAboutToBeMoved( const QModelIndex & sourceParent, int sourceStart, int sourceEnd, const QModelIndex & destinationParent, int destinationColumn );
- void sourceColumnsAboutToBeRemoved( const QModelIndex & parent, int start, int end);
- void sourceColumnsInserted( const QModelIndex & parent, int start, int end );
- void sourceColumnsMoved( const QModelIndex & sourceParent, int sourceStart, int sourceEnd, const QModelIndex & destinationParent, int destinationColumn );
- void sourceColumnsRemoved( const QModelIndex & parent, int start, int end );
- void sourceDataChanged( const QModelIndex & topLeft, const QModelIndex & bottomRight );
- void sourceHeaderDataChanged( Qt::Orientation orientation, int first, int last );
- void sourceLayoutAboutToBeChanged();
- void sourceLayoutChanged();
- void sourceModelAboutToBeReset();
- void sourceModelReset();
- void sourceRowsAboutToBeInserted( const QModelIndex & parent, int start, int end );
- void sourceRowsAboutToBeMoved( const QModelIndex & sourceParent, int sourceStart, int sourceEnd, const QModelIndex & destinationParent, int destinationRow );
- void sourceRowsAboutToBeRemoved( const QModelIndex & parent, int start, int end );
- void sourceRowsInserted( const QModelIndex & parent, int start, int end );
- void sourceRowsMoved( const QModelIndex & sourceParent, int sourceStart, int sourceEnd, const QModelIndex & destinationParent, int destinationRow );
- void sourceRowsRemoved( const QModelIndex & parent, int start, int end );
-
-//from HgDataProviderModelObserver
-public:
- virtual void dataUpdated(int from, int to);
-
-private:
- HgBufferManager* mBufferManager;
- QSortFilterProxyModel* mSortFilterProxyModel;
- HgDataProviderModel* mDataProviderModel;
- mutable bool mSupressBM;
- mutable int mCurrentPos;
-};
-
-#endif // HGCACHEPROXYMODEL_H_
--- a/hgwidgets_plat/hgcacheproxymodel_api/inc/hgdataprovidermodel.h Fri Sep 17 15:55:58 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-* Version : %version: 11 %
-*/
-#ifndef HGDATAPROVIDERMODEL_H_
-#define HGDATAPROVIDERMODEL_H_
-
-#include <QObject>
-#include <QList>
-#include <QPair>
-#include <QPixmap>
-#include <QMap>
-#include <QMutex>
-#include <QAbstractItemModel>
-
-class HbIcon;
-class QVariant;
-class HgCacheProxyModel;
-
-#ifdef BUILD_CACHEPROXYMODEL
-#define CACHEPROXYMODEL_EXPORT Q_DECL_EXPORT
-#else
-#define CACHEPROXYMODEL_EXPORT Q_DECL_IMPORT
-#endif
-
-class HgDataProviderModelObserver
-{
-public:
- virtual void dataUpdated(int from, int to) = 0;
-};
-
-class CACHEPROXYMODEL_EXPORT HgDataProviderModel : public QAbstractItemModel
-{
- Q_OBJECT
-
-public:
- HgDataProviderModel(QObject *parent = 0);
- ~HgDataProviderModel();
-//to cooperate with buffer manager
- void release(QList<int> list, bool silent = true);
- void request(QList<int> list, bool silent = false);
- virtual void doReleaseData(QList<int> list, bool silent) = 0;
- virtual void doRequestData(QList<int> list, bool silent) = 0;
- void registerObserver(HgDataProviderModelObserver* obs);
-
-public:
-//from QAbstractItemModel
- QModelIndex index(int row, int column,
- const QModelIndex &parent = QModelIndex()) const;
- virtual QModelIndex parent(const QModelIndex &child) const;
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- virtual QMap<int, QVariant> itemData(const QModelIndex &index) const;
-
-//cache management
-protected:
- QVariant data(int idx, int role) const;
- void clearCache();
- int count() const;
- bool update(int pos, QVariant obj, int role, bool silent = false);
- bool update(int pos, QList< QPair< QVariant, int > >* list, bool silent = false);
- bool updateIcon(int pos, QVariant obj, bool silent = false);
- void resetIcon(int idx);
- void newItem(QList< QPair< QVariant, int > >* list = NULL, bool silent = true);
- void newItem(QPair< QVariant, int > item, bool silent = true);
- void insertItem(int pos, QList< QPair< QVariant, int > >* list = NULL, bool silent = true);
- void insertItem(int pos, QPair< QVariant, int > item, bool silent = true);
- void clearItem(int pos, bool silent = false);
-
-private:
- void doInsertItem(int pos, QList< QPair< QVariant, int > >* list, bool silent);
-
-protected:
- void removeItem(int pos, bool silent = false);
- void removeItems(int pos, int size, bool silent = false);
-
- virtual QVariant defaultIcon() const = 0;
- inline bool containsRole(int idx, int role) const;
- inline bool isIndexValid(int idx) const;
-
-public:
- void resetModel();
-
- enum HgDataProviderIconMode {
- HgDataProviderIconHbIcon,
- HgDataProviderIconQIcon,
- HgDataProviderIconQImage,
- HgDataProviderIconQPixmap
- };
-
- void setIconMode(HgDataProviderIconMode mode);
- HgDataProviderIconMode iconMode();
-
-protected:
- virtual void doResetModel() {};
- virtual QVariant getData(int idx, int role) const {Q_UNUSED(idx); Q_UNUSED(role); return QVariant(); };
-
-// helpers fot emits
-protected:
- void emitDataChanged(int start, int end, bool silent);
-
-//QPixmap pool
-public:
- void resizeQPixmapPool(int size);
-
-protected:
- void releasePixmap(int idx);
- QVariant createIcon(int index, QPixmap aPixmap);
-
-private:
- QPixmap* getPixmap(int idx);
-
-
-private:
- QList<QMap<int, QVariant>*>* mCache;
- int mCacheSize; //Number of cached Icons. Not same as mCache->count()
- QList< QPixmap* > mFreePixmaps;
- QMap< int, QPixmap* > mUsedPixmaps;
- int mUnallocatedPixmaps;
- QMutex mQPixmapsLock;
- QMutex mDataLock;
- HgDataProviderModelObserver *mObserver;
- HgDataProviderIconMode mIconMode;
-};
-
-inline bool HgDataProviderModel::isIndexValid(int idx) const
-{
- return ((idx >= 0) &&
- (idx < mCache->size()) &&
- (mCache->at(idx)));
-}
-
-inline bool HgDataProviderModel::containsRole(int idx, int role) const
-{
- return ( isIndexValid(idx) &&
- mCache->at(idx)->contains(role) );
-}
-
-#endif // HGDATAPROVIDERMODEL_H_
--- a/hgwidgets_plat/hgwidgets_plat.pro Fri Sep 17 15:55:58 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-# Contributors:
-# Description:
-
-TEMPLATE = subdirs
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-CONFIG += ordered
-
-include(ganeswidgets_api/ganeswidgets_api.pri)
-include(hgcacheproxymodel_api/hgcacheproxymodel_api.pri)
-
-symbian {
- headers.sources = $$PUBLIC_HEADERS
- BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
- for(header, headers.sources) {
- FILENAME = $$basename(header)
- BLD_INF_RULES.prj_exports += "$$header MW_LAYER_PUBLIC_EXPORT_PATH(hgwidgets/$$FILENAME)"
- }
-}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hgwidgets_pub/ganeswidgets_api/ganeswidgets_api.pri Wed Oct 06 14:53:41 2010 +0300
@@ -0,0 +1,15 @@
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# Contributors:
+# Description:
+
+PUBLIC_HEADERS += ganeswidgets_api/inc/hgwidgets.h \
+ ganeswidgets_api/inc/hggrid.h \
+ ganeswidgets_api/inc/hgmediawall.h
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hgwidgets_pub/ganeswidgets_api/inc/hggrid.h Wed Oct 06 14:53:41 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef HGGRID_H
+#define HGGRID_H
+
+#include <hgwidgets/hgwidgets.h>
+
+class HgGridPrivate;
+
+class HG_WIDGETS_EXPORT HgGrid : public HgWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(bool effect3dEnabled READ effect3dEnabled WRITE setEffect3dEnabled )
+ Q_PROPERTY(bool pinchEnabled READ pinchEnabled WRITE setPinchEnabled )
+ Q_PROPERTY(bool reflectionsEnabled READ reflectionsEnabled WRITE setReflectionsEnabled)
+public:
+
+ explicit HgGrid(Qt::Orientation scrollDirection, QGraphicsItem *parent = 0 );
+ virtual ~HgGrid();
+
+ bool effect3dEnabled() const;
+ void setEffect3dEnabled(bool effect3dEnabled);
+
+ bool pinchEnabled() const;
+ void setPinchEnabled(bool pinchEnabled);
+
+ void setPinchLevels(QPair<int,int> levels, Qt::Orientation scrollDirection);
+ QPair<int,int> pinchLevels(Qt::Orientation scrollDirection) const;
+
+ void setRowCount(int count, Qt::Orientation scrollDirection = Qt::Horizontal);
+ int rowCount(Qt::Orientation scrollDirection = Qt::Horizontal) const;
+
+ void setReflectionsEnabled(bool reflectionsEnabled);
+ bool reflectionsEnabled() const;
+
+signals:
+
+ void emptySpacePressed();
+
+protected:
+ HgGrid(Qt::Orientation scrollDirection, HgGridPrivate &dd, QGraphicsItem *parent);
+
+private:
+ Q_DECLARE_PRIVATE_D(p_ptr, HgGrid)
+ Q_DISABLE_COPY(HgGrid)
+};
+
+#endif //HGGRID_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hgwidgets_pub/ganeswidgets_api/inc/hgmediawall.h Wed Oct 06 14:53:41 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef HGMEDIAWALL_H
+#define HGMEDIAWALL_H
+
+#include <hgwidgets/hgwidgets.h>
+
+class HgMediawallPrivate;
+
+class HG_WIDGETS_EXPORT HgMediawall : public HgWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(HbFontSpec titleFontSpec READ titleFontSpec WRITE setTitleFontSpec)
+ Q_PROPERTY(HbFontSpec descriptionFontSpec READ descriptionFontSpec WRITE setDescriptionFontSpec)
+ Q_PROPERTY(QPointF frontItemPositionDelta READ frontItemPositionDelta WRITE setFrontItemPositionDelta)
+ Q_PROPERTY(bool reflectionsEnabled READ reflectionsEnabled WRITE enableReflections)
+
+public:
+
+ explicit HgMediawall(QGraphicsItem *parent = 0 );
+ virtual ~HgMediawall();
+
+ void setTitleFontSpec(const HbFontSpec &fontSpec);
+ HbFontSpec titleFontSpec() const;
+ void setDescriptionFontSpec(const HbFontSpec &fontSpec);
+ HbFontSpec descriptionFontSpec() const;
+
+ void setFrontItemPositionDelta(const QPointF& position);
+ QPointF frontItemPositionDelta() const;
+
+ void enableReflections(bool enabled);
+ bool reflectionsEnabled() const;
+
+signals:
+
+ void animationAboutToEnd(const QModelIndex& targetIndex);
+
+protected:
+ HgMediawall(HgMediawallPrivate &dd, QGraphicsItem *parent);
+ void polish(HbStyleParameters& params);
+
+private:
+ Q_DECLARE_PRIVATE_D(p_ptr, HgMediawall)
+ Q_DISABLE_COPY(HgMediawall)
+};
+
+#endif //HGMEDIAWALL_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hgwidgets_pub/ganeswidgets_api/inc/hgwidgets.h Wed Oct 06 14:53:41 2010 +0300
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef HGWIDGET_H
+#define HGWIDGET_H
+
+#include <QItemSelectionModel>
+#include <HbGlobal>
+#include <hbnamespace.h>
+#include <HbWidget>
+
+#ifdef BUILD_HG_WIDGETS
+# define HG_WIDGETS_EXPORT Q_DECL_EXPORT
+# define HG_WIDGETS_PRIVATE_EXPORT Q_DECL_EXPORT
+#else
+# define HG_WIDGETS_EXPORT Q_DECL_IMPORT
+# define HG_WIDGETS_PRIVATE_EXPORT Q_DECL_IMPORT
+#endif // BUILD_HG_WIDGETS
+
+class HgWidgetPrivate;
+class HbScrollBar;
+
+class HG_WIDGETS_EXPORT HgWidget : public HbWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(bool longPressEnabled READ longPressEnabled WRITE setLongPressEnabled )
+ Q_PROPERTY(ScrollBarPolicy scrollBarPolicy READ scrollBarPolicy WRITE setScrollBarPolicy)
+ Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode)
+ Q_PROPERTY(IndexFeedbackPolicy IndexFeedbackPolicy READ indexFeedbackPolicy WRITE setIndexFeedbackPolicy)
+ Q_PROPERTY(ItemSizePolicy ItemSizePolicy READ itemSizePolicy WRITE setItemSizePolicy)
+ Q_PROPERTY(QSizeF itemSize READ itemSize WRITE setItemSize)
+ Q_PROPERTY(QSizeF itemSpacing READ itemSpacing WRITE setItemSpacing)
+ Q_ENUMS(ScrollBarPolicy)
+ Q_ENUMS(HgWidgetType)
+ Q_ENUMS(SelectionMode)
+ Q_ENUMS(IndexFeedbackPolicy)
+ Q_ENUMS(ItemSizePolicy)
+public:
+
+ enum HgDataRole
+ {
+ HgVisibilityRole = Qt::UserRole + 1
+ };
+
+ enum IndexFeedbackPolicy {
+ IndexFeedbackNone = 0,
+ IndexFeedbackSingleCharacter,
+ IndexFeedbackThreeCharacter,
+ IndexFeedbackString
+ };
+
+ enum ScrollBarPolicy {
+ ScrollBarAsNeeded = Qt::ScrollBarAsNeeded,
+ ScrollBarAlwaysOff = Qt::ScrollBarAlwaysOff,
+ ScrollBarAlwaysOn = Qt::ScrollBarAlwaysOn,
+ ScrollBarAutoHide
+ };
+
+ enum ItemSizePolicy {
+ ItemSizeAutomatic,
+ ItemSizeUserDefined
+ };
+
+ explicit HgWidget (QGraphicsItem *parent = 0);
+ virtual ~HgWidget ();
+
+ virtual void setModel(QAbstractItemModel *model);
+ QAbstractItemModel *model() const;
+
+ void setSelectionModel(QItemSelectionModel *selectionModel);
+ QItemSelectionModel *selectionModel() const;
+
+ enum SelectionMode {
+ NoSelection = 0,
+ SingleSelection,
+ MultiSelection,
+ ContiguousSelection
+ };
+
+ SelectionMode selectionMode() const;
+ void setSelectionMode(SelectionMode mode, bool resetSelection = true);
+ void selectAll();
+ void clearSelection();
+
+ QModelIndex currentIndex() const;
+ void setCurrentIndex(const QModelIndex &index,
+ QItemSelectionModel::SelectionFlags selectionFlag=QItemSelectionModel::NoUpdate);
+
+ void scrollTo(const QModelIndex &index);
+
+ bool longPressEnabled() const;
+ void setLongPressEnabled(bool value);
+
+ ScrollBarPolicy scrollBarPolicy() const;
+ void setScrollBarPolicy(ScrollBarPolicy policy);
+ HbScrollBar *scrollBar() const;
+ void setScrollBar(HbScrollBar *scrollBar);
+
+ bool getItemOutline(const QModelIndex& index, QPolygonF& points);
+ Qt::Orientation scrollDirection() const;
+
+ QList<QModelIndex> getVisibleItemIndices() const;
+
+ void setIndexFeedbackPolicy( IndexFeedbackPolicy policy);
+ IndexFeedbackPolicy indexFeedbackPolicy() const;
+
+ void setDefaultImage(QImage defaultImage);
+
+ void setItemSizePolicy(ItemSizePolicy policy);
+ ItemSizePolicy itemSizePolicy() const;
+
+ void setItemSize(const QSizeF& size);
+ QSizeF itemSize() const;
+
+ void setItemSpacing(const QSizeF& spacing);
+ QSizeF itemSpacing() const;
+
+signals:
+ void activated(const QModelIndex &index);
+ void longPressed(const QModelIndex &index, const QPointF &coords);
+ void scrollingStarted();
+ void scrollingEnded();
+public slots:
+
+ void aboutToChangeOrientation();
+ void orientationChanged(Qt::Orientation orientation);
+
+protected slots:
+
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+
+protected:
+ HgWidgetPrivate * const p_ptr;
+ HgWidget(HgWidgetPrivate &dd, QGraphicsItem *parent);
+
+ bool eventFilter(QObject *obj,QEvent *event);
+
+ bool event(QEvent *event);
+
+private:
+ Q_DECLARE_PRIVATE_D(p_ptr, HgWidget)
+ Q_DISABLE_COPY(HgWidget)
+ Q_PRIVATE_SLOT(d_func(), void _q_scrollPositionChanged(qreal index, bool scrollBarAnimation))
+ Q_PRIVATE_SLOT(d_func(), void _q_releaseItems(int releaseStart, int releaseEnd))
+ Q_PRIVATE_SLOT(d_func(), void _q_requestItems(int requestStart, int requestEnd))
+ Q_PRIVATE_SLOT(d_func(), void _q_hideScrollBars() )
+ Q_PRIVATE_SLOT(d_func(), void _q_thumbPositionChanged(qreal value, Qt::Orientation orientation))
+ Q_PRIVATE_SLOT(d_func(), void _q_insertRows(const QModelIndex &parent, int start, int end))
+ Q_PRIVATE_SLOT(d_func(), void _q_removeRows(const QModelIndex &parent, int start, int end))
+ Q_PRIVATE_SLOT(d_func(), void _q_moveRows(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow))
+ Q_PRIVATE_SLOT(d_func(), void _q_groovePressed(qreal, Qt::Orientation))
+ Q_PRIVATE_SLOT(d_func(), void _q_modelReset())
+ Q_PRIVATE_SLOT(d_func(), void _q_updateCurrentItem(const QModelIndex ¤t, const QModelIndex &previous))
+ Q_PRIVATE_SLOT(d_func(), void _q_themeChanged())
+};
+
+#endif //HGWIDGET_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hgwidgets_pub/hgcacheproxymodel_api/hgcacheproxymodel_api.pri Wed Oct 06 14:53:41 2010 +0300
@@ -0,0 +1,14 @@
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# Contributors:
+# Description:
+
+PUBLIC_HEADERS += hgcacheproxymodel_api/inc/hgcacheproxymodel.h \
+ hgcacheproxymodel_api/inc/hgdataprovidermodel.h
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hgwidgets_pub/hgcacheproxymodel_api/inc/hgcacheproxymodel.h Wed Oct 06 14:53:41 2010 +0300
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Version : %version: 6 %
+*/
+
+#ifndef HGCACHEPROXYMODEL_H_
+#define HGCACHEPROXYMODEL_H_
+
+#include <QAbstractItemModel>
+#include <QSortFilterProxyModel>
+
+#include <hgwidgets/hgdataprovidermodel.h>
+
+#ifdef BUILD_CACHEPROXYMODEL
+#define CACHEPROXYMODEL_EXPORT Q_DECL_EXPORT
+#else
+#define CACHEPROXYMODEL_EXPORT Q_DECL_IMPORT
+#endif
+
+class HgBufferManager;
+
+const int KDefaultCacheSize = 120;
+const int KDefaultCacheTreshold = 30;
+
+class HgBufferManagerObserver
+{
+public:
+ enum HgRequestOrder {
+ HgRequestOrderAscending,
+ HgRequestOrderDescending
+ };
+
+ virtual void release(int start, int end) = 0;
+ virtual void request(int start, int end, HgRequestOrder order = HgRequestOrderAscending) = 0;
+};
+
+class CACHEPROXYMODEL_EXPORT HgCacheProxyModel : public QAbstractItemModel, public HgBufferManagerObserver, public HgDataProviderModelObserver
+{
+ Q_OBJECT
+public:
+ HgCacheProxyModel(QObject *parent = 0);
+ ~HgCacheProxyModel();
+
+ void setDataProvider(HgDataProviderModel *dataProvider, int cacheSize = KDefaultCacheSize, int cacheTreshold = KDefaultCacheTreshold);
+ HgDataProviderModel* DataProvider();
+ void resizeCache(int newSize, int newTreshold);
+
+//from QAbstractItemModel
+ virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ virtual QModelIndex parent(const QModelIndex &child) const;
+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
+ virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
+ virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole);
+ virtual QMap<int, QVariant> itemData(const QModelIndex &index) const;
+ virtual bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles);
+ virtual QStringList mimeTypes() const;
+ virtual QMimeData *mimeData(const QModelIndexList &indexes) const;
+ virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
+ virtual Qt::DropActions supportedDropActions() const;
+ virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
+ virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex());
+ virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
+ virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex());
+ virtual void fetchMore(const QModelIndex &parent);
+ virtual bool canFetchMore(const QModelIndex &parent) const;
+ virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+ virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
+ virtual QModelIndex buddy(const QModelIndex &index) const;
+ virtual QModelIndexList match(const QModelIndex &start, int role,
+ const QVariant &value, int hits = 1,
+ Qt::MatchFlags flags =
+ Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const;
+ virtual QSize span(const QModelIndex &index) const;
+
+// for sorting
+ Qt::CaseSensitivity sortCaseSensitivity() const;
+ void setSortCaseSensitivity(Qt::CaseSensitivity cs);
+ bool isSortLocaleAware() const;
+ void setSortLocaleAware(bool on);
+ int sortColumn() const;
+ Qt::SortOrder sortOrder() const;
+ bool dynamicSortFilter() const;
+ void setDynamicSortFilter(bool enable);
+ int sortRole() const;
+ void setSortRole(int role);
+
+//for filtering
+ QRegExp filterRegExp() const;
+ void setFilterRegExp(const QRegExp ®Exp);
+ int filterKeyColumn() const;
+ void setFilterKeyColumn(int column);
+ Qt::CaseSensitivity filterCaseSensitivity() const;
+ void setFilterCaseSensitivity(Qt::CaseSensitivity cs);
+ int filterRole() const;
+ void setFilterRole(int role);
+
+public slots:
+ virtual bool submit();
+ virtual void revert();
+
+public:
+//from HgBufferManagerObserver
+ virtual void release(int start, int end);
+ virtual void request(int start, int end, HgRequestOrder order = HgRequestOrderAscending);
+
+private:
+ int count()const;
+ QModelIndex mapToSource(const QModelIndex &index)const;
+ QModelIndex mapToSource(int row, int col) const;
+ int mapToDataProviderIndex(int myIndex) const;
+ int mapFromDataProviderIndex(int myIndex) const;
+ void releaseAll();
+ void setBufferPosition(int pos) const;
+
+private slots:
+ void sourceColumnsAboutToBeInserted( const QModelIndex & parent, int start, int end);
+ void sourceColumnsAboutToBeMoved( const QModelIndex & sourceParent, int sourceStart, int sourceEnd, const QModelIndex & destinationParent, int destinationColumn );
+ void sourceColumnsAboutToBeRemoved( const QModelIndex & parent, int start, int end);
+ void sourceColumnsInserted( const QModelIndex & parent, int start, int end );
+ void sourceColumnsMoved( const QModelIndex & sourceParent, int sourceStart, int sourceEnd, const QModelIndex & destinationParent, int destinationColumn );
+ void sourceColumnsRemoved( const QModelIndex & parent, int start, int end );
+ void sourceDataChanged( const QModelIndex & topLeft, const QModelIndex & bottomRight );
+ void sourceHeaderDataChanged( Qt::Orientation orientation, int first, int last );
+ void sourceLayoutAboutToBeChanged();
+ void sourceLayoutChanged();
+ void sourceModelAboutToBeReset();
+ void sourceModelReset();
+ void sourceRowsAboutToBeInserted( const QModelIndex & parent, int start, int end );
+ void sourceRowsAboutToBeMoved( const QModelIndex & sourceParent, int sourceStart, int sourceEnd, const QModelIndex & destinationParent, int destinationRow );
+ void sourceRowsAboutToBeRemoved( const QModelIndex & parent, int start, int end );
+ void sourceRowsInserted( const QModelIndex & parent, int start, int end );
+ void sourceRowsMoved( const QModelIndex & sourceParent, int sourceStart, int sourceEnd, const QModelIndex & destinationParent, int destinationRow );
+ void sourceRowsRemoved( const QModelIndex & parent, int start, int end );
+
+//from HgDataProviderModelObserver
+public:
+ virtual void dataUpdated(int from, int to);
+ virtual bool isCached(int idx) const;
+
+private:
+ HgBufferManager* mBufferManager;
+ QSortFilterProxyModel* mSortFilterProxyModel;
+ HgDataProviderModel* mDataProviderModel;
+ mutable bool mSupressBM;
+ mutable int mCurrentPos;
+};
+
+#endif // HGCACHEPROXYMODEL_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hgwidgets_pub/hgcacheproxymodel_api/inc/hgdataprovidermodel.h Wed Oct 06 14:53:41 2010 +0300
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* Version : %version: 11 %
+*/
+#ifndef HGDATAPROVIDERMODEL_H_
+#define HGDATAPROVIDERMODEL_H_
+
+#include <QObject>
+#include <QList>
+#include <QPair>
+#include <QPixmap>
+#include <QMap>
+#include <QMutex>
+#include <QAbstractItemModel>
+
+class HbIcon;
+class QVariant;
+class HgCacheProxyModel;
+
+#ifdef BUILD_CACHEPROXYMODEL
+#define CACHEPROXYMODEL_EXPORT Q_DECL_EXPORT
+#else
+#define CACHEPROXYMODEL_EXPORT Q_DECL_IMPORT
+#endif
+
+class HgDataProviderModelObserver
+{
+public:
+ virtual void dataUpdated(int from, int to) = 0;
+ virtual bool isCached(int idx) const = 0;
+};
+
+class CACHEPROXYMODEL_EXPORT HgDataProviderModel : public QAbstractItemModel
+{
+ Q_OBJECT
+
+public:
+ HgDataProviderModel(QObject *parent = 0);
+ ~HgDataProviderModel();
+//to cooperate with buffer manager
+ void release(QList<int> list, bool silent = true);
+ void request(QList<int> list, bool silent = false);
+ virtual void doReleaseData(QList<int> list, bool silent) = 0;
+ virtual void doRequestData(QList<int> list, bool silent) = 0;
+ void registerObserver(HgDataProviderModelObserver* obs);
+
+public:
+//from QAbstractItemModel
+ QModelIndex index(int row, int column,
+ const QModelIndex &parent = QModelIndex()) const;
+ virtual QModelIndex parent(const QModelIndex &child) const;
+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ virtual QMap<int, QVariant> itemData(const QModelIndex &index) const;
+
+//cache management
+protected:
+ QVariant data(int idx, int role) const;
+ void clearCache();
+ int count() const;
+ bool update(int pos, QVariant obj, int role, bool silent = false);
+ bool update(int pos, QList< QPair< QVariant, int > >* list, bool silent = false);
+ bool updateIcon(int pos, QVariant obj, bool silent = false);
+ void resetIcon(int idx);
+ void newItem(QList< QPair< QVariant, int > >* list = NULL, bool silent = true);
+ void newItem(QPair< QVariant, int > item, bool silent = true);
+ void insertItem(int pos, QList< QPair< QVariant, int > >* list = NULL, bool silent = true);
+ void insertItem(int pos, QPair< QVariant, int > item, bool silent = true);
+ void clearItem(int pos, bool silent = false);
+
+private:
+ void doInsertItem(int pos, QList< QPair< QVariant, int > >* list, bool silent);
+
+protected:
+ void removeItem(int pos, bool silent = false);
+ void removeItems(int pos, int size, bool silent = false);
+
+ virtual QVariant defaultIcon() const = 0;
+ inline bool containsRole(int idx, int role) const;
+ inline bool isIndexValid(int idx) const;
+ bool isCached(int idx) const;
+public:
+ void resetModel();
+
+ enum HgDataProviderIconMode {
+ HgDataProviderIconHbIcon,
+ HgDataProviderIconQIcon,
+ HgDataProviderIconQImage,
+ HgDataProviderIconQPixmap
+ };
+
+ void setIconMode(HgDataProviderIconMode mode);
+ HgDataProviderIconMode iconMode();
+
+protected:
+ virtual void doResetModel() {};
+ virtual QVariant getData(int idx, int role) const {Q_UNUSED(idx); Q_UNUSED(role); return QVariant(); };
+
+// helpers fot emits
+protected:
+ void emitDataChanged(int start, int end, bool silent);
+
+//QPixmap pool
+public:
+ void resizeQPixmapPool(int size);
+
+protected:
+ void releasePixmap(int idx);
+ QVariant createIcon(int index, QPixmap aPixmap);
+
+private:
+ QPixmap* getPixmap(int idx);
+
+
+private:
+ QList<QMap<int, QVariant>*>* mCache;
+ int mCacheSize; //Number of cached Icons. Not same as mCache->count()
+ QList< QPixmap* > mFreePixmaps;
+ QMap< int, QPixmap* > mUsedPixmaps;
+ int mUnallocatedPixmaps;
+ QMutex mQPixmapsLock;
+ QMutex mDataLock;
+ HgDataProviderModelObserver *mObserver;
+ HgDataProviderIconMode mIconMode;
+};
+
+inline bool HgDataProviderModel::isIndexValid(int idx) const
+{
+ return ((idx >= 0) &&
+ (idx < mCache->size()) &&
+ (mCache->at(idx)));
+}
+
+inline bool HgDataProviderModel::containsRole(int idx, int role) const
+{
+ return ( isIndexValid(idx) &&
+ mCache->at(idx)->contains(role) );
+}
+
+#endif // HGDATAPROVIDERMODEL_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hgwidgets_pub/hgwidgets_pub.pro Wed Oct 06 14:53:41 2010 +0300
@@ -0,0 +1,28 @@
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# Contributors:
+# Description:
+
+TEMPLATE = subdirs
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+CONFIG += ordered
+
+include(ganeswidgets_api/ganeswidgets_api.pri)
+include(hgcacheproxymodel_api/hgcacheproxymodel_api.pri)
+
+symbian {
+ headers.sources = $$PUBLIC_HEADERS
+ BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
+ for(header, headers.sources) {
+ FILENAME = $$basename(header)
+ BLD_INF_RULES.prj_exports += "$$header MW_LAYER_PUBLIC_EXPORT_PATH(hgwidgets/$$FILENAME)"
+ }
+}
\ No newline at end of file
--- a/package_definition.xml Fri Sep 17 15:55:58 2010 +0300
+++ b/package_definition.xml Wed Oct 06 14:53:41 2010 +0300
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<SystemDefinition schema="3.0.0" xmlns:qt="http://www.nokia.com/qt">
- <package id="hgwidgets" name="Multimedia Widgets" levels="framework service api">
+ <package id="hgwidgets" name="Multimedia Widgets" levels="framework service api" version="1.0.0">
<collection id="hgwidgets_plat" name="Multimedia Widgets Platform Interfaces" level="api">
<component id="ganeswidgets_api" name="Ganes Widgets API" class="api" introduced="^4" filter="s60">
<unit bldFile="hgwidgets_plat/ganeswidgets_api"/>