--- a/bwins/ganeswidgetsu.def Fri Jul 23 10:05:37 2010 +0300
+++ b/bwins/ganeswidgetsu.def Fri Aug 06 09:27:34 2010 +0300
@@ -94,6 +94,4 @@
?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 &)
- ?titleAndDescriptionVisibility@HgMediawall@@QBE?AW4TitleAndDescrVisibility@1@XZ @ 96 NONAME ; enum HgMediawall::TitleAndDescrVisibility HgMediawall::titleAndDescriptionVisibility(void) const
- ?setTitleAndDescriptionVisibility@HgMediawall@@QAEXW4TitleAndDescrVisibility@1@@Z @ 97 NONAME ; void HgMediawall::setTitleAndDescriptionVisibility(enum HgMediawall::TitleAndDescrVisibility)
--- a/eabi/ganeswidgetsu.def Fri Jul 23 10:05:37 2010 +0300
+++ b/eabi/ganeswidgetsu.def Fri Aug 06 09:27:34 2010 +0300
@@ -103,6 +103,4 @@
_ZN6HgGrid18setEffect3dEnabledEb @ 102 NONAME
_ZNK6HgGrid15effect3dEnabledEv @ 103 NONAME
_ZN11HgMediawall6polishER17HbStyleParameters @ 104 NONAME
- _ZN11HgMediawall32setTitleAndDescriptionVisibilityENS_23TitleAndDescrVisibilityE @ 105 NONAME
- _ZNK11HgMediawall29titleAndDescriptionVisibilityEv @ 106 NONAME
--- a/ganeswidgets/data/hgmediawall.widgetml Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/data/hgmediawall.widgetml Fri Aug 06 09:27:34 2010 +0300
@@ -8,9 +8,11 @@
<meshitem src="scrollbar-horizontal" srcEdge="RIGHT" dst="content" dstEdge="RIGHT" />
<meshitem src="scrollbar-horizontal" srcEdge="LEFT" dst="content" dstEdge="LEFT" />
<meshitem src="description" srcEdge="BOTTOM" dst="scrollbar-horizontal" dstEdge="TOP" />
- <meshitem src="description" srcEdge="CENTERH" dst="content" dstEdge="CENTERH" />
+ <meshitem src="description" srcEdge="LEFT" dst="content" dstEdge="LEFT" />
+ <meshitem src="description" srcEdge="RIGHT" dst="content" dstEdge="RIGHT" />
<meshitem src="title" srcEdge="BOTTOM" dst="description" dstEdge="TOP" />
- <meshitem src="title" srcEdge="CENTERH" dst="content" dstEdge="CENTERH" />
+ <meshitem src="title" srcEdge="LEFT" dst="content" dstEdge="LEFT" />
+ <meshitem src="title" srcEdge="RIGHT" dst="content" dstEdge="RIGHT" />
<meshitem src="centeritem" srcEdge="BOTTOM" dst="title" dstEdge="TOP" />
<meshitem src="centeritem" srcEdge="TOP" dst="content" dstEdge="TOP" />
<meshitem src="centeritem" srcEdge="RIGHT" dst="content" dstEdge="RIGHT" />
@@ -22,9 +24,11 @@
<meshitem src="content" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
<meshitem src="content" srcEdge="LEFT" dst="" dstEdge="LEFT" />
<meshitem src="description" srcEdge="BOTTOM" dst="content" dstEdge="BOTTOM" />
- <meshitem src="description" srcEdge="CENTERH" dst="content" dstEdge="CENTERH" />
+ <meshitem src="description" srcEdge="LEFT" dst="content" dstEdge="LEFT" />
+ <meshitem src="description" srcEdge="RIGHT" dst="content" dstEdge="RIGHT" />
<meshitem src="title" srcEdge="BOTTOM" dst="description" dstEdge="TOP" />
- <meshitem src="title" srcEdge="CENTERH" dst="content" dstEdge="CENTERH" />
+ <meshitem src="title" srcEdge="LEFT" dst="content" dstEdge="LEFT" />
+ <meshitem src="title" srcEdge="RIGHT" dst="content" dstEdge="RIGHT" />
<meshitem src="centeritem" srcEdge="BOTTOM" dst="title" dstEdge="TOP" />
<meshitem src="centeritem" srcEdge="TOP" dst="content" dstEdge="TOP" />
<meshitem src="centeritem" srcEdge="RIGHT" dst="content" dstEdge="RIGHT" />
--- a/ganeswidgets/inc/hgcontainer.h Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/inc/hgcontainer.h Fri Aug 06 09:27:34 2010 +0300
@@ -93,6 +93,8 @@
Qt::Orientation scrollDirection() const;
qreal scrollPosition() const;
+ void setHandleLongPress(bool handleLongPress);
+
signals:
// emit this signal when scrolling. for example scrollbar can be connected to this signal.
@@ -119,7 +121,7 @@
int imageCount() const;
const HgImage *image(int index) const;
int flags(int index) const;
- const HgImage *indicator(int flags) const;
+ const HgImage *indicator(int flags);
protected: // events
@@ -139,7 +141,8 @@
virtual void handleTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex);
virtual void handleLongTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex);
virtual void onScrollPositionChanged(qreal pos);
-
+ virtual void loadIndicatorGraphics(bool loadIfExists = false);
+
protected:
enum ItemActionType
@@ -222,6 +225,7 @@
Qt::Orientation mOrientation;
QModelIndex mDelayedScrollToIndex;
bool mIgnoreGestureAction;
+ bool mHandleLongPress;
};
#endif
--- a/ganeswidgets/inc/hgmediawall_p.h Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/inc/hgmediawall_p.h Fri Aug 06 09:27:34 2010 +0300
@@ -23,7 +23,6 @@
class HgCoverflowContainer;
class HgCenterItemArea;
-class HbIconItem;
class HbTextItem;
class HgMediawallPrivate : public HgWidgetPrivate
@@ -41,22 +40,18 @@
HbFontSpec titleFontSpec() const;
void setDescriptionFontSpec(const HbFontSpec &fontSpec);
HbFontSpec descriptionFontSpec() const;
-
- void setTitleAndDescriptionVisibility(HgMediawall::TitleAndDescrVisibility visibility);
- HgMediawall::TitleAndDescrVisibility titleAndDescriptionVisibility() const;
HgCoverflowContainer *container();
const HgCoverflowContainer *container() const;
private: // From HgWidgetPrivate
void updateCurrentItem(const QModelIndex ¤tItem);
-
+ void handleThemeChanged();
+
private:
HbTextItem *mTitleItem;
HbTextItem *mDescriptionItem;
HgCenterItemArea *mCenterItemArea; // Dummy item for calculating correct position for center item
-
- HgMediawall::TitleAndDescrVisibility mTitleAndDescrVisibility;
};
#endif //HGMEDIAWALL_P_H
--- a/ganeswidgets/inc/hgmediawalldataprovider.h Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/inc/hgmediawalldataprovider.h Fri Aug 06 09:27:34 2010 +0300
@@ -49,7 +49,7 @@
* @param flags.
* @return pointer HgImage-object.
*/
- virtual const HgImage* indicator(int flags) const=0;
+ virtual const HgImage* indicator(int flags)=0;
};
#endif
--- a/ganeswidgets/inc/hgwidgets_p.h Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/inc/hgwidgets_p.h Fri Aug 06 09:27:34 2010 +0300
@@ -75,6 +75,11 @@
void setItemSpacing(const QSizeF& size);
QSizeF itemSpacing() const;
+ void setHandleLongPress(bool handleLongPress);
+ bool handleLongPress() const;
+
+ virtual void handleThemeChanged();
+
HgWidget *q_ptr;
private:
@@ -114,11 +119,12 @@
void _q_modelReset();
void _q_groovePressed(qreal value, Qt::Orientation orientation);
void _q_updateCurrentItem(const QModelIndex ¤t, const QModelIndex &previous);
-
+ void _q_themeChanged();
+
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
void initBufferManager(int itemCount);
-
+
protected:
HgContainer *mContainer;
--- a/ganeswidgets/src/hgcontainer.cpp Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/src/hgcontainer.cpp Fri Aug 06 09:27:34 2010 +0300
@@ -63,7 +63,8 @@
mItemSizePolicy(HgWidget::ItemSizeAutomatic),
mOrientation(Qt::Vertical),
mDelayedScrollToIndex(),
- mIgnoreGestureAction(false)
+ mIgnoreGestureAction(false),
+ mHandleLongPress(false)
{
FUNC_LOG;
@@ -418,8 +419,13 @@
return 0;
}
-const HgImage *HgContainer::indicator(int flags) const
+const HgImage *HgContainer::indicator(int flags)
{
+ if (flags != 0 && (!mMarkImageOff || !mMarkImageOn)) {
+ // indicators haven't been loaded yet.
+ loadIndicatorGraphics();
+ }
+
if (flags & 1) {
return mMarkImageOn;
}
@@ -495,6 +501,10 @@
// set scrollto index to invalid value.
mDelayedScrollToIndex = QModelIndex();
}
+ // Indicator size depends from the item size so
+ // indicators need to be updated. Indicators are created
+ // in runtime only for need so if they dont exists they aren't created.
+ loadIndicatorGraphics(true);
}
// this needs to be implemented for gesture framework to work
@@ -518,7 +528,7 @@
HbTapGesture *tap = 0;
if (QGesture *gesture = event->gesture(Qt::TapGesture)) {
tap = static_cast<HbTapGesture *>(event->gesture(Qt::TapGesture));
- if (tap->tapStyleHint() == HbTapGesture::TapAndHold) {
+ if (mHandleLongPress && tap->tapStyleHint() == HbTapGesture::TapAndHold) {
eventHandled = handleLongTap(tap->state(),
mapFromScene(event->mapToGraphicsScene(tap->hotSpot())));
@@ -549,35 +559,6 @@
mQuadRenderer = mRenderer->getRenderer();
- // Fetch icons for marking mode (on and off states).
-
- mMarkImageOn = mQuadRenderer->createNativeImage();
- HANDLE_ERROR_NULL(mMarkImageOn);
- mMarkImageOff = mQuadRenderer->createNativeImage();
- HANDLE_ERROR_NULL(mMarkImageOff);
-
- // 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<HbIconItem*>(icon);
- if (mMarkImageOn) {
- mMarkImageOn->setPixmap(iconItem->icon().pixmap());
- }
- }
- checkBox->setCheckState(Qt::Unchecked);
- icon = checkBox->HbWidget::primitive("icon");
- if (icon) {
- iconItem = static_cast<HbIconItem*>(icon);
- 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()));
@@ -717,7 +698,20 @@
{
if (mRenderer->coverflowModeEnabled() || !mSpring.isActive()) {
mIgnoreGestureAction = false;
- startLongPressWatcher(pos);
+
+ if (mHandleLongPress) {
+ if (mRenderer->coverflowModeEnabled()) {
+ // in coverflow mode we react to longtap only if animation is not on and
+ // center item is tapped.
+ int temp = 0;
+ if (getItemAt(pos,temp)->modelIndex() == mSelectionModel->currentIndex() &&
+ !mSpring.isActive()) {
+ startLongPressWatcher(pos);
+ }
+ } else {
+ startLongPressWatcher(pos);
+ }
+ }
} else if(mSpring.isActive()) {
int rowCount = mRenderer->getRowCount();
@@ -810,15 +804,24 @@
if (item && action != DoubleTap) {
if (action == LongTap) {
INFO("Long tap:" << item->modelIndex().row());
+
+ bool currentPressed = item->modelIndex() == mSelectionModel->currentIndex();
if (!mRenderer->coverflowModeEnabled()) {
selectItem(index);
} else {
mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current);
+ mSpring.animateToPos(QPointF(index, 0));
}
if (!mIgnoreGestureAction) {
- emit longPressed(item->modelIndex(), pos);
+ if (mRenderer->coverflowModeEnabled() && mHandleLongPress) {
+ if( currentPressed && !mSpring.isActive()) {
+ emit longPressed(item->modelIndex(), pos);
+ }
+ } else if (mHandleLongPress){
+ emit longPressed(item->modelIndex(), pos);
+ }
} else {
mSpring.resetVelocity();
update();
@@ -1177,6 +1180,10 @@
mRenderer->setImageSize(mUserItemSize);
mRenderer->setSpacing(mUserItemSpacing);
}
+ // Indicator size depends from the item size so
+ // indicators need to be updated. Indicators are created
+ // in runtime only for need so if they dont exists they aren't created.
+ loadIndicatorGraphics(true);
}
QSizeF HgContainer::getAutoItemSize() const
@@ -1199,4 +1206,47 @@
return mSpring.pos().x();
}
+void HgContainer::loadIndicatorGraphics(bool loadIfExists)
+{
+ if (loadIfExists && !mMarkImageOn && !mMarkImageOff) return;
+
+ if (!mMarkImageOn) {
+ mMarkImageOn = mQuadRenderer->createNativeImage();
+ }
+ HANDLE_ERROR_NULL(mMarkImageOn);
+ if (!mMarkImageOff) {
+ mMarkImageOff = mQuadRenderer->createNativeImage();
+ }
+
+ const QSizeF newIndicatorSize = itemSize()/2;
+
+ // Validate if loading marking icons is really needed by comparing the sizes.
+ // Both marking icons have the same size so its enough to check one.
+ if (mMarkImageOn && mMarkImageOn->width() == newIndicatorSize.width() &&
+ mMarkImageOn->height() == newIndicatorSize.height() ) return;
+
+ HANDLE_ERROR_NULL(mMarkImageOff);
+ HbIcon selectedIcon(QLatin1String("qtg_small_selected"));
+ HbIcon unselectedIcon(QLatin1String("qtg_small_unselected"));
+ selectedIcon.setSize(newIndicatorSize);
+ unselectedIcon.setSize(newIndicatorSize);
+
+ QPixmap selectedPixmap = selectedIcon.pixmap();
+ QPixmap unselectedPixmap = unselectedIcon.pixmap();
+
+ if (!selectedPixmap.isNull() && !unselectedPixmap.isNull()) {
+ if (mMarkImageOn) {
+ mMarkImageOn->setPixmap(selectedPixmap);
+ }
+ if (mMarkImageOff) {
+ mMarkImageOff->setPixmap(unselectedPixmap);
+ }
+ }
+}
+
+void HgContainer::setHandleLongPress(bool handheLongPress)
+{
+ // this is just a flag that is used in gesturehandling logic.
+ mHandleLongPress = handheLongPress;
+}
// EOF
--- a/ganeswidgets/src/hgmediawall.cpp Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/src/hgmediawall.cpp Fri Aug 06 09:27:34 2010 +0300
@@ -104,24 +104,6 @@
}
/*!
- Sets visibility for title and description.
-*/
-void HgMediawall::setTitleAndDescriptionVisibility(HgMediawall::TitleAndDescrVisibility visibility)
-{
- Q_D(HgMediawall);
- d->setTitleAndDescriptionVisibility( visibility );
-}
-
-/*!
- * Gets current visibility for title and description.
- */
-HgMediawall::TitleAndDescrVisibility HgMediawall::titleAndDescriptionVisibility() const
-{
- Q_D(const HgMediawall);
- return d->titleAndDescriptionVisibility();
-}
-
-/*!
* Sets front item delta from the center of the widget.
*/
void HgMediawall::setFrontItemPositionDelta(const QPointF& position)
--- a/ganeswidgets/src/hgmediawall_p.cpp Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/src/hgmediawall_p.cpp Fri Aug 06 09:27:34 2010 +0300
@@ -16,6 +16,8 @@
*/
#include <HbTextItem>
+#include <HbEvent>
+#include <QApplication>
#include "hgmediawall_p.h"
#include "hgwidgetitem.h"
#include "hgcoverflowcontainer.h"
@@ -41,10 +43,12 @@
mTitleItem = new HbTextItem("", q);
q->style()->setItemName(mTitleItem, "title");
+ mTitleItem->setElideMode(Qt::ElideRight);
mDescriptionItem = new HbTextItem("", q);
q->style()->setItemName(mDescriptionItem, "description");
-
+ mDescriptionItem->setElideMode(Qt::ElideRight);
+
mCenterItemArea = new HgCenterItemArea(q);
q->style()->setItemName(mCenterItemArea, "centeritem");
@@ -100,61 +104,6 @@
return HbFontSpec();
}
-void HgMediawallPrivate::setTitleAndDescriptionVisibility(HgMediawall::TitleAndDescrVisibility visibility)
-{
- FUNC_LOG;
-
- mTitleAndDescrVisibility = visibility;
-
- switch (visibility) {
- case HgMediawall::TitleVisibilityBothVisible:
- qDebug() << "JARI_DEBUG, HgMediawallPrivate::setTitleAndDescriptionVisibility(): TitleVisibilityBothVisible";
-
- if (mTitleItem) {
- mTitleItem->setVisible(true);
- }
- if (mDescriptionItem) {
- mDescriptionItem->setVisible(true);
- }
- break;
- case HgMediawall::TitleVisibilityTitleVisible:
- qDebug() << "JARI_DEBUG, HgMediawallPrivate::setTitleAndDescriptionVisibility(): TitleVisibilityTitleVisible";
- if (mTitleItem) {
- mTitleItem->setVisible(true);
- }
- if (mDescriptionItem) {
- mDescriptionItem->setVisible(false);
- }
- break;
- case HgMediawall::TitleVisibilityDescriptionVisible:
- qDebug() << "JARI_DEBUG, HgMediawallPrivate::setTitleAndDescriptionVisibility(): TitleVisibilityDescriptionVisible";
-
- if (mTitleItem) {
- mTitleItem->setVisible(false);
- }
- if (mDescriptionItem) {
- mDescriptionItem->setVisible(true);
- }
- break;
- case HgMediawall::TitleVisibilityBothInvisible:
- qDebug() << "JARI_DEBUG, HgMediawallPrivate::setTitleAndDescriptionVisibility(): TitleVisibilityBothInvisible";
-
- if (mTitleItem) {
- mTitleItem->setVisible(false);
- }
- if (mDescriptionItem) {
- mDescriptionItem->setVisible(false);
- }
- break;
- default: break;
- }
-}
-
-HgMediawall::TitleAndDescrVisibility HgMediawallPrivate::titleAndDescriptionVisibility() const
-{
- return mTitleAndDescrVisibility;
-}
-
HgCoverflowContainer *HgMediawallPrivate::container()
{
HANDLE_ERROR_NULL(mContainer);
@@ -182,4 +131,17 @@
}
}
+void HgMediawallPrivate::handleThemeChanged()
+{
+ HgWidgetPrivate::handleThemeChanged();
+
+ if (mTitleItem || mDescriptionItem) {
+ Q_Q(HgMediawall);
+
+ // this is needed to enforce color fetch from CSS
+ HbEvent themeEvent(HbEvent::ThemeChanged);
+ QApplication::sendEvent(q, &themeEvent);
+ }
+}
+
// EOF
--- a/ganeswidgets/src/hgmediawallrenderer.cpp Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/src/hgmediawallrenderer.cpp Fri Aug 06 09:27:34 2010 +0300
@@ -436,7 +436,7 @@
mNextScrollDirection = mScrollDirection;
return;
}
-
+
if (mScrollDirection != scrollDirection)
{
mStateMachine->setAnimated(animate);
@@ -449,7 +449,7 @@
{
//emit renderingNeeded();
}
- } else if (!animate) {
+ } else {
// reset next scrolldirection just to be sure. In some cases
// when orientation changes couple of times and container visibility changes
// we might otherwise end up in wrong state.
--- a/ganeswidgets/src/hgspring.cpp Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/src/hgspring.cpp Fri Aug 06 09:27:34 2010 +0300
@@ -71,6 +71,11 @@
// TODO: Remove this function and use only the animateToPosAfterPanning version?
void HgSpring::animateToPos(const QPointF& pos)
{
+ if (mPos == pos) {
+ // No need to animate, we are already in correct position.
+ return;
+ }
+
mStartPos = mPos;
mEndPos = pos;
--- a/ganeswidgets/src/hgwidgets.cpp Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/src/hgwidgets.cpp Fri Aug 06 09:27:34 2010 +0300
@@ -148,13 +148,11 @@
* Returns true if the scroll area handles
* long press gestures, false otherwise
*
- * \sa HbScrollArea::setHandleLongPress()
*/
bool HgWidget::longPressEnabled() const
{
Q_D( const HgWidget );
-
- return d->mHandleLongPress;
+ return d->handleLongPress();
}
/*!
@@ -163,22 +161,11 @@
*
* The default value is false.
*
- * \sa HbScrollArea::handleLongPress()
*/
void HgWidget::setLongPressEnabled (bool value)
{
Q_D( HgWidget );
-
- if (d->mHandleLongPress != value)
- {
- d->mHandleLongPress = value;
- }
-
- // TODO, should we do something like this?????
-// if (isChanged) {
-// d->updateGestures();
-// emit gestureSceneFilterChanged( d->mGestureFilter );
-// }
+ d->setHandleLongPress(value);
}
HgWidget::ScrollBarPolicy HgWidget::scrollBarPolicy() const
--- a/ganeswidgets/src/hgwidgets_p.cpp Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/src/hgwidgets_p.cpp Fri Aug 06 09:27:34 2010 +0300
@@ -17,6 +17,7 @@
#include <QApplication>
#include <HbScrollbar>
+#include <HbTheme>
#include <hgwidgets/hgwidgets.h>
#include "hgwidgets_p.h"
@@ -82,7 +83,10 @@
q->connect(mContainer, SIGNAL(scrollingStarted()), q, SIGNAL(scrollingStarted()));
q->connect(mContainer, SIGNAL(scrollingEnded()), q, SIGNAL(scrollingEnded()));
q->connect(mScrollBarHideTimer, SIGNAL(timeout()), q, SLOT(_q_hideScrollBars()));
-
+ q->connect( HbTheme::instance(), SIGNAL(changed()), q, SLOT(_q_themeChanged()));
+
+ mContainer->setHandleLongPress(mHandleLongPress);
+
// mIndexFeedback = new HgIndexFeedback(q);
// mIndexFeedback->setWidget(q);
@@ -676,27 +680,12 @@
void HgWidgetPrivate::lostForeground()
{
- if( !mForeground ) return;
-
mForeground = false;
- QList<HgWidgetItem*> list = mContainer->items();
- foreach(HgWidgetItem* item, list){
- item->releaseItemData();
- }
}
void HgWidgetPrivate::gainedForeground()
{
- if( mForeground ) return;
-
mForeground = true;
- QList<HgWidgetItem*> list = mContainer->items();
- int bufferStart = 0;
- int bufferEnd = 0;
- mBufferManager->currentBuffer(bufferStart,bufferEnd);
- for(;bufferStart<=bufferEnd;bufferStart++){
- list.at(bufferStart)->updateItemData();
- }
}
void HgWidgetPrivate::updateCurrentItem(const QModelIndex ¤tItem)
@@ -719,8 +708,8 @@
void HgWidgetPrivate::orientationChanged(Qt::Orientation orientation)
{
Q_Q(HgWidget);
- if (mContainer->orientation() != orientation) {
- mContainer->setOrientation(orientation, q->isVisible());
+ if (mContainer->orientation() != orientation) {
+ mContainer->setOrientation(orientation, q->isVisible() && q->isActive());
if (!mStaticScrollDirection) {
createScrollBar(orientation);
}
@@ -864,4 +853,28 @@
mBufferManager->resetBuffer(0, itemCount);
}
+void HgWidgetPrivate::setHandleLongPress(bool handleLongPress)
+{
+ if (mHandleLongPress != handleLongPress) {
+ mHandleLongPress = handleLongPress;
+ mContainer->setHandleLongPress(mHandleLongPress);
+ }
+}
+
+bool HgWidgetPrivate::handleLongPress() const
+{
+ return mHandleLongPress;
+}
+
+void HgWidgetPrivate::_q_themeChanged()
+{
+ handleThemeChanged();
+}
+
+void HgWidgetPrivate::handleThemeChanged()
+{
+ // TODO, add graphics updates here if required.
+}
+
+
#include "moc_hgwidgets.cpp"
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgtestdefs.h Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgtestdefs.h Fri Aug 06 09:27:34 2010 +0300
@@ -47,6 +47,5 @@
static const QString SETT_REFLECTIONS_ENABLED = "Reflections enabled";
static const QString SETT_EFFECT3D_ENABLED = "Effect3d enabled";
static const QString SETT_ITEM_SIZE_POLICY = "ItemSizePolicy";
-static const QString SETT_TITLE_DESCR_VISIBILITY = "TitleDescrVisibility";
#endif /* HGTESTDEFS_H_ */
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgetoptionsview.h Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgetoptionsview.h Fri Aug 06 09:27:34 2010 +0300
@@ -48,8 +48,6 @@
void reflectionsEnabledChanged(bool);
void effect3dEnabledChanged(bool);
void itemSizePolicyChanged(HgWidget::ItemSizePolicy);
- void titleAndDescrVisibilityChanged(HgMediawall::TitleAndDescrVisibility);
-
private slots:
void updateData(QModelIndex startIn, QModelIndex endIn);
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestview.h Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestview.h Fri Aug 06 09:27:34 2010 +0300
@@ -31,6 +31,7 @@
class HbDialog;
class QParallelAnimationGroup;
class HgCoverItem;
+
class HgItemSizeDialog;
class HgWidgetTestView : public HbView
@@ -55,7 +56,6 @@
void changeReflectionsEnabled(bool);
void changeEffect3dEnabled(bool);
void changeItemSizePolicy(HgWidget::ItemSizePolicy);
- void changeTitleAndDescrVisibility(HgMediawall::TitleAndDescrVisibility);
void toggleScrollDirection();
void openDialog(const QModelIndex &index);
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgetoptionsview.cpp Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgetoptionsview.cpp Fri Aug 06 09:27:34 2010 +0300
@@ -37,7 +37,6 @@
static const QString REFLECTIONS_ENABLED = "Reflections enabled";
static const QString EFFECT3D_ENABLED = "Grid 3d effects enabled";
static const QString ITEM_SIZE_POLICY = "Item size policy";
-static const QString TITLE_DESCR_VISIBILITY = "Title/description visibility";
enum DataFormItems {
ItemWidgetType = 0,
@@ -51,8 +50,7 @@
ItemDescriptionFont,
ItemReflectionEnabled,
ItemEffect3dEnabled,
- ItemItemSizePolicy,
- ItemTitleDescrVisibility
+ ItemItemSizePolicy
};
HgWidgetOptionsView::HgWidgetOptionsView(QGraphicsItem *parent) :
@@ -120,11 +118,7 @@
HbDataFormModelItem::ToggleValueItem, ITEM_SIZE_POLICY);
item->setContentWidgetData(QString("text"), QString("User defined"));
item->setContentWidgetData(QString("additionalText"), QString("Automatic"));
-
- item = mModel->appendDataFormItem(
- HbDataFormModelItem::ComboBoxItem, TITLE_DESCR_VISIBILITY);
- item->setContentWidgetData(QString("items"), QStringList("Both visible") << "Title visible" << "Description visible" << "Both invisible");
-
+
connect(mModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), SLOT(updateData(QModelIndex, QModelIndex)));
mForm->setModel(mModel);
@@ -305,28 +299,6 @@
settings.setValue(SETT_ITEM_SIZE_POLICY, value);
emit itemSizePolicyChanged(value);
}
- else if (item->data(HbDataFormModelItem::LabelRole).toString() == TITLE_DESCR_VISIBILITY) {
-
- int index = item->contentWidgetData(QString("currentIndex")).toInt();
- HgMediawall::TitleAndDescrVisibility visibility = HgMediawall::TitleVisibilityBothVisible;
- switch (index) {
- case 0:
- visibility = HgMediawall::TitleVisibilityBothVisible;
- break;
- case 1:
- visibility = HgMediawall::TitleVisibilityTitleVisible;
- break;
- case 2:
- visibility = HgMediawall::TitleVisibilityDescriptionVisible;
- break;
- case 3:
- visibility = HgMediawall::TitleVisibilityBothInvisible;
- break;
- default: break;
- }
- settings.setValue(SETT_TITLE_DESCR_VISIBILITY, visibility);
- emit titleAndDescrVisibilityChanged(visibility);
- }
}
void HgWidgetOptionsView::setCoverflowEnabled(bool value)
@@ -532,32 +504,6 @@
item->setContentWidgetData(QString("additionalText"), "Automatic");
}
}
-
- item = mModel->itemFromIndex(mModel->index(ItemTitleDescrVisibility, 0));
- value = settings.value(SETT_TITLE_DESCR_VISIBILITY);
- if (item && value.isValid()) {
- int index(0);
- switch (value.toInt()) {
- case HgMediawall::TitleVisibilityBothVisible:
- qDebug() << "JARI_DEBUG, HgWidgetOptionsView::setupData(): SETT_TITLE_DESCR_VISIBILITY: TitleVisibilityBothVisible";
- index = 0;
- break;
- case HgMediawall::TitleVisibilityTitleVisible:
- qDebug() << "JARI_DEBUG, HgWidgetOptionsView::setupData(): SETT_TITLE_DESCR_VISIBILITY: TitleVisibilityTitleVisible";
- index = 1;
- break;
- case HgMediawall::TitleVisibilityDescriptionVisible:
- qDebug() << "JARI_DEBUG, HgWidgetOptionsView::setupData(): SETT_TITLE_DESCR_VISIBILITY: TitleVisibilityDescriptionVisible";
- index = 2;
- break;
- case HgMediawall::TitleVisibilityBothInvisible:
- qDebug() << "JARI_DEBUG, HgWidgetOptionsView::setupData(): SETT_TITLE_DESCR_VISIBILITY: TitleVisibilityBothInvisible";
- index = 3;
- break;
- default: break;
- }
- item->setContentWidgetData(QString("currentIndex"), index);
- }
}
void HgWidgetOptionsView::resizeEvent(QGraphicsSceneResizeEvent *event)
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestview.cpp Fri Jul 23 10:05:37 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestview.cpp Fri Aug 06 09:27:34 2010 +0300
@@ -321,15 +321,6 @@
}
}
-void HgWidgetTestView::changeTitleAndDescrVisibility(HgMediawall::TitleAndDescrVisibility visibility)
-{
- HgMediawall* mediawall = qobject_cast<HgMediawall*>(mWidget);
- if (mediawall && mediawall->titleAndDescriptionVisibility() != visibility)
- {
- mediawall->setTitleAndDescriptionVisibility(visibility);
- }
-}
-
void HgWidgetTestView::activated()
{
mAnimationGroup->setDirection(QAbstractAnimation::Backward);
@@ -687,8 +678,6 @@
SLOT(changeEffect3dEnabled(bool)));
connect(view, SIGNAL(itemSizePolicyChanged(HgWidget::ItemSizePolicy)),
SLOT(changeItemSizePolicy(HgWidget::ItemSizePolicy)));
- connect(view, SIGNAL(titleAndDescrVisibilityChanged(HgMediawall::TitleAndDescrVisibility)),
- SLOT(changeTitleAndDescrVisibility(HgMediawall::TitleAndDescrVisibility)));
mOptionsView = view;
primaryWindow->addView(mOptionsView);
@@ -771,11 +760,6 @@
if (value.isValid()) {
changeItemSizePolicy(static_cast<HgMediawall::ItemSizePolicy>(value.toInt()));
}
-
- value = settings.value(SETT_TITLE_DESCR_VISIBILITY);
- if (value.isValid()) {
- changeTitleAndDescrVisibility(static_cast<HgMediawall::TitleAndDescrVisibility>(value.toInt()));
- }
}
void HgWidgetTestView::setupWidgetSize()
--- a/hgwidgets_plat/ganeswidgets_api/inc/hgmediawall.h Fri Jul 23 10:05:37 2010 +0300
+++ b/hgwidgets_plat/ganeswidgets_api/inc/hgmediawall.h Fri Aug 06 09:27:34 2010 +0300
@@ -29,20 +29,9 @@
Q_PROPERTY(HbFontSpec descriptionFontSpec READ descriptionFontSpec WRITE setDescriptionFontSpec)
Q_PROPERTY(QPointF frontItemPositionDelta READ frontItemPositionDelta WRITE setFrontItemPositionDelta)
Q_PROPERTY(bool reflectionsEnabled READ reflectionsEnabled WRITE enableReflections)
- Q_PROPERTY(HgMediawall::TitleAndDescrVisibility titleAndDescriptionVisibility \
- READ titleAndDescriptionVisibility \
- WRITE setTitleAndDescriptionVisibility)
- Q_ENUMS(TitleAndDescrVisibility)
public:
- enum TitleAndDescrVisibility {
- TitleVisibilityBothVisible = 0,
- TitleVisibilityTitleVisible,
- TitleVisibilityDescriptionVisible,
- TitleVisibilityBothInvisible
- };
-
explicit HgMediawall(QGraphicsItem *parent = 0 );
virtual ~HgMediawall();
@@ -51,9 +40,6 @@
void setDescriptionFontSpec(const HbFontSpec &fontSpec);
HbFontSpec descriptionFontSpec() const;
- void setTitleAndDescriptionVisibility(HgMediawall::TitleAndDescrVisibility visibility);
- HgMediawall::TitleAndDescrVisibility titleAndDescriptionVisibility() const;
-
void setFrontItemPositionDelta(const QPointF& position);
QPointF frontItemPositionDelta() const;
--- a/hgwidgets_plat/ganeswidgets_api/inc/hgwidgets.h Fri Jul 23 10:05:37 2010 +0300
+++ b/hgwidgets_plat/ganeswidgets_api/inc/hgwidgets.h Fri Aug 06 09:27:34 2010 +0300
@@ -49,7 +49,6 @@
Q_ENUMS(SelectionMode)
Q_ENUMS(IndexFeedbackPolicy)
Q_ENUMS(ItemSizePolicy)
-
public:
enum HgDataRole
@@ -166,6 +165,7 @@
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