# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1276256591 -10800 # Node ID 4fa04caf0f435953926126f5f3a077413df5c309 # Parent c863538fcbb6ada14a5b66f0302e014d12f0f8e6 Revision: 201021 Kit: 2010123 diff -r c863538fcbb6 -r 4fa04caf0f43 bwins/ganeswidgetsu.def --- a/bwins/ganeswidgetsu.def Thu May 27 13:59:05 2010 +0300 +++ b/bwins/ganeswidgetsu.def Fri Jun 11 14:43:11 2010 +0300 @@ -93,4 +93,5 @@ ?animationAboutToEnd@HgMediawall@@IAEXABVQModelIndex@@@Z @ 92 NONAME ; void HgMediawall::animationAboutToEnd(class QModelIndex const &) ?setEffect3dEnabled@HgGrid@@QAEX_N@Z @ 93 NONAME ; void HgGrid::setEffect3dEnabled(bool) ?effect3dEnabled@HgGrid@@QBE_NXZ @ 94 NONAME ; bool HgGrid::effect3dEnabled(void) const + ?polish@HgMediawall@@MAEXAAVHbStyleParameters@@@Z @ 95 NONAME ; void HgMediawall::polish(class HbStyleParameters &) diff -r c863538fcbb6 -r 4fa04caf0f43 bwins/hgcacheproxymodelu.def --- a/bwins/hgcacheproxymodelu.def Thu May 27 13:59:05 2010 +0300 +++ b/bwins/hgcacheproxymodelu.def Fri Jun 11 14:43:11 2010 +0300 @@ -132,4 +132,5 @@ ?sourceModelAboutToBeReset@HgCacheProxyModel@@AAEXXZ @ 131 NONAME ; void HgCacheProxyModel::sourceModelAboutToBeReset(void) ?qt_metacall@HgDataProviderModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 132 NONAME ; int HgDataProviderModel::qt_metacall(enum QMetaObject::Call, int, void * *) ?filterKeyColumn@HgCacheProxyModel@@QBEHXZ @ 133 NONAME ; int HgCacheProxyModel::filterKeyColumn(void) const + ?getData@HgDataProviderModel@@MBE?AVQVariant@@HH@Z @ 134 NONAME ; class QVariant HgDataProviderModel::getData(int, int) const diff -r c863538fcbb6 -r 4fa04caf0f43 eabi/ganeswidgetsu.def --- a/eabi/ganeswidgetsu.def Thu May 27 13:59:05 2010 +0300 +++ b/eabi/ganeswidgetsu.def Fri Jun 11 14:43:11 2010 +0300 @@ -102,4 +102,5 @@ _ZN11HgMediawall19animationAboutToEndERK11QModelIndex @ 101 NONAME _ZN6HgGrid18setEffect3dEnabledEb @ 102 NONAME _ZNK6HgGrid15effect3dEnabledEv @ 103 NONAME + _ZN11HgMediawall6polishER17HbStyleParameters @ 104 NONAME diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/data/hgmediawall.css --- a/ganeswidgets/data/hgmediawall.css Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/data/hgmediawall.css Fri Jun 11 14:43:11 2010 +0300 @@ -1,11 +1,13 @@ HgMediawall[scrollBarPolicy="ScrollBarAlwaysOff"] { layout:layout-noscrollbar; + front-cover-elevation-factor:0.4; } HgMediawall[!scrollBarPolicy="ScrollBarAlwaysOff"] { layout:layout-scrollbar; + front-cover-elevation-factor:0.4; } HgMediawall::title @@ -36,12 +38,12 @@ size-policy: preferred preferred; } -HgMediawall::scrollbar-vertical +HgMediawall::scrollbar-horizontal { - left:-var(hb-param-margin-gene-screen); - right:var(hb-param-margin-gene-screen); - top:-var(hb-param-margin-gene-top); - bottom:var(hb-param-margin-gene-screen); + left:0un; + right:var(hb-param-widget-scroll-bar-interactive-width); + top:0un; + bottom:0un; zvalue: 2; size-policy: preferred preferred; } diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/ganeswidgets.pro --- a/ganeswidgets/ganeswidgets.pro Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/ganeswidgets.pro Fri Jun 11 14:43:11 2010 +0300 @@ -33,9 +33,9 @@ # Input SOURCES += src/hgwidgets.cpp \ src/hgwidgets_p.cpp \ - src/hgcontainer.cpp \ + src/HgContainer.cpp \ src/hgwidgetitem.cpp \ - src/hgscrollbuffermanager.cpp \ + src/HgScrollBufferManager.cpp \ src/hgquad.cpp \ src/hgquadrenderer.cpp \ src/hgvgquadrenderer.cpp \ @@ -43,7 +43,7 @@ src/hgmediawallrenderer.cpp \ src/hgspring.cpp \ src/hgdrag.cpp \ - src/hgimagefader.cpp \ + src/HgImageFader.cpp \ src/hglongpressvisualizer.cpp \ src/hgcoverflowcontainer.cpp \ src/hggridcontainer.cpp \ diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/inc/HgImageFader.h --- a/ganeswidgets/inc/HgImageFader.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/inc/HgImageFader.h Fri Jun 11 14:43:11 2010 +0300 @@ -18,9 +18,9 @@ #ifndef HGIMAGEFADER_H_ #define HGIMAGEFADER_H_ -#include -#include -#include +#include +#include +#include class HgImage; diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/inc/HgScrollBufferManager.h --- a/ganeswidgets/inc/HgScrollBufferManager.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/inc/HgScrollBufferManager.h Fri Jun 11 14:43:11 2010 +0300 @@ -19,7 +19,7 @@ #ifndef HGSCROLLBUFFERMANAGER_H_ #define HGSCROLLBUFFERMANAGER_H_ -#include +#include #include class UpdatePair diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/inc/hgcenteritemarea.h --- a/ganeswidgets/inc/hgcenteritemarea.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/inc/hgcenteritemarea.h Fri Jun 11 14:43:11 2010 +0300 @@ -30,11 +30,12 @@ virtual ~HgCenterItemArea(); signals: - void sizeChanged(); + void geometryChanged(); private: - virtual void resizeEvent(QGraphicsSceneResizeEvent *event); - + void resizeEvent(QGraphicsSceneResizeEvent *event); + void moveEvent(QGraphicsSceneMoveEvent *event); + private: // Data }; diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/inc/hgcoverflowcontainer.h --- a/ganeswidgets/inc/hgcoverflowcontainer.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/inc/hgcoverflowcontainer.h Fri Jun 11 14:43:11 2010 +0300 @@ -51,6 +51,8 @@ void setFrontItemPositionDelta(const QPointF& position); QPointF frontItemPositionDelta() const; + void setFrontItemElevationFactor(qreal factor); + void enableReflections(bool enabled); bool reflectionsEnabled() const; @@ -70,6 +72,8 @@ void onScrollingStarted(); void onScrollingEnded(); + void resizeEvent(QGraphicsSceneResizeEvent *event); + private: int mPrevPos; QSizeF mAutoSize; diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/inc/hgmediawallrenderer.h --- a/ganeswidgets/inc/hgmediawallrenderer.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/inc/hgmediawallrenderer.h Fri Jun 11 14:43:11 2010 +0300 @@ -17,9 +17,9 @@ #ifndef HGMEDIAWALLRENDERER_H #define HGMEDIAWALLRENDERER_H -#include -#include -#include +#include +#include +#include class HgQuadRenderer; class HgMediaWallDataProvider; diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/inc/hgqtquadrenderer.h --- a/ganeswidgets/inc/hgqtquadrenderer.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/inc/hgqtquadrenderer.h Fri Jun 11 14:43:11 2010 +0300 @@ -19,8 +19,8 @@ #define HGQTQUADRENDERER_H #include "hgtransformedquadrenderer.h" -#include -#include +#include +#include class QPoint; class QPainter; diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/inc/hgquad.h --- a/ganeswidgets/inc/hgquad.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/inc/hgquad.h Fri Jun 11 14:43:11 2010 +0300 @@ -18,10 +18,10 @@ #ifndef HGQUAD_H #define HGQUAD_H -#include -#include -#include -#include +#include +#include +#include +#include class HgImage; diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/inc/hgquadrenderer.h --- a/ganeswidgets/inc/hgquadrenderer.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/inc/hgquadrenderer.h Fri Jun 11 14:43:11 2010 +0300 @@ -18,7 +18,7 @@ #ifndef HGQUADRENDERER_H #define HGQUADRENDERER_H -#include +#include #include #include diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/inc/hgspring.h --- a/ganeswidgets/inc/hgspring.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/inc/hgspring.h Fri Jun 11 14:43:11 2010 +0300 @@ -18,9 +18,9 @@ #ifndef HGSPRING_H #define HGSPRING_H -#include -#include -#include +#include +#include +#include class QTimer; diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/inc/hgtransformedquad.h --- a/ganeswidgets/inc/hgtransformedquad.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/inc/hgtransformedquad.h Fri Jun 11 14:43:11 2010 +0300 @@ -18,7 +18,7 @@ #ifndef HGTRANSFORMEDQUAD_H #define HGTRANSFORMEDQUAD_H -#include +#include class HgQuad; class QMatrix4x4; diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/inc/hgtransformedquadrenderer.h --- a/ganeswidgets/inc/hgtransformedquadrenderer.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/inc/hgtransformedquadrenderer.h Fri Jun 11 14:43:11 2010 +0300 @@ -19,8 +19,8 @@ #define HGTRANSFORMEDQUADRENDERER_H #include "hgquadrenderer.h" -#include -#include +#include +#include class QPoint; class QPainter; diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/inc/hgvgimage.h --- a/ganeswidgets/inc/hgvgimage.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/inc/hgvgimage.h Fri Jun 11 14:43:11 2010 +0300 @@ -18,10 +18,10 @@ #ifndef HGVGIMAGE_H #define HGVGIMAGE_H -#include -#include +#include +#include #include -#include "HgImage.h" +#include "hgimage.h" class HgVgImagePool; class HgImageFader; diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/inc/hgvgquadrenderer.h --- a/ganeswidgets/inc/hgvgquadrenderer.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/inc/hgvgquadrenderer.h Fri Jun 11 14:43:11 2010 +0300 @@ -19,10 +19,10 @@ #define HGVGQUADRENDERER_H #include "hgtransformedquadrenderer.h" -#include +#include #include -#include -#include +#include +#include class QPoint; class QPainter; diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/inc/hgwidgetitem.h --- a/ganeswidgets/inc/hgwidgetitem.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/inc/hgwidgetitem.h Fri Jun 11 14:43:11 2010 +0300 @@ -21,8 +21,8 @@ #include #include #include -#include -#include +#include +#include "hgvgimage.h" class HgQuadRenderer; class HgImage; diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/rom/rom.pri --- a/ganeswidgets/rom/rom.pri Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/rom/rom.pri Fri Jun 11 14:43:11 2010 +0300 @@ -17,11 +17,7 @@ symbian { HGWIDGETS_IBY_DIR = $$section(PWD,":",1) - exists(/epoc32/include/platform_paths.hrh) { - BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " - } else { - BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " - } + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " BLD_INF_RULES.prj_exports += "$$HGWIDGETS_IBY_DIR/ganeswidgets.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ganeswidgets.iby)" } \ No newline at end of file diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/HgContainer.cpp --- a/ganeswidgets/src/HgContainer.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/HgContainer.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -18,9 +18,8 @@ #include #include #include -#include -#include -#include "hgcontainer.h" +#include +#include "HgContainer.h" #include "hgmediawallrenderer.h" #include "hgquad.h" #include "hgvgquadrenderer.h" @@ -28,13 +27,12 @@ #include "hgwidgetitem.h" #include "trace.h" -//#include -//#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include "hglongpressvisualizer.h" static const qreal KSpringKScrolling(50.0); @@ -231,9 +229,10 @@ mOrientation = orientation; mRenderer->setOrientation(orientation); mRenderer->setScrollDirection(orientation, animate); - if (!mSpring.isActive() && mSpring.pos().x() > worldWidth()) - boundSpring(); - + if (mSpring.isActive()) { + // Need to stop scrolling. + mSpring.cancel(); + } } void HgContainer::scrollToPosition(qreal value, bool animate) @@ -406,11 +405,10 @@ { if (index >= 0 && index < itemCount()) { if (mSelectionMode != HgWidget::NoSelection) { - // TODO, fix these returns values when we can use the checkbox indicators. if (mSelectionModel && mSelectionModel->isSelected(mSelectionModel->model()->index(index, 0))) { return 1; // TODO: Assign flag to mark indicator } else - return 0; + return 2; } } return 0; @@ -505,6 +503,12 @@ { FUNC_LOG; + if (mItems.count() == 0) { + // we have no items so no need to handle the gesture. + event->ignore(); + return; + } + bool eventHandled(false); // Event may contain more than one gesture type HbTapGesture *tap = 0; @@ -541,40 +545,35 @@ mQuadRenderer = mRenderer->getRenderer(); - QImage markImage(":/images/mark.svg"); - if (markImage.isNull()) { - ERROR("Failed to load :/images/mark.svg"); - } + // Fetch icons for marking mode (on and off states). + mMarkImageOn = mQuadRenderer->createNativeImage(); HANDLE_ERROR_NULL(mMarkImageOn); - if (mMarkImageOn) { - mMarkImageOn->setImage(markImage); - } - -/* mMarkImageOn = mQuadRenderer->createNativeImage(); - HANDLE_ERROR_NULL(mMarkImageOn); mMarkImageOff = mQuadRenderer->createNativeImage(); HANDLE_ERROR_NULL(mMarkImageOff); - // Fetch icons for marking mode (on and off states). - QGraphicsItem* checkBox = style()->createPrimitive(HbStyle::P_CheckBox_icon, this); - HbIconItem* iconItem = static_cast(checkBox); - HbStyleOptionCheckBox checkBoxOption; - checkBoxOption.state = QStyle::State_On; - style()->updatePrimitive(iconItem, HbStyle::P_CheckBox_icon, &checkBoxOption); - - if (mMarkImageOn) { - mMarkImageOn->setPixmap(iconItem->icon().pixmap()); + // Since there is no way to create the icons directly currently + // lets create HbCheckBox and ask primitives from it. + HbCheckBox* checkBox = new HbCheckBox(); + checkBox->setCheckState(Qt::Checked); + QGraphicsItem *icon = checkBox->HbWidget::primitive("icon"); + HbIconItem *iconItem = 0; + if (icon) { + iconItem = static_cast(icon); + if (mMarkImageOn) { + mMarkImageOn->setPixmap(iconItem->icon().pixmap()); + } } + checkBox->setCheckState(Qt::Unchecked); + icon = checkBox->HbWidget::primitive("icon"); + if (icon) { + iconItem = static_cast(icon); + if (mMarkImageOff) { + mMarkImageOff->setPixmap(iconItem->icon().pixmap()); + } + } + delete checkBox; - checkBoxOption.state = QStyle::State_Off; - style()->updatePrimitive(iconItem, HbStyle::P_CheckBox_icon, &checkBoxOption); - if (mMarkImageOff) { - mMarkImageOff->setPixmap(iconItem->icon().pixmap()); - } - - delete checkBox; -*/ connect(&mSpring, SIGNAL(updated()), SLOT(updateBySpringPosition())); connect(&mSpring, SIGNAL(started()), SIGNAL(scrollingStarted())); connect(&mSpring, SIGNAL(started()), SLOT(onScrollingStarted())); @@ -883,7 +882,9 @@ for (int i = 0; i < quads.count(); i++) { bool ok; int index = quads.at(i)->userData().toInt(&ok); - result.append(itemByIndex(index)->modelIndex()); + HgWidgetItem *item = itemByIndex(index); + if (item) + result.append(item->modelIndex()); } qSort(result); return result; @@ -892,7 +893,7 @@ void HgContainer::itemDataChanged(const int &firstIndex, const int &lastIndex) { FUNC_LOG; - + int firstItemOnScreen = 0, lastItemOnScreen = 0; firstItemOnScreen = mSpring.pos().x(); firstItemOnScreen *= rowCount(); @@ -900,14 +901,15 @@ int itemsOnScreen = mRenderer->getVisibleQuads().count(); lastItemOnScreen = firstItemOnScreen+itemsOnScreen; - if ((firstIndex >= firstItemOnScreen && firstIndex < lastItemOnScreen) || + if ( itemsOnScreen == 0 || (firstIndex >= firstItemOnScreen && firstIndex < lastItemOnScreen) || (lastIndex >= firstItemOnScreen && lastIndex < lastItemOnScreen)) { update(); - } + } } void HgContainer::selectItem(int index) { + Q_UNUSED(index) // TODO: replace this with own selection implementation /* if (index < 0 && index >= mItems.count()) return; diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hgcenteritemarea.cpp --- a/ganeswidgets/src/hgcenteritemarea.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hgcenteritemarea.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -35,6 +35,14 @@ FUNC_LOG; INFO("HgCenterItemArea: size:" << size() << event->newSize()); - emit sizeChanged(); HbWidget::resizeEvent(event); + emit geometryChanged(); } + +void HgCenterItemArea::moveEvent(QGraphicsSceneMoveEvent *event) +{ + HbWidget::moveEvent(event); + emit geometryChanged(); +} + + diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hgcoverflowcontainer.cpp --- a/ganeswidgets/src/hgcoverflowcontainer.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hgcoverflowcontainer.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -208,6 +208,11 @@ return mRenderer ? mRenderer->frontItemPosition() : QPointF(); } +void HgCoverflowContainer::setFrontItemElevationFactor(qreal factor) +{ + mRenderer->setFrontCoverElevationFactor(factor); +} + void HgCoverflowContainer::enableReflections(bool enabled) { if (mRenderer) @@ -225,9 +230,14 @@ if (!mCenterItemArea) { mCenterItemArea = centerItemArea; - connect(mCenterItemArea, SIGNAL(sizeChanged()), SLOT(updateItemSize())); + connect(mCenterItemArea, SIGNAL(geometryChanged()), SLOT(updateItemSize())); } } +void HgCoverflowContainer::resizeEvent(QGraphicsSceneResizeEvent *event) +{ + HgContainer::resizeEvent(event); + updateItemSize(); +} - +// EOF diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hggridcontainer.cpp --- a/ganeswidgets/src/hggridcontainer.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hggridcontainer.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -18,9 +18,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include "hggridcontainer.h" #include "hgmediawallrenderer.h" #include "hgquad.h" @@ -29,10 +29,9 @@ #include "hgwidgetitem.h" #include "trace.h" -#include -#include -#include -#include +#include +#include +#include #include "hglongpressvisualizer.h" diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hglongpressvisualizer.cpp --- a/ganeswidgets/src/hglongpressvisualizer.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hglongpressvisualizer.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -18,9 +18,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include "hglongpressvisualizer.h" HgLongPressVisualizer::HgLongPressVisualizer(QGraphicsItem* parent) : HbWidget(parent), diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hgmediawall.cpp --- a/ganeswidgets/src/hgmediawall.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hgmediawall.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -19,8 +19,14 @@ #include "hgmediawall_p.h" #include "hgwidgets_p.h" #include "hgcoverflowcontainer.h" -#include -#include +#include +#include + +/* + string name from the mediwall .css for the front cover elevation factor. +*/ +static const QString FRONT_COVER_ELEVATION_FACTOR = QLatin1String("front-cover-elevation-factor"); + HgMediawall::HgMediawall(QGraphicsItem *parent ) : HgWidget( *new HgMediawallPrivate, parent ) @@ -133,4 +139,20 @@ return d->container()->reflectionsEnabled(); } +void HgMediawall::polish(HbStyleParameters& params) +{ + // Read front cover elevation factor from css file. + params.addParameter( FRONT_COVER_ELEVATION_FACTOR ); + + HbWidget::polish( params ); + + bool success = false; + double factor = params.value( FRONT_COVER_ELEVATION_FACTOR ).toDouble(&success); + if (success) { + Q_D(HgMediawall); + d->container()->setFrontItemElevationFactor(factor); + } +} + + // EOF diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hgmediawallrenderer.cpp --- a/ganeswidgets/src/hgmediawallrenderer.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hgmediawallrenderer.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -14,7 +14,7 @@ * Description: * */ -#include "HgMediaWallRenderer.h" +#include "hgmediawallrenderer.h" #include "hgmediawalldataprovider.h" #include "hgquadrenderer.h" #include "hgquad.h" @@ -22,19 +22,19 @@ #include "HgImageFader.h" #include "hgvgquadrenderer.h" #include "hgqtquadrenderer.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include const qreal KPi = 3.1415926535897932384626433832795; @@ -178,7 +178,7 @@ qreal posY = 0.5f - (rect.height() / rect.width() / 2.0 - stepY / 2.0); tm.translate(-posY,0); rm.rotate(-90, QVector3D(0,0,1)); - rot = QQuaternion::fromAxisAndAngle(QVector3D(0,0,1), -90); + rot = QQuaternion::fromAxisAndAngle(QVector3D(0,0,1), 90); } else if (mNextScrollDirection == Qt::Vertical) { @@ -187,7 +187,6 @@ rot = QQuaternion::fromAxisAndAngle(QVector3D(0,0,1), -90); } - } HgAnimatedQuad* createQuad(HgQuad* qA, HgQuad* qB) const @@ -725,6 +724,8 @@ const QTransform& sceneTransform, const QRectF& rect) { + Q_UNUSED(sceneTransform) + Q_UNUSED(rect) // save state for current orientation setupRows(startPosition, position, targetPosition, springVelocity, painter); @@ -763,6 +764,9 @@ const QTransform& sceneTransform, const QRectF& rect) { + Q_UNUSED(sceneTransform) + Q_UNUSED(rect) + setupRows(startPosition, position, targetPosition, springVelocity, painter); recordState(mOldState); @@ -983,7 +987,7 @@ quad->setPosition(pos); const HgImage* image = mDataProvider->image(itemIndex); quad->setImage(image); - quad->setVisible(true/*image && image->alpha() != 0*/); + quad->setVisible(image && image->alpha() != 0); quad->setScale(QVector2D(mImageSize3D.width(),mImageSize3D.height())); quad->setPivot(QVector2D(0,0)); quad->setUserData(QVariant(itemIndex)); @@ -999,7 +1003,7 @@ { HgQuad* indicator = mRenderer->quad(quadIndex++); setupIndicator(quad, indicator, indicatorImage, - itemIndex); + itemIndex+1000); indicator->enableMirrorImage(reflectionsEnabled); } diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hgqtquadrenderer.cpp --- a/ganeswidgets/src/hgqtquadrenderer.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hgqtquadrenderer.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -21,11 +21,11 @@ #include "trace.h" #include "hgimage.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include class HgQtImage : public HgImage @@ -33,7 +33,7 @@ public: HgQtImage(HgQtQuadRenderer* renderer) { - + Q_UNUSED(renderer) } ~HgQtImage() @@ -90,6 +90,7 @@ const QPixmap& mirrorPixmap(QPainter* painter) { + Q_UNUSED(painter) return mPixmap; /* @@ -253,6 +254,8 @@ Qt::Orientation orientation, const QTransform& sceneTransform) { + Q_UNUSED(orientation) + Q_UNUSED(sceneTransform) transformQuads(viewMatrix, projectionMatrix, QPointF(rect.width()/2, rect.height()/2), QSizeF(rect.width(), rect.height())); diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hgquad.cpp --- a/ganeswidgets/src/hgquad.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hgquad.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -#include "HgQuad.h" +#include "hgquad.h" HgQuad::HgQuad() : mRotation(QQuaternion(1,0,0,0)), diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hgspring.cpp --- a/ganeswidgets/src/hgspring.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hgspring.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -15,8 +15,8 @@ * */ -#include "HgSpring.h" -#include +#include "hgspring.h" +#include #include "trace.h" const int KTimeDelta(10); diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hgtransformedquad.cpp --- a/ganeswidgets/src/hgtransformedquad.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hgtransformedquad.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -18,10 +18,10 @@ #include "hgtransformedquad.h" #include "hgquad.h" #include "trace.h" -#include -#include -#include -#include +#include +#include +#include +#include HgTransformedQuad::HgTransformedQuad(qreal yDir) : mYDir(yDir) { diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hgtransformedquadrenderer.cpp --- a/ganeswidgets/src/hgtransformedquadrenderer.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hgtransformedquadrenderer.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -21,10 +21,10 @@ #include "trace.h" #include "hgimage.h" -#include -#include -#include -#include +#include +#include +#include +#include HgTransformedQuadRenderer::HgTransformedQuadRenderer(int maxQuads) : diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hgvgimage.cpp --- a/ganeswidgets/src/hgvgimage.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hgvgimage.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -#include "HgVgImage.h" +#include "hgvgimage.h" #include "HgImageFader.h" #include "hgvgquadrenderer.h" @@ -91,7 +91,7 @@ void HgVgImage::setPixmap(const QPixmap& pixmap) { - + Q_UNUSED(pixmap) } QImage HgVgImage::getQImage() const diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hgvgquadrenderer.cpp --- a/ganeswidgets/src/hgvgquadrenderer.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hgvgquadrenderer.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -24,11 +24,10 @@ #include #include -#include -#include -#include -#include - +#include +#include +#include +#include static void matrixFromTransform(VGfloat* matrix, const QTransform& tm) { @@ -140,6 +139,7 @@ void computeWarpMatrix(VGfloat* matrix, int pxWidth, int pxHeight, const QVector2D* points, const QVector2D& translate) { + Q_UNUSED(translate) vguComputeWarpQuadToQuad( points[0].x(), points[0].y(), diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hgwidgetitem.cpp --- a/ganeswidgets/src/hgwidgetitem.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hgwidgetitem.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -114,6 +114,12 @@ { mValidData = false; if( mModelIndex.isValid() ){ + + if (!mHgImage) + { + mHgImage = mRenderer->createNativeImage(); + } + QVariant image = mModelIndex.data(Qt::DecorationRole); QVariant texts = mModelIndex.data(Qt::DisplayRole); @@ -121,8 +127,9 @@ if (vis.canConvert()) { setVisibility(vis.toBool()); + } else { + setVisibility(true); } - // Convert data to correct format if possible. if (image.type() == QVariant::Pixmap) @@ -146,11 +153,8 @@ if (size.width() != 0 && size.height() != 0 ){ QPixmap pixmap = qicon.pixmap(size); if (!pixmap.isNull()){ - QImage tempImage = pixmap.toImage(); - if (!tempImage.isNull()) { - setImage(tempImage); - mValidData = true; - } + setPixmap(pixmap); + mValidData = true; } break; } @@ -166,7 +170,7 @@ QPixmap pixmap = tempIcon.pixmap(tempIcon.actualSize(QSize(250, 250))); if (!pixmap.isNull()){ INFO("Valid image found for" << mModelIndex); - setImage(pixmap.toImage()); + setPixmap(pixmap); mValidData = true; } } @@ -176,7 +180,7 @@ if (size.width() != 0 && size.height() != 0 ){ QPixmap pixmap = tempIcon.pixmap(size); if (!pixmap.isNull()){ - setImage(pixmap.toImage()); + setPixmap(pixmap); mValidData = true; } break; @@ -186,10 +190,12 @@ } if( texts.canConvert() ){ QStringList list(texts.toStringList() ); - if( list.count() >= 2 ){ + if (list.count() >= 1) { + mValidData = true; setTitle(list.at(0)); + } + if (list.count() >= 2){ setDescription(list.at(1)); - mValidData = true; } } diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hgwidgets.cpp --- a/ganeswidgets/src/hgwidgets.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hgwidgets.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -16,16 +16,16 @@ */ #include -#include -#include -#include +#include +#include +#include #include -#include +#include #include "hgwidgets_p.h" -#include "hgcontainer.h" +#include "HgContainer.h" #include "hgwidgetitem.h" -#include "hgscrollbuffermanager.h" +#include "HgScrollBufferManager.h" #include "hggridcontainer.h" #include "trace.h" diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/src/hgwidgets_p.cpp --- a/ganeswidgets/src/hgwidgets_p.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/src/hgwidgets_p.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -20,9 +20,9 @@ #include #include "hgwidgets_p.h" -#include "hgcontainer.h" +#include "HgContainer.h" #include "hgcoverflowcontainer.h" -#include "hgscrollbuffermanager.h" +#include "HgScrollBufferManager.h" #include "hgwidgetitem.h" #include "trace.h" //#include "hgindexfeedback.h" @@ -122,12 +122,18 @@ QItemSelectionModel *oldSelectionModel = mDefaultSelectionModel; mDefaultSelectionModel = 0; mDefaultSelectionModel = new QItemSelectionModel(mModel); + q->connect(mDefaultSelectionModel, + SIGNAL(currentChanged(QModelIndex, QModelIndex)), + SLOT(_q_updateCurrentItem(QModelIndex, QModelIndex))); mContainer->setSelectionModel(mDefaultSelectionModel, defaultItem); delete oldSelectionModel; } else if (selectionModel != mContainer->selectionModel()) { QItemSelectionModel *oldSelectionModel = mDefaultSelectionModel; mDefaultSelectionModel = 0; + q->connect(selectionModel, + SIGNAL(currentChanged(QModelIndex, QModelIndex)), + SLOT(_q_updateCurrentItem(QModelIndex, QModelIndex))); mContainer->setSelectionModel(selectionModel, defaultItem); delete oldSelectionModel; } @@ -140,9 +146,6 @@ // mIndexFeedback = new HgIndexFeedback(q); // mIndexFeedback->setWidget(q); - q->connect(mContainer->selectionModel(), - SIGNAL(currentChanged(QModelIndex, QModelIndex)), - SLOT(_q_updateCurrentItem(QModelIndex, QModelIndex))); } } } @@ -348,7 +351,16 @@ // is visible. if (firstUpdated != -1 && lastUpdated != -1) { mContainer->itemDataChanged(firstUpdated, lastUpdated); - } + // if item data for current has changed we need to update current. + if (mContainer->selectionModel()) { + QModelIndex currentIndex = mContainer->selectionModel()->currentIndex(); + if (currentIndex.isValid() && + currentIndex.row() >= firstUpdated && + currentIndex.row() <= lastUpdated) { + updateCurrentItem(currentIndex); + } + } + } } void HgWidgetPrivate::_q_scrollPositionChanged(qreal index,bool scrollBarAnimation) @@ -571,17 +583,19 @@ // Buffermanager requests items to be updated. mBufferManager->resetBuffer(0, newItemCount); - QItemSelectionModel *selectionModel = mContainer->selectionModel(); - if (mModel->rowCount() > 0) { - if (selectionModel && selectionModel->currentIndex().isValid()) { - scrollTo(selectionModel->currentIndex()); - } - else { - setCurrentIndex(mModel->index(0, 0)); - scrollTo(mModel->index(0, 0)); - } + } + + // Update selection model's current. + QItemSelectionModel *selectionModel = mContainer->selectionModel(); + if (mModel->rowCount() > 0) { + if (selectionModel && selectionModel->currentIndex().isValid()) { + scrollTo(selectionModel->currentIndex()); } - } + else { + setCurrentIndex(mModel->index(0, 0)); + scrollTo(mModel->index(0, 0)); + } + } } } @@ -761,6 +775,7 @@ void HgWidgetPrivate::setIndexFeedbackPolicy( HgWidget::IndexFeedbackPolicy policy) { + Q_UNUSED(policy) // mIndexFeedback->setIndexFeedbackPolicy(policy); } diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/tsrc/fute/HgWidgetTest/data/hgmediawall.css --- a/ganeswidgets/tsrc/fute/HgWidgetTest/data/hgmediawall.css Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/data/hgmediawall.css Fri Jun 11 14:43:11 2010 +0300 @@ -1,11 +1,13 @@ HgMediawall[scrollBarPolicy="ScrollBarAlwaysOff"] { layout:layout-noscrollbar; + front-cover-elevation-factor:0.7; } HgMediawall[!scrollBarPolicy="ScrollBarAlwaysOff"] { layout:layout-scrollbar; + front-cover-elevation-factor:0.7; } HgMediawall::title @@ -36,12 +38,12 @@ size-policy: preferred preferred; } -HgMediawall::scrollbar-vertical +HgMediawall::scrollbar-horizontal { - left:-var(hb-param-margin-gene-screen); - right:var(hb-param-margin-gene-screen); - top:-var(hb-param-margin-gene-top); - bottom:var(hb-param-margin-gene-screen); + left:0un; + right:var(hb-param-widget-scroll-bar-interactive-width); + top:0un; + bottom:0un; zvalue: 2; size-policy: preferred preferred; } @@ -62,6 +64,6 @@ left:-var(hb-param-touch-area-gene-primary-medium); right:var(hb-param-touch-area-gene-primary-medium); top:-3un; - bottom:3un; + bottom:6un; zvalue: 2; } diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/tsrc/fute/HgWidgetTest/data/hgmediawall.widgetml --- a/ganeswidgets/tsrc/fute/HgWidgetTest/data/hgmediawall.widgetml Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/data/hgmediawall.widgetml Fri Jun 11 14:43:11 2010 +0300 @@ -7,12 +7,10 @@ - - - + - - + + diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgselectiondialog.h --- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgselectiondialog.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgselectiondialog.h Fri Jun 11 14:43:11 2010 +0300 @@ -41,6 +41,7 @@ HgWidget *mHgWidget; HbPushButton *mSelectAll; HbLabel *mCountLabel; + HbAction* mPrimaryAction; }; #endif //HGSELECTIONDIALOG_H diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestview.h --- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestview.h Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestview.h Fri Jun 11 14:43:11 2010 +0300 @@ -85,6 +85,7 @@ void activated(/*HbListWidgetItem *item*/); void animationFinished(); void animationAboutToEnd(const QModelIndex& targetIndex); + void dialogFinished(HbAction* action); private: diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/tsrc/fute/HgWidgetTest/src/hgselectiondialog.cpp --- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgselectiondialog.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgselectiondialog.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -36,9 +36,9 @@ setDismissPolicy(HbDialog::NoDismiss); setTimeout(HbDialog::NoTimeout); setHeadingWidget(new HbLabel(title, this)); - HbAction *action = new HbAction(primaryText, this); - addAction(action); - action->setDisabled(true); + mPrimaryAction = new HbAction(primaryText, this); + addAction(mPrimaryAction); + mPrimaryAction->setDisabled(true); addAction(new HbAction("Cancel", this)); connect(content->selectionModel(), @@ -95,7 +95,7 @@ QItemSelectionModel *selectionModel = mHgWidget->selectionModel(); QAbstractItemModel *model = mHgWidget->model(); if (selectionModel && model) { - primaryAction()->setEnabled(selectionModel->hasSelection()); + mPrimaryAction->setEnabled(selectionModel->hasSelection()); int selectedCount = selectionModel->selectedIndexes().count(); int itemCount = model->rowCount(); diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestdatamodel.cpp --- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestdatamodel.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestdatamodel.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -101,6 +101,7 @@ if (s.indexOf(QString(".jpg"),0,Qt::CaseInsensitive)>0){ mFiles.append(s); mImages.append(QImage()); + mPixmaps.append(QPixmap()); mVisibility.append(true); } } @@ -269,7 +270,15 @@ break; case ImageTypeHbIcon: { - returnValue = mHbIcon; + QPixmap pixmap = mPixmaps.at(row); + if (!pixmap.isNull()) { + QIcon qicon(mPixmaps.at(row)); + if (!qicon.isNull()){ + returnValue = HbIcon(qicon); + }else { + returnValue = mHbIcon; + } + } } break; case ImageTypeQIcon: @@ -509,7 +518,7 @@ delete mBufferManager; mBufferManager = 0; mBufferManager = new BufferManager(this, buffer, treshhold, 0, mFiles.count()); - if (mImageType == ImageTypeQPixmap) + if (mImageType == ImageTypeQPixmap || mImageType == ImageTypeHbIcon) { for (int i = 0; i(data); - if (mImageType == ImageTypeQPixmap) + if (mImageType == ImageTypeQPixmap || mImageType == ImageTypeHbIcon) { mPixmaps.replace(mThumbnailRequestIndex, pixmap); } diff -r c863538fcbb6 -r 4fa04caf0f43 ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestview.cpp --- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestview.cpp Thu May 27 13:59:05 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestview.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -76,6 +76,8 @@ HgWidgetTestView::~HgWidgetTestView() { delete mAnimationGroup; + HbStyleLoader::unregisterFilePath(":/test/hgmediawall.css"); + HbStyleLoader::unregisterFilePath(":/test/hgmediawall.widgetml"); } void HgWidgetTestView::createMenu() @@ -171,6 +173,7 @@ HbMainWindow *primaryWindow = mainWindows[0]; connect(primaryWindow, SIGNAL(orientationChanged(Qt::Orientation)), mWidget, SLOT(orientationChanged(Qt::Orientation))); connect(primaryWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation))); + primaryWindow->setAutomaticOrientationEffectEnabled(false); } setupWidgetOptions(); setupWidgetSize(); @@ -509,10 +512,11 @@ if (mainWindows.count() > 0) { HbMainWindow *primaryWindow = mainWindows[0]; + connect(primaryWindow, SIGNAL(orientationChanged(Qt::Orientation)), view, SLOT(orientationChanged(Qt::Orientation))); primaryWindow->addView(view); primaryWindow->setCurrentView(view); // For photos simulation - primaryWindow->setOrientation(Qt::Horizontal, false); +// primaryWindow->setOrientation(Qt::Horizontal, false); } } } @@ -529,25 +533,32 @@ primaryWindow->setCurrentView(this); primaryWindow->removeView(currentView); // For photos simulation - primaryWindow->unsetOrientation(false); +// primaryWindow->unsetOrientation(false); } } void HgWidgetTestView::openDeleteItemsDialog() { FUNC_LOG; -/* HANDLE_ERROR_NULL(mWidget); + HANDLE_ERROR_NULL(mWidget); + +// HgWidget *widget = copyWidget(); +// HANDLE_ERROR_NULL(widget); - HgWidget *widget = copyWidget(); - HANDLE_ERROR_NULL(widget); - + mLayout->removeItem(mWidget); + HgSelectionDialog *dlg = - new HgSelectionDialog("Remove items", "Remove", widget); // Takes ownership of widget + new HgSelectionDialog("Remove items", "Remove", mWidget); // Takes ownership of widget HANDLE_ERROR_NULL(dlg); - mWidget->hide(); - widget->setSelectionMode(HgWidget::MultiSelection); - bool removeItems = (dlg->exec() == dlg->primaryAction()); + mWidget->setPreferredSize(mWidget->size()); + connect(dlg, SIGNAL(finished(HbAction*)), + SLOT(dialogFinished(HbAction*))); + +// mWidget->hide(); + mWidget->setSelectionMode(HgWidget::MultiSelection); + dlg->open(); +/* bool removeItems = (dlg->exec() == dlg->primaryAction()); QItemSelection selection = mSelectionModel->selection(); widget->setSelectionMode(HgWidget::NoSelection); // Clears the selection delete dlg; @@ -555,9 +566,18 @@ if (removeItems) { mModel->remove(selection); } +*/ +// mWidget->show(); +} - mWidget->show(); - */ +void HgWidgetTestView::dialogFinished(HbAction* action) +{ + mWidget->setSelectionMode(HgWidget::NoSelection); // Clears the selection + if (action->text() == "Remove" ) { + QItemSelection selection = mSelectionModel->selection(); + mModel->remove(selection); + } + mLayout->addItem(mWidget); } void HgWidgetTestView::openMoveItemsDialog() @@ -781,6 +801,9 @@ HgWidget* widget = 0; + HbStyleLoader::unregisterFilePath(":/test/hgmediawall.css"); + HbStyleLoader::unregisterFilePath(":/test/hgmediawall.widgetml"); + switch (type) { case HgWidgetGrid: mModel->setThumbnailSize(ThumbnailManager::ThumbnailMedium); @@ -792,8 +815,9 @@ mModel->setThumbnailSize(ThumbnailManager::ThumbnailMedium); mModel->setBuffer(COVERFLOWBUFFERSIZE, COVERFLOWBUFFERSIZE/3); HgMediawall *mediaWall = new HgMediawall; - // mediaWall->setItemSize(QSizeF(4, 3)); // Sets aspect ratio - // mediaWall->enableReflections(true); +// mediaWall->setItemSize(QSizeF(4, 3)); // Sets aspect ratio + HbStyleLoader::registerFilePath(":/test/hgmediawall.css"); + HbStyleLoader::registerFilePath(":/test/hgmediawall.widgetml"); widget = mediaWall; } break; @@ -801,13 +825,15 @@ mModel->setThumbnailSize(ThumbnailManager::ThumbnailMedium); mModel->setBuffer(COVERFLOWBUFFERSIZE, COVERFLOWBUFFERSIZE/3); widget = new HgMediawall; + HbStyleLoader::registerFilePath(":/test/hgmediawall.css"); + HbStyleLoader::registerFilePath(":/test/hgmediawall.widgetml"); break; default: break; } HANDLE_ERROR_NULL(widget); - + widget->setModel(mModel); widget->setSelectionModel(mSelectionModel); widget->setLongPressEnabled(true); @@ -852,6 +878,8 @@ { FUNC_LOG; + qDebug() << "SCROLLING onScrollingStarted"; + // scrolling started, need to hide // label displaying full resolution image if (mFrontItem) @@ -863,6 +891,8 @@ { FUNC_LOG; + qDebug() << "SCROLLING onScrollingEnded"; + if (mModel->lowResImagesEnabled()) { if (!mWidget) @@ -914,11 +944,13 @@ delete mCoverItem; mCoverItem = 0; mAnimationGroup->clear(); - - if (orientation == Qt::Horizontal && (mWidgetType == HgWidgetCoverflow || mWidgetType == HgWidgetGrid )) { + if (orientation == Qt::Horizontal && mWidgetType == HgWidgetCoverflow) { setItemVisible(Hb::AllItems, false); } + else if (orientation == Qt::Horizontal && mWidgetType == HgWidgetGrid && mainWindow()->currentView() == this ) { + setItemVisible(Hb::AllItems, false); + } else if (orientation == Qt::Horizontal && mWidgetType == HgWidgetTBone) { initWidget(HgWidgetCoverflow); setItemVisible(Hb::AllItems, false); diff -r c863538fcbb6 -r 4fa04caf0f43 hgcacheproxymodel/src/hgbuffermanager.cpp --- a/hgcacheproxymodel/src/hgbuffermanager.cpp Thu May 27 13:59:05 2010 +0300 +++ b/hgcacheproxymodel/src/hgbuffermanager.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -13,7 +13,7 @@ * * Description: * -* Version : %version: 4 % +* Version : %version: 5 % */ #include "hgbuffermanager.h" #include @@ -246,7 +246,7 @@ void HgBufferManager::aboutToInsertItem(int pos) { - if(pos < 0 || pos >= mTotalCount ){ + if(pos < 0 || pos > mTotalCount ){ return; } @@ -260,7 +260,7 @@ void HgBufferManager::insertedItem(int pos) { - if(pos < 0 || pos >= mTotalCount ){ + if(pos < 0 || pos > mTotalCount ){ return; } diff -r c863538fcbb6 -r 4fa04caf0f43 hgcacheproxymodel/src/hgdataprovidermodel.cpp --- a/hgcacheproxymodel/src/hgdataprovidermodel.cpp Thu May 27 13:59:05 2010 +0300 +++ b/hgcacheproxymodel/src/hgdataprovidermodel.cpp Fri Jun 11 14:43:11 2010 +0300 @@ -13,11 +13,11 @@ * * Description: * -* Version : %version: 9 % +* Version : %version: 12 % */ #include #include -#include +#include #include #include #include @@ -132,8 +132,13 @@ QVariant res; if ( containsRole(idx, role)){ res = mCache->at(idx)->value(role); - } else if (role == Qt::DecorationRole ){ - res = defaultIcon(); + } else if (isIndexValid(idx)){ + if (role == Qt::DecorationRole ){ + res = defaultIcon(); + } else { + res = getData(idx,role); + } + } return res; } @@ -165,7 +170,7 @@ bool HgDataProviderModel::update(int pos, QList< QPair< QVariant, int > >* list, bool silent) { bool change(false); - if (list && list->count() && pos >=0 && posat(pos)) { + if (list && list->count() && isIndexValid(pos)) { while(list->count()>0){ QPair< QVariant, int > pair = list->takeFirst(); change = update(pos, pair.first, pair.second, true)|change; @@ -182,7 +187,9 @@ bool change(false); if ( isIndexValid(pos)){ + mDataLock.lock(); mCache->at(pos)->insert(role, obj); //this will remove old one if needed + mDataLock.unlock(); change = true; } @@ -196,7 +203,9 @@ { bool change(false); if ( obj.isValid() && !obj.isNull() && isIndexValid(pos) ){ + mDataLock.lock(); mCache->at(pos)->insert(Qt::DecorationRole, obj); //will remove old if needed + mDataLock.unlock(); change = true; if (!silent){ TX_LOG_ARGS(QString("pos:%1").arg( pos ) ); @@ -251,7 +260,10 @@ beginInsertRows(QModelIndex(), pos, pos); } + mDataLock.lock(); mCache->insert(pos, new QMap()); + mDataLock.unlock(); + if (list && list->count()){ update(pos, list, true); } @@ -283,9 +295,11 @@ } beginRemoveRows(QModelIndex(),pos, pos+size-1); + mDataLock.lock(); for (int i=0; icount(); i++){ mCache->removeAt(pos); } + mDataLock.unlock(); endRemoveRows(); } @@ -308,7 +322,7 @@ void HgDataProviderModel::resizeQPixmapPool(int newSize) { -// mQPixmapsLock.lock(); + mQPixmapsLock.lock(); int currentSize = mFreePixmaps.count() + mUsedPixmaps.count(); int diff = currentSize - newSize - KQPixmapCacheEmergencyBuffer; mUnallocatedPixmaps = 0; @@ -325,13 +339,13 @@ diff--; } } -// mQPixmapsLock.unlock(); + mQPixmapsLock.unlock(); mCacheSize = newSize; } void HgDataProviderModel::releasePixmap(int idx) { -// mQPixmapsLock.lock(); + mQPixmapsLock.lock(); if (mUsedPixmaps.contains(idx)) { QPixmap* pix = mUsedPixmaps.take(idx); if ( ( mFreePixmaps.count() + mUsedPixmaps.count() + mUnallocatedPixmaps ) > ( mCacheSize + KQPixmapCacheEmergencyBuffer ) ) { @@ -342,7 +356,7 @@ } else { // TX_LOG_ARGS( QString("can't release pixmap for idx=%0").arg(idx)); } -// mQPixmapsLock.unlock(); + mQPixmapsLock.unlock(); } QVariant HgDataProviderModel::createIcon(int index, QPixmap aPixmap) @@ -355,9 +369,9 @@ } else { *pix = aPixmap; } -// mQPixmapsLock.lock(); + mQPixmapsLock.lock(); mUsedPixmaps.insert(index, pix); -// mQPixmapsLock.unlock(); + mQPixmapsLock.unlock(); return HbIcon(QIcon(*pix)); } TX_EXIT_ARGS( QString("No pixmap avilable")); @@ -368,7 +382,7 @@ { // TX_ENTRY QPixmap* res = NULL; -// mQPixmapsLock.lock(); + mQPixmapsLock.lock(); if ( mUsedPixmaps.contains(idx)){ res = mUsedPixmaps.take(idx);//let's just replace pixmapdata for that pixmap } else { @@ -381,7 +395,7 @@ TX_LOG_ARGS(QString("no free pixmaps")); } } -// mQPixmapsLock.unlock(); + mQPixmapsLock.unlock(); // TX_EXIT return res; } diff -r c863538fcbb6 -r 4fa04caf0f43 hgwidgets_plat/ganeswidgets_api/inc/hgmediawall.h --- a/hgwidgets_plat/ganeswidgets_api/inc/hgmediawall.h Thu May 27 13:59:05 2010 +0300 +++ b/hgwidgets_plat/ganeswidgets_api/inc/hgmediawall.h Fri Jun 11 14:43:11 2010 +0300 @@ -53,6 +53,7 @@ protected: HgMediawall(HgMediawallPrivate &dd, QGraphicsItem *parent); + void polish(HbStyleParameters& params); private: Q_DECLARE_PRIVATE_D(p_ptr, HgMediawall) diff -r c863538fcbb6 -r 4fa04caf0f43 hgwidgets_plat/hgcacheproxymodel_api/inc/hgdataprovidermodel.h --- a/hgwidgets_plat/hgcacheproxymodel_api/inc/hgdataprovidermodel.h Thu May 27 13:59:05 2010 +0300 +++ b/hgwidgets_plat/hgcacheproxymodel_api/inc/hgdataprovidermodel.h Fri Jun 11 14:43:11 2010 +0300 @@ -13,7 +13,7 @@ * * Description: * -* Version : %version: 5 % +* Version : %version: 8 % */ #ifndef HGDATAPROVIDERMODEL_H_ #define HGDATAPROVIDERMODEL_H_ @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -96,6 +96,7 @@ protected: virtual void doResetModel() {}; + virtual QVariant getData(int idx, int role) const {return QVariant(); }; // helpers fot emits protected: @@ -119,7 +120,8 @@ QList< QPixmap* > mFreePixmaps; QMap< int, QPixmap* > mUsedPixmaps; int mUnallocatedPixmaps; -// QMutex mQPixmapsLock; + QMutex mQPixmapsLock; + QMutex mDataLock; HgDataProviderModelObserver *mObserver; }; @@ -136,7 +138,4 @@ mCache->at(idx)->contains(role) ); } - - - #endif // HGDATAPROVIDERMODEL_H_