--- a/bwins/ganeswidgetsu.def Thu Jul 08 15:37:35 2010 +0300
+++ b/bwins/ganeswidgetsu.def Fri Jul 23 10:05:37 2010 +0300
@@ -94,4 +94,6 @@
?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 Thu Jul 08 15:37:35 2010 +0300
+++ b/eabi/ganeswidgetsu.def Fri Jul 23 10:05:37 2010 +0300
@@ -103,4 +103,6 @@
_ZN6HgGrid18setEffect3dEnabledEb @ 102 NONAME
_ZNK6HgGrid15effect3dEnabledEv @ 103 NONAME
_ZN11HgMediawall6polishER17HbStyleParameters @ 104 NONAME
+ _ZN11HgMediawall32setTitleAndDescriptionVisibilityENS_23TitleAndDescrVisibilityE @ 105 NONAME
+ _ZNK11HgMediawall29titleAndDescriptionVisibilityEv @ 106 NONAME
--- a/ganeswidgets/inc/hgmediawall_p.h Thu Jul 08 15:37:35 2010 +0300
+++ b/ganeswidgets/inc/hgmediawall_p.h Fri Jul 23 10:05:37 2010 +0300
@@ -41,6 +41,9 @@
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;
@@ -52,6 +55,8 @@
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/hgspring.h Thu Jul 08 15:37:35 2010 +0300
+++ b/ganeswidgets/inc/hgspring.h Fri Jul 23 10:05:37 2010 +0300
@@ -30,15 +30,21 @@
class HgSpring : public QObject
{
Q_OBJECT
+ Q_PROPERTY(qreal mDamping READ damping WRITE setDamping)
+ Q_PROPERTY(qreal mK READ k WRITE setK)
+
public:
explicit HgSpring();
virtual ~HgSpring();
+ qreal k() const;
+ qreal damping() const;
void setK(qreal K);
void setDamping(qreal damping);
void animateToPos(const QPointF& pos);
+ void animateToPosAfterPanning(const QPointF& pos, qreal worldWidth);
void gotoPos(const QPointF& pos);
void cancel();
bool isActive() const;
@@ -63,6 +69,7 @@
QPointF mStartPos;
QPointF mPos;
QPointF mEndPos;
+ QPointF mEndPosOverListBoundary;
QPointF mVelocity;
qreal mK;
qreal mDamping;
@@ -70,6 +77,9 @@
QTimer* mTimer;
QTime mPrevTime;
bool mDoNotUpdate;
+
+ bool mEndPosOverListEdge;
+ qreal mWorldWidth;
};
#endif
--- a/ganeswidgets/src/hgcontainer.cpp Thu Jul 08 15:37:35 2010 +0300
+++ b/ganeswidgets/src/hgcontainer.cpp Fri Jul 23 10:05:37 2010 +0300
@@ -96,6 +96,7 @@
}
}
+// TODO: This does exactly the same as HgContainer::imageCount(), should this be thus removed?
int HgContainer::itemCount() const
{
return mItems.count();
@@ -393,6 +394,7 @@
scrollTo(mSelectionModel->currentIndex());
}
+// TODO: This does exactly the same as HgContainer::itemCount(), should this be thus removed?
int HgContainer::imageCount() const
{
return mItems.count();
@@ -611,14 +613,12 @@
FUNC_LOG;
qreal x = mSpring.endPos().x();
- x = qBound(qreal(0), x, worldWidth());
if (mRenderer->coverflowModeEnabled()) {
qreal i = floorf(x);
x = (x - i > 0.5f) ? ceilf(x) : i;
- mSpring.animateToPos(QPointF(x, 0));
}
- mSpring.animateToPos(QPointF(x, 0));
+ mSpring.animateToPosAfterPanning(QPointF(x, 0), worldWidth());
}
@@ -679,7 +679,9 @@
mDragged = false;
qreal newPos(0);
if (mDrag.finish(pos, mRenderer->coverflowModeEnabled(), newPos)) {
- mSpring.animateToPos(QPointF(qBound(qreal(0), newPos, worldWidth()), 0));
+
+ mSpring.animateToPosAfterPanning(QPointF(newPos, 0), worldWidth());
+
HgWidgetItem* item = itemByIndex(newPos);
if (item && item->modelIndex() != mSelectionModel->currentIndex()) {
// mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current);
@@ -707,7 +709,7 @@
FUNC_LOG;
bool handleGesture = false;
-
+
if (hasItemAt(pos)) {
switch (state)
{
@@ -717,7 +719,29 @@
mIgnoreGestureAction = false;
startLongPressWatcher(pos);
} else if(mSpring.isActive()) {
- mSpring.cancel();
+
+ int rowCount = mRenderer->getRowCount();
+ if(rowCount != 0) //just in case, should not be zero
+ {
+ qreal springPos = mSpring.pos().x();
+ int gridTotalHeightInImages = ceilf( mItems.count() / rowCount );
+ qreal currentViewHeightInImages;
+ if (scrollDirection() == Qt::Horizontal ) {
+ int rowHeight = mRenderer->getImageSize().width() + mRenderer->getSpacing().width();
+ currentViewHeightInImages = rect().width() / rowHeight;
+ } else {
+ int rowHeight = mRenderer->getImageSize().height() + mRenderer->getSpacing().height();
+ currentViewHeightInImages = rect().height() / rowHeight;
+ }
+
+ // If list does not currently fill the whole screen (some theme background behind the list
+ // is visible), and list is moving, then do not react to tapping.
+ if( springPos >= 0
+ && springPos <= (gridTotalHeightInImages - currentViewHeightInImages) )
+ {
+ mSpring.cancel();
+ }
+ }
mIgnoreGestureAction = true;
}
break;
@@ -733,7 +757,7 @@
handleGesture = true;
} else {
- mIgnoreGestureAction = true;
+ mIgnoreGestureAction = true;
}
return handleGesture;
}
--- a/ganeswidgets/src/hgmediawall.cpp Thu Jul 08 15:37:35 2010 +0300
+++ b/ganeswidgets/src/hgmediawall.cpp Fri Jul 23 10:05:37 2010 +0300
@@ -104,6 +104,24 @@
}
/*!
+ 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 Thu Jul 08 15:37:35 2010 +0300
+++ b/ganeswidgets/src/hgmediawall_p.cpp Fri Jul 23 10:05:37 2010 +0300
@@ -100,6 +100,61 @@
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);
--- a/ganeswidgets/src/hgmediawallrenderer.cpp Thu Jul 08 15:37:35 2010 +0300
+++ b/ganeswidgets/src/hgmediawallrenderer.cpp Fri Jul 23 10:05:37 2010 +0300
@@ -661,23 +661,42 @@
}
qreal HgMediaWallRenderer::getWorldWidth() const
-{
- qreal width = ceil((qreal)mDataProvider->imageCount() / (qreal)mRowCount - 1.0f);
-
+{
+ qreal worldWidth = ceil((qreal)mDataProvider->imageCount() / (qreal)mRowCount);
+ qreal worldWidthAsIndex = worldWidth - 1.0f;
+
// if we are in vertical orientation we want last and first item
// to place at the top and bottom of the screen instead of center
if (mScrollDirection == Qt::Vertical)
{
- qreal step = mSpacing2D.height() + mImageSize2D.height();
- width -= (mRect.height() / step - 1.0f);
+ qreal step = mSpacing2D.height() + mImageSize2D.height();
+ qreal screenWidth = mRect.height() / step;
+ if(worldWidth > screenWidth) //do the items take over one screenful?
+ {
+ worldWidthAsIndex -= (screenWidth - 1.0f);
+ }
+ else
+ {
+ // all items fit to one screenful
+ return 0;
+ }
}
else if (mScrollDirection == Qt::Horizontal && !mCoverflowMode)
{
qreal step = mSpacing2D.width() + mImageSize2D.width();
- width -= (mRect.width() / step - 1.0f);
+ qreal screenWidth = mRect.width() / step;
+ if(worldWidth > screenWidth) //do the items take over one screenful?
+ {
+ worldWidthAsIndex -= (screenWidth - 1.0f);
+ }
+ else
+ {
+ // all items fit to one screenful
+ return 0;
+ }
}
-
- return width;
+
+ return worldWidthAsIndex;
}
--- a/ganeswidgets/src/hgspring.cpp Thu Jul 08 15:37:35 2010 +0300
+++ b/ganeswidgets/src/hgspring.cpp Fri Jul 23 10:05:37 2010 +0300
@@ -21,7 +21,7 @@
const int KTimeDelta(10);
const qreal KTimeDeltaF(0.01f);
-//const qreal KVelocitySnap(0.05f);
+const qreal KVelocitySnap(0.06f);
const qreal KPositionSnap(0.01f);
const int KTimerInterval(10);
@@ -29,11 +29,13 @@
mStartPos(QPointF(0,0)),
mPos(QPointF(0,0)),
mEndPos(QPointF(0,0)),
+mEndPosOverListBoundary(QPointF(0,0)),
mVelocity(QPointF(0,0)),
mK(30.1),
mDamping(10.1),
mAccumulator(0.0),
-mDoNotUpdate(false)
+mDoNotUpdate(false),
+mEndPosOverListEdge(false)
{
mTimer = new QTimer(this);
@@ -56,8 +58,19 @@
mDamping = damping;
}
+qreal HgSpring::k() const
+{
+ return mK;
+}
+
+qreal HgSpring::damping() const
+{
+ return mDamping;
+}
+
+// TODO: Remove this function and use only the animateToPosAfterPanning version?
void HgSpring::animateToPos(const QPointF& pos)
-{
+{
mStartPos = mPos;
mEndPos = pos;
@@ -70,6 +83,39 @@
}
}
+void HgSpring::animateToPosAfterPanning(const QPointF& pos, qreal worldWidth)
+{
+ mWorldWidth = worldWidth;
+ mStartPos = mPos;
+
+ qreal xPos = pos.x();
+ if( xPos < 0.0 )
+ {
+ mEndPosOverListEdge = true;
+ mEndPosOverListBoundary = pos;
+ mEndPos = QPointF(0, 0);
+ }
+ else if( xPos > worldWidth )
+ {
+ mEndPosOverListEdge = true;
+ mEndPosOverListBoundary = pos;
+ mEndPos = QPointF(worldWidth, 0);
+ }
+ else
+ {
+ mEndPosOverListEdge = false;
+ mEndPos = pos;
+ }
+
+ emit started();
+
+ if (!mTimer->isActive())
+ {
+ mTimer->start(KTimerInterval);
+ mPrevTime.start();
+ }
+}
+
void HgSpring::gotoPos(const QPointF& pos)
{
if (mTimer->isActive())
@@ -122,12 +168,36 @@
bool stopped = false;
while (mAccumulator >= KTimeDelta)
{
- QPointF delta = mEndPos - mPos;
+ QPointF delta;
+ if(mEndPosOverListEdge)
+ {
+ delta = mEndPosOverListBoundary - mPos;
+
+ if( mPos.x() < KPositionSnap || mPos.x() > mWorldWidth )
+ {
+ // When list's position goes past the world boundary
+ // we reset our mEndPosOverListEdge boolean flag
+ // -> the passed boundary will be used as end point,
+ // and the K value of this spring will be modified.
+ mEndPosOverListEdge = false; //reset
+ mEndPosOverListBoundary = QPointF(0,0); //reset
+ mWorldWidth = 0.0; //reset
+ mK = 60.0;
+ }
+
+ }
+ else
+ {
+ delta = mEndPos - mPos;
+ }
+
QPointF force = delta * mK - mVelocity * mDamping;
mVelocity += force * KTimeDeltaF;
mPos += mVelocity * KTimeDeltaF;
+
if ( (qAbs(mPos.x() - mEndPos.x()) < KPositionSnap &&
- qAbs(mPos.y() - mEndPos.y()) < KPositionSnap) )
+ qAbs(mPos.y() - mEndPos.y()) < KPositionSnap)
+ && qAbs(mVelocity.x()) < KVelocitySnap )
{
mPos = mEndPos;
mAccumulator = 0;
@@ -139,7 +209,7 @@
mAccumulator -= KTimeDelta;
}
-
+
if (!mDoNotUpdate)
emit updated();
--- a/ganeswidgets/src/hgwidgets.cpp Thu Jul 08 15:37:35 2010 +0300
+++ b/ganeswidgets/src/hgwidgets.cpp Fri Jul 23 10:05:37 2010 +0300
@@ -25,7 +25,7 @@
#include "hgwidgets_p.h"
#include "hgcontainer.h"
#include "hgwidgetitem.h"
-#include "hgscrollBufferManager.h"
+#include "hgscrollbuffermanager.h"
#include "hggridcontainer.h"
#include "trace.h"
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgtestdefs.h Thu Jul 08 15:37:35 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgtestdefs.h Fri Jul 23 10:05:37 2010 +0300
@@ -47,5 +47,6 @@
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 Thu Jul 08 15:37:35 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgetoptionsview.h Fri Jul 23 10:05:37 2010 +0300
@@ -48,6 +48,8 @@
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 Thu Jul 08 15:37:35 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestview.h Fri Jul 23 10:05:37 2010 +0300
@@ -31,7 +31,6 @@
class HbDialog;
class QParallelAnimationGroup;
class HgCoverItem;
-
class HgItemSizeDialog;
class HgWidgetTestView : public HbView
@@ -56,6 +55,7 @@
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 Thu Jul 08 15:37:35 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgetoptionsview.cpp Fri Jul 23 10:05:37 2010 +0300
@@ -37,6 +37,7 @@
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,
@@ -50,7 +51,8 @@
ItemDescriptionFont,
ItemReflectionEnabled,
ItemEffect3dEnabled,
- ItemItemSizePolicy
+ ItemItemSizePolicy,
+ ItemTitleDescrVisibility
};
HgWidgetOptionsView::HgWidgetOptionsView(QGraphicsItem *parent) :
@@ -118,7 +120,11 @@
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);
@@ -143,6 +149,8 @@
QSettings settings(SETT_ORGANIZATION, SETT_APPLICATION);
HbDataFormModelItem *item = mModel->itemFromIndex(startIn);
+ if( !item ) return;
+
if (item->data(HbDataFormModelItem::LabelRole).toString() == WIDGET_TYPE) {
int index = item->contentWidgetData(QString("currentIndex")).toInt();
HgTestWidgetType type = HgWidgetNone;
@@ -297,6 +305,28 @@
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)
@@ -502,6 +532,32 @@
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)
@@ -510,7 +566,7 @@
if (mUpdateWidgetSize) {
mContentReady = false;
- HbDataFormModelItem *item = item = mModel->itemFromIndex(mModel->index(ItemWidgetHeight, 0));
+ HbDataFormModelItem *item = mModel->itemFromIndex(mModel->index(ItemWidgetHeight, 0));
if (item) {
item->setContentWidgetData(QString("text"), event->newSize().height());
}
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestview.cpp Thu Jul 08 15:37:35 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestview.cpp Fri Jul 23 10:05:37 2010 +0300
@@ -321,6 +321,15 @@
}
}
+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);
@@ -668,12 +677,8 @@
connect(view, SIGNAL(lowResImageUseChanged(bool)), SLOT(changeLowResImageUse(bool)));
connect(view, SIGNAL(widgetHeightChanged(int)), SLOT(changeWidgetHeight(int)));
connect(view, SIGNAL(widgetWidthChanged(int)), SLOT(changeWidgetWidth(int)));
- connect(view, SIGNAL(titlePositionChanged(HgMediawall::LabelPosition)),
- SLOT(changeTitlePosition(HgMediawall::LabelPosition)));
connect(view, SIGNAL(titleFontChanged(HbFontSpec)),
SLOT(changeTitleFont(HbFontSpec)));
- connect(view, SIGNAL(descriptionPositionChanged(HgMediawall::LabelPosition)),
- SLOT(changeDescriptionPosition(HgMediawall::LabelPosition)));
connect(view, SIGNAL(descriptionFontChanged(HbFontSpec)),
SLOT(changeDescriptionFont(HbFontSpec)));
connect(view, SIGNAL(reflectionsEnabledChanged(bool)),
@@ -682,6 +687,8 @@
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);
@@ -764,6 +771,11 @@
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()
@@ -948,20 +960,22 @@
if (orientation == Qt::Horizontal && mWidgetType == HgWidgetCoverflow) {
setItemVisible(Hb::AllItems, false);
}
- else if (orientation == Qt::Horizontal && mWidgetType == HgWidgetGrid && mainWindow()->currentView() == this ) {
+ 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);
- }
+ }
else if (orientation == Qt::Vertical && mWidgetType == HgWidgetCoverflow) {
initWidget(HgWidgetTBone);
setItemVisible(Hb::AllItems, true);
}
else if (orientation == Qt::Vertical && mWidgetType == HgWidgetGrid) {
setItemVisible(Hb::AllItems, true);
- }
+ }
}
void HgWidgetTestView::resizeEvent(QGraphicsSceneResizeEvent *event)
{
--- a/hgwidgets_plat/ganeswidgets_api/inc/hgmediawall.h Thu Jul 08 15:37:35 2010 +0300
+++ b/hgwidgets_plat/ganeswidgets_api/inc/hgmediawall.h Fri Jul 23 10:05:37 2010 +0300
@@ -29,10 +29,20 @@
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_ENUMS(LabelPosition)
+ 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();
@@ -41,6 +51,9 @@
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 Thu Jul 08 15:37:35 2010 +0300
+++ b/hgwidgets_plat/ganeswidgets_api/inc/hgwidgets.h Fri Jul 23 10:05:37 2010 +0300
@@ -49,6 +49,7 @@
Q_ENUMS(SelectionMode)
Q_ENUMS(IndexFeedbackPolicy)
Q_ENUMS(ItemSizePolicy)
+
public:
enum HgDataRole