--- a/bwins/hgcacheproxymodelu.def Mon May 03 13:32:54 2010 +0300
+++ b/bwins/hgcacheproxymodelu.def Fri May 14 16:57:01 2010 +0300
@@ -1,92 +1,137 @@
EXPORTS
?headerData@HgCacheProxyModel@@UBE?AVQVariant@@HW4Orientation@Qt@@H@Z @ 1 NONAME ; class QVariant HgCacheProxyModel::headerData(int, enum Qt::Orientation, int) const
- ?insertItem@HgDataProviderModel@@IAEXHU?$QPair@VQVariant@@H@@_N@Z @ 2 NONAME ; void HgDataProviderModel::insertItem(int, struct QPair<class QVariant, int>, bool)
- ?sortRole@HgCacheProxyModel@@QBEHXZ @ 3 NONAME ; int HgCacheProxyModel::sortRole(void) const
- ?data@HgCacheProxyModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 4 NONAME ; class QVariant HgCacheProxyModel::data(class QModelIndex const &, int) const
- ?createIcon@HgDataProviderModel@@IAE?AVQVariant@@HVQPixmap@@@Z @ 5 NONAME ; class QVariant HgDataProviderModel::createIcon(int, class QPixmap)
- ?parent@HgDataProviderModel@@UBE?AVQModelIndex@@ABV2@@Z @ 6 NONAME ; class QModelIndex HgDataProviderModel::parent(class QModelIndex const &) const
- ?parent@HgCacheProxyModel@@UBE?AVQModelIndex@@ABV2@@Z @ 7 NONAME ; class QModelIndex HgCacheProxyModel::parent(class QModelIndex const &) const
- ?buddy@HgCacheProxyModel@@UBE?AVQModelIndex@@ABV2@@Z @ 8 NONAME ; class QModelIndex HgCacheProxyModel::buddy(class QModelIndex const &) const
- ?setDataProvider@HgCacheProxyModel@@QAEXPAVHgDataProviderModel@@HH@Z @ 9 NONAME ; void HgCacheProxyModel::setDataProvider(class HgDataProviderModel *, int, int)
- ?containsRole@HgDataProviderModel@@IBE_NHH@Z @ 10 NONAME ; bool HgDataProviderModel::containsRole(int, int) const
- ?itemData@HgDataProviderModel@@UBE?AV?$QMap@HVQVariant@@@@ABVQModelIndex@@@Z @ 11 NONAME ; class QMap<int, class QVariant> HgDataProviderModel::itemData(class QModelIndex const &) const
- ?release@HgDataProviderModel@@QAEXV?$QList@H@@_N@Z @ 12 NONAME ; void HgDataProviderModel::release(class QList<int>, bool)
- ?qt_metacast@HgDataProviderModel@@UAEPAXPBD@Z @ 13 NONAME ; void * HgDataProviderModel::qt_metacast(char const *)
- ?resizeQPixmapPool@HgDataProviderModel@@QAEXH@Z @ 14 NONAME ; void HgDataProviderModel::resizeQPixmapPool(int)
- ??0HgDataProviderModel@@QAE@PAVQObject@@@Z @ 15 NONAME ; HgDataProviderModel::HgDataProviderModel(class QObject *)
- ?dropMimeData@HgCacheProxyModel@@UAE_NPBVQMimeData@@W4DropAction@Qt@@HHABVQModelIndex@@@Z @ 16 NONAME ; bool HgCacheProxyModel::dropMimeData(class QMimeData const *, enum Qt::DropAction, int, int, class QModelIndex const &)
- ?columnCount@HgDataProviderModel@@UBEHABVQModelIndex@@@Z @ 17 NONAME ; int HgDataProviderModel::columnCount(class QModelIndex const &) const
- ?columnCount@HgCacheProxyModel@@UBEHABVQModelIndex@@@Z @ 18 NONAME ; int HgCacheProxyModel::columnCount(class QModelIndex const &) const
- ?tr@HgDataProviderModel@@SA?AVQString@@PBD0@Z @ 19 NONAME ; class QString HgDataProviderModel::tr(char const *, char const *)
- ?update@HgDataProviderModel@@IAE_NHPAV?$QList@U?$QPair@VQVariant@@H@@@@_N@Z @ 20 NONAME ; bool HgDataProviderModel::update(int, class QList<struct QPair<class QVariant, int> > *, bool)
- ?registerObserver@HgDataProviderModel@@QAEXPAVHgDataProviderModelObserver@@@Z @ 21 NONAME ; void HgDataProviderModel::registerObserver(class HgDataProviderModelObserver *)
- ??1HgCacheProxyModel@@UAE@XZ @ 22 NONAME ; HgCacheProxyModel::~HgCacheProxyModel(void)
- ?doResetModel@HgDataProviderModel@@MAEXXZ @ 23 NONAME ; void HgDataProviderModel::doResetModel(void)
- ?canFetchMore@HgCacheProxyModel@@UBE_NABVQModelIndex@@@Z @ 24 NONAME ; bool HgCacheProxyModel::canFetchMore(class QModelIndex const &) const
- ?emitDataChanged@HgDataProviderModel@@IAEXHH_N@Z @ 25 NONAME ; void HgDataProviderModel::emitDataChanged(int, int, bool)
- ?supportedDropActions@HgCacheProxyModel@@UBE?AV?$QFlags@W4DropAction@Qt@@@@XZ @ 26 NONAME ; class QFlags<enum Qt::DropAction> HgCacheProxyModel::supportedDropActions(void) const
- ?staticMetaObject@HgDataProviderModel@@2UQMetaObject@@B @ 27 NONAME ; struct QMetaObject const HgDataProviderModel::staticMetaObject
- ??0HgCacheProxyModel@@QAE@PAVQObject@@@Z @ 28 NONAME ; HgCacheProxyModel::HgCacheProxyModel(class QObject *)
- ?updateIcon@HgDataProviderModel@@IAE_NHVQVariant@@_N@Z @ 29 NONAME ; bool HgDataProviderModel::updateIcon(int, class QVariant, bool)
- ?index@HgDataProviderModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 30 NONAME ; class QModelIndex HgDataProviderModel::index(int, int, class QModelIndex const &) const
- ?sort@HgCacheProxyModel@@UAEXHW4SortOrder@Qt@@@Z @ 31 NONAME ; void HgCacheProxyModel::sort(int, enum Qt::SortOrder)
- ?data@HgDataProviderModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 32 NONAME ; class QVariant HgDataProviderModel::data(class QModelIndex const &, int) const
- ?releasePixmap@HgDataProviderModel@@IAEXH@Z @ 33 NONAME ; void HgDataProviderModel::releasePixmap(int)
- ?removeColumns@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 34 NONAME ; bool HgCacheProxyModel::removeColumns(int, int, class QModelIndex const &)
- ?insertRows@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 35 NONAME ; bool HgCacheProxyModel::insertRows(int, int, class QModelIndex const &)
- ?revert@HgCacheProxyModel@@UAEXXZ @ 36 NONAME ; void HgCacheProxyModel::revert(void)
- ?insertItem@HgDataProviderModel@@IAEXHPAV?$QList@U?$QPair@VQVariant@@H@@@@_N@Z @ 37 NONAME ; void HgDataProviderModel::insertItem(int, class QList<struct QPair<class QVariant, int> > *, bool)
- ?setSortCaseSensitivity@HgCacheProxyModel@@QAEXW4CaseSensitivity@Qt@@@Z @ 38 NONAME ; void HgCacheProxyModel::setSortCaseSensitivity(enum Qt::CaseSensitivity)
- ?itemData@HgCacheProxyModel@@UBE?AV?$QMap@HVQVariant@@@@ABVQModelIndex@@@Z @ 39 NONAME ; class QMap<int, class QVariant> HgCacheProxyModel::itemData(class QModelIndex const &) const
- ?dynamicSortFilter@HgCacheProxyModel@@QBE_NXZ @ 40 NONAME ; bool HgCacheProxyModel::dynamicSortFilter(void) const
- ?data@HgDataProviderModel@@IBE?AVQVariant@@HH@Z @ 41 NONAME ; class QVariant HgDataProviderModel::data(int, int) const
- ?rowCount@HgDataProviderModel@@UBEHABVQModelIndex@@@Z @ 42 NONAME ; int HgDataProviderModel::rowCount(class QModelIndex const &) const
- ?submit@HgCacheProxyModel@@UAE_NXZ @ 43 NONAME ; bool HgCacheProxyModel::submit(void)
- ?hasChildren@HgCacheProxyModel@@UBE_NABVQModelIndex@@@Z @ 44 NONAME ; bool HgCacheProxyModel::hasChildren(class QModelIndex const &) const
- ?trUtf8@HgDataProviderModel@@SA?AVQString@@PBD0H@Z @ 45 NONAME ; class QString HgDataProviderModel::trUtf8(char const *, char const *, int)
- ?tr@HgDataProviderModel@@SA?AVQString@@PBD0H@Z @ 46 NONAME ; class QString HgDataProviderModel::tr(char const *, char const *, int)
- ?sortOrder@HgCacheProxyModel@@QBE?AW4SortOrder@Qt@@XZ @ 47 NONAME ; enum Qt::SortOrder HgCacheProxyModel::sortOrder(void) const
- ?setSortLocaleAware@HgCacheProxyModel@@QAEX_N@Z @ 48 NONAME ; void HgCacheProxyModel::setSortLocaleAware(bool)
- ?removeItem@HgDataProviderModel@@IAEXH@Z @ 49 NONAME ; void HgDataProviderModel::removeItem(int)
- ?removeRows@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 50 NONAME ; bool HgCacheProxyModel::removeRows(int, int, class QModelIndex const &)
- ?getStaticMetaObject@HgDataProviderModel@@SAABUQMetaObject@@XZ @ 51 NONAME ; struct QMetaObject const & HgDataProviderModel::getStaticMetaObject(void)
- ?clearCache@HgDataProviderModel@@IAEXXZ @ 52 NONAME ; void HgDataProviderModel::clearCache(void)
- ?dataUpdated@HgCacheProxyModel@@UAEXHH@Z @ 53 NONAME ; void HgCacheProxyModel::dataUpdated(int, int)
- ??1HgDataProviderModel@@UAE@XZ @ 54 NONAME ; HgDataProviderModel::~HgDataProviderModel(void)
- ?isSortLocaleAware@HgCacheProxyModel@@QBE_NXZ @ 55 NONAME ; bool HgCacheProxyModel::isSortLocaleAware(void) const
- ?fetchMore@HgCacheProxyModel@@UAEXABVQModelIndex@@@Z @ 56 NONAME ; void HgCacheProxyModel::fetchMore(class QModelIndex const &)
- ?newItem@HgDataProviderModel@@IAEXU?$QPair@VQVariant@@H@@_N@Z @ 57 NONAME ; void HgDataProviderModel::newItem(struct QPair<class QVariant, int>, bool)
- ?setDynamicSortFilter@HgCacheProxyModel@@QAEX_N@Z @ 58 NONAME ; void HgCacheProxyModel::setDynamicSortFilter(bool)
- ?isIndexValid@HgDataProviderModel@@IBE_NH@Z @ 59 NONAME ; bool HgDataProviderModel::isIndexValid(int) const
- ?index@HgCacheProxyModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 60 NONAME ; class QModelIndex HgCacheProxyModel::index(int, int, class QModelIndex const &) const
- ?sortColumn@HgCacheProxyModel@@QBEHXZ @ 61 NONAME ; int HgCacheProxyModel::sortColumn(void) const
- ?request@HgDataProviderModel@@QAEXV?$QList@H@@_N@Z @ 62 NONAME ; void HgDataProviderModel::request(class QList<int>, bool)
- ?removeItems@HgDataProviderModel@@IAEXHH@Z @ 63 NONAME ; void HgDataProviderModel::removeItems(int, int)
- ?doInsertItem@HgDataProviderModel@@AAEXHPAV?$QList@U?$QPair@VQVariant@@H@@@@_N@Z @ 64 NONAME ; void HgDataProviderModel::doInsertItem(int, class QList<struct QPair<class QVariant, int> > *, bool)
- ?resizeCache@HgCacheProxyModel@@QAEXHH@Z @ 65 NONAME ; void HgCacheProxyModel::resizeCache(int, int)
- ?count@HgDataProviderModel@@IBEHXZ @ 66 NONAME ; int HgDataProviderModel::count(void) const
- ?request@HgCacheProxyModel@@UAEXHHW4HgRequestOrder@HgBufferManagerObserver@@@Z @ 67 NONAME ; void HgCacheProxyModel::request(int, int, enum HgBufferManagerObserver::HgRequestOrder)
- ?mimeTypes@HgCacheProxyModel@@UBE?AVQStringList@@XZ @ 68 NONAME ; class QStringList HgCacheProxyModel::mimeTypes(void) const
- ?sortCaseSensitivity@HgCacheProxyModel@@QBE?AW4CaseSensitivity@Qt@@XZ @ 69 NONAME ; enum Qt::CaseSensitivity HgCacheProxyModel::sortCaseSensitivity(void) const
- ?setItemData@HgCacheProxyModel@@UAE_NABVQModelIndex@@ABV?$QMap@HVQVariant@@@@@Z @ 70 NONAME ; bool HgCacheProxyModel::setItemData(class QModelIndex const &, class QMap<int, class QVariant> const &)
- ?rowCount@HgCacheProxyModel@@UBEHABVQModelIndex@@@Z @ 71 NONAME ; int HgCacheProxyModel::rowCount(class QModelIndex const &) const
- ?setData@HgCacheProxyModel@@UAE_NABVQModelIndex@@ABVQVariant@@H@Z @ 72 NONAME ; bool HgCacheProxyModel::setData(class QModelIndex const &, class QVariant const &, int)
- ??_EHgDataProviderModel@@UAE@I@Z @ 73 NONAME ; HgDataProviderModel::~HgDataProviderModel(unsigned int)
- ?mimeData@HgCacheProxyModel@@UBEPAVQMimeData@@ABV?$QList@VQModelIndex@@@@@Z @ 74 NONAME ; class QMimeData * HgCacheProxyModel::mimeData(class QList<class QModelIndex> const &) const
- ?newItem@HgDataProviderModel@@IAEXPAV?$QList@U?$QPair@VQVariant@@H@@@@_N@Z @ 75 NONAME ; void HgDataProviderModel::newItem(class QList<struct QPair<class QVariant, int> > *, bool)
- ?setHeaderData@HgCacheProxyModel@@UAE_NHW4Orientation@Qt@@ABVQVariant@@H@Z @ 76 NONAME ; bool HgCacheProxyModel::setHeaderData(int, enum Qt::Orientation, class QVariant const &, int)
- ?update@HgDataProviderModel@@IAE_NHVQVariant@@H_N@Z @ 77 NONAME ; bool HgDataProviderModel::update(int, class QVariant, int, bool)
- ?match@HgCacheProxyModel@@UBE?AV?$QList@VQModelIndex@@@@ABVQModelIndex@@HABVQVariant@@HV?$QFlags@W4MatchFlag@Qt@@@@@Z @ 78 NONAME ; class QList<class QModelIndex> HgCacheProxyModel::match(class QModelIndex const &, int, class QVariant const &, int, class QFlags<enum Qt::MatchFlag>) const
- ?release@HgCacheProxyModel@@UAEXHH@Z @ 79 NONAME ; void HgCacheProxyModel::release(int, int)
- ?resetModel@HgDataProviderModel@@QAEXXZ @ 80 NONAME ; void HgDataProviderModel::resetModel(void)
- ?span@HgCacheProxyModel@@UBE?AVQSize@@ABVQModelIndex@@@Z @ 81 NONAME ; class QSize HgCacheProxyModel::span(class QModelIndex const &) const
- ?insertColumns@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 82 NONAME ; bool HgCacheProxyModel::insertColumns(int, int, class QModelIndex const &)
- ?metaObject@HgDataProviderModel@@UBEPBUQMetaObject@@XZ @ 83 NONAME ; struct QMetaObject const * HgDataProviderModel::metaObject(void) const
- ?resetIcon@HgDataProviderModel@@IAEXH@Z @ 84 NONAME ; void HgDataProviderModel::resetIcon(int)
- ?setSortRole@HgCacheProxyModel@@QAEXH@Z @ 85 NONAME ; void HgCacheProxyModel::setSortRole(int)
- ?getPixmap@HgDataProviderModel@@AAEPAVQPixmap@@H@Z @ 86 NONAME ; class QPixmap * HgDataProviderModel::getPixmap(int)
- ?trUtf8@HgDataProviderModel@@SA?AVQString@@PBD0@Z @ 87 NONAME ; class QString HgDataProviderModel::trUtf8(char const *, char const *)
- ?flags@HgCacheProxyModel@@UBE?AV?$QFlags@W4ItemFlag@Qt@@@@ABVQModelIndex@@@Z @ 88 NONAME ; class QFlags<enum Qt::ItemFlag> HgCacheProxyModel::flags(class QModelIndex const &) const
- ?qt_metacall@HgDataProviderModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 89 NONAME ; int HgDataProviderModel::qt_metacall(enum QMetaObject::Call, int, void * *)
- ?DataProvider@HgCacheProxyModel@@QAEPAVHgDataProviderModel@@XZ @ 90 NONAME ; class HgDataProviderModel * HgCacheProxyModel::DataProvider(void)
+ ?sortRole@HgCacheProxyModel@@QBEHXZ @ 2 NONAME ; int HgCacheProxyModel::sortRole(void) const
+ ?setFilterKeyColumn@HgCacheProxyModel@@QAEXH@Z @ 3 NONAME ; void HgCacheProxyModel::setFilterKeyColumn(int)
+ ?buddy@HgCacheProxyModel@@UBE?AVQModelIndex@@ABV2@@Z @ 4 NONAME ; class QModelIndex HgCacheProxyModel::buddy(class QModelIndex const &) const
+ ?containsRole@HgDataProviderModel@@IBE_NHH@Z @ 5 NONAME ; bool HgDataProviderModel::containsRole(int, int) const
+ ?trUtf8@HgCacheProxyModel@@SA?AVQString@@PBD0@Z @ 6 NONAME ; class QString HgCacheProxyModel::trUtf8(char const *, char const *)
+ ?itemData@HgDataProviderModel@@UBE?AV?$QMap@HVQVariant@@@@ABVQModelIndex@@@Z @ 7 NONAME ; class QMap<int, class QVariant> HgDataProviderModel::itemData(class QModelIndex const &) const
+ ?resizeQPixmapPool@HgDataProviderModel@@QAEXH@Z @ 8 NONAME ; void HgDataProviderModel::resizeQPixmapPool(int)
+ ?filterRegExp@HgCacheProxyModel@@QBE?AVQRegExp@@XZ @ 9 NONAME ; class QRegExp HgCacheProxyModel::filterRegExp(void) const
+ ??0HgDataProviderModel@@QAE@PAVQObject@@@Z @ 10 NONAME ; HgDataProviderModel::HgDataProviderModel(class QObject *)
+ ?dropMimeData@HgCacheProxyModel@@UAE_NPBVQMimeData@@W4DropAction@Qt@@HHABVQModelIndex@@@Z @ 11 NONAME ; bool HgCacheProxyModel::dropMimeData(class QMimeData const *, enum Qt::DropAction, int, int, class QModelIndex const &)
+ ?setFilterRegExp@HgCacheProxyModel@@QAEXABVQRegExp@@@Z @ 12 NONAME ; void HgCacheProxyModel::setFilterRegExp(class QRegExp const &)
+ ?columnCount@HgDataProviderModel@@UBEHABVQModelIndex@@@Z @ 13 NONAME ; int HgDataProviderModel::columnCount(class QModelIndex const &) const
+ ?update@HgDataProviderModel@@IAE_NHPAV?$QList@U?$QPair@VQVariant@@H@@@@_N@Z @ 14 NONAME ; bool HgDataProviderModel::update(int, class QList<struct QPair<class QVariant, int> > *, bool)
+ ?doResetModel@HgDataProviderModel@@MAEXXZ @ 15 NONAME ; void HgDataProviderModel::doResetModel(void)
+ ?canFetchMore@HgCacheProxyModel@@UBE_NABVQModelIndex@@@Z @ 16 NONAME ; bool HgCacheProxyModel::canFetchMore(class QModelIndex const &) const
+ ?emitDataChanged@HgDataProviderModel@@IAEXHH_N@Z @ 17 NONAME ; void HgDataProviderModel::emitDataChanged(int, int, bool)
+ ?staticMetaObject@HgDataProviderModel@@2UQMetaObject@@B @ 18 NONAME ; struct QMetaObject const HgDataProviderModel::staticMetaObject
+ ?mapFromDataProviderIndex@HgCacheProxyModel@@ABEHH@Z @ 19 NONAME ; int HgCacheProxyModel::mapFromDataProviderIndex(int) const
+ ?sourceLayoutChanged@HgCacheProxyModel@@AAEXXZ @ 20 NONAME ; void HgCacheProxyModel::sourceLayoutChanged(void)
+ ?data@HgDataProviderModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 21 NONAME ; class QVariant HgDataProviderModel::data(class QModelIndex const &, int) const
+ ?setSortCaseSensitivity@HgCacheProxyModel@@QAEXW4CaseSensitivity@Qt@@@Z @ 22 NONAME ; void HgCacheProxyModel::setSortCaseSensitivity(enum Qt::CaseSensitivity)
+ ?itemData@HgCacheProxyModel@@UBE?AV?$QMap@HVQVariant@@@@ABVQModelIndex@@@Z @ 23 NONAME ; class QMap<int, class QVariant> HgCacheProxyModel::itemData(class QModelIndex const &) const
+ ?submit@HgCacheProxyModel@@UAE_NXZ @ 24 NONAME ; bool HgCacheProxyModel::submit(void)
+ ?sourceColumnsAboutToBeRemoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 25 NONAME ; void HgCacheProxyModel::sourceColumnsAboutToBeRemoved(class QModelIndex const &, int, int)
+ ?hasChildren@HgCacheProxyModel@@UBE_NABVQModelIndex@@@Z @ 26 NONAME ; bool HgCacheProxyModel::hasChildren(class QModelIndex const &) const
+ ?sourceColumnsRemoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 27 NONAME ; void HgCacheProxyModel::sourceColumnsRemoved(class QModelIndex const &, int, int)
+ ?trUtf8@HgDataProviderModel@@SA?AVQString@@PBD0H@Z @ 28 NONAME ; class QString HgDataProviderModel::trUtf8(char const *, char const *, int)
+ ?tr@HgDataProviderModel@@SA?AVQString@@PBD0H@Z @ 29 NONAME ; class QString HgDataProviderModel::tr(char const *, char const *, int)
+ ?setFilterRole@HgCacheProxyModel@@QAEXH@Z @ 30 NONAME ; void HgCacheProxyModel::setFilterRole(int)
+ ?setSortLocaleAware@HgCacheProxyModel@@QAEX_N@Z @ 31 NONAME ; void HgCacheProxyModel::setSortLocaleAware(bool)
+ ?removeItem@HgDataProviderModel@@IAEXH@Z @ 32 NONAME ; void HgDataProviderModel::removeItem(int)
+ ?trUtf8@HgCacheProxyModel@@SA?AVQString@@PBD0H@Z @ 33 NONAME ; class QString HgCacheProxyModel::trUtf8(char const *, char const *, int)
+ ?getStaticMetaObject@HgCacheProxyModel@@SAABUQMetaObject@@XZ @ 34 NONAME ; struct QMetaObject const & HgCacheProxyModel::getStaticMetaObject(void)
+ ?sourceColumnsAboutToBeMoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH0H@Z @ 35 NONAME ; void HgCacheProxyModel::sourceColumnsAboutToBeMoved(class QModelIndex const &, int, int, class QModelIndex const &, int)
+ ?clearCache@HgDataProviderModel@@IAEXXZ @ 36 NONAME ; void HgDataProviderModel::clearCache(void)
+ ??1HgDataProviderModel@@UAE@XZ @ 37 NONAME ; HgDataProviderModel::~HgDataProviderModel(void)
+ ?sourceColumnsMoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH0H@Z @ 38 NONAME ; void HgCacheProxyModel::sourceColumnsMoved(class QModelIndex const &, int, int, class QModelIndex const &, int)
+ ?isSortLocaleAware@HgCacheProxyModel@@QBE_NXZ @ 39 NONAME ; bool HgCacheProxyModel::isSortLocaleAware(void) const
+ ?isIndexValid@HgDataProviderModel@@IBE_NH@Z @ 40 NONAME ; bool HgDataProviderModel::isIndexValid(int) const
+ ?sortColumn@HgCacheProxyModel@@QBEHXZ @ 41 NONAME ; int HgCacheProxyModel::sortColumn(void) const
+ ?request@HgDataProviderModel@@QAEXV?$QList@H@@_N@Z @ 42 NONAME ; void HgDataProviderModel::request(class QList<int>, bool)
+ ?cleanupForBMReset@HgCacheProxyModel@@AAEXXZ @ 43 NONAME ; void HgCacheProxyModel::cleanupForBMReset(void)
+ ?resizeCache@HgCacheProxyModel@@QAEXHH@Z @ 44 NONAME ; void HgCacheProxyModel::resizeCache(int, int)
+ ?doInsertItem@HgDataProviderModel@@AAEXHPAV?$QList@U?$QPair@VQVariant@@H@@@@_N@Z @ 45 NONAME ; void HgDataProviderModel::doInsertItem(int, class QList<struct QPair<class QVariant, int> > *, bool)
+ ?mapToDataProviderIndex@HgCacheProxyModel@@ABEHH@Z @ 46 NONAME ; int HgCacheProxyModel::mapToDataProviderIndex(int) const
+ ?qt_metacast@HgCacheProxyModel@@UAEPAXPBD@Z @ 47 NONAME ; void * HgCacheProxyModel::qt_metacast(char const *)
+ ?request@HgCacheProxyModel@@UAEXHHW4HgRequestOrder@HgBufferManagerObserver@@@Z @ 48 NONAME ; void HgCacheProxyModel::request(int, int, enum HgBufferManagerObserver::HgRequestOrder)
+ ?mimeTypes@HgCacheProxyModel@@UBE?AVQStringList@@XZ @ 49 NONAME ; class QStringList HgCacheProxyModel::mimeTypes(void) const
+ ?sortCaseSensitivity@HgCacheProxyModel@@QBE?AW4CaseSensitivity@Qt@@XZ @ 50 NONAME ; enum Qt::CaseSensitivity HgCacheProxyModel::sortCaseSensitivity(void) const
+ ?setItemData@HgCacheProxyModel@@UAE_NABVQModelIndex@@ABV?$QMap@HVQVariant@@@@@Z @ 51 NONAME ; bool HgCacheProxyModel::setItemData(class QModelIndex const &, class QMap<int, class QVariant> const &)
+ ?staticMetaObject@HgCacheProxyModel@@2UQMetaObject@@B @ 52 NONAME ; struct QMetaObject const HgCacheProxyModel::staticMetaObject
+ ?rowCount@HgCacheProxyModel@@UBEHABVQModelIndex@@@Z @ 53 NONAME ; int HgCacheProxyModel::rowCount(class QModelIndex const &) const
+ ??_EHgDataProviderModel@@UAE@I@Z @ 54 NONAME ; HgDataProviderModel::~HgDataProviderModel(unsigned int)
+ ?newItem@HgDataProviderModel@@IAEXPAV?$QList@U?$QPair@VQVariant@@H@@@@_N@Z @ 55 NONAME ; void HgDataProviderModel::newItem(class QList<struct QPair<class QVariant, int> > *, bool)
+ ?setHeaderData@HgCacheProxyModel@@UAE_NHW4Orientation@Qt@@ABVQVariant@@H@Z @ 56 NONAME ; bool HgCacheProxyModel::setHeaderData(int, enum Qt::Orientation, class QVariant const &, int)
+ ?resetBM@HgCacheProxyModel@@AAEXXZ @ 57 NONAME ; void HgCacheProxyModel::resetBM(void)
+ ?releaseAll@HgCacheProxyModel@@AAEXXZ @ 58 NONAME ; void HgCacheProxyModel::releaseAll(void)
+ ?setSortRole@HgCacheProxyModel@@QAEXH@Z @ 59 NONAME ; void HgCacheProxyModel::setSortRole(int)
+ ?trUtf8@HgDataProviderModel@@SA?AVQString@@PBD0@Z @ 60 NONAME ; class QString HgDataProviderModel::trUtf8(char const *, char const *)
+ ?flags@HgCacheProxyModel@@UBE?AV?$QFlags@W4ItemFlag@Qt@@@@ABVQModelIndex@@@Z @ 61 NONAME ; class QFlags<enum Qt::ItemFlag> HgCacheProxyModel::flags(class QModelIndex const &) const
+ ?DataProvider@HgCacheProxyModel@@QAEPAVHgDataProviderModel@@XZ @ 62 NONAME ; class HgDataProviderModel * HgCacheProxyModel::DataProvider(void)
+ ?insertItem@HgDataProviderModel@@IAEXHU?$QPair@VQVariant@@H@@_N@Z @ 63 NONAME ; void HgDataProviderModel::insertItem(int, struct QPair<class QVariant, int>, bool)
+ ?sourceColumnsAboutToBeInserted@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 64 NONAME ; void HgCacheProxyModel::sourceColumnsAboutToBeInserted(class QModelIndex const &, int, int)
+ ?data@HgCacheProxyModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 65 NONAME ; class QVariant HgCacheProxyModel::data(class QModelIndex const &, int) const
+ ?createIcon@HgDataProviderModel@@IAE?AVQVariant@@HVQPixmap@@@Z @ 66 NONAME ; class QVariant HgDataProviderModel::createIcon(int, class QPixmap)
+ ?parent@HgCacheProxyModel@@UBE?AVQModelIndex@@ABV2@@Z @ 67 NONAME ; class QModelIndex HgCacheProxyModel::parent(class QModelIndex const &) const
+ ?parent@HgDataProviderModel@@UBE?AVQModelIndex@@ABV2@@Z @ 68 NONAME ; class QModelIndex HgDataProviderModel::parent(class QModelIndex const &) const
+ ?setDataProvider@HgCacheProxyModel@@QAEXPAVHgDataProviderModel@@HH@Z @ 69 NONAME ; void HgCacheProxyModel::setDataProvider(class HgDataProviderModel *, int, int)
+ ?release@HgDataProviderModel@@QAEXV?$QList@H@@_N@Z @ 70 NONAME ; void HgDataProviderModel::release(class QList<int>, bool)
+ ?qt_metacast@HgDataProviderModel@@UAEPAXPBD@Z @ 71 NONAME ; void * HgDataProviderModel::qt_metacast(char const *)
+ ?mapToSource@HgCacheProxyModel@@ABE?AVQModelIndex@@ABV2@@Z @ 72 NONAME ; class QModelIndex HgCacheProxyModel::mapToSource(class QModelIndex const &) const
+ ?sourceDataChanged@HgCacheProxyModel@@AAEXABVQModelIndex@@0@Z @ 73 NONAME ; void HgCacheProxyModel::sourceDataChanged(class QModelIndex const &, class QModelIndex const &)
+ ?sourceRowsAboutToBeRemoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 74 NONAME ; void HgCacheProxyModel::sourceRowsAboutToBeRemoved(class QModelIndex const &, int, int)
+ ?columnCount@HgCacheProxyModel@@UBEHABVQModelIndex@@@Z @ 75 NONAME ; int HgCacheProxyModel::columnCount(class QModelIndex const &) const
+ ?mapToSource@HgCacheProxyModel@@ABE?AVQModelIndex@@HH@Z @ 76 NONAME ; class QModelIndex HgCacheProxyModel::mapToSource(int, int) const
+ ?tr@HgDataProviderModel@@SA?AVQString@@PBD0@Z @ 77 NONAME ; class QString HgDataProviderModel::tr(char const *, char const *)
+ ?sourceRowsRemoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 78 NONAME ; void HgCacheProxyModel::sourceRowsRemoved(class QModelIndex const &, int, int)
+ ?sourceHeaderDataChanged@HgCacheProxyModel@@AAEXW4Orientation@Qt@@HH@Z @ 79 NONAME ; void HgCacheProxyModel::sourceHeaderDataChanged(enum Qt::Orientation, int, int)
+ ??1HgCacheProxyModel@@UAE@XZ @ 80 NONAME ; HgCacheProxyModel::~HgCacheProxyModel(void)
+ ?registerObserver@HgDataProviderModel@@QAEXPAVHgDataProviderModelObserver@@@Z @ 81 NONAME ; void HgDataProviderModel::registerObserver(class HgDataProviderModelObserver *)
+ ?sourceRowsAboutToBeMoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH0H@Z @ 82 NONAME ; void HgCacheProxyModel::sourceRowsAboutToBeMoved(class QModelIndex const &, int, int, class QModelIndex const &, int)
+ ??0HgCacheProxyModel@@QAE@PAVQObject@@@Z @ 83 NONAME ; HgCacheProxyModel::HgCacheProxyModel(class QObject *)
+ ?supportedDropActions@HgCacheProxyModel@@UBE?AV?$QFlags@W4DropAction@Qt@@@@XZ @ 84 NONAME ; class QFlags<enum Qt::DropAction> HgCacheProxyModel::supportedDropActions(void) const
+ ?updateIcon@HgDataProviderModel@@IAE_NHVQVariant@@_N@Z @ 85 NONAME ; bool HgDataProviderModel::updateIcon(int, class QVariant, bool)
+ ?index@HgDataProviderModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 86 NONAME ; class QModelIndex HgDataProviderModel::index(int, int, class QModelIndex const &) const
+ ?sort@HgCacheProxyModel@@UAEXHW4SortOrder@Qt@@@Z @ 87 NONAME ; void HgCacheProxyModel::sort(int, enum Qt::SortOrder)
+ ?releasePixmap@HgDataProviderModel@@IAEXH@Z @ 88 NONAME ; void HgDataProviderModel::releasePixmap(int)
+ ?sourceRowsMoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH0H@Z @ 89 NONAME ; void HgCacheProxyModel::sourceRowsMoved(class QModelIndex const &, int, int, class QModelIndex const &, int)
+ ?removeColumns@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 90 NONAME ; bool HgCacheProxyModel::removeColumns(int, int, class QModelIndex const &)
+ ?insertRows@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 91 NONAME ; bool HgCacheProxyModel::insertRows(int, int, class QModelIndex const &)
+ ?tr@HgCacheProxyModel@@SA?AVQString@@PBD0H@Z @ 92 NONAME ; class QString HgCacheProxyModel::tr(char const *, char const *, int)
+ ?insertItem@HgDataProviderModel@@IAEXHPAV?$QList@U?$QPair@VQVariant@@H@@@@_N@Z @ 93 NONAME ; void HgDataProviderModel::insertItem(int, class QList<struct QPair<class QVariant, int> > *, bool)
+ ?revert@HgCacheProxyModel@@UAEXXZ @ 94 NONAME ; void HgCacheProxyModel::revert(void)
+ ?dynamicSortFilter@HgCacheProxyModel@@QBE_NXZ @ 95 NONAME ; bool HgCacheProxyModel::dynamicSortFilter(void) const
+ ?data@HgDataProviderModel@@IBE?AVQVariant@@HH@Z @ 96 NONAME ; class QVariant HgDataProviderModel::data(int, int) const
+ ?rowCount@HgDataProviderModel@@UBEHABVQModelIndex@@@Z @ 97 NONAME ; int HgDataProviderModel::rowCount(class QModelIndex const &) const
+ ?setFilterCaseSensitivity@HgCacheProxyModel@@QAEXW4CaseSensitivity@Qt@@@Z @ 98 NONAME ; void HgCacheProxyModel::setFilterCaseSensitivity(enum Qt::CaseSensitivity)
+ ?count@HgCacheProxyModel@@ABEHXZ @ 99 NONAME ; int HgCacheProxyModel::count(void) const
+ ?sortOrder@HgCacheProxyModel@@QBE?AW4SortOrder@Qt@@XZ @ 100 NONAME ; enum Qt::SortOrder HgCacheProxyModel::sortOrder(void) const
+ ?removeRows@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 101 NONAME ; bool HgCacheProxyModel::removeRows(int, int, class QModelIndex const &)
+ ?getStaticMetaObject@HgDataProviderModel@@SAABUQMetaObject@@XZ @ 102 NONAME ; struct QMetaObject const & HgDataProviderModel::getStaticMetaObject(void)
+ ?setBufferPosition@HgCacheProxyModel@@ABEXH@Z @ 103 NONAME ; void HgCacheProxyModel::setBufferPosition(int) const
+ ?dataUpdated@HgCacheProxyModel@@UAEXHH@Z @ 104 NONAME ; void HgCacheProxyModel::dataUpdated(int, int)
+ ?sourceRowsAboutToBeInserted@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 105 NONAME ; void HgCacheProxyModel::sourceRowsAboutToBeInserted(class QModelIndex const &, int, int)
+ ?fetchMore@HgCacheProxyModel@@UAEXABVQModelIndex@@@Z @ 106 NONAME ; void HgCacheProxyModel::fetchMore(class QModelIndex const &)
+ ?filterCaseSensitivity@HgCacheProxyModel@@QBE?AW4CaseSensitivity@Qt@@XZ @ 107 NONAME ; enum Qt::CaseSensitivity HgCacheProxyModel::filterCaseSensitivity(void) const
+ ?newItem@HgDataProviderModel@@IAEXU?$QPair@VQVariant@@H@@_N@Z @ 108 NONAME ; void HgDataProviderModel::newItem(struct QPair<class QVariant, int>, bool)
+ ?setDynamicSortFilter@HgCacheProxyModel@@QAEX_N@Z @ 109 NONAME ; void HgCacheProxyModel::setDynamicSortFilter(bool)
+ ?sourceModelReset@HgCacheProxyModel@@AAEXXZ @ 110 NONAME ; void HgCacheProxyModel::sourceModelReset(void)
+ ?index@HgCacheProxyModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 111 NONAME ; class QModelIndex HgCacheProxyModel::index(int, int, class QModelIndex const &) const
+ ?removeItems@HgDataProviderModel@@IAEXHH@Z @ 112 NONAME ; void HgDataProviderModel::removeItems(int, int)
+ ?count@HgDataProviderModel@@IBEHXZ @ 113 NONAME ; int HgDataProviderModel::count(void) const
+ ?sourceColumnsInserted@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 114 NONAME ; void HgCacheProxyModel::sourceColumnsInserted(class QModelIndex const &, int, int)
+ ?tr@HgCacheProxyModel@@SA?AVQString@@PBD0@Z @ 115 NONAME ; class QString HgCacheProxyModel::tr(char const *, char const *)
+ ?qt_metacall@HgCacheProxyModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 116 NONAME ; int HgCacheProxyModel::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?setData@HgCacheProxyModel@@UAE_NABVQModelIndex@@ABVQVariant@@H@Z @ 117 NONAME ; bool HgCacheProxyModel::setData(class QModelIndex const &, class QVariant const &, int)
+ ?mimeData@HgCacheProxyModel@@UBEPAVQMimeData@@ABV?$QList@VQModelIndex@@@@@Z @ 118 NONAME ; class QMimeData * HgCacheProxyModel::mimeData(class QList<class QModelIndex> const &) const
+ ?update@HgDataProviderModel@@IAE_NHVQVariant@@H_N@Z @ 119 NONAME ; bool HgDataProviderModel::update(int, class QVariant, int, bool)
+ ?match@HgCacheProxyModel@@UBE?AV?$QList@VQModelIndex@@@@ABVQModelIndex@@HABVQVariant@@HV?$QFlags@W4MatchFlag@Qt@@@@@Z @ 120 NONAME ; class QList<class QModelIndex> HgCacheProxyModel::match(class QModelIndex const &, int, class QVariant const &, int, class QFlags<enum Qt::MatchFlag>) const
+ ?sourceRowsInserted@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 121 NONAME ; void HgCacheProxyModel::sourceRowsInserted(class QModelIndex const &, int, int)
+ ?release@HgCacheProxyModel@@UAEXHH@Z @ 122 NONAME ; void HgCacheProxyModel::release(int, int)
+ ?resetModel@HgDataProviderModel@@QAEXXZ @ 123 NONAME ; void HgDataProviderModel::resetModel(void)
+ ?span@HgCacheProxyModel@@UBE?AVQSize@@ABVQModelIndex@@@Z @ 124 NONAME ; class QSize HgCacheProxyModel::span(class QModelIndex const &) const
+ ?insertColumns@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 125 NONAME ; bool HgCacheProxyModel::insertColumns(int, int, class QModelIndex const &)
+ ??_EHgCacheProxyModel@@UAE@I@Z @ 126 NONAME ; HgCacheProxyModel::~HgCacheProxyModel(unsigned int)
+ ?filterRole@HgCacheProxyModel@@QBEHXZ @ 127 NONAME ; int HgCacheProxyModel::filterRole(void) const
+ ?metaObject@HgDataProviderModel@@UBEPBUQMetaObject@@XZ @ 128 NONAME ; struct QMetaObject const * HgDataProviderModel::metaObject(void) const
+ ?resetIcon@HgDataProviderModel@@IAEXH@Z @ 129 NONAME ; void HgDataProviderModel::resetIcon(int)
+ ?sourceLayoutAboutToBeChanged@HgCacheProxyModel@@AAEXXZ @ 130 NONAME ; void HgCacheProxyModel::sourceLayoutAboutToBeChanged(void)
+ ?metaObject@HgCacheProxyModel@@UBEPBUQMetaObject@@XZ @ 131 NONAME ; struct QMetaObject const * HgCacheProxyModel::metaObject(void) const
+ ?getPixmap@HgDataProviderModel@@AAEPAVQPixmap@@H@Z @ 132 NONAME ; class QPixmap * HgDataProviderModel::getPixmap(int)
+ ?sourceModelAboutToBeReset@HgCacheProxyModel@@AAEXXZ @ 133 NONAME ; void HgCacheProxyModel::sourceModelAboutToBeReset(void)
+ ?qt_metacall@HgDataProviderModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 134 NONAME ; int HgDataProviderModel::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?filterKeyColumn@HgCacheProxyModel@@QBEHXZ @ 135 NONAME ; int HgCacheProxyModel::filterKeyColumn(void) const
--- a/eabi/hgcacheproxymodelu.def Mon May 03 13:32:54 2010 +0300
+++ b/eabi/hgcacheproxymodelu.def Fri May 14 16:57:01 2010 +0300
@@ -1,94 +1,136 @@
EXPORTS
_ZN17HgCacheProxyModel10insertRowsEiiRK11QModelIndex @ 1 NONAME
- _ZN17HgCacheProxyModel10removeRowsEiiRK11QModelIndex @ 2 NONAME
- _ZN17HgCacheProxyModel11dataUpdatedEii @ 3 NONAME
- _ZN17HgCacheProxyModel11resizeCacheEii @ 4 NONAME
- _ZN17HgCacheProxyModel11setItemDataERK11QModelIndexRK4QMapIi8QVariantE @ 5 NONAME
- _ZN17HgCacheProxyModel11setSortRoleEi @ 6 NONAME
- _ZN17HgCacheProxyModel12DataProviderEv @ 7 NONAME
- _ZN17HgCacheProxyModel12dropMimeDataEPK9QMimeDataN2Qt10DropActionEiiRK11QModelIndex @ 8 NONAME
- _ZN17HgCacheProxyModel13insertColumnsEiiRK11QModelIndex @ 9 NONAME
- _ZN17HgCacheProxyModel13removeColumnsEiiRK11QModelIndex @ 10 NONAME
- _ZN17HgCacheProxyModel13setHeaderDataEiN2Qt11OrientationERK8QVarianti @ 11 NONAME
- _ZN17HgCacheProxyModel15setDataProviderEP19HgDataProviderModelii @ 12 NONAME
- _ZN17HgCacheProxyModel18setSortLocaleAwareEb @ 13 NONAME
- _ZN17HgCacheProxyModel20setDynamicSortFilterEb @ 14 NONAME
- _ZN17HgCacheProxyModel22setSortCaseSensitivityEN2Qt15CaseSensitivityE @ 15 NONAME
- _ZN17HgCacheProxyModel4sortEiN2Qt9SortOrderE @ 16 NONAME
- _ZN17HgCacheProxyModel6revertEv @ 17 NONAME
- _ZN17HgCacheProxyModel6submitEv @ 18 NONAME
- _ZN17HgCacheProxyModel7releaseEii @ 19 NONAME
- _ZN17HgCacheProxyModel7requestEiiN23HgBufferManagerObserver14HgRequestOrderE @ 20 NONAME
- _ZN17HgCacheProxyModel7setDataERK11QModelIndexRK8QVarianti @ 21 NONAME
- _ZN17HgCacheProxyModel9fetchMoreERK11QModelIndex @ 22 NONAME
- _ZN17HgCacheProxyModelC1EP7QObject @ 23 NONAME
- _ZN17HgCacheProxyModelC2EP7QObject @ 24 NONAME
- _ZN17HgCacheProxyModelD0Ev @ 25 NONAME
- _ZN17HgCacheProxyModelD1Ev @ 26 NONAME
- _ZN17HgCacheProxyModelD2Ev @ 27 NONAME
- _ZN19HgDataProviderModel10clearCacheEv @ 28 NONAME
- _ZN19HgDataProviderModel10createIconEi7QPixmap @ 29 NONAME
- _ZN19HgDataProviderModel10insertItemEi5QPairI8QVariantiEb @ 30 NONAME
- _ZN19HgDataProviderModel10insertItemEiP5QListI5QPairI8QVariantiEEb @ 31 NONAME
- _ZN19HgDataProviderModel10removeItemEi @ 32 NONAME
- _ZN19HgDataProviderModel10resetModelEv @ 33 NONAME
- _ZN19HgDataProviderModel10updateIconEi8QVariantb @ 34 NONAME
- _ZN19HgDataProviderModel11qt_metacallEN11QMetaObject4CallEiPPv @ 35 NONAME
- _ZN19HgDataProviderModel11qt_metacastEPKc @ 36 NONAME
- _ZN19HgDataProviderModel11removeItemsEii @ 37 NONAME
- _ZN19HgDataProviderModel12doInsertItemEiP5QListI5QPairI8QVariantiEEb @ 38 NONAME
- _ZN19HgDataProviderModel13releasePixmapEi @ 39 NONAME
- _ZN19HgDataProviderModel15emitDataChangedEiib @ 40 NONAME
- _ZN19HgDataProviderModel16registerObserverEP27HgDataProviderModelObserver @ 41 NONAME
- _ZN19HgDataProviderModel16staticMetaObjectE @ 42 NONAME DATA 16
- _ZN19HgDataProviderModel17resizeQPixmapPoolEi @ 43 NONAME
- _ZN19HgDataProviderModel19getStaticMetaObjectEv @ 44 NONAME
- _ZN19HgDataProviderModel6updateEi8QVariantib @ 45 NONAME
- _ZN19HgDataProviderModel6updateEiP5QListI5QPairI8QVariantiEEb @ 46 NONAME
- _ZN19HgDataProviderModel7newItemE5QPairI8QVariantiEb @ 47 NONAME
- _ZN19HgDataProviderModel7newItemEP5QListI5QPairI8QVariantiEEb @ 48 NONAME
- _ZN19HgDataProviderModel7releaseE5QListIiEb @ 49 NONAME
- _ZN19HgDataProviderModel7requestE5QListIiEb @ 50 NONAME
- _ZN19HgDataProviderModel9getPixmapEi @ 51 NONAME
- _ZN19HgDataProviderModel9resetIconEi @ 52 NONAME
- _ZN19HgDataProviderModelC2EP7QObject @ 53 NONAME
- _ZN19HgDataProviderModelD0Ev @ 54 NONAME
- _ZN19HgDataProviderModelD1Ev @ 55 NONAME
- _ZN19HgDataProviderModelD2Ev @ 56 NONAME
- _ZNK17HgCacheProxyModel10headerDataEiN2Qt11OrientationEi @ 57 NONAME
- _ZNK17HgCacheProxyModel10sortColumnEv @ 58 NONAME
- _ZNK17HgCacheProxyModel11columnCountERK11QModelIndex @ 59 NONAME
- _ZNK17HgCacheProxyModel11hasChildrenERK11QModelIndex @ 60 NONAME
- _ZNK17HgCacheProxyModel12canFetchMoreERK11QModelIndex @ 61 NONAME
- _ZNK17HgCacheProxyModel17dynamicSortFilterEv @ 62 NONAME
- _ZNK17HgCacheProxyModel17isSortLocaleAwareEv @ 63 NONAME
- _ZNK17HgCacheProxyModel19sortCaseSensitivityEv @ 64 NONAME
- _ZNK17HgCacheProxyModel20supportedDropActionsEv @ 65 NONAME
- _ZNK17HgCacheProxyModel4dataERK11QModelIndexi @ 66 NONAME
- _ZNK17HgCacheProxyModel4spanERK11QModelIndex @ 67 NONAME
- _ZNK17HgCacheProxyModel5buddyERK11QModelIndex @ 68 NONAME
- _ZNK17HgCacheProxyModel5flagsERK11QModelIndex @ 69 NONAME
- _ZNK17HgCacheProxyModel5indexEiiRK11QModelIndex @ 70 NONAME
- _ZNK17HgCacheProxyModel5matchERK11QModelIndexiRK8QVarianti6QFlagsIN2Qt9MatchFlagEE @ 71 NONAME
- _ZNK17HgCacheProxyModel6parentERK11QModelIndex @ 72 NONAME
- _ZNK17HgCacheProxyModel8itemDataERK11QModelIndex @ 73 NONAME
- _ZNK17HgCacheProxyModel8mimeDataERK5QListI11QModelIndexE @ 74 NONAME
- _ZNK17HgCacheProxyModel8rowCountERK11QModelIndex @ 75 NONAME
- _ZNK17HgCacheProxyModel8sortRoleEv @ 76 NONAME
- _ZNK17HgCacheProxyModel9mimeTypesEv @ 77 NONAME
- _ZNK17HgCacheProxyModel9sortOrderEv @ 78 NONAME
- _ZNK19HgDataProviderModel10metaObjectEv @ 79 NONAME
- _ZNK19HgDataProviderModel11columnCountERK11QModelIndex @ 80 NONAME
- _ZNK19HgDataProviderModel4dataERK11QModelIndexi @ 81 NONAME
- _ZNK19HgDataProviderModel4dataEii @ 82 NONAME
- _ZNK19HgDataProviderModel5countEv @ 83 NONAME
- _ZNK19HgDataProviderModel5indexEiiRK11QModelIndex @ 84 NONAME
- _ZNK19HgDataProviderModel6parentERK11QModelIndex @ 85 NONAME
- _ZNK19HgDataProviderModel8itemDataERK11QModelIndex @ 86 NONAME
- _ZNK19HgDataProviderModel8rowCountERK11QModelIndex @ 87 NONAME
- _ZTI19HgDataProviderModel @ 88 NONAME
- _ZTV19HgDataProviderModel @ 89 NONAME
- _ZThn12_N17HgCacheProxyModel11dataUpdatedEii @ 90 NONAME
- _ZThn8_N17HgCacheProxyModel7releaseEii @ 91 NONAME
- _ZThn8_N17HgCacheProxyModel7requestEiiN23HgBufferManagerObserver14HgRequestOrderE @ 92 NONAME
+ _ZN17HgCacheProxyModel10releaseAllEv @ 2 NONAME
+ _ZN17HgCacheProxyModel10removeRowsEiiRK11QModelIndex @ 3 NONAME
+ _ZN17HgCacheProxyModel11dataUpdatedEii @ 4 NONAME
+ _ZN17HgCacheProxyModel11qt_metacallEN11QMetaObject4CallEiPPv @ 5 NONAME
+ _ZN17HgCacheProxyModel11qt_metacastEPKc @ 6 NONAME
+ _ZN17HgCacheProxyModel11resizeCacheEii @ 7 NONAME
+ _ZN17HgCacheProxyModel11setItemDataERK11QModelIndexRK4QMapIi8QVariantE @ 8 NONAME
+ _ZN17HgCacheProxyModel11setSortRoleEi @ 9 NONAME
+ _ZN17HgCacheProxyModel12DataProviderEv @ 10 NONAME
+ _ZN17HgCacheProxyModel12dropMimeDataEPK9QMimeDataN2Qt10DropActionEiiRK11QModelIndex @ 11 NONAME
+ _ZN17HgCacheProxyModel13insertColumnsEiiRK11QModelIndex @ 12 NONAME
+ _ZN17HgCacheProxyModel13removeColumnsEiiRK11QModelIndex @ 13 NONAME
+ _ZN17HgCacheProxyModel13setFilterRoleEi @ 14 NONAME
+ _ZN17HgCacheProxyModel13setHeaderDataEiN2Qt11OrientationERK8QVarianti @ 15 NONAME
+ _ZN17HgCacheProxyModel15setDataProviderEP19HgDataProviderModelii @ 16 NONAME
+ _ZN17HgCacheProxyModel15setFilterRegExpERK7QRegExp @ 17 NONAME
+ _ZN17HgCacheProxyModel15sourceRowsMovedERK11QModelIndexiiS2_i @ 18 NONAME
+ _ZN17HgCacheProxyModel16sourceModelResetEv @ 19 NONAME
+ _ZN17HgCacheProxyModel16staticMetaObjectE @ 20 NONAME DATA 16
+ _ZN17HgCacheProxyModel17cleanupForBMResetEv @ 21 NONAME
+ _ZN17HgCacheProxyModel17sourceDataChangedERK11QModelIndexS2_ @ 22 NONAME
+ _ZN17HgCacheProxyModel17sourceRowsRemovedERK11QModelIndexii @ 23 NONAME
+ _ZN17HgCacheProxyModel18setFilterKeyColumnEi @ 24 NONAME
+ _ZN17HgCacheProxyModel18setSortLocaleAwareEb @ 25 NONAME
+ _ZN17HgCacheProxyModel18sourceColumnsMovedERK11QModelIndexiiS2_i @ 26 NONAME
+ _ZN17HgCacheProxyModel18sourceRowsInsertedERK11QModelIndexii @ 27 NONAME
+ _ZN17HgCacheProxyModel19getStaticMetaObjectEv @ 28 NONAME
+ _ZN17HgCacheProxyModel19sourceLayoutChangedEv @ 29 NONAME
+ _ZN17HgCacheProxyModel20setDynamicSortFilterEb @ 30 NONAME
+ _ZN17HgCacheProxyModel20sourceColumnsRemovedERK11QModelIndexii @ 31 NONAME
+ _ZN17HgCacheProxyModel21sourceColumnsInsertedERK11QModelIndexii @ 32 NONAME
+ _ZN17HgCacheProxyModel22setSortCaseSensitivityEN2Qt15CaseSensitivityE @ 33 NONAME
+ _ZN17HgCacheProxyModel23sourceHeaderDataChangedEN2Qt11OrientationEii @ 34 NONAME
+ _ZN17HgCacheProxyModel24setFilterCaseSensitivityEN2Qt15CaseSensitivityE @ 35 NONAME
+ _ZN17HgCacheProxyModel24sourceRowsAboutToBeMovedERK11QModelIndexiiS2_i @ 36 NONAME
+ _ZN17HgCacheProxyModel25sourceModelAboutToBeResetEv @ 37 NONAME
+ _ZN17HgCacheProxyModel26sourceRowsAboutToBeRemovedERK11QModelIndexii @ 38 NONAME
+ _ZN17HgCacheProxyModel27sourceColumnsAboutToBeMovedERK11QModelIndexiiS2_i @ 39 NONAME
+ _ZN17HgCacheProxyModel27sourceRowsAboutToBeInsertedERK11QModelIndexii @ 40 NONAME
+ _ZN17HgCacheProxyModel28sourceLayoutAboutToBeChangedEv @ 41 NONAME
+ _ZN17HgCacheProxyModel29sourceColumnsAboutToBeRemovedERK11QModelIndexii @ 42 NONAME
+ _ZN17HgCacheProxyModel30sourceColumnsAboutToBeInsertedERK11QModelIndexii @ 43 NONAME
+ _ZN17HgCacheProxyModel4sortEiN2Qt9SortOrderE @ 44 NONAME
+ _ZN17HgCacheProxyModel6revertEv @ 45 NONAME
+ _ZN17HgCacheProxyModel6submitEv @ 46 NONAME
+ _ZN17HgCacheProxyModel7releaseEii @ 47 NONAME
+ _ZN17HgCacheProxyModel7requestEiiN23HgBufferManagerObserver14HgRequestOrderE @ 48 NONAME
+ _ZN17HgCacheProxyModel7resetBMEv @ 49 NONAME
+ _ZN17HgCacheProxyModel7setDataERK11QModelIndexRK8QVarianti @ 50 NONAME
+ _ZN17HgCacheProxyModel9fetchMoreERK11QModelIndex @ 51 NONAME
+ _ZN17HgCacheProxyModelC1EP7QObject @ 52 NONAME
+ _ZN17HgCacheProxyModelC2EP7QObject @ 53 NONAME
+ _ZN17HgCacheProxyModelD0Ev @ 54 NONAME
+ _ZN17HgCacheProxyModelD1Ev @ 55 NONAME
+ _ZN17HgCacheProxyModelD2Ev @ 56 NONAME
+ _ZN19HgDataProviderModel10clearCacheEv @ 57 NONAME
+ _ZN19HgDataProviderModel10createIconEi7QPixmap @ 58 NONAME
+ _ZN19HgDataProviderModel10insertItemEi5QPairI8QVariantiEb @ 59 NONAME
+ _ZN19HgDataProviderModel10insertItemEiP5QListI5QPairI8QVariantiEEb @ 60 NONAME
+ _ZN19HgDataProviderModel10removeItemEi @ 61 NONAME
+ _ZN19HgDataProviderModel10resetModelEv @ 62 NONAME
+ _ZN19HgDataProviderModel10updateIconEi8QVariantb @ 63 NONAME
+ _ZN19HgDataProviderModel11qt_metacallEN11QMetaObject4CallEiPPv @ 64 NONAME
+ _ZN19HgDataProviderModel11qt_metacastEPKc @ 65 NONAME
+ _ZN19HgDataProviderModel11removeItemsEii @ 66 NONAME
+ _ZN19HgDataProviderModel12doInsertItemEiP5QListI5QPairI8QVariantiEEb @ 67 NONAME
+ _ZN19HgDataProviderModel13releasePixmapEi @ 68 NONAME
+ _ZN19HgDataProviderModel15emitDataChangedEiib @ 69 NONAME
+ _ZN19HgDataProviderModel16registerObserverEP27HgDataProviderModelObserver @ 70 NONAME
+ _ZN19HgDataProviderModel16staticMetaObjectE @ 71 NONAME DATA 16
+ _ZN19HgDataProviderModel17resizeQPixmapPoolEi @ 72 NONAME
+ _ZN19HgDataProviderModel19getStaticMetaObjectEv @ 73 NONAME
+ _ZN19HgDataProviderModel6updateEi8QVariantib @ 74 NONAME
+ _ZN19HgDataProviderModel6updateEiP5QListI5QPairI8QVariantiEEb @ 75 NONAME
+ _ZN19HgDataProviderModel7newItemE5QPairI8QVariantiEb @ 76 NONAME
+ _ZN19HgDataProviderModel7newItemEP5QListI5QPairI8QVariantiEEb @ 77 NONAME
+ _ZN19HgDataProviderModel7releaseE5QListIiEb @ 78 NONAME
+ _ZN19HgDataProviderModel7requestE5QListIiEb @ 79 NONAME
+ _ZN19HgDataProviderModel9getPixmapEi @ 80 NONAME
+ _ZN19HgDataProviderModel9resetIconEi @ 81 NONAME
+ _ZN19HgDataProviderModelC2EP7QObject @ 82 NONAME
+ _ZN19HgDataProviderModelD0Ev @ 83 NONAME
+ _ZN19HgDataProviderModelD1Ev @ 84 NONAME
+ _ZN19HgDataProviderModelD2Ev @ 85 NONAME
+ _ZNK17HgCacheProxyModel10filterRoleEv @ 86 NONAME
+ _ZNK17HgCacheProxyModel10headerDataEiN2Qt11OrientationEi @ 87 NONAME
+ _ZNK17HgCacheProxyModel10metaObjectEv @ 88 NONAME
+ _ZNK17HgCacheProxyModel10sortColumnEv @ 89 NONAME
+ _ZNK17HgCacheProxyModel11columnCountERK11QModelIndex @ 90 NONAME
+ _ZNK17HgCacheProxyModel11hasChildrenERK11QModelIndex @ 91 NONAME
+ _ZNK17HgCacheProxyModel11mapToSourceERK11QModelIndex @ 92 NONAME
+ _ZNK17HgCacheProxyModel11mapToSourceEii @ 93 NONAME
+ _ZNK17HgCacheProxyModel12canFetchMoreERK11QModelIndex @ 94 NONAME
+ _ZNK17HgCacheProxyModel12filterRegExpEv @ 95 NONAME
+ _ZNK17HgCacheProxyModel15filterKeyColumnEv @ 96 NONAME
+ _ZNK17HgCacheProxyModel17dynamicSortFilterEv @ 97 NONAME
+ _ZNK17HgCacheProxyModel17isSortLocaleAwareEv @ 98 NONAME
+ _ZNK17HgCacheProxyModel17setBufferPositionEi @ 99 NONAME
+ _ZNK17HgCacheProxyModel19sortCaseSensitivityEv @ 100 NONAME
+ _ZNK17HgCacheProxyModel20supportedDropActionsEv @ 101 NONAME
+ _ZNK17HgCacheProxyModel21filterCaseSensitivityEv @ 102 NONAME
+ _ZNK17HgCacheProxyModel22mapToDataProviderIndexEi @ 103 NONAME
+ _ZNK17HgCacheProxyModel24mapFromDataProviderIndexEi @ 104 NONAME
+ _ZNK17HgCacheProxyModel4dataERK11QModelIndexi @ 105 NONAME
+ _ZNK17HgCacheProxyModel4spanERK11QModelIndex @ 106 NONAME
+ _ZNK17HgCacheProxyModel5buddyERK11QModelIndex @ 107 NONAME
+ _ZNK17HgCacheProxyModel5countEv @ 108 NONAME
+ _ZNK17HgCacheProxyModel5flagsERK11QModelIndex @ 109 NONAME
+ _ZNK17HgCacheProxyModel5indexEiiRK11QModelIndex @ 110 NONAME
+ _ZNK17HgCacheProxyModel5matchERK11QModelIndexiRK8QVarianti6QFlagsIN2Qt9MatchFlagEE @ 111 NONAME
+ _ZNK17HgCacheProxyModel6parentERK11QModelIndex @ 112 NONAME
+ _ZNK17HgCacheProxyModel8itemDataERK11QModelIndex @ 113 NONAME
+ _ZNK17HgCacheProxyModel8mimeDataERK5QListI11QModelIndexE @ 114 NONAME
+ _ZNK17HgCacheProxyModel8rowCountERK11QModelIndex @ 115 NONAME
+ _ZNK17HgCacheProxyModel8sortRoleEv @ 116 NONAME
+ _ZNK17HgCacheProxyModel9mimeTypesEv @ 117 NONAME
+ _ZNK17HgCacheProxyModel9sortOrderEv @ 118 NONAME
+ _ZNK19HgDataProviderModel10metaObjectEv @ 119 NONAME
+ _ZNK19HgDataProviderModel11columnCountERK11QModelIndex @ 120 NONAME
+ _ZNK19HgDataProviderModel4dataERK11QModelIndexi @ 121 NONAME
+ _ZNK19HgDataProviderModel4dataEii @ 122 NONAME
+ _ZNK19HgDataProviderModel5countEv @ 123 NONAME
+ _ZNK19HgDataProviderModel5indexEiiRK11QModelIndex @ 124 NONAME
+ _ZNK19HgDataProviderModel6parentERK11QModelIndex @ 125 NONAME
+ _ZNK19HgDataProviderModel8itemDataERK11QModelIndex @ 126 NONAME
+ _ZNK19HgDataProviderModel8rowCountERK11QModelIndex @ 127 NONAME
+ _ZTI17HgCacheProxyModel @ 128 NONAME
+ _ZTI19HgDataProviderModel @ 129 NONAME
+ _ZTV17HgCacheProxyModel @ 130 NONAME
+ _ZTV19HgDataProviderModel @ 131 NONAME
+ _ZThn12_N17HgCacheProxyModel11dataUpdatedEii @ 132 NONAME
+ _ZThn8_N17HgCacheProxyModel7releaseEii @ 133 NONAME
+ _ZThn8_N17HgCacheProxyModel7requestEiiN23HgBufferManagerObserver14HgRequestOrderE @ 134 NONAME
--- a/ganeswidgets/ganeswidgets.pro Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/ganeswidgets.pro Fri May 14 16:57:01 2010 +0300
@@ -22,7 +22,6 @@
$$MW_LAYER_SYSTEMINCLUDE \
/sf/mw/hb/src/hbcore/gui
LIBS += -lestor.dll \
- -lmpxcommon.dll \
-lhbcore \
-lhbwidgets \
-llibOpenVG.dll \
@@ -48,12 +47,15 @@
src/hglongpressvisualizer.cpp \
src/hgcoverflowcontainer.cpp \
src/hggridcontainer.cpp \
- src/hgindexfeedback.cpp \
- src/hgindexfeedback_p.cpp \
+# src/hgindexfeedback.cpp \
+# src/hgindexfeedback_p.cpp \
src/hggrid.cpp \
src/hggrid_p.cpp \
src/hgmediawall.cpp \
- src/hgmediawall_p.cpp
+ src/hgmediawall_p.cpp \
+ src/hgqtquadrenderer.cpp \
+ src/hgtransformedquad.cpp \
+ src/hgtransformedquadrenderer.cpp
HEADERS = inc/trace.h \
../hgwidgets_plat/ganeswidgets_api/inc/hgwidgets.h \
../hgwidgets_plat/ganeswidgets_api/inc/hggrid.h \
@@ -70,9 +72,13 @@
inc/hglongpressvisualizer.h \
inc/hgcoverflowcontainer.h \
inc/hggridcontainer.h \
- inc/hgindexfeedback.h
+# inc/hgindexfeedback.h \
+ inc/hgqtquadrenderer.h \
+ inc/hgtransformedquad.h \
+ inc/hgtransformedquadrenderer.h
RESOURCES += data/ganeswidgets.qrc
+DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT
include(rom/rom.pri)
include(sis/stub.pri)
\ No newline at end of file
--- a/ganeswidgets/inc/HgContainer.h Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/inc/HgContainer.h Fri May 14 16:57:01 2010 +0300
@@ -103,6 +103,11 @@
void scrollingStarted();
void scrollingEnded();
+protected slots:
+
+ virtual void onScrollingStarted();
+ virtual void onScrollingEnded();
+
private slots:
void updateBySpringPosition();
@@ -136,7 +141,6 @@
virtual void handleLongTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex);
virtual void onScrollPositionChanged(qreal pos);
virtual void handleCurrentChanged(const QModelIndex ¤t);
- virtual QRectF drawableRect() const;
protected:
@@ -158,7 +162,7 @@
bool handleLongTap(Qt::GestureState state, const QPointF &pos);
bool handleItemAction(const QPointF &pos, ItemActionType action);
- void selectItem();
+ void selectItem(int index);
void updateSelectedItem();
void unselectItem();
@@ -168,8 +172,6 @@
void stopLongPressWatcher();
bool updateSelectionModel(HgWidgetItem* item);
- QTransform qtToVgTransform() const;
- QPointF mapQtToVg(const QPointF& p) const;
virtual void updateItemSizeAndSpacing();
virtual QSizeF getAutoItemSize() const;
@@ -196,7 +198,8 @@
HgWidget::SelectionMode mSelectionMode;
QItemSelectionModel *mSelectionModel;
- HgImage *mMarkImage;
+ HgImage *mMarkImageOn;
+ HgImage *mMarkImageOff;
qreal mSpringVelAtDragStart;
bool mDragged;
@@ -219,6 +222,8 @@
QSizeF mUserItemSpacing;
Qt::Orientation mOrientation;
+ QModelIndex mDelayedScrollToIndex;
+ bool mIgnoreTap;
};
#endif
--- a/ganeswidgets/inc/HgScrollBufferManager.h Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/inc/HgScrollBufferManager.h Fri May 14 16:57:01 2010 +0300
@@ -121,10 +121,11 @@
int mReleaseStart;
int mReleaseCount;
QTimer mTimer;
-
+ bool mFirstTime;
+
UpdateBuffer mRequestBuffer;
UpdateBuffer mReleaseBuffer;
-
+
private:
Q_DISABLE_COPY(HgScrollBufferManager)
};
--- a/ganeswidgets/inc/hgcoverflowcontainer.h Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/inc/hgcoverflowcontainer.h Fri May 14 16:57:01 2010 +0300
@@ -46,7 +46,6 @@
virtual void handleCurrentChanged(const QModelIndex & current);
virtual void itemDataChanged(const int &firstIndex, const int &lastIndex);
virtual void scrollToPosition(const QPointF& pos, bool animate);
- virtual QRectF drawableRect() const;
virtual QSizeF getAutoItemSize() const;
virtual QSizeF getAutoItemSpacing() const;
@@ -66,7 +65,11 @@
void enableReflections(bool enabled);
bool reflectionsEnabled() const;
-
+
+signals:
+
+ void animationAboutToEnd(const QModelIndex& targetIndex);
+
private: // From HgContainer
void setDefaultImage(QImage defaultImage);
@@ -78,16 +81,18 @@
void calculatePositions();
void positionLabels();
+ void onScrollingStarted();
+ void onScrollingEnded();
private:
- HbLabel *mTitleLabel;
- HbLabel *mDescriptionLabel;
- HgMediawall::LabelPosition mTitlePosition;
- HgMediawall::LabelPosition mDescriptionPosition;
- int mPrevPos;
- qreal mAspectRatio;
- QRectF mDrawableRect;
- QSizeF mAutoSize;
+ HbLabel *mTitleLabel;
+ HbLabel *mDescriptionLabel;
+ HgMediawall::LabelPosition mTitlePosition;
+ HgMediawall::LabelPosition mDescriptionPosition;
+ int mPrevPos;
+ qreal mAspectRatio;
+ QSizeF mAutoSize;
+ bool mAnimationAboutToEndReacted;
};
#endif
--- a/ganeswidgets/inc/hgimage.h Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/inc/hgimage.h Fri May 14 16:57:01 2010 +0300
@@ -19,7 +19,7 @@
#define HGIMAGE_H
class QImage;
-
+class QPixmap;
/**
* Interface class for Images provided to HgQuadRenderer.
*/
@@ -30,6 +30,7 @@
virtual void setAlpha(qreal alpha) { mAlpha = alpha; }
virtual qreal alpha() const { return mAlpha; }
virtual void setImage(const QImage& image)=0;
+ virtual void setPixmap(const QPixmap& pixmap)=0;
virtual QImage getQImage() const=0;
virtual void releaseImage()=0;
virtual int width() const = 0;
--- a/ganeswidgets/inc/hgmediawallrenderer.h Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/inc/hgmediawallrenderer.h Fri May 14 16:57:01 2010 +0300
@@ -19,6 +19,7 @@
#include <qmatrix4x4>
#include <qobject>
+#include <qmap>
class HgQuadRenderer;
class HgMediaWallDataProvider;
@@ -31,6 +32,7 @@
class HgImageFader;
class HgImage;
class QPolygonF;
+class HgAnimatedQuadFactory;
/**
* MediaWall rendering engine class.
@@ -41,23 +43,18 @@
Q_PROPERTY(qreal animationAlpha READ animationAlpha WRITE setAnimationAlpha)
Q_PROPERTY(qreal stateAnimationAlpha READ stateAnimationAlpha WRITE setStateAnimationAlpha)
public:
-
- enum OpeningAnimationType
- {
- OpeningAnimationFlip,
- OpeningAnimationZoomIn,
- OpeningAnimationZoomOver
- };
explicit HgMediaWallRenderer(HgMediaWallDataProvider* provider,
- Qt::Orientation orientation, bool coverflowMode);
+ Qt::Orientation orientation, Qt::Orientation scrollDirection, bool coverflowMode);
virtual ~HgMediaWallRenderer();
void setCameraDistance(qreal distance);
qreal getCameraDistance() const;
+
void setCameraRotationY(qreal angle);
qreal getCameraRotationY() const;
+
void setCameraRotationZ(qreal angle);
qreal getCameraRotationZ() const;
@@ -66,16 +63,14 @@
const QPointF& position,
const QPointF& targetPosition,
qreal springVelocity,
- QPainter* painter);
-
- void setFlipAnimationAngle(qreal angleInDegrees);
+ QPainter* painter,
+ const QTransform& sceneTransform,
+ const QRectF& rect);
+
+ void setScrollDirection(Qt::Orientation scrollDirection, bool animate=false);
+ Qt::Orientation getScrollDirection() const;
- void setOpeningAnimationType(OpeningAnimationType type);
-
- void setOpeningAnimationDuration(int msecs);
-
- void setOrientation(Qt::Orientation orientation, bool animate=false);
- Qt::Orientation getOrientation() const;
+ void setOrientation(Qt::Orientation orientation);
void enableCoverflowMode(bool enabled);
bool coverflowModeEnabled() const;
@@ -84,9 +79,7 @@
int getRowCount() const;
HgQuad* getQuadAt(const QPointF& position) const;
-
- void setRect(const QRectF& windowRect);
- const QRectF& getRect() const;
+
void setSpacing(const QSizeF& spacing);
const QSizeF& getSpacing() const;
void setImageSize(const QSizeF& imageSize);
@@ -94,10 +87,6 @@
void setFrontCoverElevationFactor(qreal elevation);
qreal getFrontCoverElevationFactor() const;
-
- void openItem(int index, bool animate);
- void closeItem(bool animate);
- bool isItemOpen() const;
void enableReflections(bool enabled);
bool reflectionsEnabled() const;
@@ -108,10 +97,7 @@
void endRemoveRows();
int getSelectedItem() const;
-
- void initialize(QPainter* painter);
- bool initialized() const;
-
+
HgQuadRenderer* getRenderer();
bool getItemPoints(int index, QPolygonF& points) const;
@@ -120,24 +106,15 @@
void setFrontItemPosition(const QPointF& position);
QPointF frontItemPosition() const;
-
+
signals:
void renderingNeeded();
- void itemOpened(int index);
- void itemClosed(int index);
- void itemMarked(int index);
- void toggleItem();
void toggleState();
- void itemsRemoved(int start, int end);
-private slots:
- void onIdleState();
- void onOpenedState();
- void emitUpdate();
protected:
struct State
{
- QList<HgQuad*> mQuads;
+ QMap<int, HgQuad*> mQuads;
};
void setAnimationAlpha(qreal alpha);
@@ -158,15 +135,33 @@
qreal springVelocity,
QPainter* painter);
- void drawQuads(QPainter* painter);
+ void startScrollDirectionChangeAnimation (
+ const QPointF& startPosition,
+ const QPointF& position,
+ const QPointF& targetPosition,
+ qreal springVelocity,
+ QPainter* painter,
+ const QTransform& sceneTransform,
+ const QRectF& rect);
+
+ void startRowCountChangeAnimation (
+ const QPointF& startPosition,
+ const QPointF& position,
+ const QPointF& targetPosition,
+ qreal springVelocity,
+ QPainter* painter,
+ const QTransform& sceneTransform,
+ const QRectF& rect);
+
+ void createAnimatedQuads(const HgAnimatedQuadFactory& factory);
+
+ void drawQuads(QPainter* painter, const QTransform& sceneTransform);
void resetQuads();
void updateCameraMatrices();
void updateSpacingAndImageSize();
qreal getRowPosY(int row);
qreal getColumnPosX(int column);
- QPointF mapFromWindow(const QPointF& point) const;
- void applyOpeningAnimation(HgQuad* quad);
- void startStateAnimation(QPainter* painter);
+
void setupCoverflow(const QPointF& startPosition,
@@ -187,47 +182,31 @@
qreal springVelocity,
QPainter* painter);
- void setupGridRow(qreal posY, int itemIndex, int& quadIndex);
- void setupGridColumn(qreal posX, int itemIndex, int& quadIndex);
+ void setupGridRow(qreal posY, int& itemIndex, int& quadIndex);
+ void setupGridColumn(qreal posX, int& itemIndex, int& quadIndex);
void setupDefaultQuad(const QVector3D& pos, int itemIndex, bool reflectionsEnabled, int& quadIndex);
void setupIndicator(HgQuad* parent,
HgQuad* indicator, const HgImage* indicatorImage, int itemIndex);
- bool initializeRenderer(QPainter* painter);
-
-
+
protected:
-
- enum ItemState
- {
- ItemClosed,
- ItemOpening,
- ItemOpened,
- ItemClosing
- };
-
+
HgMediaWallDataProvider* mDataProvider;
HgQuadRenderer* mRenderer;
HgQuadRenderer* mIndicatorRenderer;
bool mRendererInitialized;
+ Qt::Orientation mScrollDirection;
+ Qt::Orientation mNextScrollDirection;
Qt::Orientation mOrientation;
- Qt::Orientation mNextOrientation;
qreal mStateAnimationAlpha;
bool mStateAnimationOnGoing;
qreal mAnimationAlpha;
- OpeningAnimationType mOpeningAnimationType;
- int mOpeningAnimationDuration;
- int mOpenedItem;
- int mSelectedItem;
- qreal mFlipAngle;
- QTimer* mAnimationTimer;
QMatrix4x4 mViewMatrix;
QMatrix4x4 mProjMatrix;
QStateMachine* mStateMachine;
- qreal mZoomAmount;
bool mCoverflowMode;
int mRowCount;
int mNextRowCount;
@@ -251,25 +230,14 @@
State mOldState;
State mNextState;
-
-
- bool mReflectionsEnabled;
- HgImageFader* mImageFader;
-
+
QSizeF mNextImageSize;
- bool mItemCountChanged;
- int mRemoveStart;
- int mRemoveEnd;
- int mInsertStart;
- int mInsertEnd;
int mColumnCount;
-
- ItemState mOpenedItemState;
-
+
QPointF mFrontItemPosition;
bool mFrontItemPositionSet;
-
+
private:
Q_DISABLE_COPY(HgMediaWallRenderer)
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ganeswidgets/inc/hgqtquadrenderer.h Fri May 14 16:57:01 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef HGQTQUADRENDERER_H
+#define HGQTQUADRENDERER_H
+
+#include "hgtransformedquadrenderer.h"
+#include <qlist>
+#include <qimage>
+
+class QPoint;
+class QPainter;
+class QRectF;
+class QMatrix4x4;
+class HgQtImage;
+class QSize;
+class HgTransformedQuad;
+
+/**
+ * Qt implementation of the HgTransformedQuadRenderer.
+ */
+class HgQtQuadRenderer: public HgTransformedQuadRenderer
+{
+public:
+ HgQtQuadRenderer(int maxQuads);
+ virtual ~HgQtQuadRenderer();
+
+ // From HgQuadRenderer
+ virtual void drawQuads(QPainter* painter, const QRectF& rect,
+ const QMatrix4x4& viewMatrix, const QMatrix4x4& projectionMatrix,
+ Qt::Orientation orientation,
+ const QTransform& sceneTransform);
+ virtual HgImage* createNativeImage();
+ virtual void setDefaultImage(QImage defaultImage);
+
+ // new functions
+ HgQtImage* defaultImage();
+
+ bool isReflection() const;
+
+protected:
+
+ // From HgTransformedQuadRenderer
+ virtual HgTransformedQuad* createNativeQuad();
+
+ void drawFloor(QPainter* painter, const QRectF& rect);
+
+private:
+ HgQtImage* mDefaultQtImage;
+ bool mIsReflection;
+};
+
+#endif
--- a/ganeswidgets/inc/hgquadrenderer.h Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/inc/hgquadrenderer.h Fri May 14 16:57:01 2010 +0300
@@ -29,7 +29,7 @@
class QMatrix4x4;
class QPolygonF;
class HgImage;
-class HgImageFader;
+
/**
*
* Abstract class to be inherited by differend quad renderer implementations.
@@ -58,26 +58,25 @@
* @return quad under the pointer position or -1 if nothing is there.
*/
virtual HgQuad* getQuadAt(const QPointF& point) const = 0;
+
/**
- * Transform quads with view and projection transformation for rendering.
- * @param view view transformation matrix.
- * @param projection transformation matrix.
- * @rect window rectangle.
+ * Rasterize 3D quads to 2D screen using painter or underlying Native graphics API.
+ * This should be called inside Widgets draw method.
+ * @param painter QPainter-object.
+ * @param rect window rectangle.
+ * @param viewMatrix view matrix
+ * @param projectionMatrix projection matrix
+ * @param orientation current screen orientation
*/
- virtual void transformQuads(const QMatrix4x4& view, const QMatrix4x4& proj,
- const QRectF& rect)=0;
- /**
- * Draw transformed quads using painter or underlying Native graphics API.
- * This should be called inside Widgets draw method.
- * @param rect window rectangle.
- * @param painter QPainter-object.
- */
- virtual void drawQuads(const QRectF& rect, QPainter* painter)=0;
+ virtual void drawQuads(QPainter* painter, const QRectF& rect,
+ const QMatrix4x4& viewMatrix, const QMatrix4x4& projectionMatrix,
+ const Qt::Orientation orientation,
+ const QTransform& sceneTransform)=0;
/**
*
*/
- virtual bool getQuadTranformedPoints(QPolygonF& points, int index) const=0;
+ virtual bool getQuadTranformedPointsByUserData(QPolygonF& points, const QVariant& userData) const=0;
/**
*
@@ -88,17 +87,15 @@
*
*/
virtual HgImage* createNativeImage()=0;
-
- /**
- *
- */
- virtual void setImageFader(HgImageFader* fader);
-
+
/**
*
*/
virtual QList<HgQuad*> getVisibleQuads(const QRectF& rect) const=0;
+ /**
+ *
+ */
virtual void setDefaultImage(QImage defaultImage);
/**
@@ -116,14 +113,24 @@
*/
virtual QImage getDefaultImage() const;
+ /**
+ *
+ */
+ virtual void enableReflections(bool enabled);
+
+ /**
+ *
+ */
+ virtual bool reflectionsEnabled() const;
+
protected:
HgQuadRenderer(int maxQuads);
QList<HgQuad*> mQuads;
qreal mMirroringPlaneY;
- HgImageFader* mImageFader;
QImage mDefaultImage;
QVector2D mTranslation;
+ bool mReflectionsEnabled;
};
#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ganeswidgets/inc/hgtransformedquad.h Fri May 14 16:57:01 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef HGTRANSFORMEDQUAD_H
+#define HGTRANSFORMEDQUAD_H
+
+#include <qvector2d>
+
+class HgQuad;
+class QMatrix4x4;
+class QPointF;
+class QSizeF;
+class QPolygonF;
+class QPainter;
+
+/**
+ * Base class for transformed quads, to be used by renderers.
+ */
+class HgTransformedQuad
+{
+public:
+ HgTransformedQuad(qreal yDir=1);
+ virtual ~HgTransformedQuad();
+
+ int index() const;
+
+ bool isPointInside(const QPointF& point) const;
+
+ void transformQuad(int index, const QMatrix4x4& projView, HgQuad* quad,
+ qreal mirroringPlaneY, const QVector2D& translate, const QPointF& center,
+ const QSizeF& windowSize);
+
+ void getTransformedPoints(QPolygonF& poly) const;
+
+ HgQuad* quad() const;
+
+ virtual void draw(QPainter* painter, const QRectF& rect)=0;
+
+ static bool quadSorter(HgTransformedQuad* a, HgTransformedQuad* b);
+
+protected:
+
+ void computeMirroredPoints(const QMatrix4x4& trans, const QMatrix4x4& projView,
+ qreal mirroringPlaneY, const QVector2D& translate, const QPointF& center,
+ const QSizeF& windowSize);
+
+ void perspectiveTransformPoints(QVector2D* outPoints, const QMatrix4x4& matrix,
+ const QPointF& center, const QSizeF& windowSize);
+
+protected:
+ int mIndex;
+ HgQuad* mQuad;
+ QVector2D mTransformedPoints[4];
+ QVector2D mMirroredPoints[4];
+ qreal mYDir;
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ganeswidgets/inc/hgtransformedquadrenderer.h Fri May 14 16:57:01 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef HGTRANSFORMEDQUADRENDERER_H
+#define HGTRANSFORMEDQUADRENDERER_H
+
+#include "hgquadrenderer.h"
+#include <qlist>
+#include <qimage>
+
+class QPoint;
+class QPainter;
+class QRectF;
+class QMatrix4x4;
+class QSize;
+class HgTransformedQuad;
+
+/**
+ * Abstract base class for quad renderers, that need to tranform quads manually. (using CPU)
+ */
+class HgTransformedQuadRenderer: public HgQuadRenderer
+{
+public:
+
+ HgTransformedQuadRenderer(int maxQuads);
+ virtual ~HgTransformedQuadRenderer();
+
+ virtual HgQuad* getQuadAt(const QPointF& point) const;
+ virtual bool getQuadTranformedPointsByUserData(QPolygonF& points, const QVariant& userData) const;
+ virtual QList<HgQuad*> getVisibleQuads(const QRectF& rect) const;
+
+protected:
+
+ // this must be called from inheriting class
+ void init(int maxQuads);
+
+ virtual void transformQuads(const QMatrix4x4& view, const QMatrix4x4& proj,
+ const QPointF& center, const QSizeF& windowSize);
+
+ virtual void drawTransformedQuads(QPainter* painter, const QRectF& rect);
+
+ virtual HgTransformedQuad* createNativeQuad()=0;
+
+private:
+ QList<HgTransformedQuad*> mTransformedQuads;
+ QList<HgTransformedQuad*> mSortedQuads;
+};
+
+#endif
--- a/ganeswidgets/inc/hgvgimage.h Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/inc/hgvgimage.h Fri May 14 16:57:01 2010 +0300
@@ -46,6 +46,7 @@
VGImage mirrorImage() const;
void setImage(const QImage& image);
+ void setPixmap(const QPixmap& pixmap);
void releaseImage();
QImage getQImage() const;
--- a/ganeswidgets/inc/hgvgquadrenderer.h Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/inc/hgvgquadrenderer.h Fri May 14 16:57:01 2010 +0300
@@ -18,10 +18,11 @@
#ifndef HGVGQUADRENDERER_H
#define HGVGQUADRENDERER_H
-#include "hgquadrenderer.h"
+#include "hgtransformedquadrenderer.h"
#include <qlist>
#include <VG/openvg.h>
#include <qimage>
+#include <qtransform>
class QPoint;
class QPainter;
@@ -29,38 +30,40 @@
class QMatrix4x4;
class HgVgQuad;
class HgVgImage;
-class HgImageFader;
class QSize;
+class HgTransformedQuad;
/**
* OpenVG implementation of the HgQuadRenderer.
*/
-class HgVgQuadRenderer: public HgQuadRenderer
+class HgVgQuadRenderer: public HgTransformedQuadRenderer
{
public:
HgVgQuadRenderer(int maxQuads);
virtual ~HgVgQuadRenderer();
- virtual HgQuad* getQuadAt(const QPointF& point) const;
- virtual void transformQuads(const QMatrix4x4& view, const QMatrix4x4& proj,
- const QRectF& rect);
- virtual void drawQuads(const QRectF& rect, QPainter* painter);
- virtual bool getQuadTranformedPoints(QPolygonF& points, int index) const;
+
+ // From HgQuadRenderer
+ virtual void drawQuads(QPainter* painter, const QRectF& rect,
+ const QMatrix4x4& viewMatrix, const QMatrix4x4& projectionMatrix,
+ Qt::Orientation orientation,
+ const QTransform& sceneTransform);
virtual HgImage* createNativeImage();
- virtual QList<HgQuad*> getVisibleQuads(const QRectF& rect) const;
virtual void setDefaultImage(QImage defaultImage);
-
+
// new functions
HgVgImage* defaultImage();
- QSize imageSize(bool mirror=false) const;
- HgImageFader* imageFader();
+protected:
+
+ // From HgTransformedQuadRenderer
+ virtual HgTransformedQuad* createNativeQuad();
+
private:
- QList<HgVgQuad*> mTransformedQuads;
-
- QList<HgVgQuad*> mSortedQuads;
+ QTransform qtToVgTransform(QPainter* painter, const QTransform& sceneTransform,
+ const QRectF& rect, Qt::Orientation orientation) const;
- HgVgImage* mDefaultVgImage;
-
+private:
+ HgVgImage* mDefaultVgImage;
};
#endif
--- a/ganeswidgets/inc/hgwidgetitem.h Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/inc/hgwidgetitem.h Fri May 14 16:57:01 2010 +0300
@@ -37,6 +37,7 @@
virtual ~HgWidgetItem();
void setImage(const QImage &image);
+ void setPixmap(const QPixmap& pixmap);
void setTitle(QString title);
QString title() const;
--- a/ganeswidgets/inc/hgwidgets_p.h Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/inc/hgwidgets_p.h Fri May 14 16:57:01 2010 +0300
@@ -136,7 +136,7 @@
bool mHandleLongPress;
bool mForeground;
int mBufferSize;
- HgIndexFeedback *mIndexFeedback;
+// HgIndexFeedback *mIndexFeedback;
bool mStaticScrollDirection;
};
--- a/ganeswidgets/src/HgContainer.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/src/HgContainer.cpp Fri May 14 16:57:01 2010 +0300
@@ -28,6 +28,8 @@
#include "hgwidgetitem.h"
#include "trace.h"
+//#include <hbstyleoptioncheckbox.h>
+//#include <hbcheckbox>
#include <hbgridviewitem>
#include <hbgridview>
#include <hbiconitem>
@@ -50,16 +52,19 @@
mAnimateUsingScrollBar(false),
mSelectionMode(HgWidget::NoSelection),
mSelectionModel(0),
- mMarkImage(0),
+ mMarkImageOn(0),
+ mMarkImageOff(0),
mSpringVelAtDragStart(0),
mDragged(false),
mFramesDragged(0),
mHitItemView(NULL),
mLongPressVisualizer(NULL),
mLongPressTimer(NULL),
- mHitItemIndex(NULL),
- mItemSizePolicy(HgWidget::ItemSizeUserDefined),
- mOrientation(Qt::Vertical)
+ mHitItemIndex(-1),
+ mItemSizePolicy(HgWidget::ItemSizeAutomatic),
+ mOrientation(Qt::Vertical),
+ mDelayedScrollToIndex(),
+ mIgnoreTap(false)
{
FUNC_LOG;
@@ -74,7 +79,8 @@
qDeleteAll(mItems);
mItems.clear();
- delete mMarkImage;
+ delete mMarkImageOn;
+ delete mMarkImageOff;
delete mRenderer;
}
@@ -192,8 +198,7 @@
{
const QRectF containerRect(rect());
- // TODO, fix logic
- if (containerRect.height() > containerRect.width()) {
+ if (scrollDirection()== Qt::Vertical) {
// assume we are in portrait mode, ofcource this might not be the case
screenSize = containerRect.height()/(mRenderer->getImageSize().height() + mRenderer->getSpacing().height());
worldSize = worldWidth();
@@ -214,9 +219,13 @@
void HgContainer::setOrientation(Qt::Orientation orientation, bool animate)
{
FUNC_LOG;
-
+
mOrientation = orientation;
- mRenderer->setOrientation(orientation, false);
+ mRenderer->setOrientation(orientation);
+ mRenderer->setScrollDirection(orientation, animate);
+ if (!mSpring.isActive() && mSpring.pos().x() > worldWidth())
+ boundSpring();
+
}
void HgContainer::scrollToPosition(qreal value, bool animate)
@@ -243,8 +252,67 @@
{
FUNC_LOG;
- if (index.isValid() && mRenderer->getRowCount() > 0) {
- scrollToPosition(QPointF(index.row()/mRenderer->getRowCount(), 0), false);
+ if (index.isValid() && mRenderer->getRowCount() > 0 ) {
+
+ QRectF containerRect(rect());
+ if (containerRect.isNull()) {
+ // Container hasn't been resized yet. We need to know the container
+ // size before we can calculate if index we are scrolling to is valid.
+ // Store scrollTo index and scrolling is performed when container is resized.
+ mDelayedScrollToIndex = index;
+ }
+
+ // Container has some size. We can try to calculate if scrollto index is valid.
+ // ScrollTo index will be the top item in grid and left item on coverflow.
+
+ if (!mRenderer->coverflowModeEnabled()) {
+ // Grid case
+ int itemsOnScreen = 0;
+ if (scrollDirection()== Qt::Vertical) {
+ const int rowHeight = mRenderer->getImageSize().height() + mRenderer->getSpacing().height();
+ itemsOnScreen = containerRect.height()/rowHeight;
+ if ((int)containerRect.height()%rowHeight) {
+ itemsOnScreen++;
+ }
+ itemsOnScreen *= rowCount();
+ if (itemsOnScreen + index.row() > mItems.count()) {
+ int newItem = mItems.count()-itemsOnScreen;
+
+ if (mItems.count()%rowCount())
+ newItem += rowCount() - (mItems.count()%rowCount());
+ if (newItem < 0)
+ newItem = 0;
+
+ scrollToPosition(QPointF(newItem/mRenderer->getRowCount(),0), false);
+ } else {
+ scrollToPosition(QPointF(index.row()/mRenderer->getRowCount(), 0), false);
+ }
+ } else {
+ // Scrolldirection is horizontal
+ const int rowWidth = mRenderer->getImageSize().width() + mRenderer->getSpacing().width();
+ itemsOnScreen = containerRect.width()/rowWidth;
+ if ((int)containerRect.height()%rowWidth) {
+ itemsOnScreen++;
+ }
+ itemsOnScreen *= rowCount();
+ if (itemsOnScreen + index.row() > mItems.count()) {
+ int newItem = mItems.count()-itemsOnScreen;
+
+ if (mItems.count()%rowCount())
+ newItem += rowCount() - (mItems.count()%rowCount());
+ if (newItem < 0) newItem = 0;
+
+ scrollToPosition(QPointF(newItem/mRenderer->getRowCount(),0), false);
+ } else {
+ scrollToPosition(QPointF(index.row()/mRenderer->getRowCount(), 0), false);
+ }
+ }
+ updateBySpringPosition();
+ } else {
+ // Coverflow case. TODO, this will need some finetuning.
+ scrollToPosition(QPointF(index.row()/mRenderer->getRowCount(), 0), false);
+ updateBySpringPosition();
+ }
}
}
@@ -327,8 +395,12 @@
int HgContainer::flags(int index) const
{
if (index >= 0 && index < itemCount()) {
- if (mSelectionModel && mSelectionModel->isSelected(mSelectionModel->model()->index(index, 0))) {
- return 1; // TODO: Assign flag to mark indicator
+ 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 0;
@@ -337,7 +409,10 @@
const HgImage *HgContainer::indicator(int flags) const
{
if (flags & 1) {
- return mMarkImage;
+ return mMarkImageOn;
+ }
+ else if (flags & 2) {
+ return mMarkImageOff;
}
return 0;
@@ -363,36 +438,20 @@
{
Q_UNUSED(option)
Q_UNUSED(widget)
+
+ // update spring position at paint if needed,
+ // this is hack for scrollbar, since dragging it
+ // causes also paint events in here
if (mSpring.updatePositionIfNeeded())
{
- // spring works always in one dimension, that is, x coord.
qreal pos = mSpring.pos().x();
onScrollPositionChanged(pos);
emit scrollPositionChanged(pos, true);
}
-
- QRectF vp = painter->viewport();
- QRectF rts = mapRectToScene(drawableRect());
- QRectF r;
-
- // transform rectangle to vg space &
- // rotate rendering according to orientation
- if (mOrientation == Qt::Horizontal) {
- r = QRectF(vp.width()-(rts.height()+rts.top()), rts.left(), rts.height(), rts.width());
-
- mRenderer->setRect(r);
-
- mRenderer->setCameraRotationZ(-90);
- }
- else {
- r = QRectF(rts.left(), vp.height()-(rts.height()+rts.top()), rts.width(), rts.height());
- mRenderer->setCameraRotationZ(0);
-
- mRenderer->setRect(r);
-
- if (!mSpring.isActive() && mSpring.pos().x() > worldWidth())
- boundSpring();
- }
+
+ QPainter::RenderHints hints = painter->renderHints();
+ painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
+
// interpolate spring velocity towards zero, this is done
// so that spring velocity for rendering doesn't drop directly to
@@ -408,8 +467,9 @@
mRenderer->setCameraDistance(getCameraDistance(springVel));
mRenderer->setCameraRotationY(getCameraRotationY(springVel));
mRenderer->draw(mSpring.startPos(), mSpring.pos(), mSpring.endPos(),
- springVel, painter);
+ springVel, painter, sceneTransform(), rect());
+ painter->setRenderHint(QPainter::SmoothPixmapTransform, false);
}
void HgContainer::resizeEvent(QGraphicsSceneResizeEvent *event)
@@ -417,12 +477,26 @@
FUNC_LOG;
HbWidget::resizeEvent(event);
+
+ if (mDelayedScrollToIndex.isValid()) {
+ scrollTo(mDelayedScrollToIndex);
+ // set scrollto index to invalid value.
+ mDelayedScrollToIndex = QModelIndex();
+ }
}
// this needs to be implemented for gesture framework to work
void HgContainer::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
Q_UNUSED(event);
+ if (mSpring.isActive() && !mRenderer->coverflowModeEnabled()) {
+ // We could do some small animation when scrolling is stopped.
+ mSpring.cancel();
+ update();
+ mIgnoreTap = true;
+ } else {
+ mIgnoreTap = false;
+ }
}
void HgContainer::gestureEvent(QGestureEvent *event)
@@ -474,15 +548,41 @@
if (markImage.isNull()) {
ERROR("Failed to load :/images/mark.svg");
}
- mMarkImage = mQuadRenderer->createNativeImage();
- HANDLE_ERROR_NULL(mMarkImage);
- if (mMarkImage) {
- mMarkImage->setImage(markImage);
+ 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<HbIconItem*>(checkBox);
+ HbStyleOptionCheckBox checkBoxOption;
+ checkBoxOption.state = QStyle::State_On;
+ style()->updatePrimitive(iconItem, HbStyle::P_CheckBox_icon, &checkBoxOption);
+
+ if (mMarkImageOn) {
+ mMarkImageOn->setPixmap(iconItem->icon().pixmap());
+ }
+
+ 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()));
connect(&mSpring, SIGNAL(ended()), SIGNAL(scrollingEnded()));
- connect(&mSpring, SIGNAL(started()), SIGNAL(scrollingStarted()));
+ connect(&mSpring, SIGNAL(ended()), SLOT(onScrollingEnded()));
connect(mRenderer, SIGNAL(renderingNeeded()), SLOT(redraw()));
}
@@ -533,14 +633,14 @@
qreal delta(0);
qreal itemSide(0);
- if (mOrientation == mRenderer->getOrientation()) {
+ if (mOrientation == mRenderer->getScrollDirection()) {
delta = gesture->delta().y();
}
else {
delta = gesture->delta().x();
}
- if (mRenderer->getOrientation() == Qt::Vertical)
+ if (mRenderer->getScrollDirection() == Qt::Vertical)
itemSide = mRenderer->getImageSize().height()+mRenderer->getSpacing().height();
else
itemSide = mRenderer->getImageSize().width()+mRenderer->getSpacing().width();
@@ -654,20 +754,20 @@
// If there is content, mSelectionModel must always exist - either default or client-provided
if (!mSelectionModel) return false;
- mHitItem = getItemAt(pos, mHitItemIndex);
+ int index = -1;
+ mHitItem = getItemAt(pos, index);
if (mHitItem)
{
- int index = mHitItemIndex;
-
HgWidgetItem* item = itemByIndex(index);
if (item && action != DoubleTap) {
if (action == LongTap) {
INFO("Long tap:" << item->modelIndex().row());
+
mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current);
-
+
if (!mRenderer->coverflowModeEnabled())
- selectItem();
-
+ selectItem(index);
+
emit longPressed(item->modelIndex(), pos);
}
else if (mSelectionMode == HgWidget::MultiSelection) {
@@ -705,8 +805,7 @@
else {
INFO("Tap:" << item->modelIndex().row());
- if (mRenderer->coverflowModeEnabled())
- {
+ if (mRenderer->coverflowModeEnabled()) { //coverflow and t-bone modes
if (qAbs(qreal(index) - mSpring.pos().x()) < 0.01f)
{
mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current);
@@ -717,11 +816,12 @@
mSpring.animateToPos(QPointF(index, 0));
}
}
- else
- {
- mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current);
- selectItem();
- emit activated(item->modelIndex());
+ else { //grid mode
+ if (!mIgnoreTap) {
+ mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current);
+ selectItem(index);
+ emit activated(item->modelIndex());
+ }
}
}
}
@@ -738,15 +838,7 @@
bool HgContainer::getItemPoints(int index, QPolygonF& points)
{
- QPolygonF poly;
- if (!mRenderer->getItemPoints(index, poly))
- return false;
-
- bool invertible;
- QTransform t = qtToVgTransform().inverted(&invertible);
-
- points = t.map(poly);
- return true;
+ return mRenderer->getItemPoints(index, points);
}
QList<QModelIndex> HgContainer::getVisibleItemIndices() const
@@ -766,11 +858,6 @@
{
FUNC_LOG;
- // if screen is frequently updated no need to update now.
- if (mSpring.isActive() || mDragged ) return;
-
- // TODO FIX THIS FUNCTION!!!!!!!!!!!!!!!!!!!!!!
-
int firstItemOnScreen = 0, lastItemOnScreen = 0;
firstItemOnScreen = mSpring.pos().x();
firstItemOnScreen *= rowCount();
@@ -784,12 +871,14 @@
}
}
-void HgContainer::selectItem()
+void HgContainer::selectItem(int index)
{
// TODO: replace this with own selection implementation
- if (mHitItemIndex < 0 && mHitItemIndex >= mItems.count())
+/* if (index < 0 && index >= mItems.count())
return;
+ mHitItemIndex = index;
+
if (mHitItemView)
{
delete mHitItemView;
@@ -818,6 +907,7 @@
mHitItemView->resize(mRenderer->getImageSize().width(),
mRenderer->getImageSize().height());
+ */
}
void HgContainer::updateSelectedItem()
@@ -829,8 +919,16 @@
if (!getItemPoints(mHitItemIndex, points))
{
// the item was not rendered, we must hide
- // our qt item
+ // our qt item
mHitItemView->setVisible(false);
+ return;
+ }
+
+ QRectF bounds = points.boundingRect();
+ if (!(rect().contains(bounds) || rect().intersects(bounds)))
+ {
+ mHitItemView->setVisible(false);
+ return;
}
QPolygonF img;
@@ -842,7 +940,9 @@
QTransform t;
QTransform::quadToQuad(img, points, t);
- mHitItemView->setTransform(t);
+ //t.translate(50,50);
+ bool bOk;
+ mHitItemView->setTransform(t * this->transform().inverted(&bOk));
mHitItemView->setVisible(true);
}
@@ -883,8 +983,7 @@
HgWidgetItem* HgContainer::getItemAt(const QPointF& pos, int& index)
{
- QPointF p = mapQtToVg(pos);
- HgQuad* quad = mRenderer->getQuadAt(p);
+ HgQuad* quad = mRenderer->getQuadAt(pos);
if (quad)
{
bool ok;
@@ -926,30 +1025,6 @@
}
}
-QTransform HgContainer::qtToVgTransform() const
-{
- QTransform t;
- if (mOrientation == Qt::Vertical)
- {
- t.translate(0, drawableRect().bottom());
- t.scale(1, -1);
- }
- else // horizontal
- {
- t.translate(drawableRect().bottom(), 0);
- t.scale(-1, 1);
- t.translate(0, drawableRect().right());
- t.rotate(-90, Qt::ZAxis);
- }
- return t;
-}
-
-QPointF HgContainer::mapQtToVg(const QPointF& p) const
-{
- QTransform t = qtToVgTransform();
- return t.map(p);
-}
-
qreal HgContainer::getCameraDistance(qreal springVelocity)
{
Q_UNUSED(springVelocity)
@@ -981,17 +1056,22 @@
Q_UNUSED(pos)
}
+void HgContainer::onScrollingStarted()
+{
+ // By default do nothing
+}
+
+void HgContainer::onScrollingEnded()
+{
+ // By default do nothing
+}
+
void HgContainer::handleCurrentChanged(const QModelIndex ¤t)
{
Q_UNUSED(current)
// By default do nothing
}
-QRectF HgContainer::drawableRect() const
-{
- return rect();
-}
-
void HgContainer::setDefaultImage(QImage defaultImage)
{
HgQuadRenderer *renderer = mRenderer->getRenderer();
@@ -1059,7 +1139,7 @@
Qt::Orientation HgContainer::scrollDirection() const
{
- return mRenderer->getOrientation();
+ return mRenderer->getScrollDirection();
}
qreal HgContainer::scrollPosition() const
--- a/ganeswidgets/src/HgScrollBufferManager.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/src/HgScrollBufferManager.cpp Fri May 14 16:57:01 2010 +0300
@@ -39,7 +39,8 @@
mRequestStart(0),
mRequestCount(0),
mReleaseStart(0),
- mReleaseCount(0)
+ mReleaseCount(0),
+ mFirstTime(true)
{
init();
}
@@ -205,8 +206,12 @@
void HgScrollBufferManager::asyncUpdate()
{
- if( !mTimer.isActive())
+ if (!mTimer.isActive() && mFirstTime) {
+ mFirstTime = false;
mTimer.start(0);
+ } else {
+ timeout();
+ }
}
void HgScrollBufferManager::currentBuffer(int& bufferStart, int& bufferEnd)
--- a/ganeswidgets/src/hgcoverflowcontainer.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/src/hgcoverflowcontainer.cpp Fri May 14 16:57:01 2010 +0300
@@ -37,7 +37,7 @@
mDescriptionPosition(HgMediawall::PositionNone),
mPrevPos(-1),
mAspectRatio(1),
- mDrawableRect(rect())
+ mAnimationAboutToEndReacted(false)
{
mTitleLabel = new HbLabel(this);
mTitleLabel->setZValue(zValue()+1);
@@ -48,7 +48,7 @@
mDescriptionLabel->setZValue(zValue()+1);
mDescriptionLabel->setAlignment(Qt::AlignCenter);
mDescriptionLabel->setVisible(false);
-
+
mUserItemSize = QSize(250,250);
mUserItemSpacing = QSize(1,1);
}
@@ -60,7 +60,9 @@
// events
void HgCoverflowContainer::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
+ painter->setRenderHint(QPainter::Antialiasing, true);
HgContainer::paint(painter, option, widget);
+ painter->setRenderHint(QPainter::Antialiasing, false);
}
void HgCoverflowContainer::resizeEvent(QGraphicsSceneResizeEvent *event)
@@ -69,13 +71,13 @@
HbWidget::resizeEvent(event);
- updatePositions();
+ updatePositions();
}
// from HgContainer
HgMediaWallRenderer* HgCoverflowContainer::createRenderer(Qt::Orientation scrollDirection)
{
- HgMediaWallRenderer* renderer = new HgMediaWallRenderer(this, scrollDirection, true);
+ HgMediaWallRenderer* renderer = new HgMediaWallRenderer(this, scrollDirection, scrollDirection, true);
renderer->setImageSize(mUserItemSize);
renderer->enableCoverflowMode(true);
renderer->setRowCount(1, renderer->getImageSize(), false);
@@ -120,12 +122,25 @@
{
HgContainer::onScrollPositionChanged(pos);
+ if(!mAnimationAboutToEndReacted) {
+ qreal endPos = mSpring.endPos().x();
+ qreal abs = qAbs(endPos - mSpring.pos().x());
+
+ if( abs <= 0.5f ) {
+ HgWidgetItem* item = itemByIndex((int)endPos);
+ if (item) {
+ emit animationAboutToEnd( item->modelIndex() );
+ mAnimationAboutToEndReacted = true;
+ }
+ }
+ }
+
qreal ipos = floorf(pos);
qreal frac = pos - ipos;
qreal p = frac > 0.5 ? ipos + 1.0f : ipos;
if (mPrevPos != (int)p) {
- mPrevPos = (int)p;
+ mPrevPos = (int)p;
HgWidgetItem* item = itemByIndex((int)p);
if (item && item->modelIndex() != mSelectionModel->currentIndex()) {
mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current);
@@ -133,6 +148,16 @@
}
}
+void HgCoverflowContainer::onScrollingStarted()
+{
+ mAnimationAboutToEndReacted = false; //reset
+}
+
+void HgCoverflowContainer::onScrollingEnded()
+{
+ mAnimationAboutToEndReacted = false; //reset
+}
+
void HgCoverflowContainer::handleCurrentChanged(const QModelIndex ¤t)
{
FUNC_LOG;
@@ -243,7 +268,7 @@
FUNC_LOG;
HANDLE_ERROR_NULL(mTitleLabel);
HANDLE_ERROR_NULL(mDescriptionLabel);
-
+
int height = size().height();
int width = size().width();
int titleHeight = QFontMetrics(mTitleLabel->effectiveFontSpec().font()).height();
@@ -256,61 +281,67 @@
usableHeight -= (descriptionHeight+KLabelMargin);
}
- usableHeight *= 0.8; // Leave some space for the reflection
if (usableHeight <= 0) return;
- qreal usableWidth = width/2;
+ qreal usableWidth = width/1.4;
if (usableWidth <= 0) return;
- mDrawableRect = rect();
- QSizeF imageSize;
+ QRectF imageRect = rect();
if (usableWidth/usableHeight > mAspectRatio) {
- imageSize.setHeight(usableHeight);
- imageSize.setWidth(mAspectRatio*usableHeight);
+ imageRect.setHeight(usableHeight);
+ imageRect.setWidth(mAspectRatio*usableHeight);
+ imageRect.moveLeft((width-imageRect.width())/2);
}
else {
- imageSize.setWidth(usableWidth);
- imageSize.setHeight(usableWidth/mAspectRatio);
- mDrawableRect.setTop((usableHeight-imageSize.height())/2);
+ imageRect.setWidth(usableWidth);
+ imageRect.setHeight(usableWidth/mAspectRatio);
+ imageRect.moveTop((usableHeight-imageRect.height())/2);
+ imageRect.moveLeft((width-imageRect.width())/2);
}
- QRectF titleGeometry(0, mDrawableRect.top()+KLabelMargin, width, titleHeight);
- QRectF descriptionGeometry(0, mDrawableRect.top()+KLabelMargin, width, descriptionHeight);
+ QRectF titleGeometry(0, imageRect.top()+KLabelMargin, width, titleHeight);
+ QRectF descriptionGeometry(0, imageRect.top()+KLabelMargin, width, descriptionHeight);
if (mTitlePosition == HgMediawall::PositionAboveImage &&
mDescriptionPosition == HgMediawall::PositionAboveImage) {
// titleGeometry default is ok
descriptionGeometry.moveTop(titleGeometry.bottom()+KLabelMargin);
- mDrawableRect.setTop(descriptionGeometry.bottom()+KLabelMargin);
+ imageRect.moveTop(descriptionGeometry.bottom()+KLabelMargin);
}
else if (mTitlePosition == HgMediawall::PositionBelowImage &&
mDescriptionPosition == HgMediawall::PositionBelowImage) {
- titleGeometry.moveTop(mDrawableRect.top()+imageSize.height()+KLabelMargin);
+ titleGeometry.moveTop(imageRect.bottom()+KLabelMargin);
descriptionGeometry.moveTop(titleGeometry.bottom()+KLabelMargin);
}
else {
if (mTitlePosition == HgMediawall::PositionAboveImage) {
// titleGeometry default is ok
- mDrawableRect.setTop(titleGeometry.bottom()+KLabelMargin);
+ imageRect.moveTop(titleGeometry.bottom()+KLabelMargin);
}
else if (mDescriptionPosition == HgMediawall::PositionAboveImage) {
// descriptionGeometry default is ok
- mDrawableRect.setTop(descriptionGeometry.bottom()+KLabelMargin);
+ imageRect.moveTop(descriptionGeometry.bottom()+KLabelMargin);
}
if (mTitlePosition == HgMediawall::PositionBelowImage) {
- titleGeometry.moveTop(mDrawableRect.top()+imageSize.height()+KLabelMargin);
+ titleGeometry.moveTop(imageRect.bottom()+KLabelMargin);
}
else if (mDescriptionPosition == HgMediawall::PositionBelowImage) {
- descriptionGeometry.moveTop(mDrawableRect.top()+imageSize.height()+KLabelMargin);
+ descriptionGeometry.moveTop(imageRect.bottom()+KLabelMargin);
}
}
- INFO("Setting image size to:" << imageSize << "(total size:" << QSize(width, height)
- << "usable size:" << QSizeF(usableWidth, usableHeight) << ", aspect ratio is:" << mAspectRatio << ")" << "Drawable rect:" << mDrawableRect);
- mRenderer->setImageSize(imageSize);
- mAutoSize = imageSize;
- mDrawableRect.setHeight(imageSize.height()/0.8);
+ INFO("Setting image rect to:" << imageRect << "(total size:" << QSize(width, height)
+ << "usable size:" << QSizeF(usableWidth, usableHeight) << ", aspect ratio is:" << mAspectRatio << ")");
+
+ mRenderer->setImageSize(imageRect.size());
+ qreal diff = rect().center().y()-imageRect.center().y();
+
+ INFO("Setting front item position to:" << QPointF(0, -diff) << "(rect:" << rect()
+ << "imageRect:" << imageRect << ")");
+ mRenderer->setFrontItemPosition(QPointF(0, -diff));
+
+ mAutoSize = imageRect.size();
if (mTitlePosition != HgMediawall::PositionNone) {
INFO("Title geometry:" << titleGeometry);
@@ -333,9 +364,9 @@
if (mSelectionModel && mSelectionModel->currentIndex().isValid()) {
updateLabels(mSelectionModel->currentIndex().row());
}
-
+
mRenderer->setSpacing(QSizeF(1,1));
-
+
}
void HgCoverflowContainer::positionLabels()
@@ -343,7 +374,6 @@
FUNC_LOG;
HANDLE_ERROR_NULL(mTitleLabel);
HANDLE_ERROR_NULL(mDescriptionLabel);
- HANDLE_ERROR_NULL(mSelectionModel);
int centerIconTop = (size().height() - mRenderer->getImageSize().height()) / 2;
@@ -433,14 +463,6 @@
HgContainer::scrollToPosition(p,animate);
}
-QRectF HgCoverflowContainer::drawableRect() const
-{
- if (mItemSizePolicy == HgWidget::ItemSizeAutomatic)
- return mDrawableRect;
-
- return rect();
-}
-
void HgCoverflowContainer::setDefaultImage(QImage defaultImage)
{
HgContainer::setDefaultImage(defaultImage);
@@ -457,24 +479,24 @@
}
QSizeF HgCoverflowContainer::getAutoItemSpacing() const
-{
+{
return QSizeF(1,1);
}
void HgCoverflowContainer::updateItemSizeAndSpacing()
{
HgContainer::updateItemSizeAndSpacing();
-
+
updatePositions();
}
void HgCoverflowContainer::updatePositions()
{
- if (mItemSizePolicy == HgWidget::ItemSizeAutomatic)
+ if (mItemSizePolicy == HgWidget::ItemSizeAutomatic) {
calculatePositions();
- else
- {
+ }
+ else {
positionLabels();
}
}
@@ -483,7 +505,7 @@
{
if (!mRenderer)
return;
-
+
mRenderer->setFrontItemPosition(position);
}
--- a/ganeswidgets/src/hggridcontainer.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/src/hggridcontainer.cpp Fri May 14 16:57:01 2010 +0300
@@ -62,7 +62,7 @@
HgMediaWallRenderer* HgGridContainer::createRenderer(Qt::Orientation scrollDirection)
{
- HgMediaWallRenderer* renderer = new HgMediaWallRenderer(this, scrollDirection, false);
+ HgMediaWallRenderer* renderer = new HgMediaWallRenderer(this, scrollDirection, scrollDirection, false);
renderer->enableCoverflowMode(false);
renderer->setImageSize(mUserItemSize);
renderer->setRowCount(3, renderer->getImageSize(), false);
@@ -75,7 +75,7 @@
qreal HgGridContainer::getCameraDistance(qreal springVelocity)
{
- if (mRenderer->getOrientation() == Qt::Vertical)
+ if (mRenderer->getScrollDirection() == Qt::Vertical)
return 0;
return qAbs(springVelocity * 0.01f);
@@ -83,7 +83,7 @@
qreal HgGridContainer::getCameraRotationY(qreal springVelocity)
{
- if (mRenderer->getOrientation() == Qt::Vertical)
+ if (mRenderer->getScrollDirection() == Qt::Vertical)
return 0;
return qBound(-KCameraMaxYAngle, springVelocity * KSpringVelocityToCameraYAngleFactor, KCameraMaxYAngle);
@@ -94,7 +94,7 @@
Q_UNUSED(pos)
Q_UNUSED(hitItemIndex)
- selectItem();
+ selectItem(hitItemIndex);
emit activated(hitItem->modelIndex());
}
@@ -102,7 +102,7 @@
{
Q_UNUSED(hitItemIndex)
- selectItem();
+ selectItem(hitItemIndex);
emit longPressed(hitItem->modelIndex(), pos);
}
@@ -116,7 +116,6 @@
HgWidgetItem* item = itemByIndex(index);
if (item && item->modelIndex() != mSelectionModel->currentIndex()) {
- qDebug() << "CURRENT CHANGE" << QString::number(item->modelIndex().row());
mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current);
}
}
--- a/ganeswidgets/src/hgmediawall_p.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/src/hgmediawall_p.cpp Fri May 14 16:57:01 2010 +0300
@@ -39,6 +39,9 @@
// Mediawall supports only horizontal scrolling.
container->init(orientation);
HgWidgetPrivate::init(container);
+
+ q->connect( container, SIGNAL(animationAboutToEnd(QModelIndex)),
+ q, SIGNAL(animationAboutToEnd(QModelIndex)) );
}
void HgMediawallPrivate::setTitlePosition(HgMediawall::LabelPosition position)
--- a/ganeswidgets/src/hgmediawallrenderer.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/src/hgmediawallrenderer.cpp Fri May 14 16:57:01 2010 +0300
@@ -21,6 +21,7 @@
#include "hgimage.h"
#include "HgImageFader.h"
#include "hgvgquadrenderer.h"
+#include "hgqtquadrenderer.h"
#include <qvector3d>
#include <qtimer>
#include <qpropertyanimation>
@@ -37,6 +38,7 @@
const qreal KPi = 3.1415926535897932384626433832795;
+
static qreal lerp(qreal start, qreal end, qreal t)
{
return start * (1.0f - t) + end * t;
@@ -57,66 +59,183 @@
QVector3D mValue;
};
+class MyQuaternionAnimation : public QVariantAnimation
+{
+public:
+ virtual void updateCurrentValue(const QVariant& value)
+ {
+ mValue = value.value<QQuaternion>();
+ }
+ QQuaternion getValue() const
+ {
+ return mValue;
+ }
+private:
+ QQuaternion mValue;
+};
+
+
class HgAnimatedQuad
{
public:
+
+ static HgAnimatedQuad* createScrollDirectionChangeAnimation(
+ HgQuad* a, HgQuad* b, const QMatrix4x4& tm, const QMatrix4x4& rm,
+ const QQuaternion& rot, Qt::Orientation orientation,
+ int duration)
+ {
+ HgAnimatedQuad* q = new HgAnimatedQuad();
+ q->mQuad = a;
+
+ q->mPosition.setEasingCurve(QEasingCurve::InOutCubic);
+ q->mPosition.setDuration(duration);
+ QVector3D pos = tm * (a->position() * rm);
+ q->mPosition.setKeyValueAt(0, pos);
+
+ QVector3D pos2;
+
+ if (orientation == Qt::Horizontal)
+ {
+ pos2 = QVector3D(pos.x(), 0, pos.z() + (pos.y() > b->position().y() ? -0.5f : -0.5f));
+ }
+ else
+ {
+ pos2 = QVector3D(0, pos.y(), pos.z() + (pos.x() > b->position().x() ? -0.5f : -0.5f));
+ }
+
+ q->mPosition.setKeyValueAt(0.5f, pos2);
+ q->mPosition.setKeyValueAt(1, b->position());
+
+ q->mRotation.setEasingCurve(QEasingCurve::InOutCubic);
+ q->mRotation.setDuration(duration);
+ q->mRotation.setKeyValueAt(0, rot);
+ q->mRotation.setKeyValueAt(0.5f, QQuaternion::fromAxisAndAngle(QVector3D(1,1,0), 180));
+ q->mRotation.setKeyValueAt(1, b->rotation());
- HgAnimatedQuad(HgQuad* start, HgQuad* end,
- int duration) : mQuad(start)
- {
- mPositionAnimation.setDuration(duration);
- mPositionAnimation.setKeyValueAt(0, start->position());
- mPositionAnimation.setKeyValueAt(1.0, end->position());
- mPositionAnimation.setEasingCurve(QEasingCurve::Linear);
-
- mScaleAnimation.setDuration(duration);
- mScaleAnimation.setKeyValueAt(0, QVector3D(start->scale().x(), start->scale().y(), 0));
- mScaleAnimation.setKeyValueAt(1, QVector3D(end->scale().x(), end->scale().y(), 0));
- mScaleAnimation.setEasingCurve(QEasingCurve::Linear);
-
+ return q;
}
- ~HgAnimatedQuad()
+ static HgAnimatedQuad* createBasicAnimation(HgQuad* a, HgQuad* b, int duration)
{
+ HgAnimatedQuad* q = new HgAnimatedQuad();
+ q->mQuad = a;
+
+ q->mPosition.setDuration(duration);
+ q->mPosition.setKeyValueAt(0, a->position());
+ q->mPosition.setKeyValueAt(1, b->position());
+
+ q->mRotation.setDuration(duration);
+ q->mRotation.setKeyValueAt(0, a->rotation());
+ q->mRotation.setKeyValueAt(1, b->rotation());
+
+ return q;
}
-
+
void start()
{
- mPositionAnimation.start();
- mScaleAnimation.start();
+ mPosition.start();
+ mRotation.start();
}
void update()
{
- mQuad->setPosition(mPositionAnimation.currentValue().value<QVector3D>());
- QVector3D scale = mScaleAnimation.currentValue().value<QVector3D>();
- mQuad->setScale(QVector2D(scale.x(), scale.y()));
+ mQuad->setPosition(mPosition.currentValue().value<QVector3D>());
+ mQuad->setRotation(mRotation.currentValue().value<QQuaternion>());
}
+ const HgQuad* quad() const
+ {
+ return mQuad;
+ }
+
+private:
HgQuad* mQuad;
- MyVectorAnimation mPositionAnimation;
- MyVectorAnimation mScaleAnimation;
+ MyVectorAnimation mPosition;
+ //MyVectorAnimation mScale;
+ MyQuaternionAnimation mRotation;
+
+};
+
+class HgAnimatedQuadFactory
+{
+public:
+ virtual HgAnimatedQuad* createQuad(HgQuad* qA, HgQuad* qB) const=0;
};
+class HgScrollDirChangeQuadFactory : public HgAnimatedQuadFactory
+{
+public:
+ void setup(Qt::Orientation nextScrollDirection,
+ const QRectF& rect, const QSizeF& spacing, const QSizeF& size,
+ int duration)
+ {
+ mNextScrollDirection = nextScrollDirection;
+ mDuration = duration;
+
+ if (mNextScrollDirection == Qt::Horizontal)
+ {
+ qreal stepY = spacing.height() + size.height();
+ 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);
+ }
+ else if (mNextScrollDirection == Qt::Vertical)
+ {
+ tm.translate(0,0.5f);
+ rm.rotate(90, QVector3D(0,0,1));
+ rot = QQuaternion::fromAxisAndAngle(QVector3D(0,0,1), -90);
+ }
+
+
+ }
+
+ HgAnimatedQuad* createQuad(HgQuad* qA, HgQuad* qB) const
+ {
+ return HgAnimatedQuad::createScrollDirectionChangeAnimation(qA, qB,
+ tm, rm, rot, mNextScrollDirection, mDuration);
+ }
+private:
+ QMatrix4x4 tm;
+ QMatrix4x4 rm;
+ QQuaternion rot;
+ Qt::Orientation mNextScrollDirection;
+ int mDuration;
+};
+
+class HgRowCountChangeQuadFactory : public HgAnimatedQuadFactory
+{
+public:
+ HgRowCountChangeQuadFactory(int duration) : mDuration(duration)
+ {
+
+ }
+
+ HgAnimatedQuad* createQuad(HgQuad* qA, HgQuad* qB) const
+ {
+ return HgAnimatedQuad::createBasicAnimation(qA, qB, mDuration);
+ }
+private:
+ int mDuration;
+};
+
+
HgMediaWallRenderer::HgMediaWallRenderer(HgMediaWallDataProvider* provider,
- Qt::Orientation scrollDirection, bool coverflowMode) :
+ Qt::Orientation orientation, Qt::Orientation scrollDirection, bool coverflowMode) :
mDataProvider(provider),
mRenderer(NULL),
mIndicatorRenderer(NULL),
mRendererInitialized(false),
- mOrientation(scrollDirection),
- mNextOrientation(scrollDirection),
+ mScrollDirection(scrollDirection),
+ mNextScrollDirection(scrollDirection),
+ mOrientation(orientation),
mStateAnimationAlpha(0),
mStateAnimationOnGoing(false),
mAnimationAlpha(0),
- mOpeningAnimationDuration(500),
- mOpenedItem(-1),
- mFlipAngle(qreal(360)),
- mZoomAmount(qreal(0.5)),
mCoverflowMode(coverflowMode),
mRowCount(1),
mNextRowCount(1),
- mStateAnimationDuration(300),
+ mStateAnimationDuration(500),
mStep(1.1),
mZfar(-2),
mSpacing2D(10,10),
@@ -125,26 +244,21 @@
mCameraRotationY(0),
mCameraRotationZ(0),
mFrontCoverElevation(0.4),
- mReflectionsEnabled(true),
- mItemCountChanged(false),
- mOpenedItemState(ItemClosed),
- mFrontItemPosition(0,0),
- mFrontItemPositionSet(false)
+ mFrontItemPosition(0,0)
{
createStateMachine();
- mImageFader = new HgImageFader();
- mRenderer = new HgVgQuadRenderer(256);
+ mRenderer = new HgQtQuadRenderer(64);
+ mRenderer->enableReflections(true);
mRendererInitialized = true;
if (mCoverflowMode) {
- mOrientation = Qt::Horizontal;
- mNextOrientation = mOrientation;
+ mScrollDirection = Qt::Horizontal;
+ mNextScrollDirection = mScrollDirection;
}
}
HgMediaWallRenderer::~HgMediaWallRenderer()
{
delete mRenderer;
- delete mImageFader;
delete mStateMachine;
}
@@ -184,31 +298,28 @@
const QPointF& position,
const QPointF& targetPosition,
qreal springVelocity,
- QPainter* painter)
+ QPainter* painter,
+ const QTransform& sceneTransform,
+ const QRectF& rect)
{
+ // save new rect
+ mRect = rect;
+
// if still not initialized we cant draw anything
if (!mRendererInitialized)
return;
- if (mOrientation != mNextOrientation ||
- mRowCount != mNextRowCount)
+ if (mScrollDirection != mNextScrollDirection)
{
-
- // save old state of the quads
- recordState(mOldState);
-
- // goto wanted orientation / rowcount
- mOrientation = mNextOrientation;
- mRowCount = mNextRowCount;
- setImageSize(mNextImageSize);
-
- // setup quads to new state
- setupRows(startPosition, position, targetPosition, springVelocity, painter);
-
- // record state for animation
- recordState(mNextState);
-
- startStateAnimation(painter);
+ startScrollDirectionChangeAnimation(startPosition, position,
+ targetPosition, springVelocity, painter, sceneTransform,
+ rect);
+ }
+ else if (mRowCount != mNextRowCount)
+ {
+ startRowCountChangeAnimation(startPosition, position,
+ targetPosition, springVelocity, painter, sceneTransform,
+ rect);
}
else
{
@@ -223,7 +334,7 @@
}
updateCameraMatrices();
- drawQuads(painter);
+ drawQuads(painter, sceneTransform);
}
void HgMediaWallRenderer::setupRows(const QPointF& startPosition,
@@ -243,7 +354,7 @@
}
else
{
- if (mOrientation == Qt::Vertical)
+ if (mScrollDirection == Qt::Vertical)
{
setupGridPortrait(startPosition, position, targetPosition,
springVelocity, painter);
@@ -256,21 +367,6 @@
}
}
-void HgMediaWallRenderer::setFlipAnimationAngle(qreal angleInDegrees)
-{
- mFlipAngle = angleInDegrees;
-}
-
-void HgMediaWallRenderer::setOpeningAnimationType(HgMediaWallRenderer::OpeningAnimationType type)
-{
- mOpeningAnimationType = type;
-}
-
-void HgMediaWallRenderer::setOpeningAnimationDuration(int msecs)
-{
- mOpeningAnimationDuration = msecs;
-}
-
qreal HgMediaWallRenderer::animationAlpha() const
{
return mAnimationAlpha;
@@ -279,13 +375,7 @@
void HgMediaWallRenderer::setAnimationAlpha(qreal alpha)
{
mAnimationAlpha = alpha;
-
- if (mOpenedItemState == ItemClosing && alpha == 0.0f)
- mOpenedItemState = ItemClosed;
-
- if (mOpenedItemState == ItemOpening && alpha == 1.0f)
- mOpenedItemState = ItemOpened;
-
+
emit renderingNeeded();
}
@@ -310,33 +400,8 @@
mStateMachine->setAnimated(true);
QState* root = new QState(QState::ParallelStates);
- QState* p1 = new QState(root);
QState* p2 = new QState(root);
-
- // create idle/opened states
- {
- QState* idle = new QState(p1);
- QState* opened = new QState(p1);
-
- idle->assignProperty(this, "animationAlpha", qreal(0));
- opened->assignProperty(this, "animationAlpha", qreal(1));
-
- // add opening animation
- QPropertyAnimation* anim1 = new QPropertyAnimation(this, "animationAlpha");
- anim1->setDuration(mOpeningAnimationDuration);
- idle->addTransition(this, SIGNAL(toggleItem()), opened)->addAnimation(anim1);
-
- // add closing animation
- QPropertyAnimation* anim2 = new QPropertyAnimation(this, "animationAlpha");
- anim2->setDuration(mOpeningAnimationDuration);
- opened->addTransition(this, SIGNAL(toggleItem()), idle)->addAnimation(anim2);
-
- QObject::connect(idle, SIGNAL(entered()), this, SLOT(onIdleState()));
- QObject::connect(opened, SIGNAL(entered()), this, SLOT(onOpenedState()));
-
- p1->setInitialState(idle);
- }
-
+
// create two states to animate between
{
QState* s1 = new QState(p2);
@@ -356,58 +421,47 @@
p2->setInitialState(s1);
}
- root->setInitialState(p1);
+ root->setInitialState(p2);
mStateMachine->addState(root);
mStateMachine->setInitialState(root);
mStateMachine->start();
}
-void HgMediaWallRenderer::onIdleState()
-{
- emit itemClosed(mOpenedItem);
-}
-
-void HgMediaWallRenderer::onOpenedState()
-{
- emit itemOpened(mOpenedItem);
-}
-
-void HgMediaWallRenderer::setOrientation(Qt::Orientation orientation, bool animate)
+void HgMediaWallRenderer::setScrollDirection(Qt::Orientation scrollDirection, bool animate)
{
// coverflow is always horizontal
if (mCoverflowMode)
{
- mOrientation = Qt::Horizontal;
- mNextOrientation = mOrientation;
+ mScrollDirection = Qt::Horizontal;
+ mNextScrollDirection = mScrollDirection;
return;
}
- if (mOrientation != orientation)
+ if (mScrollDirection != scrollDirection)
{
mStateMachine->setAnimated(animate);
- mNextOrientation = orientation;
+ mNextScrollDirection = scrollDirection;
if (!animate)
- mOrientation = orientation;
+ mScrollDirection = scrollDirection;
else
{
- emit renderingNeeded();
+ //emit renderingNeeded();
}
}
}
-Qt::Orientation HgMediaWallRenderer::getOrientation() const
+Qt::Orientation HgMediaWallRenderer::getScrollDirection() const
{
- return mOrientation;
+ return mScrollDirection;
}
-void HgMediaWallRenderer::drawQuads(QPainter* painter)
+void HgMediaWallRenderer::drawQuads(QPainter* painter,
+ const QTransform& sceneTransform)
{
-
- mRenderer->transformQuads(mViewMatrix, mProjMatrix, mRect);
-
- mRenderer->drawQuads(mRect, painter);
+ mRenderer->drawQuads(painter, mRect, mViewMatrix, mProjMatrix, mOrientation,
+ sceneTransform);
}
@@ -453,11 +507,7 @@
void HgMediaWallRenderer::recordState(HgMediaWallRenderer::State& state)
{
// cleanup old quads
- for (int i = 0; i < state.mQuads.size(); i++)
- {
- delete state.mQuads[i];
- }
-
+ qDeleteAll(state.mQuads.begin(), state.mQuads.end());
state.mQuads.clear();
// record new quads
@@ -467,7 +517,8 @@
if (!quad->visible())
continue;
- state.mQuads.append(quad->copy());
+ int index = quad->userData().toInt();
+ state.mQuads[index] = quad->copy();
}
}
@@ -476,12 +527,18 @@
Q_UNUSED(painter)
resetQuads();
+ updateSpacingAndImageSize();
+
// setup quads from animated state
- for (int i = 0; i < mOldState.mQuads.size(); i++)
+ for (int i = 0; i < mAnimatedQuads.count(); i++)
{
- mAnimatedQuads[i]->update();
- mRenderer->quad(i)->copyFrom(*mOldState.mQuads[i]);
+ if (i >= mRenderer->quadCount())
+ return;
+
+ mAnimatedQuads[i]->update();
+ mRenderer->quad(i)->copyFrom(*mAnimatedQuads[i]->quad());
}
+
}
void HgMediaWallRenderer::resetQuads()
@@ -495,22 +552,7 @@
if (!mRendererInitialized)
return NULL;
- return mRenderer->getQuadAt(position);//mapFromWindow(position));
-}
-
-bool HgMediaWallRenderer::isItemOpen() const
-{
- return (mOpenedItem != -1 && mAnimationAlpha > 0);
-}
-
-void HgMediaWallRenderer::setRect(const QRectF& windowRect)
-{
- mRect = windowRect;
-}
-
-const QRectF& HgMediaWallRenderer::getRect() const
-{
- return mRect;
+ return mRenderer->getQuadAt(position);
}
void HgMediaWallRenderer::updateCameraMatrices()
@@ -523,26 +565,18 @@
QVector3D(0.0f, 0.0f, 0.0f), QVector3D(0.0f, 1.0f, 0.0f));
QMatrix4x4 rot;
- rot.rotate(mCameraRotationZ, QVector3D(0,0,1));
+ //rot.rotate(mCameraRotationZ, QVector3D(0,0,1));
rot.rotate(mCameraRotationY, QVector3D(0,1,0));
view *= rot;
-
- qreal aspect = mRect.width() / mRect.height();
-
+
QMatrix4x4 proj;
proj.setToIdentity();
- if (mRect.width() <= mRect.height())
- {
- qreal aspect = mRect.height() / mRect.width();
- proj.frustum(-0.5f, 0.5f, -0.5f*aspect, 0.5f*aspect, 1.0f, 1000.0f);
- }
- else
- {
- qreal aspect = mRect.width() / mRect.height();
- proj.frustum(-0.5f*aspect, 0.5f*aspect, -0.5f, 0.5f, 1.0f, 1000.0f);
- }
-
+ // setup projection matrix so that width of the item wichi has the
+ // width of the screen has width of 1 in 3D space
+ qreal aspect = mRect.height() / mRect.width();
+ proj.frustum(-0.5f, 0.5f, -0.5f * aspect, 0.5f * aspect, 1.0f, 1000.0f);
+
mViewMatrix = view;
mProjMatrix = proj;
@@ -562,7 +596,7 @@
void HgMediaWallRenderer::updateSpacingAndImageSize()
{
- qreal div = mRect.width() <= mRect.height() ? mRect.width() : mRect.height();
+ qreal div = mRect.width();
mSpacing3D = mSpacing2D / div;
mImageSize3D = mImageSize2D / div;
@@ -599,32 +633,6 @@
return mFrontCoverElevation;
}
-void HgMediaWallRenderer::openItem(int index, bool animate)
-{
- if (isItemOpen())
- return;
-
- mOpenedItem = index;
- mOpenedItemState = animate ? ItemOpening : ItemOpened;
-
- mStateMachine->setAnimated(animate);
- emit toggleItem();
-
-}
-
-void HgMediaWallRenderer::closeItem(bool animate)
-{
- if (!isItemOpen())
- return;
-
- mOpenedItemState = animate ? ItemClosing : ItemClosed;
- if (!animate)
- mOpenedItem = -1;
-
- mStateMachine->setAnimated(animate);
- emit toggleItem();
-}
-
qreal HgMediaWallRenderer::getRowPosY(int row)
{
qreal step = mSpacing3D.height() + mImageSize3D.height();
@@ -637,95 +645,99 @@
return mColumnCount == 1 ? qreal(0) : (((qreal)mColumnCount/qreal(2)-qreal(0.5)) - (qreal)col) * step;
}
-
void HgMediaWallRenderer::enableReflections(bool enabled)
{
- mReflectionsEnabled = enabled;
+ mRenderer->enableReflections(enabled);
}
bool HgMediaWallRenderer::reflectionsEnabled() const
{
- return mReflectionsEnabled;
+ return mRenderer->reflectionsEnabled();
}
-QPointF HgMediaWallRenderer::mapFromWindow(const QPointF& point) const
-{
- return QPointF(point.x(), mRect.height() - point.y());
-}
-
-void HgMediaWallRenderer::emitUpdate()
-{
- emit renderingNeeded();
-}
-
-void HgMediaWallRenderer::applyOpeningAnimation(HgQuad* quad)
-{
- QQuaternion rot(0,0,0,1);
- qreal rotAngle = mAnimationAlpha * mFlipAngle;
- rot = QQuaternion::fromAxisAndAngle(QVector3D(0,1,0), rotAngle);
- quad->setRotation(rot);
- quad->setPosition(quad->position() + QVector3D(0,0,mAnimationAlpha * mZoomAmount));
-}
-
-
qreal HgMediaWallRenderer::getWorldWidth() const
{
qreal width = ceil((qreal)mDataProvider->imageCount() / (qreal)mRowCount - 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 (mOrientation == Qt::Vertical)
+ if (mScrollDirection == Qt::Vertical)
{
qreal step = mSpacing2D.height() + mImageSize2D.height();
width -= (mRect.height() / step - 1.0f);
}
+ else if (mScrollDirection == Qt::Horizontal && !mCoverflowMode)
+ {
+ qreal step = mSpacing2D.width() + mImageSize2D.width();
+ width -= (mRect.width() / step - 1.0f);
+ }
return width;
}
-void HgMediaWallRenderer::beginRemoveRows(int start, int end)
+
+void HgMediaWallRenderer::createAnimatedQuads(const HgAnimatedQuadFactory& factory)
{
- mRemoveStart = start;
- mRemoveEnd = end;
- mItemCountChanged = true;
+ // clear previous animation quads
+ qDeleteAll(mAnimatedQuads.begin(), mAnimatedQuads.end());
+ mAnimatedQuads.clear();
+
+ // default quad is used if no counterpart for the current quad exits.
+ HgQuad* defaultQuad = new HgQuad();
+ defaultQuad->setPosition(QVector3D(100,100,-100));
- recordState(mOldState);
-
-}
-
-void HgMediaWallRenderer::endRemoveRows()
-{
+ // setup new animated quads
+ QMap<int, HgQuad*>::iterator i = mNextState.mQuads.begin();
+ while(i != mNextState.mQuads.end())
+ {
+ HgQuad* qB = i.value();
+ HgQuad* qA = NULL;
+ QMap<int, HgQuad*>::iterator j = mOldState.mQuads.find(i.key());
+ if (j != mOldState.mQuads.end())
+ {
+ qA = j.value();
+ }
+ else
+ {
+ qA = defaultQuad->copy();
+ }
- mStateMachine->setAnimated(true);
-
- emit renderingNeeded();
-
+ HgAnimatedQuad* q = factory.createQuad(qA, qB);
+ mAnimatedQuads.append(q);
+
+ q->start();
+ i++;
+ }
}
-void HgMediaWallRenderer::startStateAnimation(QPainter* painter)
+void HgMediaWallRenderer::startScrollDirectionChangeAnimation(
+ const QPointF& startPosition,
+ const QPointF& position,
+ const QPointF& targetPosition,
+ qreal springVelocity,
+ QPainter* painter,
+ const QTransform& sceneTransform,
+ const QRectF& rect)
{
-
- // clear previous animation quads
- for (int i = 0; i < mAnimatedQuads.size(); i++)
- {
- delete mAnimatedQuads[i];
- }
- mAnimatedQuads.clear();
+
+ // save state for current orientation
+ setupRows(startPosition, position, targetPosition, springVelocity, painter);
+ recordState(mOldState);
- // setup animated quads
- HgQuad* defaultQuad = new HgQuad();
- defaultQuad->setPosition(QVector3D(100,100,-100));
- int n = mOldState.mQuads.count() < mNextState.mQuads.count() ? mNextState.mQuads.count() : mOldState.mQuads.count();
- for (int i = 0; i < n; i++)
- {
- HgQuad* qA = (i >= mOldState.mQuads.count()) ? defaultQuad : mOldState.mQuads[i];
- HgQuad* qB = (i >= mNextState.mQuads.count()) ? defaultQuad : mNextState.mQuads[i];
+ // goto wanted orientation
+ mScrollDirection = mNextScrollDirection;
+
+ // setup quads to new state
+ setupRows(startPosition, position, targetPosition, springVelocity, painter);
+
+ // record state for animation
+ recordState(mNextState);
+
+ HgScrollDirChangeQuadFactory factory;
+ factory.setup(mNextScrollDirection, mRect, mSpacing3D, mImageSize3D, mStateAnimationDuration);
+
+ createAnimatedQuads(factory);
- HgAnimatedQuad* q = new HgAnimatedQuad(qA, qB, mStateAnimationDuration);
- mAnimatedQuads.append(q);
- q->start();
- }
-
mStateAnimationOnGoing = true;
// setup first frame of the animation
@@ -733,7 +745,38 @@
// toggle state animation on
toggleState();
+
+}
+void HgMediaWallRenderer::startRowCountChangeAnimation(
+ const QPointF& startPosition,
+ const QPointF& position,
+ const QPointF& targetPosition,
+ qreal springVelocity,
+ QPainter* painter,
+ const QTransform& sceneTransform,
+ const QRectF& rect)
+{
+ setupRows(startPosition, position, targetPosition, springVelocity, painter);
+ recordState(mOldState);
+
+ mRowCount = mNextRowCount;
+ setImageSize(mNextImageSize);
+
+ setupRows(startPosition, position, targetPosition, springVelocity, painter);
+ recordState(mNextState);
+
+ HgRowCountChangeQuadFactory factory(mStateAnimationDuration);
+
+ createAnimatedQuads(factory);
+
+ mStateAnimationOnGoing = true;
+
+ // setup first frame of the animation
+ setupStateAnimation(painter);
+
+ // toggle state animation on
+ toggleState();
}
void HgMediaWallRenderer::setupCoverflow(const QPointF& startPosition,
@@ -746,10 +789,7 @@
Q_UNUSED(targetPosition)
Q_UNUSED(springVelocity)
Q_UNUSED(painter)
-
- // save selected item for coverflow
- mSelectedItem = ceil(position.x());
-
+
int quadsVisible = (mRect.width() / mImageSize2D.width() + 1) * 4;
int selectedItemIndex = quadsVisible / 2;
@@ -794,7 +834,7 @@
// setup quad for this item
HgQuad* quad = mRenderer->quad(quadIndex);
- setupDefaultQuad(QVector3D(posX, posY, posZ), itemIndex, mReflectionsEnabled, quadIndex);
+ setupDefaultQuad(QVector3D(posX, posY, posZ), itemIndex, reflectionsEnabled(), quadIndex);
// step to next item
posX += step;
@@ -816,8 +856,10 @@
Q_UNUSED(springVelocity)
Q_UNUSED(painter)
- int rowCount = (mRect.height() / mImageSize2D.height() + 1) * 4;
- int rowsUp = rowCount/2;
+ // we need to setup 2 times more rows than visible, because we need
+ // more quads for the orientation switch
+ int rowCount = (mRect.height() / mImageSize2D.height() + 1) * 3;
+ int rowsUp = rowCount / 3;
qreal stepY = mSpacing3D.height() + mImageSize3D.height();
qreal ipos = floorf(position.x());
@@ -825,8 +867,7 @@
qreal posY = -(qreal)rowsUp * stepY - frac;
// adjust height so that we begin from top
- qreal div = mRect.width() <= mRect.height() ? mRect.width() : mRect.height();
- posY -= mRect.height() / div / 2.0 - stepY / 2.0;
+ posY -= mRect.height() / mRect.width() / 2.0 - stepY / 2.0;
int count = mDataProvider->imageCount();
int itemIndex = ((int)(ipos - (qreal)rowsUp)) * mColumnCount;
@@ -839,7 +880,6 @@
{
itemIndex+=mColumnCount;
posY += stepY;
- row++;
continue;
}
else if (itemIndex >= count || quadIndex >= mRenderer->quadCount() || row >= rowCount)
@@ -851,7 +891,6 @@
posY += stepY;
row++;
- itemIndex+=mColumnCount;
}
}
@@ -866,15 +905,17 @@
Q_UNUSED(targetPosition)
Q_UNUSED(springVelocity)
Q_UNUSED(painter)
-
+
int colCount = (mRect.width() / mImageSize2D.width() + 1) * 3;
- int colsLeft = colCount/2;
+ int colsLeft = colCount / 3;
qreal stepX = mSpacing3D.width() + mImageSize3D.width();
qreal ipos = floorf(position.x());
qreal frac = (position.x() - ipos) * stepX;
qreal posX = -(qreal)colsLeft * stepX - frac;
+ posX -= 0.5f - stepX / 2.0;
+
int count = mDataProvider->imageCount();
int itemIndex = ((int)(ipos - (qreal)colsLeft)) * mRowCount;
int col = 0;
@@ -886,7 +927,6 @@
{
itemIndex+=mColumnCount;
posX += stepX;
- col++;
continue;
}
else if (itemIndex >= count || col >= colCount || quadIndex >= mRenderer->quadCount())
@@ -898,34 +938,36 @@
posX += stepX;
col++;
- itemIndex+=mRowCount;
}
}
-void HgMediaWallRenderer::setupGridColumn(qreal posX, int itemIndex, int& quadIndex)
+void HgMediaWallRenderer::setupGridColumn(qreal posX, int& itemIndex, int& quadIndex)
{
for (int i = 0; i < mRowCount; i++)
{
+ if (quadIndex >= mRenderer->quadCount() || itemIndex >= mDataProvider->imageCount())
+ return;
+
qreal posY = getRowPosY(i);
// enable reflections for the last row needed
- bool reflections = (i == (mRowCount-1) && mReflectionsEnabled);
+ bool reflections = (i == (mRowCount-1) && reflectionsEnabled());
setupDefaultQuad(QVector3D(posX, posY, 0), itemIndex++, reflections, quadIndex);
- if (itemIndex >= mDataProvider->imageCount())
- return;
}
}
-void HgMediaWallRenderer::setupGridRow(qreal posY, int itemIndex, int& quadIndex)
+void HgMediaWallRenderer::setupGridRow(qreal posY, int& itemIndex, int& quadIndex)
{
for (int i = 0; i < mColumnCount; i++)
{
+ if (quadIndex >= mRenderer->quadCount() || itemIndex >= mDataProvider->imageCount())
+ return;
+
qreal posX = getColumnPosX(i);
+
setupDefaultQuad(QVector3D(posX, posY, 0), itemIndex++, false, quadIndex);
- if (itemIndex >= mDataProvider->imageCount())
- return;
}
}
@@ -943,14 +985,10 @@
quad->enableMirrorImage(reflectionsEnabled);
quad->setAlpha(1.0f);
- // apply opening animation if needed
- /* if (itemIndex == mOpenedItem)
- applyOpeningAnimation(quad);
-*/
// setup indicator/decorator for the item if needed
int flags = mDataProvider->flags(itemIndex);
const HgImage* indicatorImage = mDataProvider->indicator(flags);
- if (flags != 0 && indicatorImage)
+ if (flags != 0 && indicatorImage && quadIndex < mRenderer->quadCount())
{
HgQuad* indicator = mRenderer->quad(quadIndex++);
setupIndicator(quad, indicator, indicatorImage,
@@ -976,9 +1014,6 @@
indicator->enableMirrorImage(false);
indicator->setAlpha(parent->alpha());
- // apply opening animation to indicator if needed
- if (itemIndex == mOpenedItem)
- applyOpeningAnimation(indicator);
}
HgQuadRenderer* HgMediaWallRenderer::getRenderer()
@@ -989,7 +1024,7 @@
bool HgMediaWallRenderer::getItemPoints(int index, QPolygonF& points) const
{
QPolygonF poly;
- if (!mRenderer->getQuadTranformedPoints(poly, index))
+ if (!mRenderer->getQuadTranformedPointsByUserData(poly, QVariant(index)))
return false;
points = poly;
@@ -1013,3 +1048,8 @@
{
return mFrontItemPosition;
}
+
+void HgMediaWallRenderer::setOrientation(Qt::Orientation orientation)
+{
+ mOrientation = orientation;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ganeswidgets/src/hgqtquadrenderer.cpp Fri May 14 16:57:01 2010 +0300
@@ -0,0 +1,319 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "hgqtquadrenderer.h"
+#include "hgquad.h"
+#include "hgtransformedquad.h"
+#include "trace.h"
+#include "hgimage.h"
+
+#include <qvector2d>
+#include <qpolygon>
+#include <qmatrix4x4>
+#include <qpainter>
+#include <qpixmapcache>
+
+
+class HgQtImage : public HgImage
+{
+public:
+ HgQtImage(HgQtQuadRenderer* renderer)
+ {
+
+ }
+
+ ~HgQtImage()
+ {
+ }
+
+ int width() const
+ {
+ return mPixmap.width();
+ }
+
+ int height() const
+ {
+ return mPixmap.height();
+ }
+
+ int mirrorImageWidth() const
+ {
+ return width();
+ }
+
+ int mirrorImageHeight() const
+ {
+ return height();
+ }
+
+ void setImage(const QImage& image)
+ {
+ mPixmap = QPixmap::fromImage(image);
+ //mMirrorPixmap = QPixmap();
+ }
+
+ void setPixmap(const QPixmap& pixmap)
+ {
+ mPixmap = pixmap;
+ //mMirrorPixmap = QPixmap();
+ }
+
+ void releaseImage()
+ {
+ //mPixmap = QPixmap();
+ //mMirrorPixmap = QPixmap();
+ }
+
+ QImage getQImage() const
+ {
+ return mPixmap.toImage();
+ }
+
+ const QPixmap& pixmap() const
+ {
+ return mPixmap;
+ }
+
+ const QPixmap& mirrorPixmap(QPainter* painter)
+ {
+
+ return mPixmap;
+/*
+ if (mPixmap.isNull())
+ return mPixmap;
+
+ if (mMirrorPixmap.isNull())
+ {
+ QImage img = mPixmap.toImage();
+ QImage mirrorImage = img.scaled(QSize(img.width()/3,img.height()/3)).convertToFormat(QImage::Format_ARGB32);
+
+ // apply gradient to alpha channel so that mirror image looks like
+ // it fades under the floor
+ for (int i = 0; i < mirrorImage.height(); i++)
+ {
+ qreal t = qreal(i) / qreal(mirrorImage.height());
+ int a = (int)(t * 255.0);
+ uchar* scanline = mirrorImage.scanLine(i);
+ for (int j = 0; j < mirrorImage.width(); j++)
+ {
+ scanline[j*4+0] /= 3;
+ scanline[j*4+1] /= 3;
+ scanline[j*4+2] /= 3;
+ scanline[j*4+3] = 255;
+ }
+ }
+
+ mMirrorPixmap = QPixmap::fromImage(mirrorImage);
+
+ QPaintDevice* device = painter->device();
+ painter->end();
+
+ mMirrorPixmap = mPixmap.scaled(100,100);
+ int w = mMirrorPixmap.width();
+ int h = mMirrorPixmap.height();
+ //QPainter p;
+ painter->begin(&mMirrorPixmap);
+ painter->fillRect(0,0,w, h, QColor::fromRgbF(0, 0, 0, 0.5f));
+ painter->end();
+
+ painter->begin(device);
+
+ }
+
+
+ return mMirrorPixmap;*/
+ }
+
+ QPixmap mPixmap;
+};
+
+class HgQtQuad : public HgTransformedQuad
+{
+public:
+
+ HgQtQuad(HgQtQuadRenderer* renderer) : HgTransformedQuad(-1), mRenderer(renderer)
+ {
+
+ }
+
+ ~HgQtQuad()
+ {
+
+ }
+
+ void draw(QPainter* painter, const QRectF& rect)
+ {
+ if (!quad()->visible())
+ return;
+
+ HgQtImage* image = (HgQtImage*)quad()->image();
+ if (image == NULL)
+ image = mRenderer->defaultImage();
+
+ if (image == NULL)
+ return;
+
+ if (image->pixmap().isNull())
+ image = mRenderer->defaultImage();
+
+ drawImage(painter, image, rect);
+ }
+
+
+private:
+
+ void computeWarpMatrix(QTransform& tm, int pxWidth, int pxHeight, const QVector2D* points)
+ {
+ QPolygonF poly;
+
+ poly << points[0].toPointF();
+ poly << points[1].toPointF();
+ poly << points[2].toPointF();
+ poly << points[3].toPointF();
+
+ QPolygonF img;
+
+ img.append(QPointF(0,pxHeight));
+ img.append(QPointF(pxWidth,pxHeight));
+ img.append(QPointF(pxWidth,0));
+ img.append(QPointF(0,0));
+
+ QTransform::quadToQuad(img, poly, tm);
+ }
+
+ void drawImage(QPainter* painter, HgQtImage* image, const QRectF& rect)
+ {
+ const QPixmap& pixmap = image->pixmap();
+
+ if (pixmap.isNull())
+ return;
+
+ const QVector2D* points = mTransformedPoints;
+ if (mRenderer->isReflection() && quad()->mirrorImageEnabled())
+ points = mMirroredPoints;
+
+ QPolygonF poly;
+ poly << points[0].toPointF();
+ poly << points[1].toPointF();
+ poly << points[2].toPointF();
+ poly << points[3].toPointF();
+ QRectF bounds = poly.boundingRect();
+ if (!(bounds.intersects(rect) || rect.contains(bounds))) {
+ return;
+ }
+
+ computeWarpMatrix(mTransform, image->width(), image->height(), points);
+
+ QTransform base = painter->transform();
+ painter->setTransform(mTransform * base);
+ painter->drawPixmap(QPointF(0,0), pixmap);
+ painter->setTransform(base);
+ }
+
+ HgQtQuadRenderer* mRenderer;
+ QTransform mTransform;
+ QTransform mMirrorTransform;
+};
+
+
+HgQtQuadRenderer::HgQtQuadRenderer(int maxQuads) :
+ HgTransformedQuadRenderer(maxQuads),
+ mDefaultQtImage(NULL)
+{
+ // initialize base class to the end.
+ init(maxQuads);
+ QImage image(QSize(200,200), QImage::Format_RGB16);
+ image.fill(0xFFFFFFFF);
+ setDefaultImage(image);
+
+ QPixmapCache::setCacheLimit(2048);
+}
+
+HgQtQuadRenderer::~HgQtQuadRenderer()
+{
+ delete mDefaultQtImage;
+}
+
+void HgQtQuadRenderer::drawQuads(QPainter* painter, const QRectF& rect,
+ const QMatrix4x4& viewMatrix, const QMatrix4x4& projectionMatrix,
+ Qt::Orientation orientation,
+ const QTransform& sceneTransform)
+{
+
+ transformQuads(viewMatrix, projectionMatrix,
+ QPointF(rect.width()/2, rect.height()/2), QSizeF(rect.width(), rect.height()));
+
+ // save old transform
+ QTransform temp = painter->transform();
+
+ if (mReflectionsEnabled)
+ {
+ mIsReflection = true;
+
+ drawTransformedQuads(painter, rect);
+
+ drawFloor(painter, rect);
+ }
+
+ mIsReflection = false;
+
+ drawTransformedQuads(painter, rect);
+
+ painter->setTransform(temp);
+
+}
+
+HgImage* HgQtQuadRenderer::createNativeImage()
+{
+ return new HgQtImage(this);
+}
+
+HgQtImage* HgQtQuadRenderer::defaultImage()
+{
+ return mDefaultQtImage;
+}
+
+void HgQtQuadRenderer::setDefaultImage(QImage defaultImage)
+{
+ HgQuadRenderer::setDefaultImage(defaultImage);
+
+ delete mDefaultQtImage;
+ mDefaultQtImage = 0;
+
+ mDefaultQtImage = static_cast<HgQtImage*>(createNativeImage());
+ mDefaultQtImage->setImage(mDefaultImage);
+
+}
+
+HgTransformedQuad* HgQtQuadRenderer::createNativeQuad()
+{
+ return new HgQtQuad(this);
+}
+
+bool HgQtQuadRenderer::isReflection() const
+{
+ return mIsReflection;
+}
+
+void HgQtQuadRenderer::drawFloor(QPainter* painter, const QRectF& rect)
+{
+ QRectF floorRect(0, rect.height()/2, rect.width(), rect.height()/2);
+ QBrush brush(QColor::fromRgbF(0,0,0,0.5f));
+ painter->setBrush(brush);
+ painter->drawRect(floorRect);
+}
+
--- a/ganeswidgets/src/hgquadrenderer.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/src/hgquadrenderer.cpp Fri May 14 16:57:01 2010 +0300
@@ -49,11 +49,6 @@
mMirroringPlaneY = mirroringPlaneY;
}
-void HgQuadRenderer::setImageFader(HgImageFader* fader)
-{
- mImageFader = fader;
-}
-
void HgQuadRenderer::setDefaultImage(QImage defaultImage)
{
mDefaultImage = defaultImage;
@@ -80,3 +75,13 @@
return mDefaultImage;
}
+void HgQuadRenderer::enableReflections(bool enabled)
+{
+ mReflectionsEnabled = enabled;
+}
+
+bool HgQuadRenderer::reflectionsEnabled() const
+{
+ return mReflectionsEnabled;
+}
+
--- a/ganeswidgets/src/hgspring.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/src/hgspring.cpp Fri May 14 16:57:01 2010 +0300
@@ -84,7 +84,9 @@
void HgSpring::cancel()
{
if (mTimer->isActive())
- mTimer->stop();
+ mTimer->stop();
+
+ mVelocity = QPointF(0,0);
}
const QPointF& HgSpring::startPos() const
@@ -104,10 +106,9 @@
const QPointF& HgSpring::velocity() const
{
-return mVelocity;
+ return mVelocity;
}
-
void HgSpring::update()
{
int deltaTime = mPrevTime.elapsed();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ganeswidgets/src/hgtransformedquad.cpp Fri May 14 16:57:01 2010 +0300
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "hgtransformedquad.h"
+#include "hgquad.h"
+#include "trace.h"
+#include <qvector2d>
+#include <qpolygon>
+#include <qmatrix4x4>
+#include <qpainter>
+
+ HgTransformedQuad::HgTransformedQuad(qreal yDir) : mYDir(yDir)
+ {
+
+ }
+
+ HgTransformedQuad::~HgTransformedQuad()
+ {
+
+ }
+
+ int HgTransformedQuad::index() const
+ {
+ return mIndex;
+ }
+
+ bool HgTransformedQuad::isPointInside(const QPointF& point) const
+ {
+ QPolygonF poly;
+ getTransformedPoints(poly);
+ QRectF rect = poly.boundingRect();
+ if (rect.contains(point))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ void HgTransformedQuad::transformQuad(int index, const QMatrix4x4& projView, HgQuad* quad,
+ qreal mirroringPlaneY, const QVector2D& translate, const QPointF& center,
+ const QSizeF& windowSize)
+ {
+ mIndex = index;
+ mQuad = quad;
+
+ QMatrix4x4 tm;
+ tm.setToIdentity();
+ tm.rotate(quad->outerRotation());
+
+ if (mQuad->mirrorImageEnabled())
+ {
+ computeMirroredPoints(tm, projView, mirroringPlaneY, translate, center, windowSize);
+ }
+
+ tm.translate(quad->position());
+ tm.rotate(quad->rotation());
+ tm.scale(quad->scale().x(), quad->scale().y());
+
+ tm = projView * tm;
+
+ perspectiveTransformPoints(mTransformedPoints, tm, center, windowSize);
+
+ for (int i = 0; i < 4; i++)
+ mTransformedPoints[i] += translate;
+
+ }
+
+ void HgTransformedQuad::getTransformedPoints(QPolygonF& poly) const
+ {
+ poly.clear();
+ poly.append(mTransformedPoints[0].toPointF());
+ poly.append(mTransformedPoints[1].toPointF());
+ poly.append(mTransformedPoints[2].toPointF());
+ poly.append(mTransformedPoints[3].toPointF());
+ }
+
+ bool HgTransformedQuad::quadSorter(HgTransformedQuad* a, HgTransformedQuad* b)
+ {
+ return a->mQuad->position().z() < b->mQuad->position().z();
+ }
+
+ HgQuad* HgTransformedQuad::quad() const
+ {
+ return mQuad;
+ }
+
+ void HgTransformedQuad::computeMirroredPoints(const QMatrix4x4& trans, const QMatrix4x4& projView,
+ qreal mirroringPlaneY, const QVector2D& translate, const QPointF& center,
+ const QSizeF& windowSize)
+ {
+ HgQuad* quad = mQuad;
+
+ QMatrix4x4 mirror = trans;
+
+ qreal distToPlane = qAbs(quad->position().y() - mirroringPlaneY);
+
+ mirror.translate(quad->position().x(), mirroringPlaneY - distToPlane/1, quad->position().z());
+ mirror.scale(quad->scale().x(), -quad->scale().y()/1);
+ mirror.rotate(quad->rotation());
+
+ QMatrix4x4 modelViewProjMatrix = projView * mirror;
+
+ perspectiveTransformPoints(mMirroredPoints, modelViewProjMatrix, center, windowSize);
+
+ for (int i = 0; i < 4; i++)
+ mMirroredPoints[i] += translate;
+
+ }
+
+ void HgTransformedQuad::perspectiveTransformPoints(QVector2D* outPoints, const QMatrix4x4& matrix,
+ const QPointF& center, const QSizeF& windowSize)
+ {
+ const QVector4D points[] =
+ {
+ QVector4D(-0.5f, -0.5f, 0.0f, 1.0f),
+ QVector4D( 0.5f, -0.5f, 0.0f, 1.0f),
+ QVector4D( 0.5f, 0.5f, 0.0f, 1.0f),
+ QVector4D(-0.5f, 0.5f, 0.0f, 1.0f)
+ };
+
+ qreal hw = windowSize.width() * 0.5f;
+ qreal hh = windowSize.height() * 0.5f;
+
+ for (int i = 0; i < 4; i++)
+ {
+ QVector4D temp = matrix * points[i];
+
+ outPoints[i] = QVector2D(
+ center.x() + temp.x() / temp.w() * hw,
+ center.y() + (temp.y() / temp.w() * hh) * mYDir);
+
+ }
+
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ganeswidgets/src/hgtransformedquadrenderer.cpp Fri May 14 16:57:01 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "hgtransformedquadrenderer.h"
+#include "hgquad.h"
+#include "hgtransformedquad.h"
+#include "trace.h"
+#include "hgimage.h"
+
+#include <qvector2d>
+#include <qpolygon>
+#include <qmatrix4x4>
+#include <qpainter>
+
+
+HgTransformedQuadRenderer::HgTransformedQuadRenderer(int maxQuads) :
+ HgQuadRenderer(maxQuads)
+{
+}
+
+HgTransformedQuadRenderer::~HgTransformedQuadRenderer()
+{
+ qDeleteAll(mTransformedQuads.begin(), mTransformedQuads.end());
+}
+
+void HgTransformedQuadRenderer::init(int maxQuads)
+{
+ for (int i = 0; i < maxQuads; i++)
+ {
+ mTransformedQuads.append(createNativeQuad());
+ }
+}
+
+HgQuad* HgTransformedQuadRenderer::getQuadAt(const QPointF& point) const
+{
+ QList<HgTransformedQuad*>::const_iterator i = mSortedQuads.begin();
+ while(i != mSortedQuads.end())
+ {
+ HgTransformedQuad* q = (*i);
+ if (q->isPointInside(point))
+ {
+ return q->quad();
+ }
+ i++;
+ }
+
+ return NULL;
+}
+
+
+void HgTransformedQuadRenderer::transformQuads(const QMatrix4x4& view, const QMatrix4x4& proj,
+ const QPointF& center, const QSizeF& windowSize)
+{
+ QMatrix4x4 pv = proj * view;
+
+ mSortedQuads.clear();
+
+ for (int i = 0; i < mQuads.size(); i++)
+ {
+ HgQuad* q = mQuads[i];
+
+ HgTransformedQuad* tq = mTransformedQuads[i];
+
+ if (q->visible())
+ {
+ tq->transformQuad(i, pv, q, mMirroringPlaneY, mTranslation, center, windowSize);
+ mSortedQuads.append(tq);
+ }
+ }
+
+ qSort(mSortedQuads.begin(), mSortedQuads.end(), HgTransformedQuad::quadSorter);
+}
+
+bool HgTransformedQuadRenderer::getQuadTranformedPointsByUserData(QPolygonF& points, const QVariant& userData) const
+{
+ for (int i = 0; i < mSortedQuads.count(); i++)
+ {
+ HgTransformedQuad* quad = mSortedQuads[i];
+ if (quad->quad())
+ {
+ if (quad->quad()->userData() == userData)
+ {
+ quad->getTransformedPoints(points);
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+QList<HgQuad*> HgTransformedQuadRenderer::getVisibleQuads(const QRectF& rect) const
+{
+ // this implementation isn't 100% precise
+ QList<HgQuad*> result;
+ for (int i = 0; i < mSortedQuads.count(); i++) {
+ QPolygonF poly;
+ mSortedQuads[i]->getTransformedPoints(poly);
+ QRectF bounds = poly.boundingRect();
+ if (bounds.intersects(rect) || rect.contains(bounds)) {
+ result.append(mSortedQuads[i]->quad());
+ }
+ }
+
+ return result;
+}
+
+void HgTransformedQuadRenderer::drawTransformedQuads(QPainter* painter, const QRectF& rect)
+{
+ // draw quads
+ for (int i = 0; i < mSortedQuads.size(); i++)
+ {
+ mSortedQuads[i]->draw(painter, rect);
+ }
+}
--- a/ganeswidgets/src/hgvgimage.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/src/hgvgimage.cpp Fri May 14 16:57:01 2010 +0300
@@ -89,6 +89,11 @@
}
+void HgVgImage::setPixmap(const QPixmap& pixmap)
+{
+
+}
+
QImage HgVgImage::getQImage() const
{
return mQImage;
--- a/ganeswidgets/src/hgvgquadrenderer.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/src/hgvgquadrenderer.cpp Fri May 14 16:57:01 2010 +0300
@@ -16,6 +16,7 @@
*/
#include "hgvgquadrenderer.h"
+#include "hgtransformedquad.h"
#include "hgquad.h"
#include "hgvgimage.h"
#include "trace.h"
@@ -29,231 +30,46 @@
#include <qpainter>
-class HgVgQuad
-{
-public:
- HgVgQuad(HgVgQuadRenderer* renderer);
- ~HgVgQuad();
-
- int index() const;
- bool isPointInside(const QPointF& point) const;
- void transformQuad(int index, const QMatrix4x4& matrix, HgQuad* quad,
- const QRectF& rect, qreal mirroringPlaneY, const QVector2D& translate);
- void draw();
-
- void getTransformedPoints(QPolygonF& polygon) const;
-
- void computeMirrorMatrix(const QMatrix4x4& tm, const QMatrix4x4& projView,
- const QRectF& rect, qreal mirroringPlaneY,
- const QVector2D& translate);
-
- bool perspectiveTransformPoints(QVector2D* points, const QMatrix4x4& matrix,
- const QRectF& rect);
-
- void computeWarpMatrix(VGfloat* matrix, int pxWidth, int pxHeight, const QVector2D* points,
- const QVector2D& translate);
-
- void drawImage(HgVgImage* image, qreal alpha);
-
- int mIndex;
- HgQuad* mQuad;
- QVector2D mTransformedPoints[4];
- VGfloat mMatrix[9];
- VGfloat mMirrorMatrix[9];
- HgVgQuadRenderer* mRenderer;
- bool mDegenerate;
-private:
- HgVgQuad(const HgVgQuad&);
- HgVgQuad& operator=(const HgVgQuad&);
-};
-
-static bool quadSorter(HgVgQuad* a, HgVgQuad* b)
-{
- return a->mQuad->position().z() < b->mQuad->position().z();
-}
-
-HgVgQuad::HgVgQuad(HgVgQuadRenderer* renderer) : mRenderer(renderer)
-{
-
-}
-
-HgVgQuad::~HgVgQuad()
+static void matrixFromTransform(VGfloat* matrix, const QTransform& tm)
{
-
-}
-
-int HgVgQuad::index() const
- {
- return mIndex;
- }
-
-bool HgVgQuad::isPointInside(const QPointF& point) const
-{
- QPolygonF poly;
- getTransformedPoints(poly);
- QRectF rect = poly.boundingRect();
- if (rect.contains(point))
- {
- return true;
- }
- return false;
-}
-
-
-void HgVgQuad::computeMirrorMatrix(const QMatrix4x4& trans, const QMatrix4x4& projView,
- const QRectF& rect, qreal mirroringPlaneY, const QVector2D& translate)
-{
- HgQuad* quad = mQuad;
+ matrix[0] = tm.m11();
+ matrix[1] = tm.m12();
+ matrix[2] = tm.m13();
- QMatrix4x4 mirror = trans;
+ matrix[3] = tm.m21();
+ matrix[4] = tm.m22();
+ matrix[5] = tm.m23();
- qreal distToPlane = qAbs(quad->position().y() - mirroringPlaneY);
-
- mirror.translate(quad->position().x(), mirroringPlaneY - distToPlane/2, quad->position().z());
- mirror.scale(quad->scale().x(), -quad->scale().y()/2);
- mirror.rotate(quad->rotation());
-
- QMatrix4x4 modelViewProjMatrix = projView * mirror;
-
- QVector2D temp[4];
-
- perspectiveTransformPoints(temp, modelViewProjMatrix, rect);
-
- HgVgImage* image = (HgVgImage*)mQuad->image();
-
- if (image == NULL)
- {
- image = mRenderer->defaultImage();
- if (!image) {
- return;
- }
- }
-
- int pxWidth = image->mirrorImageWidth();
- int pxHeight = image->mirrorImageHeight();
-
- computeWarpMatrix(mMirrorMatrix, pxWidth, pxHeight, temp, translate);
+ matrix[6] = tm.m31();
+ matrix[7] = tm.m32();
+ matrix[8] = tm.m33();
}
-void HgVgQuad::transformQuad(int index, const QMatrix4x4& projView, HgQuad* quad,
- const QRectF& rect, qreal mirroringPlaneY, const QVector2D& translate)
+class HgVgQuad : public HgTransformedQuad
{
- mIndex = index;
- mQuad = quad;
-
- QMatrix4x4 tm;
- tm.setToIdentity();
- tm.rotate(quad->outerRotation());
-
- if (mQuad->mirrorImageEnabled())
+public:
+
+ HgVgQuad(HgVgQuadRenderer* renderer) : HgTransformedQuad(-1), mRenderer(renderer)
{
- computeMirrorMatrix(tm, projView, rect, mirroringPlaneY, translate);
- }
-
- tm.translate(quad->position());
- tm.rotate(quad->rotation());
- tm.scale(quad->scale().x(), quad->scale().y());
-
- tm = projView * tm;
- //QMatrix4x4 tmt = tm.transposed();
-
- mDegenerate = false;
- if (!perspectiveTransformPoints(mTransformedPoints, tm, rect))
- {
- mDegenerate = true;
+
}
- HgVgImage* image = (HgVgImage*)mQuad->image();
-
- if (image == NULL)
+ ~HgVgQuad()
{
- image = mRenderer->defaultImage();
- if (!image)
- return;
- }
-
- int pxWidth = image->width();
- int pxHeight = image->height();
-
-
- computeWarpMatrix(mMatrix, pxWidth, pxHeight, mTransformedPoints, translate);
-
- for (int i = 0; i < 4; i++)
- mTransformedPoints[i] += translate;
-
-}
-
-bool HgVgQuad::perspectiveTransformPoints(QVector2D* outPoints, const QMatrix4x4& matrix,
- const QRectF& rect)
-{
- const QVector4D points[] =
- {
- QVector4D(-0.5f, -0.5f, 0.0f, 1.0f),
- QVector4D( 0.5f, -0.5f, 0.0f, 1.0f),
- QVector4D( 0.5f, 0.5f, 0.0f, 1.0f),
- QVector4D(-0.5f, 0.5f, 0.0f, 1.0f)
- };
-
- qreal hw = rect.width() * 0.5f;
- qreal hh = rect.height() * 0.5f;
-
- for (int i = 0; i < 4; i++)
- {
- QVector4D temp = matrix * points[i];
-
- outPoints[i] = QVector2D(
- hw + temp.x() / temp.w() * hw,
- hh + temp.y() / temp.w() * hh);
-
+
}
-
- return true;
-}
-void HgVgQuad::computeWarpMatrix(VGfloat* matrix, int pxWidth, int pxHeight, const QVector2D* points,
- const QVector2D& translate)
-{
-
- vguComputeWarpQuadToQuad(
- points[0].x() + translate.x(), points[0].y() + translate.y(),
- points[1].x() + translate.x(), points[1].y() + translate.y(),
- points[2].x() + translate.x(), points[2].y() + translate.y(),
- points[3].x() + translate.x(), points[3].y() + translate.y(),
- 0, pxHeight,
- pxWidth, pxHeight,
- pxWidth, 0,
- 0, 0,
- matrix);
-/*
- INFO("P0 x:" << points[0].x() << " y:" << points[0].y());
- INFO("P1 x:" << points[1].x() << " y:" << points[1].y());
- INFO("P2 x:" << points[2].x() << " y:" << points[2].y());
- INFO("P3 x:" << points[3].x() << " y:" << points[3].y());*/
-}
-
-
-void HgVgQuad::draw()
-{
- if (!mQuad->visible())
- return;
-
- if (mDegenerate)
- return;
-
- HgVgImage* image = (HgVgImage*)mQuad->image();
-
-
- if (image == NULL || image->alpha() == 0)
+ void draw(QPainter* painter, const QRectF& rect)
{
- if (mRenderer->defaultImage()) {
- drawImage(mRenderer->defaultImage(), 1.0f);
- }
- }
- else
- {
- image->upload(mQuad->mirrorImageEnabled());
+ Q_UNUSED(painter)
+ Q_UNUSED(rect)
- if (image->image() == VG_INVALID_HANDLE)
+ if (!mQuad->visible())
+ return;
+
+ HgVgImage* image = (HgVgImage*)mQuad->image();
+
+ if (image == NULL || image->alpha() == 0)
{
if (mRenderer->defaultImage()) {
drawImage(mRenderer->defaultImage(), 1.0f);
@@ -261,75 +77,94 @@
}
else
{
-
- if ( mQuad->alpha() < 1.0f )
+ image->upload(mQuad->mirrorImageEnabled());
+
+ if (image->image() == VG_INVALID_HANDLE)
{
if (mRenderer->defaultImage()) {
- drawImage(mRenderer->defaultImage(), 1.0f - mQuad->alpha());
+ drawImage(mRenderer->defaultImage(), 1.0f);
}
}
+ else
+ {
+
+ if ( mQuad->alpha() < 1.0f )
+ {
+ if (mRenderer->defaultImage()) {
+ drawImage(mRenderer->defaultImage(), 1.0f - mQuad->alpha());
+ }
+ }
+
+ drawImage(image, mQuad->alpha());
+ }
+ }
+
+
+ }
+
+ void drawImage(HgVgImage* image, qreal alpha)
+ {
+ Q_UNUSED(alpha)
- drawImage(image, mQuad->alpha());
+ VGImage vgImage = image->image();
+
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
+
+ VGfloat m[9];
+ vgGetMatrix(m);
+
+ computeWarpMatrix(mMatrix, image->width(), image->height(), mTransformedPoints, QVector2D());
+
+ vgMultMatrix(mMatrix);
+ vgDrawImage(vgImage);
+
+ vgLoadMatrix(m);
+
+ if (mQuad->mirrorImageEnabled())
+ {
+ VGImage mirrorImage = image->mirrorImage();
+ if (mirrorImage == VG_INVALID_HANDLE)
+ return;
+
+ computeWarpMatrix(mMirrorMatrix, image->mirrorImageWidth(), image->mirrorImageHeight(), mMirroredPoints, QVector2D());
+ vgMultMatrix(mMirrorMatrix);
+
+ vgDrawImage(mirrorImage);
+ vgLoadMatrix(m);
}
+
}
-
-}
+private:
-void HgVgQuad::drawImage(HgVgImage* image, qreal alpha)
-{
- Q_UNUSED(alpha)
+ void computeWarpMatrix(VGfloat* matrix, int pxWidth, int pxHeight, const QVector2D* points,
+ const QVector2D& translate)
+ {
- //VGfloat values[] = { 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0 };
- //values[3] = alpha;
-
- //vgSetfv(VG_COLOR_TRANSFORM_VALUES, 8, values);
-
- VGImage vgImage = image->image();
-
- vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
-
- VGfloat m[9];
- vgGetMatrix(m);
-
- vgMultMatrix(mMatrix);
- vgDrawImage(vgImage);
+ vguComputeWarpQuadToQuad(
+ points[0].x(), points[0].y(),
+ points[1].x(), points[1].y(),
+ points[2].x(), points[2].y(),
+ points[3].x(), points[3].y(),
+ 0, pxHeight,
+ pxWidth, pxHeight,
+ pxWidth, 0,
+ 0, 0,
+ matrix);
- vgLoadMatrix(m);
+ }
- if (mQuad->mirrorImageEnabled())
- {
- VGImage mirrorImage = image->mirrorImage();
- if (mirrorImage == VG_INVALID_HANDLE)
- return;
-
- vgMultMatrix(mMirrorMatrix);
-
- vgDrawImage(mirrorImage);
- vgLoadMatrix(m);
- }
-
-}
-
-
-void HgVgQuad::getTransformedPoints(QPolygonF& poly) const
-{
- poly.append(mTransformedPoints[0].toPointF());
- poly.append(mTransformedPoints[1].toPointF());
- poly.append(mTransformedPoints[2].toPointF());
- poly.append(mTransformedPoints[3].toPointF());
-}
+ HgVgQuadRenderer* mRenderer;
+ VGfloat mMatrix[9];
+ VGfloat mMirrorMatrix[9];
+};
HgVgQuadRenderer::HgVgQuadRenderer(int maxQuads) :
- HgQuadRenderer(maxQuads),
+ HgTransformedQuadRenderer(maxQuads),
mDefaultVgImage(NULL)
{
- for (int i = 0; i < maxQuads; i++)
- {
- mTransformedQuads.append(new HgVgQuad(this));
- }
- mImageFader = new HgImageFader();
+ init(maxQuads);
}
HgVgQuadRenderer::~HgVgQuadRenderer()
@@ -337,133 +172,52 @@
delete mDefaultVgImage;
}
-HgQuad* HgVgQuadRenderer::getQuadAt(const QPointF& point) const
-{
- FUNC_LOG
-
- // TODO: need to use sorted quads here, in reversed order.
- QList<HgVgQuad*>::const_iterator i = mSortedQuads.begin();
- while(i != mSortedQuads.end())
- {
- HgVgQuad* q = (*i);
- if (q->isPointInside(point))
- {
- return q->mQuad;
- }
- i++;
- }
-
- return NULL;
-}
-
-
-void HgVgQuadRenderer::transformQuads(const QMatrix4x4& view, const QMatrix4x4& proj,
- const QRectF& rect)
+void HgVgQuadRenderer::drawQuads(QPainter* painter, const QRectF& rect,
+ const QMatrix4x4& viewMatrix, const QMatrix4x4& projectionMatrix,
+ Qt::Orientation orientation,
+ const QTransform& sceneTransform)
{
- QMatrix4x4 pv = proj * view;
-
- mSortedQuads.clear();
-
- for (int i = 0; i < mQuads.size(); i++)
- {
- HgQuad* q = mQuads[i];
-
- HgVgQuad* tq = mTransformedQuads[i];
-
- if (q->visible())
- {
- tq->transformQuad(i, pv, q, rect, mMirroringPlaneY, mTranslation);
- mSortedQuads.append(tq);
- }
- }
-
- qSort(mSortedQuads.begin(), mSortedQuads.end(), quadSorter);
-}
-
-void HgVgQuadRenderer::drawQuads(const QRectF& rect, QPainter* painter)
-{
- Q_UNUSED(rect)
-
-
+ // start direct vg
painter->beginNativePainting();
- // need to save old scissoring rects, otherwise hb
- // screws up with rendering
-/* VGint oldScissoring = vgGeti(VG_SCISSORING);
- VGint numRects = 32;//vgGeti(VG_MAX_SCISSOR_RECTS);
- VGint oldRects[32*4];
- vgGetiv(VG_SCISSOR_RECTS, numRects, oldRects);
-
- // setup our new scissoring rects
- VGint sRect[4];
- sRect[0] = rect.left();
- sRect[1] = rect.top();
- sRect[2] = rect.width();
- sRect[3] = rect.height();
- vgSeti(VG_SCISSORING, VG_TRUE);
- vgSetiv(VG_SCISSOR_RECTS, 4, sRect);
- */
- // setup root transform
- vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
- vgLoadIdentity();
- vgTranslate(rect.left(), rect.top());
-
+ // setup default vg states
vgSeti(VG_COLOR_TRANSFORM, VG_FALSE);
vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER);
vgSeti(VG_IMAGE_MODE, VG_DRAW_IMAGE_NORMAL);
-
- // draw quads
- for (int i = 0; i < mSortedQuads.size(); i++)
- {
- mSortedQuads[i]->draw();
- }
-
- // set back old scissor rects
- // vgSeti(VG_SCISSORING, oldScissoring);
- // vgSetiv(VG_SCISSOR_RECTS, numRects, oldRects);
+
+ // setup root transform
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
+ VGfloat toVgMatrix[9];
+ matrixFromTransform(toVgMatrix, qtToVgTransform(painter, sceneTransform, rect, orientation));
+ vgLoadMatrix(toVgMatrix);
+ // transform quads to screen
+ transformQuads(viewMatrix, projectionMatrix, QPointF(rect.width()/2, rect.height()/2),
+ QSizeF(rect.width(), rect.height()));
+
+ drawTransformedQuads(painter, rect);
+
+ // end directt vg
painter->endNativePainting();
}
-bool HgVgQuadRenderer::getQuadTranformedPoints(QPolygonF& points, int index) const
-{
- for (int i = 0; i < mSortedQuads.count(); i++)
- {
- HgVgQuad* quad = mSortedQuads[i];
- if (quad->mQuad)
- {
- bool bOk;
- if (quad->mQuad->userData().toInt(&bOk) == index)
- {
- quad->getTransformedPoints(points);
- return true;
- }
- }
- }
-
- return false;
-}
-
HgImage* HgVgQuadRenderer::createNativeImage()
{
return new HgVgImage(this);
}
+HgTransformedQuad* HgVgQuadRenderer::createNativeQuad()
+{
+ return new HgVgQuad(this);
+}
+
HgVgImage* HgVgQuadRenderer::defaultImage()
{
if (mDefaultVgImage && mDefaultVgImage->image() == VG_INVALID_HANDLE) {
mDefaultVgImage->upload(true);
}
-/* if (mDefaultVgImage == NULL)
- {
- QImage defaultImage(64,64,QImage::Format_RGB16);
- defaultImage.fill(qRgb(255,0,0));
- mDefaultVgImage = static_cast<HgVgImage*>(createNativeImage());
- mDefaultVgImage->setImage(defaultImage);
- mDefaultVgImage->upload(true);
- }
- */
+
return mDefaultVgImage;
}
@@ -477,27 +231,23 @@
mDefaultVgImage->upload(true);
}
-HgImageFader* HgVgQuadRenderer::imageFader()
-{
- return mImageFader;
-}
-
-QList<HgQuad*> HgVgQuadRenderer::getVisibleQuads(const QRectF& rect) const
+QTransform HgVgQuadRenderer::qtToVgTransform(QPainter* painter, const QTransform& sceneTransform,
+ const QRectF& rect, Qt::Orientation orientation) const
{
- FUNC_LOG;
-
- // this implementation isn't 100% precise
- QList<HgQuad*> result;
- for (int i = 0; i < mSortedQuads.count(); i++) {
- QPolygonF poly;
- mSortedQuads[i]->getTransformedPoints(poly);
- QRectF bounds = poly.boundingRect();
- if (bounds.intersects(rect) || rect.contains(bounds)) {
- result.append(mSortedQuads[i]->mQuad);
- }
+ QTransform t;
+ if (orientation == Qt::Vertical)
+ {
+ t.translate(sceneTransform.dx(), painter->viewport().height() - sceneTransform.dy());
+ t.scale(1, -1);
}
-
- return result;
+ else
+ {
+ // TODO: this will need reviewing later :)
+ t.translate(rect.bottom(), 0);
+ t.scale(-1, 1);
+ t.translate(0, rect.right());
+ t.rotate(-90, Qt::ZAxis);
+ }
+
+ return t;
}
-
-
--- a/ganeswidgets/src/hgwidgetitem.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/src/hgwidgetitem.cpp Fri May 14 16:57:01 2010 +0300
@@ -64,6 +64,21 @@
}
+void HgWidgetItem::setPixmap(const QPixmap &pixmap)
+{
+ if (!mHgImage)
+ {
+ mHgImage = mRenderer->createNativeImage();
+ }
+
+ mHgImage->setPixmap(pixmap);
+
+ if (!mVisibility)
+ mHgImage->setAlpha(0);
+
+}
+
+
void HgWidgetItem::setTitle( QString title )
{
mTitle = title;
@@ -107,8 +122,14 @@
setVisibility(vis.toBool());
}
+
// Convert data to correct format if possible.
- if(image.canConvert<QImage>()){
+ if (image.type() == QVariant::Pixmap)
+ {
+ setPixmap(image.value<QPixmap>());
+ mValidData = true;
+ }
+ else if(image.canConvert<QImage>()){
setImage(image.value<QImage>());
mValidData = true;
}
--- a/ganeswidgets/src/hgwidgets.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/src/hgwidgets.cpp Fri May 14 16:57:01 2010 +0300
@@ -26,7 +26,6 @@
#include "hgcontainer.h"
#include "hgwidgetitem.h"
#include "hgscrollbuffermanager.h"
-#include "hgcoverflowcontainer.h"
#include "hggridcontainer.h"
#include "trace.h"
--- a/ganeswidgets/src/hgwidgets_p.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/src/hgwidgets_p.cpp Fri May 14 16:57:01 2010 +0300
@@ -26,7 +26,7 @@
#include "hgscrollbuffermanager.h"
#include "hgwidgetitem.h"
#include "trace.h"
-#include "hgindexfeedback.h"
+//#include "hgindexfeedback.h"
static const int INITIAL_SCROLLBAR_HIDE_TIMEOUT(4000);
static const int DEFAULT_BUFFER_SIZE(30);
@@ -86,8 +86,8 @@
q->connect(mContainer, SIGNAL(scrollingEnded()), q, SIGNAL(scrollingEnded()));
q->connect(mScrollBarHideTimer, SIGNAL(timeout()), q, SLOT(_q_hideScrollBars()));
- mIndexFeedback = new HgIndexFeedback(q);
- mIndexFeedback->setWidget(q);
+// mIndexFeedback = new HgIndexFeedback(q);
+// mIndexFeedback->setWidget(q);
}
@@ -123,12 +123,12 @@
delete oldSelectionModel;
}
if (mContainer->selectionModel()) {
- if (mIndexFeedback) {
- delete mIndexFeedback;
- mIndexFeedback = 0;
- }
- mIndexFeedback = new HgIndexFeedback(q);
- mIndexFeedback->setWidget(q);
+// if (mIndexFeedback) {
+// delete mIndexFeedback;
+// mIndexFeedback = 0;
+// }
+// mIndexFeedback = new HgIndexFeedback(q);
+// mIndexFeedback->setWidget(q);
}
}
}
@@ -464,7 +464,14 @@
Q_Q(HgWidget);
if (mContainer) {
- int oldItemCount = mContainer->itemCount();
+ const int oldItemCount = mContainer->itemCount();
+ if (oldItemCount == 0) {
+ // rows have been inserted to empty model. This is a special case
+ // that reset function should handle.
+ _q_modelReset();
+ return;
+ }
+
mBufferManager->addItems(start, end);
mContainer->addItems(start, end);
// re-set model indexes for the items including and after the added indexes
@@ -674,7 +681,7 @@
{
Q_Q(HgWidget);
if (mContainer->orientation() != orientation) {
- mContainer->setOrientation(orientation);
+ mContainer->setOrientation(orientation, q->isVisible());
if (!mStaticScrollDirection) {
createScrollBar(orientation);
}
@@ -723,12 +730,13 @@
void HgWidgetPrivate::setIndexFeedbackPolicy( HgWidget::IndexFeedbackPolicy policy)
{
- mIndexFeedback->setIndexFeedbackPolicy(policy);
+// mIndexFeedback->setIndexFeedbackPolicy(policy);
}
HgWidget::IndexFeedbackPolicy HgWidgetPrivate::indexFeedbackPolicy() const
{
- return mIndexFeedback->indexFeedbackPolicy();
+// return mIndexFeedback->indexFeedbackPolicy();
+ return HgWidget::IndexFeedbackNone;
}
void HgWidgetPrivate::setDefaultImage(QImage defaultImage)
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/hgwidgettest.pro Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/hgwidgettest.pro Fri May 14 16:57:01 2010 +0300
@@ -35,7 +35,8 @@
src/hgselectiondialog.cpp \
src/hgflipwidget.cpp \
src/buffermanager.cpp \
- src/hgitemsizedialog.cpp
+ src/hgitemsizedialog.cpp \
+ src/hgcoveritem.cpp
HEADERS += inc/hgcoverflowwidget.h \
inc/hgwidgetoptionsview.h \
inc/hgwidgettestdatamodel.h \
@@ -45,7 +46,10 @@
inc/hgselectiondialog.h \
inc/hgflipwidget.h \
inc/buffermanager.h \
- inc/hgitemsizedialog.h
+ inc/hgitemsizedialog.h \
+ inc/hgcoveritem.h
LIBS += -lganeswidgets.dll \
-lthumbnailmanagerqt.dll
RESOURCES += data/hgwidgettest.qrc
+
+DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgcoveritem.h Fri May 14 16:57:01 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Another view for test application.
+*
+*/
+#ifndef HGCOVERITEM_H_
+#define HGCOVERITEM_H_
+
+#include <QGraphicsPixmapItem>
+#include <hbiconitem>
+#include <hblistwidget>
+
+class HgCoverItem : public HbIconItem
+{
+ Q_OBJECT
+
+public:
+
+ HgCoverItem(QPixmap pixmap, QGraphicsItem *parent);
+
+signals:
+
+ void close();
+
+private:
+
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
+};
+
+class HgListWidget : public HbListWidget
+{
+ Q_OBJECT
+
+public:
+
+ HgListWidget(QGraphicsItem *parent = 0);
+
+signals:
+
+ void close();
+
+private:
+
+ virtual void leftGesture(int value);
+
+};
+
+#endif /* HGCOVERITEM_H_*/
+
+// EOF
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgtestdefs.h Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgtestdefs.h Fri May 14 16:57:01 2010 +0300
@@ -29,7 +29,8 @@
ImageTypeNone = 0,
ImageTypeQIcon,
ImageTypeHbIcon,
- ImageTypeQImage
+ ImageTypeQImage,
+ ImageTypeQPixmap
};
static const QString SETT_ORGANIZATION = "Nokia";
@@ -46,5 +47,6 @@
static const QString SETT_DESCRIPTION_POSITION = "DescriptionPosition";
static const QString SETT_DESCRIPTION_FONT = "DescriptionFont";
static const QString SETT_REFLECTIONS_ENABLED = "Reflections enabled";
+static const QString SETT_ITEM_SIZE_POLICY = "ItemSizePolicy";
#endif /* HGTESTDEFS_H_ */
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgetoptionsview.h Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgetoptionsview.h Fri May 14 16:57:01 2010 +0300
@@ -48,6 +48,7 @@
void widgetHeightChanged(int);
void widgetWidthChanged(int);
void reflectionsEnabledChanged(bool);
+ void itemSizePolicyChanged(HgWidget::ItemSizePolicy);
private slots:
void updateData(QModelIndex startIn, QModelIndex endIn);
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestdatamodel.h Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestdatamodel.h Fri May 14 16:57:01 2010 +0300
@@ -21,6 +21,7 @@
#include <QAbstractListModel>
#include <QItemSelection>
#include <QStringList>
+#include <QFileInfoList>
#include <hbicon>
#include <thumbnailmanager_qt.h>
#include <QImage>
@@ -46,6 +47,7 @@
int rowCount(const QModelIndex &parent=QModelIndex()) const;
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const;
+ QVariant silentData(const QModelIndex &index, int role=Qt::DisplayRole);
bool setData(const QModelIndex& index, const QVariant& value, int role=Qt::EditRole);
void refreshModel();
@@ -73,7 +75,8 @@
void updateAlbumArt( int index );
void albumCacheReady();
-
+ void timeOut();
+
private:
void release(int start, int end);
@@ -91,6 +94,9 @@
bool mUseLowResImages;
QList<QImage> mImages;
BufferManager *mBufferManager;
+ QList<QPixmap> mPixmaps;
+ QPixmap mDefaultPixmap;
+ bool mSilentDataFetch;
ThumbnailManager* mWrapper;
QStringList mWaitingThumbnails;
@@ -98,6 +104,7 @@
int mThumbnailRequestIndex;
int mThumbnailRequestID;
+ QFileInfoList mFileInfoList;
};
#endif // HgWidgetTestDataModel_H
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestview.h Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestview.h Fri May 14 16:57:01 2010 +0300
@@ -29,6 +29,8 @@
class HgFlipWidget;
class HbLabel;
class HbDialog;
+class QParallelAnimationGroup;
+class HgCoverItem;
class HgItemSizeDialog;
@@ -53,6 +55,9 @@
void changeDescriptionFont(const HbFontSpec &);
void changeWidgetHeight(int);
void changeWidgetWidth(int);
+ void changeReflectionsEnabled(bool);
+ void changeItemSizePolicy(HgWidget::ItemSizePolicy);
+
void toggleScrollDirection();
void openDialog(const QModelIndex &index);
void openView(const QModelIndex& index);
@@ -76,8 +81,11 @@
void itemPosDialogClosed();
void resetOptions();
- void changeReflectionsEnabled(bool);
void resetModel();
+ void activated(/*HbListWidgetItem *item*/);
+ void animationFinished();
+ void animationAboutToEnd(const QModelIndex& targetIndex);
+
private:
void createMenu();
@@ -88,22 +96,26 @@
HgWidget *copyWidget() const;
void resizeEvent(QGraphicsSceneResizeEvent *event);
Qt::Orientation orientation() const;
-
+ void startAnimation(const QModelIndex& index);
+
private: // data
- HgWidget *mWidget;
- QGraphicsLinearLayout *mLayout;
- HgWidgetTestDataModel *mModel;
+ HgWidget* mWidget;
+ QGraphicsLinearLayout* mLayout;
+ HgWidgetTestDataModel* mModel;
HgTestWidgetType mWidgetType;
- HbListWidget *mListWidget;
+ HbListWidget* mListWidget;
bool mToggleOrientation;
- QItemSelectionModel *mSelectionModel;
+ QItemSelectionModel* mSelectionModel;
HgFlipWidget* mFlipWidget;
QModelIndex mFlippedIndex;
HbLabel* mFrontItem;
- HbView *mOptionsView;
- HgItemSizeDialog *mItemSizeDialog;
- HgItemSizeDialog *mItemPosDialog;
+ HbView* mOptionsView;
+ HgItemSizeDialog* mItemSizeDialog;
+ HgItemSizeDialog* mItemPosDialog;
+ QParallelAnimationGroup* mAnimationGroup;
+ HbDialog* mDialog;
+ HgCoverItem* mCoverItem;
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgcoveritem.cpp Fri May 14 16:57:01 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Another view for test application.
+*
+*/
+#include "hgcoveritem.h"
+
+HgCoverItem::HgCoverItem(QPixmap pixmap, QGraphicsItem *parent) : HbIconItem(parent)
+{
+ setIcon(HbIcon(QIcon(pixmap)));
+}
+
+void HgCoverItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
+ {
+ emit close();
+ }
+
+HgListWidget::HgListWidget(QGraphicsItem *parent) : HbListWidget(parent)
+{
+ setScrollDirections( Qt::Horizontal | Qt::Vertical );
+ setHorizontalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff);
+}
+
+void HgListWidget::leftGesture(int value)
+{
+ if (value > 30) {
+ emit close();
+ }
+}
+
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgetoptionsview.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgetoptionsview.cpp Fri May 14 16:57:01 2010 +0300
@@ -37,6 +37,7 @@
static const QString DESCRIPTION_POSITION = "Description position";
static const QString DESCRIPTION_FONT = "Description font";
static const QString REFLECTIONS_ENABLED = "Reflections enabled";
+static const QString ITEM_SIZE_POLICY = "Item size policy";
enum DataFormItems {
ItemWidgetType = 0,
@@ -51,6 +52,7 @@
ItemDescriptionPosition,
ItemDescriptionFont,
ItemReflectionEnabled,
+ ItemItemSizePolicy
};
HgWidgetOptionsView::HgWidgetOptionsView(QGraphicsItem *parent) :
@@ -79,7 +81,7 @@
item = mModel->appendDataFormItem(
HbDataFormModelItem::ComboBoxItem, MODEL_IMAGE_TYPE);
- item->setContentWidgetData(QString("items"), QStringList("QImage") << "HbIcon" << "QIcon");
+ item->setContentWidgetData(QString("items"), QStringList("QImage") << "HbIcon" << "QIcon" << "QPixmap");
item = mModel->appendDataFormItem(
HbDataFormModelItem::TextItem, WIDGET_HEIGHT);
@@ -117,6 +119,11 @@
item->setContentWidgetData(QString("text"), QString("no"));
item->setContentWidgetData(QString("additionalText"), QString("yes"));
+ item = mModel->appendDataFormItem(
+ HbDataFormModelItem::ToggleValueItem, ITEM_SIZE_POLICY);
+ item->setContentWidgetData(QString("text"), QString("User defined"));
+ item->setContentWidgetData(QString("additionalText"), QString("Automatic"));
+
connect(mModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), SLOT(updateData(QModelIndex, QModelIndex)));
mForm->setModel(mModel);
@@ -205,6 +212,9 @@
case 2:
type = ImageTypeQIcon;
break;
+ case 3:
+ type = ImageTypeQPixmap;
+ break;
default: break;
}
@@ -318,6 +328,12 @@
settings.setValue(SETT_REFLECTIONS_ENABLED, value);
emit reflectionsEnabledChanged(value);
}
+ else if (item->data(HbDataFormModelItem::LabelRole).toString() == ITEM_SIZE_POLICY) {
+ QVariant data = item->contentWidgetData(QString("text"));
+ HgWidget::ItemSizePolicy value = (data.toString() == "Automatic" ? HgWidget::ItemSizeAutomatic : HgWidget::ItemSizeUserDefined);
+ settings.setValue(SETT_ITEM_SIZE_POLICY, value);
+ emit itemSizePolicyChanged(value);
+ }
}
void HgWidgetOptionsView::setCoverflowEnabled(bool value)
@@ -333,7 +349,9 @@
item = mForm->itemByIndex(mModel->index(ItemDescriptionFont, 0));
if (item) item->setEnabled(value);
item = mForm->itemByIndex(mModel->index(ItemReflectionEnabled, 0));
- if (item) item->setEnabled(value);
+ if (item) item->setEnabled(value);
+ item = mForm->itemByIndex(mModel->index(ItemItemSizePolicy, 0));
+ if (item) item->setEnabled(value);
}
void HgWidgetOptionsView::storeWidgetSize()
@@ -403,7 +421,7 @@
value = settings.value(SETT_SCROLLBAR_INTERACTIVITY);
if (item && value.isValid()) {
item->setContentWidgetData(QString("text"), value.toBool() ? "yes" : "no");
- item->setContentWidgetData(QString("alternateText"), value.toBool() ? "no" : "yes");
+ item->setContentWidgetData(QString("additionalText"), value.toBool() ? "no" : "yes");
}
item = mModel->itemFromIndex(mModel->index(ItemModelImageType, 0));
@@ -412,13 +430,16 @@
int index(0);
switch (value.toInt()) {
case ImageTypeQImage:
- value = 0;
+ index = 0;
break;
case ImageTypeHbIcon:
- value = 1;
+ index = 1;
break;
case ImageTypeQIcon:
- value = 2;
+ index = 2;
+ break;
+ case ImageTypeQPixmap:
+ index = 3;
break;
default: break;
}
@@ -443,7 +464,7 @@
value = settings.value(SETT_LOW_RES_IMAGES);
if (item && value.isValid()) {
item->setContentWidgetData(QString("text"), value.toBool() ? "yes" : "no");
- item->setContentWidgetData(QString("alternateText"), value.toBool() ? "no" : "yes");
+ item->setContentWidgetData(QString("additionalText"), value.toBool() ? "no" : "yes");
}
item = mModel->itemFromIndex(mModel->index(ItemTitlePosition, 0));
@@ -541,9 +562,21 @@
value = settings.value(SETT_REFLECTIONS_ENABLED);
if (item && value.isValid()) {
item->setContentWidgetData(QString("text"), value.toBool() ? "yes" : "no");
- item->setContentWidgetData(QString("alternateText"), value.toBool() ? "no" : "yes");
+ item->setContentWidgetData(QString("additionalText"), value.toBool() ? "no" : "yes");
}
+ item = mModel->itemFromIndex(mModel->index(ItemItemSizePolicy, 0));
+ value = settings.value(SETT_ITEM_SIZE_POLICY);
+ if (item && value.isValid()) {
+ if (value.toInt() == HgWidget::ItemSizeAutomatic) {
+ item->setContentWidgetData(QString("text"), "Automatic");
+ item->setContentWidgetData(QString("additionalText"), "User defined");
+ }
+ else {
+ item->setContentWidgetData(QString("text"), "User defined");
+ item->setContentWidgetData(QString("additionalText"), "Automatic");
+ }
+ }
}
void HgWidgetOptionsView::resizeEvent(QGraphicsSceneResizeEvent *event)
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestdatamodel.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestdatamodel.cpp Fri May 14 16:57:01 2010 +0300
@@ -55,13 +55,14 @@
: QAbstractListModel(parent),
mCachingInProgress(false),
mImageType(ImageTypeNone),
- mDefaultIcon((":/images/default.svg")),
+// mDefaultIcon((":/images/default.svg")),
mUseLowResImages(false),
mWrapper( new ThumbnailManager() ),
mThumbnailRequestPending(false),
mThumbnailRequestIndex(-1),
mThumbnailRequestID(-1),
- mBufferManager(0)
+ mBufferManager(0),
+ mSilentDataFetch(false)
{
FUNC_LOG;
mWrapper->setQualityPreference( ThumbnailManager::OptimizeForPerformance );
@@ -91,6 +92,31 @@
mWrapper->setThumbnailSize(size);
}
+void HgWidgetTestDataModel::timeOut()
+{
+ for (int i = 0; i < mFileInfoList.size(); ++i){
+ QFileInfo fileInfo = mFileInfoList.at(i);
+ if (fileInfo.isFile()){
+ QString s = fileInfo.filePath();
+ if (s.indexOf(QString(".jpg"),0,Qt::CaseInsensitive)>0){
+ mFiles.append(s);
+ mImages.append(QImage());
+ mVisibility.append(true);
+ }
+ }
+ }
+
+ if (mBufferManager) {
+ mBufferManager->resetBuffer(0,mFiles.count());
+ }
+
+ if (mFiles.count()>0) {
+ // photo's behaves this way so for testing purposes lets follow their practice.
+ beginInsertRows(QModelIndex(), 0, mFiles.count()-1);
+ endInsertRows();
+ }
+}
+
void HgWidgetTestDataModel::init()
{
FUNC_LOG;
@@ -104,26 +130,17 @@
dir.setPath(QString("f:/data/images"));
#endif
- QFileInfoList list = dir.entryInfoList();
- for (int i = 0; i < list.size(); ++i){
- QFileInfo fileInfo = list.at(i);
- if (fileInfo.isFile()){
- QString s = fileInfo.filePath();
- if (s.indexOf(QString(".jpg"),0,Qt::CaseInsensitive)>0){
- mFiles.append(s);
- mImages.append(QImage());
- mVisibility.append(true);
- }
- }
- }
-
+ mFileInfoList = dir.entryInfoList();
QPixmap pixmap(":/images/default.svg");
+ mDefaultPixmap = pixmap;
if (!pixmap.isNull()){
mQIcon = QIcon(pixmap);
if (!mQIcon.isNull()){
mHbIcon = HbIcon(mQIcon);
}
}
+
+ QTimer::singleShot(0, this, SLOT(timeOut()));
}
/*!
@@ -141,6 +158,15 @@
return mFiles.count();
}
+
+QVariant HgWidgetTestDataModel::silentData(const QModelIndex &index, int role)
+{
+ mSilentDataFetch = true;
+ QVariant variant = data(index,role);
+ mSilentDataFetch = false;
+ return variant;
+}
+
/*!
Returns the data stored for the item referred to by the \a index.
@@ -159,7 +185,7 @@
return returnValue;
}
- if( mBufferManager )
+ if( mBufferManager && !mSilentDataFetch)
mBufferManager->setPosition( row );
switch ( role )
@@ -182,45 +208,76 @@
}
case Qt::DecorationRole:
{
- // INFO("Requesting model item" << row << ", " << mFiles.at(row));
- if (mFiles.at(row).isEmpty()) {
- returnValue = mDefaultIcon;
- }
- else {
- QImage icon = mImages.at(row);
- if ( !icon.isNull() )
+ if (mFiles.at(row).isEmpty())
+ {
+
+ switch (mImageType)
{
- if (mUseLowResImages) {
- QSize size = icon.size();
- icon = icon.scaled(QSize(size.width()/4, size.height()/4));
+ case ImageTypeHbIcon:
+ returnValue = mHbIcon;
+ break;
+ case ImageTypeQImage:
+ returnValue = mDefaultIcon;
+ break;
+ case ImageTypeQIcon:
+ returnValue = mQIcon;
+ break;
+ case ImageTypeQPixmap:
+ returnValue = mDefaultPixmap;
+ break;
}
-
- switch(mImageType)
+
+ }
+ else
+ {
+ switch (mImageType)
+ {
+ case ImageTypeQImage:
+ {
+ QImage image = mImages.at(row);
+ if (image.isNull())
{
- case ImageTypeHbIcon:
+ returnValue = mDefaultIcon;
+ }
+ else
+ {
+ if (mUseLowResImages)
{
- returnValue = mHbIcon;
- break;
+ QSize size = image.size();
+ image = image.scaled(QSize(size.width()/4, size.height()/4));
+ returnValue = image;
}
- case ImageTypeQImage:
+ else
{
- returnValue = icon;
- break;
- }
- case ImageTypeQIcon:
- {
- returnValue = mQIcon;
- break;
+ returnValue = image;
}
- default:
- break;
}
-
}
- else
+ break;
+ case ImageTypeQPixmap:
{
- returnValue = mDefaultIcon;
+ QPixmap pixmap = mPixmaps.at(row);
+ if (pixmap.isNull())
+ {
+ returnValue = mDefaultPixmap;
+ }
+ else
+ {
+ returnValue = pixmap;
+ }
}
+ break;
+ case ImageTypeHbIcon:
+ {
+ returnValue = mHbIcon;
+ }
+ break;
+ case ImageTypeQIcon:
+ {
+ returnValue = mQIcon;
+ }
+ break;
+ }
}
break;
}
@@ -362,8 +419,13 @@
void HgWidgetTestDataModel::reset()
{
emit beginResetModel();
- mImages.removeAt(0);
mFiles.removeAt(0);
+ if (mImageType == ImageTypeQPixmap)
+ {
+ mPixmaps.removeAt(0);
+ }
+ else
+ mImages.removeAt(0);
emit endResetModel();
}
@@ -447,8 +509,19 @@
delete mBufferManager;
mBufferManager = 0;
mBufferManager = new BufferManager(this, buffer, treshhold, 0, mFiles.count());
- for (int i = 0; i<mImages.count();i++) {
- mImages.replace(i, QImage());
+ if (mImageType == ImageTypeQPixmap)
+ {
+ for (int i = 0; i<mPixmaps.count();i++) {
+ mPixmaps.replace(i, QPixmap());
+ }
+
+ }
+ else
+ {
+ for (int i = 0; i<mImages.count();i++) {
+ mImages.replace(i, QImage());
+ }
+
}
}
@@ -470,7 +543,14 @@
mWrapper->cancelRequest(mThumbnailRequestID);
requestNew = true;
}
- mImages.replace(i,QImage());
+ if (mImageType == ImageTypeQPixmap)
+ {
+ mPixmaps.replace(i, QPixmap());
+ }
+ else
+ {
+ mImages.replace(i,QImage());
+ }
}
if (requestNew){
@@ -509,7 +589,13 @@
{
if (!error && !pixmap.isNull() ){
// int idx = reinterpret_cast<int>(data);
- mImages.replace(mThumbnailRequestIndex,pixmap.toImage().convertToFormat(QImage::Format_RGB16));
+ if (mImageType == ImageTypeQPixmap)
+ {
+ mPixmaps.replace(mThumbnailRequestIndex, pixmap);
+ }
+ else {
+ mImages.replace(mThumbnailRequestIndex,pixmap.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied));//.convertToFormat(QImage::Format_RGB16));
+ }
QModelIndex modelIndex = QAbstractItemModel::createIndex(mThumbnailRequestIndex, 0);
emit dataChanged(modelIndex, modelIndex);
}
--- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestview.cpp Mon May 03 13:32:54 2010 +0300
+++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestview.cpp Fri May 14 16:57:01 2010 +0300
@@ -20,11 +20,14 @@
#include <hbinstance.h>
#include <hblabel.h>
#include <hblistwidget.h>
+#include <hblistwidgetitem.h>
#include <hbmenu.h>
#include <hbscrollbar>
#include <QActionGroup>
#include <QGraphicsLinearLayout>
#include <QSettings>
+#include <QParallelAnimationGroup>
+#include <QPropertyAnimation>
#include "hgwidgettestview.h"
#include "hgtestview.h"
#include "hgwidgetoptionsview.h"
@@ -34,12 +37,13 @@
#include "hgitemsizedialog.h"
#include "hgcoverflowwidget.h"
#include "trace.h"
+#include "hgcoveritem.h"
#include <hgwidgets/hggrid.h>
#include <hgwidgets/hgmediawall.h>
static const int GRIDBUFFERSIZE(400);
-static const int COVERFLOWBUFFERSIZE(130);
+static const int COVERFLOWBUFFERSIZE(150);
HgWidgetTestView::HgWidgetTestView(QGraphicsItem *parent) :
HbView(parent),
@@ -52,11 +56,16 @@
mFrontItem(0),
mOptionsView(0),
mItemSizeDialog(0),
- mItemPosDialog(0)
-{
+ mItemPosDialog(0),
+ mDialog(0),
+ mCoverItem(0),
+ mAnimationGroup(0)
+{
mModel = new HgWidgetTestDataModel(this);
mSelectionModel = new QItemSelectionModel(mModel, this);
+ mAnimationGroup = new QParallelAnimationGroup();
+
createMenu();
mLayout = new QGraphicsLinearLayout(Qt::Vertical);
@@ -67,6 +76,7 @@
HgWidgetTestView::~HgWidgetTestView()
{
+ delete mAnimationGroup;
}
void HgWidgetTestView::createMenu()
@@ -123,20 +133,26 @@
setItemVisible(Hb::AllItems, true);
mModel->enableLowResImages(false);
// TODO, init grid different model,
- mModel->setThumbnailSize(ThumbnailManager::ThumbnailMedium);
+// mModel->setThumbnailSize(ThumbnailManager::ThumbnailMedium);
break;
case HgWidgetCoverflow:
- mModel->setThumbnailSize(ThumbnailManager::ThumbnailLarge);
+// mModel->setThumbnailSize(ThumbnailManager::ThumbnailLarge);
setItemVisible(Hb::AllItems, orientation() != Qt::Horizontal);
break;
case HgWidgetTBone:
setItemVisible(Hb::AllItems, true);
- mModel->setThumbnailSize(ThumbnailManager::ThumbnailMedium);
+// mModel->setThumbnailSize(ThumbnailManager::ThumbnailMedium);
mListWidget = new HbListWidget;
mLayout->addItem(mListWidget);
- mListWidget->addItem( "List item 1");
+ /*mListWidget->addItem( "List item 1");
mListWidget->addItem( "List item 2");
- mListWidget->addItem( "List item 3");
+ mListWidget->addItem( "List item 3");*/
+
+ HgMediawall* mediawall = qobject_cast<HgMediawall*>( mWidget );
+ if (mediawall) {
+ connect(mediawall, SIGNAL(animationAboutToEnd(QModelIndex)),
+ SLOT(animationAboutToEnd(QModelIndex)));
+ }
break;
default:
break;
@@ -160,6 +176,27 @@
}
}
+void HgWidgetTestView::animationAboutToEnd(const QModelIndex& targetIndex)
+{
+ FUNC_LOG;
+
+ QVariant texts = mModel->data(targetIndex, Qt::DisplayRole);
+ if (texts.canConvert<QStringList>()) {
+ QStringList strList = texts.toStringList();
+ if (strList.count() > 0) {
+ if( mListWidget->count() >= 5 ) {
+ //delete the last itme in the list and insert the new row to the beginning of the list
+ HbListWidgetItem* delItem = mListWidget->takeItem(4);
+ if (delItem) {
+ delete delItem;
+ delItem = 0;
+ }
+ }
+ mListWidget->insertItem(0, strList.at(0));
+ }
+ }
+}
+
void HgWidgetTestView::changeScrollBarVisibility(HgWidget::ScrollBarPolicy policy)
{
FUNC_LOG;
@@ -277,14 +314,53 @@
mLayout->setContentsMargins(margin, top, margin, bottom);
}
-void HgWidgetTestView::openDialog(const QModelIndex& index)
+void HgWidgetTestView::changeReflectionsEnabled(bool enabled)
+{
+ HgMediawall* wall = qobject_cast<HgMediawall*>(mWidget);
+ if (wall)
+ wall->enableReflections(enabled);
+}
+
+void HgWidgetTestView::changeItemSizePolicy(HgMediawall::ItemSizePolicy policy)
{
FUNC_LOG;
- QVariant image = mModel->data(index, Qt::DecorationRole);
- QVariant texts = mModel->data(index, Qt::DisplayRole);
+ if (mWidget && mWidget->itemSizePolicy() != policy) {
+ mWidget->setItemSizePolicy(policy);
+ }
+}
+
+void HgWidgetTestView::activated()
+{
+ mAnimationGroup->setDirection(QAbstractAnimation::Backward);
+ connect(mAnimationGroup, SIGNAL(finished()), this, SLOT(animationFinished()));
+ mAnimationGroup->start();
+}
- if (mWidgetType == HgWidgetCoverflow || mWidgetType == HgWidgetTBone)
+void HgWidgetTestView::animationFinished()
+{
+ delete mCoverItem;
+ mCoverItem = 0;
+ mAnimationGroup->disconnect(this, SIGNAL(animationFinished()));
+ mAnimationGroup->setDirection(QAbstractAnimation::Forward);
+ mAnimationGroup->clear();
+ delete mDialog;
+ mDialog = 0;
+}
+
+void HgWidgetTestView::openDialog(const QModelIndex& index)
+{
+ FUNC_LOG;
+
+ QVariant image = mModel->silentData(index, Qt::DecorationRole);
+ QVariant texts = mModel->silentData(index, Qt::DisplayRole);
+
+ if (mWidgetType == HgWidgetCoverflow )
+ {
+ startAnimation(index);
+ return;
+ }
+ else if(mWidgetType == HgWidgetTBone)
{
if (image.canConvert<QPixmap>() && texts.canConvert<QStringList>())
{
@@ -351,12 +427,78 @@
dlg.exec();
}
+void HgWidgetTestView::startAnimation(const QModelIndex& index)
+{
+ if( mAnimationGroup->state() == QAbstractAnimation::Running ||
+ mDialog || mCoverItem ) return;
+
+ QPolygonF poly;
+ if (!mWidget->getItemOutline(index, poly))
+ return;
+
+
+ mFlippedIndex = index;
+
+ QRectF itemRect = poly.boundingRect();
+ itemRect.moveTo(itemRect.topLeft() + mWidget->geometry().topLeft());
+
+ QVariant image = mModel->silentData(index, Qt::DecorationRole);
+ QPixmap pixmap;
+ QImage temp = image.value<QImage>();
+ QImage scaled = temp.scaled(itemRect.size().toSize());
+ if (scaled.isNull()) return;
+ QPixmap pixmap2 = pixmap.fromImage(scaled);
+ if(pixmap2.isNull()) return;
+
+ mCoverItem = new HgCoverItem(pixmap2, this);
+ mCoverItem->setPos(itemRect.topLeft());
+ mCoverItem->setZValue(mWidget->zValue()+2);
+ mCoverItem->show();
+
+ QPropertyAnimation* animation = new QPropertyAnimation(mCoverItem, "geometry");
+ animation->setDuration(400);
+ animation->setStartValue(itemRect);
+
+ QRectF endRect = itemRect;
+ int topLeftX = (mWidget->size().width() - itemRect.size().width()*2)/2;
+ endRect.moveTo(topLeftX,endRect.topLeft().y());
+ animation->setEndValue(endRect);
+
+ mAnimationGroup->addAnimation(animation);
+
+ HgListWidget* list = new HgListWidget(this);
+ mDialog = new HbDialog(this);
+ mDialog->setZValue(mWidget->zValue()+1);
+ mDialog->setContentWidget(list);
+ mDialog->setDismissPolicy(HbPopup::TapOutside);
+ list->addItem( "List item 1");
+ list->addItem( "List item 2");
+ list->addItem( "List item 3");
+ list->addItem( "List item 4");
+ list->addItem( "List item 5");
+ list->addItem( "List item 6");
+ list->addItem( "List item 7");
+
+ connect(list,SIGNAL(activated(HbListWidgetItem*)),this, SLOT(activated()));
+ connect(list,SIGNAL(close()),this, SLOT(activated()));
+ connect(mCoverItem,SIGNAL(close()),this, SLOT(activated()));
+
+ animation = new QPropertyAnimation(mDialog, "geometry");
+ animation->setDuration(400);
+ animation->setStartValue(itemRect);
+ endRect.moveTo(endRect.topRight());
+ animation->setEndValue(endRect);
+
+ mAnimationGroup->addAnimation(animation);
+ mAnimationGroup->start();
+}
+
void HgWidgetTestView::openView(const QModelIndex& index)
{
FUNC_LOG;
- QVariant image = mModel->data(index, Qt::DecorationRole);
- QVariant texts = mModel->data(index, Qt::DisplayRole);
+ QVariant image = mModel->silentData(index, Qt::DecorationRole);
+ QVariant texts = mModel->silentData(index, Qt::DisplayRole);
if (image.canConvert<QImage>() && texts.canConvert<QStringList>())
{
@@ -515,6 +657,8 @@
SLOT(changeDescriptionFont(HbFontSpec)));
connect(view, SIGNAL(reflectionsEnabledChanged(bool)),
SLOT(changeReflectionsEnabled(bool)));
+ connect(view, SIGNAL(itemSizePolicyChanged(HgWidget::ItemSizePolicy)),
+ SLOT(changeItemSizePolicy(HgWidget::ItemSizePolicy)));
mOptionsView = view;
primaryWindow->addView(mOptionsView);
@@ -603,6 +747,10 @@
changeReflectionsEnabled(value.toBool());
}
+ value = settings.value(SETT_ITEM_SIZE_POLICY);
+ if (value.isValid()) {
+ changeItemSizePolicy(static_cast<HgMediawall::ItemSizePolicy>(value.toInt()));
+ }
}
void HgWidgetTestView::setupWidgetSize()
@@ -631,13 +779,15 @@
if (mainWindows.count() > 0)
{
HbMainWindow *primaryWindow = mainWindows[0];
+ primaryWindow->scene()->setItemIndexMethod(QGraphicsScene::NoIndex);
+ primaryWindow->setOptimizationFlag(QGraphicsView::DontSavePainterState, true);
if (primaryWindow->orientation() == Qt::Horizontal) {
scrollDirection = Qt::Horizontal;
}
}
HgWidget* widget = 0;
- HgCoverflowWidget* temp = 0;
+ HgMediawall* temp = 0;
switch (type) {
case HgWidgetGrid:
@@ -646,18 +796,21 @@
widget = new HgGrid(scrollDirection);
break;
case HgWidgetCoverflow:
+ {
mModel->setThumbnailSize(ThumbnailManager::ThumbnailLarge);
mModel->setBuffer(COVERFLOWBUFFERSIZE, COVERFLOWBUFFERSIZE/3);
- widget = new HgCoverflowWidget();
- temp = (HgCoverflowWidget*)widget;
- temp->setTitlePosition(HgMediawall::PositionNone);
+ widget = new HgMediawall();
+ temp = (HgMediawall*)widget;
+ temp->setDescriptionPosition(HgMediawall::PositionAboveImage);
break;
+ }
case HgWidgetTBone:
mModel->setThumbnailSize(ThumbnailManager::ThumbnailLarge);
mModel->setBuffer(COVERFLOWBUFFERSIZE, COVERFLOWBUFFERSIZE/3);
- widget = new HgCoverflowWidget();
- temp = (HgCoverflowWidget*)widget;
- temp->setTitlePosition(HgMediawall::PositionNone);
+ widget = new HgMediawall();
+ temp = (HgMediawall*)widget;
+ temp->setDescriptionPosition(HgMediawall::PositionAboveImage);
+ temp->enableReflections(false);
break;
default:
break;
@@ -670,6 +823,9 @@
widget->setLongPressEnabled(true);
widget->scrollTo(widget->currentIndex());
+ QImage defaultImage(":/images/default.svg");
+ widget->setDefaultImage(defaultImage);
+
return widget;
}
@@ -736,7 +892,7 @@
return;
// fetch highresolution image from the model
- QVariant imgVariant = mModel->data(index, Qt::UserRole+2);
+ QVariant imgVariant = mModel->silentData(index, Qt::UserRole+2);
if (imgVariant.isNull())
return;
@@ -762,19 +918,26 @@
void HgWidgetTestView::orientationChanged(Qt::Orientation orientation)
{
+ if (mDialog) {
+ mModel->setData(mFlippedIndex, true, Qt::UserRole+1);
+ }
+ mAnimationGroup->stop();
+ delete mDialog;
+ mDialog = 0;
+ delete mCoverItem;
+ mCoverItem = 0;
+ mAnimationGroup->clear();
+
+
if (orientation == Qt::Horizontal && mWidgetType == HgWidgetCoverflow ) {
setItemVisible(Hb::AllItems, false);
}
else if (orientation == Qt::Horizontal && mWidgetType == HgWidgetTBone) {
initWidget(HgWidgetCoverflow);
-// HbEffect::add(mWidget,":/effect1.fxml", "end");
-// HbEffect::start(mWidget, "end");
setItemVisible(Hb::AllItems, false);
}
else if (orientation == Qt::Vertical && mWidgetType == HgWidgetCoverflow) {
initWidget(HgWidgetTBone);
-// HbEffect::add(mWidget,":/effect1.fxml", "end");
-// HbEffect::start(mWidget, "end");
setItemVisible(Hb::AllItems, true);
}
@@ -872,13 +1035,13 @@
if (!mItemPosDialog)
return;
- HgCoverflowWidget* wall = qobject_cast<HgCoverflowWidget*>(mWidget);
+ HgMediawall* wall = qobject_cast<HgMediawall*>(mWidget);
if (!wall)
return;
QSizeF s = mItemPosDialog->itemSize();
wall->setFrontItemPositionDelta(QPointF(s.width(), s.height()));
- wall->updateTextPositions();
+// wall->updateTextPositions();
mWidget->update();
}
@@ -900,13 +1063,6 @@
setupWidget();
}
-void HgWidgetTestView::changeReflectionsEnabled(bool enabled)
-{
- HgMediawall* wall = qobject_cast<HgMediawall*>(mWidget);
- if (wall)
- wall->enableReflections(enabled);
-}
-
void HgWidgetTestView::resetModel()
{
mModel->reset();
--- a/hgcacheproxymodel/sis/hgcacheproxymodelstub.pkg Mon May 03 13:32:54 2010 +0300
+++ b/hgcacheproxymodel/sis/hgcacheproxymodelstub.pkg Fri May 14 16:57:01 2010 +0300
@@ -19,7 +19,7 @@
&EN
; standard SIS file header
-#{"hgcacheproxymodel"},(0x2002EA2A),10,0,0, TYPE=SA
+#{"hgcacheproxymodel"},(0x2002EA2A),1,0,0, TYPE=SA
;Localised Vendor name
%{"Nokia"}
Binary file hgcacheproxymodel/sis/hgcacheproxymodelstub.sis has changed
--- a/hgcacheproxymodel/src/hgcacheproxymodel.cpp Mon May 03 13:32:54 2010 +0300
+++ b/hgcacheproxymodel/src/hgcacheproxymodel.cpp Fri May 14 16:57:01 2010 +0300
@@ -13,7 +13,7 @@
*
* Description:
*
-* Version : %version: 2 %
+* Version : %version: 7 %
*/
#include <QList>
#include <QAbstractItemModel>
@@ -27,104 +27,93 @@
-Q_DECL_EXPORT HgCacheProxyModel::HgCacheProxyModel(QObject *parent):
-QAbstractItemModel(parent),
-mBufferManager(0),
-mSortFilterProxyModel(new QSortFilterProxyModel(this)),
-mDataProviderModel(0),
-mResetNeeded(false),
-mSupressBM(false),
-mSortParameterChanged(true),
-mFilterParameterChanged(true)
+HgCacheProxyModel::HgCacheProxyModel(QObject *parent):
+ QAbstractItemModel(parent),
+ mBufferManager(0),
+ mSortFilterProxyModel(new QSortFilterProxyModel(this)),
+ mDataProviderModel(0),
+ mSupressBM(false),
+ mCurrentPos(0)//,
+// mSortParameterChanged(true)
{
- connect(mSortFilterProxyModel, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
- this, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)));
-
- connect(mSortFilterProxyModel, SIGNAL(columnsAboutToBeMoved(QModelIndex, int, int, QModelIndex, int)),
- this, SIGNAL(columnsAboutToBeMoved(QModelIndex, int, int, QModelIndex, int)));
+ TX_ENTRY
+ connect(mSortFilterProxyModel, SIGNAL(columnsAboutToBeInserted(const QModelIndex&, int, int)),
+ this, SLOT(sourceColumnsAboutToBeInserted(const QModelIndex&, int, int)));
+ connect(mSortFilterProxyModel, SIGNAL(columnsAboutToBeMoved(const QModelIndex&, int, int, const QModelIndex&, int)),
+ this, SLOT(sourceColumnsAboutToBeMoved(const QModelIndex&, int, int, const QModelIndex&, int)));
+ connect(mSortFilterProxyModel, SIGNAL(columnsAboutToBeRemoved(const QModelIndex&, int, int)),
+ this, SLOT(sourceColumnsAboutToBeRemoved(const QModelIndex&, int, int)));
- connect(mSortFilterProxyModel, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
- this, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)));
-
- connect(mSortFilterProxyModel, SIGNAL(columnsInserted(QModelIndex,int,int)),
- this, SIGNAL(columnsInserted(QModelIndex,int,int)));
-
- connect(mSortFilterProxyModel, SIGNAL(columnsMoved(QModelIndex, int, int, QModelIndex, int)),
- this, SIGNAL(columnsMoved(QModelIndex, int, int, QModelIndex, int)));
-
- connect(mSortFilterProxyModel, SIGNAL(columnsRemoved(QModelIndex,int,int)),
- this, SIGNAL(columnsRemoved(QModelIndex,int,int)));
-
- connect(mSortFilterProxyModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this, SLOT(dataUpdated(QModelIndex,QModelIndex)));
-
- connect(mSortFilterProxyModel, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
- this, SIGNAL(headerDataChanged(Qt::Orientation,int,int)));
-
+ connect(mSortFilterProxyModel, SIGNAL(columnsInserted(const QModelIndex&, int, int)),
+ this, SLOT(sourceColumnsInserted(const QModelIndex&, int, int)));
+ connect(mSortFilterProxyModel, SIGNAL(columnsMoved(const QModelIndex&, int, int, const QModelIndex&, int)),
+ this, SLOT(sourceColumnsMoved(const QModelIndex&, int, int, const QModelIndex&, int)));
+ connect(mSortFilterProxyModel, SIGNAL(columnsRemoved(const QModelIndex&, int, int )),
+ this, SLOT(sourceColumnsRemoved(const QModelIndex&, int, int )));
+ connect(mSortFilterProxyModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
+ this, SLOT(sourceDataChanged(const QModelIndex&, const QModelIndex&)));
+ connect(mSortFilterProxyModel, SIGNAL(headerDataChanged(Qt::Orientation, int, int)),
+ this, SLOT(sourceHeaderDataChanged(Qt::Orientation, int, int)));
connect(mSortFilterProxyModel, SIGNAL(layoutAboutToBeChanged()),
- this, SIGNAL(layoutAboutToBeChanged()));
-
- connect(mSortFilterProxyModel, SIGNAL(layoutChanged()),
- this, SIGNAL(layoutChanged()));
-
- connect(mSortFilterProxyModel, SIGNAL(modelAboutToBeReset()),
- this, SLOT(sourceAboutToBeReset()));
-
- connect(mSortFilterProxyModel, SIGNAL(modelReset()),
- this, SLOT(sourceReset()));
-
- connect(mSortFilterProxyModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
- this, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
-
- connect(mSortFilterProxyModel, SIGNAL(rowsAboutToBeMoved(QModelIndex, int, int, QModelIndex, int)),
- this, SIGNAL(rowsAboutToBeMoved(QModelIndex, int, int, QModelIndex, int)));
-
- connect(mSortFilterProxyModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
- this, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
-
- connect(mSortFilterProxyModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
- this, SIGNAL(rowsInserted(QModelIndex,int,int)));
-
- connect(mSortFilterProxyModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
- this, SLOT(sourceRowsInserted(QModelIndex,int,int)));
-
- connect(mSortFilterProxyModel, SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)),
- this, SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)));
-
- connect(mSortFilterProxyModel, SIGNAL(rowsRemoved(QModelIndex,int,int)),
- this, SIGNAL(rowsRemoved(QModelIndex,int,int)));
-
- connect(mSortFilterProxyModel, SIGNAL(rowsRemoved(QModelIndex,int,int)),
- this, SLOT(sourceRowsRemoved(QModelIndex,int,int)));
+ this, SLOT(sourceLayoutAboutToBeChanged()));
+ connect(mSortFilterProxyModel, SIGNAL(layoutChanged()),
+ this, SLOT(sourceLayoutChanged()));
+ connect(mSortFilterProxyModel, SIGNAL(modelAboutToBeReset()),
+ this, SLOT(sourceModelAboutToBeReset()));
+ connect(mSortFilterProxyModel, SIGNAL(modelReset()),
+ this, SLOT(sourceModelReset()));
+ connect(mSortFilterProxyModel, SIGNAL(rowsAboutToBeInserted(const QModelIndex&, int, int)),
+ this, SLOT(sourceRowsAboutToBeInserted(const QModelIndex&, int, int)));
+ connect(mSortFilterProxyModel, SIGNAL(rowsAboutToBeMoved(const QModelIndex&, int, int, const QModelIndex&, int)),
+ this, SLOT(sourceRowsAboutToBeMoved(const QModelIndex&, int, int, const QModelIndex&, int)));
+ connect(mSortFilterProxyModel, SIGNAL(rowsAboutToBeRemoved(const QModelIndex&, int, int)),
+ this, SLOT(sourceRowsAboutToBeRemoved(const QModelIndex&, int, int)));
+ connect(mSortFilterProxyModel, SIGNAL(rowsInserted(const QModelIndex &, int , int)),
+ this, SLOT(sourceRowsInserted(const QModelIndex &, int , int)));
+ connect(mSortFilterProxyModel, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex&, int)),
+ this, SLOT(sourceRowsMoved(const QModelIndex &, int, int, const QModelIndex&, int)));
+ connect(mSortFilterProxyModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
+ this, SLOT(sourceRowsRemoved(const QModelIndex&, int, int)));
+
+ TX_EXIT
}
-Q_DECL_EXPORT HgCacheProxyModel::~HgCacheProxyModel()
+HgCacheProxyModel::~HgCacheProxyModel()
{
+ TX_ENTRY
delete mBufferManager;
+ TX_EXIT
}
-Q_DECL_EXPORT void HgCacheProxyModel::setDataProvider(HgDataProviderModel *dataProvider, int cacheSize, int cacheTreshold)
+void HgCacheProxyModel::setDataProvider(HgDataProviderModel *dataProvider, int cacheSize, int cacheTreshold)
{
TX_ENTRY
mDataProviderModel = dataProvider;
mSortFilterProxyModel->setSourceModel(mDataProviderModel);
if (mDataProviderModel){
mDataProviderModel->registerObserver(this);
- mDataProviderModel->resizeQPixmapPool(cacheSize);
+
+ mSupressBM = true;
+ resizeCache(cacheSize, cacheTreshold);
+ mSupressBM = false;
- delete mBufferManager;
- mBufferManager = NULL;
- mBufferManager = new HgBufferManager(this, cacheSize, cacheTreshold, 0, count() );
+ if (mBufferManager == NULL){
+ mBufferManager = new HgBufferManager(this, cacheSize, cacheTreshold, 0, count() );
+ } else {
+ mBufferManager->resetBuffer(0, count());
+ }
+
+
}
TX_EXIT
}
-Q_DECL_EXPORT HgDataProviderModel* HgCacheProxyModel::DataProvider()
+HgDataProviderModel* HgCacheProxyModel::DataProvider()
{
return mDataProviderModel;
}
-Q_DECL_EXPORT void HgCacheProxyModel::resizeCache(int newSize, int newTreshold)
+void HgCacheProxyModel::resizeCache(int newSize, int newTreshold)
{
TX_ENTRY
if (mDataProviderModel)
@@ -134,7 +123,7 @@
TX_EXIT
}
-Q_DECL_EXPORT QModelIndex HgCacheProxyModel::index(int row, int column, const QModelIndex &parent) const
+QModelIndex HgCacheProxyModel::index(int row, int column, const QModelIndex &parent) const
{
Q_UNUSED(parent);
if ( row >= rowCount() ){
@@ -147,65 +136,65 @@
return QAbstractItemModel::createIndex(row, column);
}
-Q_DECL_EXPORT QModelIndex HgCacheProxyModel::parent(const QModelIndex &child) const
+QModelIndex HgCacheProxyModel::parent(const QModelIndex &child) const
{
return mSortFilterProxyModel->parent(mapToSource(child));
}
-Q_DECL_EXPORT int HgCacheProxyModel::rowCount(const QModelIndex &parent) const
+int HgCacheProxyModel::rowCount(const QModelIndex &parent) const
{
return mSortFilterProxyModel->rowCount(mapToSource(parent));
}
-Q_DECL_EXPORT int HgCacheProxyModel::columnCount(const QModelIndex &parent) const
+int HgCacheProxyModel::columnCount(const QModelIndex &parent) const
{
return mSortFilterProxyModel->columnCount(mapToSource(parent));
}
-Q_DECL_EXPORT bool HgCacheProxyModel::hasChildren(const QModelIndex &parent) const
+bool HgCacheProxyModel::hasChildren(const QModelIndex &parent) const
{
return mSortFilterProxyModel->hasChildren(mapToSource(parent));
}
-Q_DECL_EXPORT QVariant HgCacheProxyModel::data(const QModelIndex &index, int role) const
+QVariant HgCacheProxyModel::data(const QModelIndex &index, int role) const
{
setBufferPosition(index.row());
QVariant res = mSortFilterProxyModel->data(mapToSource(index), role);
return res;
}
-Q_DECL_EXPORT bool HgCacheProxyModel::setData(const QModelIndex &index, const QVariant &value, int role)
+bool HgCacheProxyModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
return mSortFilterProxyModel->setData(mapToSource(index), value, role);
}
-Q_DECL_EXPORT QVariant HgCacheProxyModel::headerData(int section, Qt::Orientation orientation, int role) const
+QVariant HgCacheProxyModel::headerData(int section, Qt::Orientation orientation, int role) const
{
return mSortFilterProxyModel->headerData(section, orientation, role);
}
-Q_DECL_EXPORT bool HgCacheProxyModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role)
+bool HgCacheProxyModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role)
{
return mSortFilterProxyModel->setHeaderData(section, orientation, value, role);
}
-Q_DECL_EXPORT QMap<int, QVariant> HgCacheProxyModel::itemData(const QModelIndex &index) const
+QMap<int, QVariant> HgCacheProxyModel::itemData(const QModelIndex &index) const
{
setBufferPosition(index.row());
return mSortFilterProxyModel->itemData(mapToSource(index));
}
-Q_DECL_EXPORT bool HgCacheProxyModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles)
+bool HgCacheProxyModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles)
{
return mSortFilterProxyModel->setItemData(mapToSource(index), roles);
}
-Q_DECL_EXPORT QStringList HgCacheProxyModel::mimeTypes() const
+QStringList HgCacheProxyModel::mimeTypes() const
{
return mSortFilterProxyModel->mimeTypes();
}
-Q_DECL_EXPORT QMimeData *HgCacheProxyModel::mimeData(const QModelIndexList &indexes) const
+QMimeData *HgCacheProxyModel::mimeData(const QModelIndexList &indexes) const
{
QModelIndexList list;
for ( int i=0; i < indexes.count(); i++){
@@ -214,222 +203,217 @@
return mSortFilterProxyModel->mimeData(list);
}
-Q_DECL_EXPORT bool HgCacheProxyModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
+bool HgCacheProxyModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
return mSortFilterProxyModel->dropMimeData(data, action, row, column, mapToSource(parent));
}
-Q_DECL_EXPORT Qt::DropActions HgCacheProxyModel::supportedDropActions() const
+Qt::DropActions HgCacheProxyModel::supportedDropActions() const
{
return mSortFilterProxyModel->supportedDropActions();
}
-Q_DECL_EXPORT bool HgCacheProxyModel::insertRows(int row, int count, const QModelIndex &parent)
+bool HgCacheProxyModel::insertRows(int row, int count, const QModelIndex &parent)
{
return mSortFilterProxyModel->insertRows(row, count, mapToSource(parent));
}
-Q_DECL_EXPORT bool HgCacheProxyModel::insertColumns(int column, int count, const QModelIndex &parent)
+bool HgCacheProxyModel::insertColumns(int column, int count, const QModelIndex &parent)
{
return mSortFilterProxyModel->insertColumns(column, count, mapToSource(parent));
}
-Q_DECL_EXPORT bool HgCacheProxyModel::removeRows(int row, int count, const QModelIndex &parent)
+bool HgCacheProxyModel::removeRows(int row, int count, const QModelIndex &parent)
{
return mSortFilterProxyModel->removeRows(row, count, mapToSource(parent));
}
-Q_DECL_EXPORT bool HgCacheProxyModel::removeColumns(int column, int count, const QModelIndex &parent)
+bool HgCacheProxyModel::removeColumns(int column, int count, const QModelIndex &parent)
{
return mSortFilterProxyModel->removeColumns(column, count, mapToSource(parent));
}
-Q_DECL_EXPORT void HgCacheProxyModel::fetchMore(const QModelIndex &parent)
+void HgCacheProxyModel::fetchMore(const QModelIndex &parent)
{
mSortFilterProxyModel->fetchMore(mapToSource(parent));
}
-Q_DECL_EXPORT bool HgCacheProxyModel::canFetchMore(const QModelIndex &parent) const
+bool HgCacheProxyModel::canFetchMore(const QModelIndex &parent) const
{
return mSortFilterProxyModel->canFetchMore(mapToSource(parent));
}
-Q_DECL_EXPORT Qt::ItemFlags HgCacheProxyModel::flags(const QModelIndex &index) const
+Qt::ItemFlags HgCacheProxyModel::flags(const QModelIndex &index) const
{
return mSortFilterProxyModel->flags(mapToSource(index));
}
-Q_DECL_EXPORT void HgCacheProxyModel::sort(int column, Qt::SortOrder order)
+void HgCacheProxyModel::sort(int column, Qt::SortOrder order)
{
- if ( mSortParameterChanged || (sortColumn() != column) || (sortOrder() != order) ){
- mSortParameterChanged = false;
- mResetNeeded = true;
- cleanupForBMResetIfNeeded();
- mSortFilterProxyModel->sort(column, order);
- resetBMIfNeeded();
- }
+ mSupressBM = true;
+ cleanupForBMReset();
+ mSortFilterProxyModel->sort(column, order);
+ resetBM();
}
-Q_DECL_EXPORT QModelIndex HgCacheProxyModel::buddy(const QModelIndex &index) const
+QModelIndex HgCacheProxyModel::buddy(const QModelIndex &index) const
{
return mSortFilterProxyModel->buddy(mapToSource(index));
}
-Q_DECL_EXPORT QModelIndexList HgCacheProxyModel::match(const QModelIndex &start, int role,
+QModelIndexList HgCacheProxyModel::match(const QModelIndex &start, int role,
const QVariant &value, int hits,
Qt::MatchFlags flags) const
{
return mSortFilterProxyModel->match(mapToSource(start), role, value, hits, flags);
}
-Q_DECL_EXPORT QSize HgCacheProxyModel::span(const QModelIndex &index) const
+QSize HgCacheProxyModel::span(const QModelIndex &index) const
{
return mSortFilterProxyModel->span(mapToSource(index));
}
-Q_DECL_EXPORT Qt::CaseSensitivity HgCacheProxyModel::sortCaseSensitivity() const
+Qt::CaseSensitivity HgCacheProxyModel::sortCaseSensitivity() const
{
return mSortFilterProxyModel->sortCaseSensitivity();
}
-Q_DECL_EXPORT void HgCacheProxyModel::setSortCaseSensitivity(Qt::CaseSensitivity cs)
+void HgCacheProxyModel::setSortCaseSensitivity(Qt::CaseSensitivity cs)
{
if (sortCaseSensitivity() != cs){
- mSortParameterChanged = true;
- cleanupForBMResetIfNeeded();
+ mSupressBM = true;
+ cleanupForBMReset();
mSortFilterProxyModel->setSortCaseSensitivity(cs);
- resetBMIfNeeded();
+ resetBM();
}
}
-Q_DECL_EXPORT bool HgCacheProxyModel::isSortLocaleAware() const
+bool HgCacheProxyModel::isSortLocaleAware() const
{
return mSortFilterProxyModel->isSortLocaleAware();
}
-Q_DECL_EXPORT void HgCacheProxyModel::setSortLocaleAware(bool on)
+void HgCacheProxyModel::setSortLocaleAware(bool on)
{
if (isSortLocaleAware() != on){
- mSortParameterChanged = true;
- cleanupForBMResetIfNeeded();
+ mSupressBM = true;
+ cleanupForBMReset();
mSortFilterProxyModel->setSortLocaleAware(on);
- resetBMIfNeeded();
+ resetBM();
}
}
-Q_DECL_EXPORT int HgCacheProxyModel::sortColumn() const
+int HgCacheProxyModel::sortColumn() const
{
return mSortFilterProxyModel->sortColumn();
}
-Q_DECL_EXPORT Qt::SortOrder HgCacheProxyModel::sortOrder() const
+Qt::SortOrder HgCacheProxyModel::sortOrder() const
{
return mSortFilterProxyModel->sortOrder();
}
-Q_DECL_EXPORT bool HgCacheProxyModel::dynamicSortFilter() const
+bool HgCacheProxyModel::dynamicSortFilter() const
{
return mSortFilterProxyModel->dynamicSortFilter();
}
-Q_DECL_EXPORT void HgCacheProxyModel::setDynamicSortFilter(bool enable)
+void HgCacheProxyModel::setDynamicSortFilter(bool enable)
{
if (dynamicSortFilter() != enable){
- mSortParameterChanged = true;
- mFilterParameterChanged = true;
- cleanupForBMResetIfNeeded();
+ mSupressBM = true;
+ cleanupForBMReset();
mSortFilterProxyModel->setDynamicSortFilter(enable);
- resetBMIfNeeded();
+ resetBM();
}
}
-Q_DECL_EXPORT int HgCacheProxyModel::sortRole() const
+int HgCacheProxyModel::sortRole() const
{
return mSortFilterProxyModel->sortRole();
}
-Q_DECL_EXPORT void HgCacheProxyModel::setSortRole(int role)
+void HgCacheProxyModel::setSortRole(int role)
{
if (sortRole() != role){
- mSortParameterChanged = true;
- cleanupForBMResetIfNeeded();
+ mSupressBM = true;
+ cleanupForBMReset();
mSortFilterProxyModel->setSortRole(role);
- resetBMIfNeeded();
+ resetBM();
+ }
+}
+
+QRegExp HgCacheProxyModel::filterRegExp() const
+{
+ return mSortFilterProxyModel->filterRegExp();
+}
+
+void HgCacheProxyModel::setFilterRegExp(const QRegExp ®Exp)
+{
+ if (filterRegExp() != regExp){
+ mSupressBM = true;
+ cleanupForBMReset();
+ mSortFilterProxyModel->setFilterRegExp(regExp);
+ resetBM();
}
}
-//Q_DECL_EXPORT QRegExp HgCacheProxyModel::filterRegExp() const
-//{
-// return mSortFilterProxyModel->filterRegExp();
-//}
-//
-//Q_DECL_EXPORT void HgCacheProxyModel::setFilterRegExp(const QRegExp ®Exp)
-//{
-// if (filterRegExp() != regExp){
-// mFilterParameterChanged = true;
-// cleanupForBMResetIfNeeded();
-// mSortFilterProxyModel->setFilterRegExp(regExp);
-// resetBMIfNeeded();
-// }
-//}
-//
-//Q_DECL_EXPORT int HgCacheProxyModel::filterKeyColumn() const
-//{
-// return mSortFilterProxyModel->filterKeyColumn();
-//}
-//
-//Q_DECL_EXPORT void HgCacheProxyModel::setFilterKeyColumn(int column)
-//{
-// if (filterKeyColumn() != column){
-// mFilterParameterChanged = true;
-// cleanupForBMResetIfNeeded();
-// mSortFilterProxyModel->setFilterKeyColumn(column);
-// resetBMIfNeeded();
-// }
-//}
-//
-//Q_DECL_EXPORT Qt::CaseSensitivity HgCacheProxyModel::filterCaseSensitivity() const
-//{
-// return mSortFilterProxyModel->filterCaseSensitivity();
-//}
-//
-//Q_DECL_EXPORT void HgCacheProxyModel::setFilterCaseSensitivity(Qt::CaseSensitivity cs)
-//{
-// if ( filterCaseSensitivity() != cs){
-// mFilterParameterChanged = true;
-// cleanupForBMResetIfNeeded();
-// mSortFilterProxyModel->setFilterCaseSensitivity(cs);
-// resetBMIfNeeded();
-// }
-//}
-//
-//Q_DECL_EXPORT int HgCacheProxyModel::filterRole() const
-//{
-// return mSortFilterProxyModel->filterRole();
-//}
-//
-//Q_DECL_EXPORT void HgCacheProxyModel::setFilterRole(int role)
-//{
-// if ( mFilterParameterChanged || (filterRole() != role)){
-// mFilterParameterChanged = false;
-// mResetNeeded = true;
-// cleanupForBMResetIfNeeded();
-// mSortFilterProxyModel->setFilterRole(role);
-// resetBMIfNeeded();
-// }
-//}
+int HgCacheProxyModel::filterKeyColumn() const
+{
+ return mSortFilterProxyModel->filterKeyColumn();
+}
+
+void HgCacheProxyModel::setFilterKeyColumn(int column)
+{
+ if (filterKeyColumn() != column){
+ mSupressBM = true;
+ cleanupForBMReset();
+ mSortFilterProxyModel->setFilterKeyColumn(column);
+ resetBM();
+ }
+}
+
+Qt::CaseSensitivity HgCacheProxyModel::filterCaseSensitivity() const
+{
+ return mSortFilterProxyModel->filterCaseSensitivity();
+}
-Q_DECL_EXPORT bool HgCacheProxyModel::submit()
+void HgCacheProxyModel::setFilterCaseSensitivity(Qt::CaseSensitivity cs)
+{
+ if ( filterCaseSensitivity() != cs){
+ mSupressBM = true;
+ cleanupForBMReset();
+ mSortFilterProxyModel->setFilterCaseSensitivity(cs);
+ resetBM();
+ }
+}
+
+int HgCacheProxyModel::filterRole() const
+{
+ return mSortFilterProxyModel->filterRole();
+}
+
+void HgCacheProxyModel::setFilterRole(int role)
+{
+ if ( filterRole() != role ){
+ mSupressBM = true;
+ cleanupForBMReset();
+ mSortFilterProxyModel->setFilterRole(role);
+ resetBM();
+ }
+}
+
+bool HgCacheProxyModel::submit()
{
return mSortFilterProxyModel->submit();
}
-Q_DECL_EXPORT void HgCacheProxyModel::revert()
+void HgCacheProxyModel::revert()
{
mSortFilterProxyModel->revert();
}
-Q_DECL_EXPORT void HgCacheProxyModel::release(int start, int end)
+void HgCacheProxyModel::release(int start, int end)
{
TX_ENTRY_ARGS( QString("%0-%1").arg(start).arg(end));
QList<int> list;
@@ -447,10 +431,10 @@
}
if (mDataProviderModel)
mDataProviderModel->release(list, true);
- TX_EXIT
+ TX_EXIT
}
-Q_DECL_EXPORT void HgCacheProxyModel::request(int start, int end, HgRequestOrder order)
+void HgCacheProxyModel::request(int start, int end, HgRequestOrder order)
{
TX_ENTRY_ARGS( QString("%0-%1").arg(start).arg(end));
QList<int> list;
@@ -498,27 +482,18 @@
return mSortFilterProxyModel->mapFromSource( mDataProviderModel->index(myIndex, 0) ).row();
}
-void HgCacheProxyModel::cleanupForBMResetIfNeeded()
+void HgCacheProxyModel::cleanupForBMReset()
{
- if (mResetNeeded || mSortFilterProxyModel->dynamicSortFilter()==true){
- TX_LOG
- mSupressBM = true;
- mResetNeeded = true;
- beginResetModel();
- releaseAll();
- }
+ releaseAll();
}
-void HgCacheProxyModel::resetBMIfNeeded()
+void HgCacheProxyModel::resetBM()
{
- if ( mResetNeeded ){
- if (mBufferManager)
- mBufferManager->resetBuffer( mCurrentPos, count() );
- mSupressBM = false;
- mResetNeeded = false;
- endResetModel();
+ if (mBufferManager){
+ mCurrentPos = 0;
+ mBufferManager->resetBuffer( mCurrentPos, count() );
}
- mResetNeeded = false;
+ mSupressBM = false;
}
void HgCacheProxyModel::releaseAll()
@@ -528,64 +503,218 @@
for ( int i=0; i<mDataProviderModel->rowCount(); i++){
list.append(i);
}
- mDataProviderModel->release(list, true); //will quietly replace all icons with default ones,
+ mDataProviderModel->release(list, true);
}
}
void HgCacheProxyModel::setBufferPosition(int pos) const
{
- if (!mSupressBM && mBufferManager){
- TX_LOG_ARGS(QString("idx:%1 ").arg(pos) );
+ if (mBufferManager && !mSupressBM){
if (mCurrentPos!=pos){
+// TX_LOG_ARGS(QString("pos:%1 ").arg(pos) );
mCurrentPos = pos;
mBufferManager->setPosition(mCurrentPos);
}
}
}
-void HgCacheProxyModel::sourceReset()
+void HgCacheProxyModel::sourceColumnsAboutToBeInserted( const QModelIndex & parent, int start, int end)
+{
+ TX_ENTRY
+ beginInsertColumns(parent, start, end);
+ TX_EXIT
+}
+
+void HgCacheProxyModel::sourceColumnsAboutToBeMoved( const QModelIndex & sourceParent, int sourceStart,
+ int sourceEnd, const QModelIndex & destinationParent, int destinationColumn )
+{
+ TX_ENTRY
+ beginMoveColumns(sourceParent, sourceStart, sourceEnd, destinationParent, destinationColumn);
+ TX_EXIT
+}
+
+void HgCacheProxyModel::sourceColumnsAboutToBeRemoved( const QModelIndex & parent, int start, int end)
{
- mSupressBM = true;
- mResetNeeded = true;
- releaseAll();
- if (mBufferManager)
- mBufferManager->resetBuffer( 0, count() );
- mSupressBM = false;
- mResetNeeded = false;
- endResetModel();
+ TX_ENTRY
+ beginRemoveColumns(parent, start, end);
+ TX_EXIT
+}
+
+void HgCacheProxyModel::sourceColumnsInserted( const QModelIndex & parent, int start, int end )
+{
+ TX_ENTRY
+ Q_UNUSED(parent);
+ Q_UNUSED(start);
+ Q_UNUSED(end);
+ endInsertColumns();
+ TX_EXIT
+}
+
+void HgCacheProxyModel::sourceColumnsMoved( const QModelIndex & sourceParent, int sourceStart,
+ int sourceEnd, const QModelIndex & destinationParent, int destinationColumn )
+{
+ TX_ENTRY
+ Q_UNUSED(sourceParent);
+ Q_UNUSED(sourceStart);
+ Q_UNUSED(sourceEnd);
+ Q_UNUSED(destinationParent);
+ Q_UNUSED(destinationColumn);
+ endMoveColumns();
+ TX_EXIT
}
-void HgCacheProxyModel::sourceAboutToBeReset()
+void HgCacheProxyModel::sourceColumnsRemoved( const QModelIndex & parent, int start, int end )
+{
+ TX_ENTRY
+ Q_UNUSED(parent);
+ Q_UNUSED(start);
+ Q_UNUSED(end);
+ endRemoveColumns();
+ TX_EXIT
+}
+
+void HgCacheProxyModel::sourceDataChanged( const QModelIndex & topLeft, const QModelIndex & bottomRight )
{
+ TX_ENTRY_ARGS(QString("from:%1 to:%2").arg( topLeft.row() ).arg( bottomRight.row() ) );
+ QModelIndex begin = index( topLeft.row(), topLeft.column() );
+ QModelIndex end = index( bottomRight.row(), bottomRight.column() );
+
+ if (begin.isValid() && end.isValid() && !mSupressBM)
+ emit dataChanged(begin, end);
+ TX_EXIT
+}
+
+void HgCacheProxyModel::sourceHeaderDataChanged( Qt::Orientation orientation, int first, int last )
+{
+ TX_ENTRY
+ emit headerDataChanged( orientation, first, last );
+ TX_EXIT
+}
+
+void HgCacheProxyModel::sourceLayoutAboutToBeChanged()
+{
+ TX_ENTRY
+ emit layoutAboutToBeChanged();
mSupressBM = true;
- mResetNeeded = true;
- beginResetModel();
+ releaseAll();
+ TX_EXIT
+}
+
+void HgCacheProxyModel::sourceLayoutChanged()
+{
+ TX_ENTRY
+ mSupressBM = true;
+ if (mBufferManager){
+ mCurrentPos = 0;
+ mBufferManager->resetBuffer( mCurrentPos, count() );
+ }
+ mSupressBM = false;
+ emit layoutChanged();
+ TX_EXIT
}
-void HgCacheProxyModel::sourceRowsInserted(const QModelIndex &source_parent, int start, int end)
+void HgCacheProxyModel::sourceModelAboutToBeReset()
+{
+ TX_ENTRY
+ beginResetModel();
+ mSupressBM = true;
+ releaseAll();
+ TX_EXIT
+}
+
+void HgCacheProxyModel::sourceModelReset()
+{
+ TX_ENTRY
+ mSupressBM = true;
+ if (mBufferManager){
+ mCurrentPos = 0;
+ mBufferManager->resetBuffer( mCurrentPos, count() );
+ }
+ mSupressBM = false;
+ endResetModel();
+ TX_EXIT
+}
+
+void HgCacheProxyModel::sourceRowsAboutToBeInserted( const QModelIndex & parent, int start, int end )
{
- Q_UNUSED(source_parent);
- Q_UNUSED(end);
- if (mBufferManager)
- mBufferManager->itemCountChanged(start, false, count());
+ TX_ENTRY
+ if (mBufferManager && !mSupressBM){
+ beginInsertRows(parent, start, end);
+// mBufferManager->aboutToInsertItems(start, end);
+ }
+ TX_EXIT
+}
+
+void HgCacheProxyModel::sourceRowsAboutToBeMoved( const QModelIndex & sourceParent, int sourceStart,
+ int sourceEnd, const QModelIndex & destinationParent, int destinationRow )
+{
+ TX_ENTRY
+ beginMoveRows(sourceParent, sourceStart, sourceEnd, destinationParent, destinationRow);
+ TX_EXIT
+}
+
+void HgCacheProxyModel::sourceRowsAboutToBeRemoved( const QModelIndex & parent, int start, int end )
+{
+ TX_ENTRY
+ if (mBufferManager && !mSupressBM){
+ beginRemoveRows(parent, start, end);
+// mBufferManager->aboutToRemoveItems(start, end);
+ }
+ TX_EXIT
}
-void HgCacheProxyModel::sourceRowsRemoved(const QModelIndex &source_parent, int start, int end)
+void HgCacheProxyModel::sourceRowsInserted( const QModelIndex & parent, int start, int end )
{
- Q_UNUSED(source_parent);
- Q_UNUSED(end);
- if (mBufferManager)
- mBufferManager->itemCountChanged(start, true, count());
+ TX_ENTRY
+ Q_UNUSED(parent);
+ Q_UNUSED(end);
+ if (mBufferManager && !mSupressBM){
+ mBufferManager->itemCountChanged(start, false, count());
+ endInsertRows();
+ }
+ TX_EXIT
+}
+
+void HgCacheProxyModel::sourceRowsMoved( const QModelIndex & sourceParent, int sourceStart,
+ int sourceEnd, const QModelIndex & destinationParent, int destinationRow )
+{
+ TX_ENTRY
+ Q_UNUSED(sourceParent);
+ Q_UNUSED(sourceStart);
+ Q_UNUSED(sourceEnd);
+ Q_UNUSED(destinationParent);
+ Q_UNUSED(destinationRow);
+ endMoveRows();
+ TX_EXIT
}
-void HgCacheProxyModel::dataUpdated(QModelIndex from, QModelIndex to)
+void HgCacheProxyModel::sourceRowsRemoved( const QModelIndex & parent, int start, int end )
{
- dataUpdated(from.row(), to.row());
+ TX_ENTRY
+ Q_UNUSED(parent);
+ Q_UNUSED(end);
+ if (mBufferManager && !mSupressBM){
+ mBufferManager->itemCountChanged(start, true, count());
+ endRemoveRows();
+ }
+ TX_EXIT
}
-Q_DECL_EXPORT void HgCacheProxyModel::dataUpdated(int from, int to)
+void HgCacheProxyModel::dataUpdated(int from, int to)
{
TX_LOG_ARGS(QString("from:%1 to:%2").arg(from).arg(to));
- emit dataChanged(index(mapFromDataProviderIndex(from),0), index ( mapFromDataProviderIndex(to),0) );
+ QModelIndex begin;
+ QModelIndex end;
+ begin = index(mapFromDataProviderIndex(from),0);
+
+ if ( from == to ){
+ end = begin;
+ } else {
+ end = index(mapFromDataProviderIndex(to),0);
+ }
+
+ if (begin.isValid() && end.isValid() && !mSupressBM)
+ emit dataChanged(begin, end );
}
+
//eof
--- a/hgcacheproxymodel/src/hgdataprovidermodel.cpp Mon May 03 13:32:54 2010 +0300
+++ b/hgcacheproxymodel/src/hgdataprovidermodel.cpp Fri May 14 16:57:01 2010 +0300
@@ -13,7 +13,7 @@
*
* Description:
*
-* Version : %version: 3 %
+* Version : %version: 6 %
*/
#include <e32debug.h>
#include <QVariant>
@@ -46,7 +46,7 @@
mFreePixmaps.clear();
qDeleteAll( mUsedPixmaps.begin(), mUsedPixmaps.end() );
mUsedPixmaps.clear();
- TX_EXIT
+ TX_EXIT
}
void HgDataProviderModel::release(QList<int> list, bool silent)
@@ -59,10 +59,11 @@
for ( int idx = 0; idx < list.count(); idx++){
i = list[idx];
if ( i >=0 && i<count()){
- if ( i < min)
+ if ( i < min){
min = i;
- if ( i > max)
+ } if ( i > max){
max = i;
+ }
resetIcon(i);
}
}
@@ -72,12 +73,14 @@
if (min<max){ //min<max is true if at least one item is in range <0,count())
emitDataChanged(min, max, silent);
}
- TX_EXIT
+ TX_EXIT
}
void HgDataProviderModel::request(QList<int> list, bool silent)
{
+ TX_ENTRY
doRequestData(list, silent);
+ TX_EXIT
}
void HgDataProviderModel::registerObserver(HgDataProviderModelObserver* obs)
@@ -174,7 +177,7 @@
{
bool change(false);
- if ( pos >=0 && pos<count() && mCache->at(pos)){
+ if ( isIndexValid(pos)){
mCache->at(pos)->insert(role, obj); //this will remove old one if needed
change = true;
}
@@ -187,23 +190,19 @@
bool HgDataProviderModel::updateIcon(int pos, QVariant obj, bool silent)
{
- if (obj.isValid()==false)
- return false;
-
bool change(false);
- if ( pos >=0 && pos<count() && mCache->at(pos)){
+ if ( obj.isValid() && !obj.isNull() && isIndexValid(pos) ){
mCache->at(pos)->insert(Qt::DecorationRole, obj); //will remove old if needed
change = true;
- }
-
- if (!silent && change){
- TX_LOG
- if ( mObserver){
- mObserver->dataUpdated(pos,pos);
- } else {
- QModelIndex topLeft = index(pos, 0);
- QModelIndex bottomRight = index(pos, 0);
- emit dataChanged(topLeft,bottomRight);
+ if (!silent){
+ TX_LOG_ARGS(QString("pos:%1").arg( pos ) );
+ if ( mObserver){
+ mObserver->dataUpdated(pos,pos);
+ } else { //if no observer, let's emit signal
+ QModelIndex topLeft = index(pos, 0);
+ QModelIndex bottomRight = index(pos, 0);
+ emit dataChanged(topLeft,bottomRight);
+ }
}
}
return change;
@@ -298,7 +297,7 @@
void HgDataProviderModel::emitDataChanged(int from, int to, bool silent)
{
if ( !silent ){
- TX_LOG
+// TX_LOG
QModelIndex topLeft = index(from, 0);
QModelIndex bottomRight = index(to, 0);
emit dataChanged(topLeft,bottomRight);
@@ -307,7 +306,7 @@
void HgDataProviderModel::resizeQPixmapPool(int newSize)
{
- mQPixmapsLock.lock();
+// mQPixmapsLock.lock();
int currentSize = mFreePixmaps.count() + mUsedPixmaps.count();
int diff = currentSize - newSize - KQPixmapCacheEmergencyBuffer;
mUnallocatedPixmaps = 0;
@@ -324,38 +323,39 @@
diff--;
}
}
- mQPixmapsLock.unlock();
+// mQPixmapsLock.unlock();
mCacheSize = newSize;
}
void HgDataProviderModel::releasePixmap(int idx)
{
- mQPixmapsLock.lock();
- if (mUsedPixmaps.contains(idx)){
+// mQPixmapsLock.lock();
+ if (mUsedPixmaps.contains(idx)) {
QPixmap* pix = mUsedPixmaps.take(idx);
- if ( mFreePixmaps.count() + mUsedPixmaps.count() + mUnallocatedPixmaps> mCacheSize + KQPixmapCacheEmergencyBuffer){
+ if ( ( mFreePixmaps.count() + mUsedPixmaps.count() + mUnallocatedPixmaps ) > ( mCacheSize + KQPixmapCacheEmergencyBuffer ) ) {
delete pix; //we have too many pixmaps
- }else{
+ } else {
mFreePixmaps.append(pix);
}
- }else{
- TX_LOG_ARGS( QString("can't release pixmap for idx=%0").arg(idx));
+ } 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)
{
+ TX_ENTRY
QPixmap* pix = getPixmap(index);
if (pix){
- if ( pix->pixmapData() ){
+ if ( pix->pixmapData() ) {
pix->pixmapData()->fromImage(aPixmap.toImage(), Qt::AutoColor );
} 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"));
@@ -364,9 +364,9 @@
QPixmap* HgDataProviderModel::getPixmap(int idx)
{
- TX_ENTRY
+// 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 {
@@ -377,10 +377,10 @@
res = new QPixmap();
} else {
TX_LOG_ARGS(QString("no free pixmaps"));
- }
+ }
}
- mQPixmapsLock.unlock();
- TX_EXIT
+// mQPixmapsLock.unlock();
+// TX_EXIT
return res;
}
--- a/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/hgcacheproxymodeltestapp.pro Mon May 03 13:32:54 2010 +0300
+++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/hgcacheproxymodeltestapp.pro Fri May 14 16:57:01 2010 +0300
@@ -19,6 +19,7 @@
symbian {
TARGET.EPOCSTACKSIZE = 0x14000
+ TARGET.EPOCHEAPSIZE = 0x020000 0x4000000
TARGET.EPOCALLOWDLLDATA = 1
TARGET.CAPABILITY = ALL \
-TCB
--- a/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mydataprovider.cpp Mon May 03 13:32:54 2010 +0300
+++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mydataprovider.cpp Fri May 14 16:57:01 2010 +0300
@@ -62,7 +62,7 @@
void MyDataProvider::changeIconSize(ThumbnailManager::ThumbnailSize aThumbnailsize)
{
// TX_ENTRY
-// we could remove all iconsfrom cache and put default ones, but probably that would be waste of time, and it's better just to load new icons with correct sizes.
+// we could remove all icons from cache and put default ones, but probably that would be waste of time, and it's better just to load new icons with correct sizes.
mThumbnailsize = aThumbnailsize;
mWrapper->setThumbnailSize( mThumbnailsize );
// TX_EXIT
@@ -76,7 +76,7 @@
int i = 0;
for (int idx=0; idx<list.count(); idx++){
i = list[idx];
- if (containsRole(i, KItemIdRole) && !containsRole(i, Qt::DecorationRole)) {//if there is icon, don't request new one
+ if (containsRole(i, KItemIdRole) ) {
items += QString("%0 ").arg(i);
mWaitingThumbnails.append(i);
}
@@ -94,7 +94,7 @@
if (i >=0 && i < count() && containsRole(i, KItemIdRole)) {
int id = (data(i, KItemIdRole)).toInt();
unsigned long int uId = (unsigned long int)id;
-// TX_LOG_ARGS(QString("getThumbnail for index:%0 uID:%1").arg(i).arg(uId));
+ TX_LOG_ARGS(QString("getThumbnail for index:%0 uID:%1").arg(i).arg(uId));
void *clientData = reinterpret_cast<void *>(i);
mThumbnailRequestID = mWrapper->getThumbnail(uId, clientData, KThumbnailsPriority);
mThumbnailRequestIndex = i;
@@ -113,9 +113,11 @@
{
// TX_ENTRY
Q_UNUSED(id);
- if (!error && pixmap.rect().height()>0 && pixmap.rect().width()>0 ){
+ if (!error && pixmap.rect().height()>0 && pixmap.rect().width()>0 ) {
int idx = reinterpret_cast<int>(data);
-// TX_LOG_ARGS(QString("thumbnailReady idx = %0").arg(idx));
+ TX_LOG_ARGS(QString("thumbnailReady idx = %0").arg(idx));
+// updateIcon(idx, HbIcon( QIcon( pixmap ) ) );
+// update(idx, HbIcon( QIcon( pixmap ) ), Qt::DecorationRole, false);
updateIcon(idx, createIcon(idx, pixmap));
} else {
TX_LOG_ARGS(QString("error:%0 id:%0").arg(error).arg(id));
@@ -129,7 +131,7 @@
void MyDataProvider::doReleaseData(QList<int> list, bool silent)
{
-// TX_ENTRY
+ TX_ENTRY
Q_UNUSED(silent);
int i = 0;
QString items = "Released items:";
@@ -149,7 +151,7 @@
TX_LOG_ARGS(items);
getNextThumbnail();
-// TX_EXIT
+ TX_EXIT
}
QVariant MyDataProvider::defaultIcon() const
@@ -203,7 +205,7 @@
void MyDataProvider::doResetModel()
{
-
+ TX_ENTRY
if (mThumbnailRequestPending && mThumbnailRequestID!=-1){
mWrapper->cancelRequest(mThumbnailRequestID);
}
@@ -231,6 +233,6 @@
);
-// TX_EXIT
+ TX_EXIT
}
--- a/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mywindow.cpp Mon May 03 13:32:54 2010 +0300
+++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mywindow.cpp Fri May 14 16:57:01 2010 +0300
@@ -127,7 +127,7 @@
view->setColumnCount( 3 );
view->setRowCount( 5 );
}
- view->setTextVisible(false);
+// view->setTextVisible(false);
view->setUniformItemSizes( true );
view->setItemRecycling( true );
//this could be done to change mode, for images it doesn't make sence, becouse images thumbnails are created by default only for medium and fullsize
@@ -167,15 +167,15 @@
mModel->sort(0);
} else if (command == 201) { //disable filter
QRegExp reg = QRegExp();
-// mModel->setFilterRegExp(reg);
+ mModel->setFilterRegExp(reg);
} else if (command == 202) { //Filter ITEM* (Case Sensitive)
QRegExp reg = QRegExp("ITEM*", Qt::CaseSensitive, QRegExp::Wildcard);
-// mModel->setFilterCaseSensitivity(Qt::CaseSensitive);
-// mModel->setFilterRegExp(reg);
+ mModel->setFilterCaseSensitivity(Qt::CaseSensitive);
+ mModel->setFilterRegExp(reg);
} else if (command == 203) { //Filter ITEM1*(Case Insensitive)
QRegExp reg = QRegExp("ITEM1*", Qt::CaseInsensitive, QRegExp::Wildcard);
-// mModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
-// mModel->setFilterRegExp(reg);
+ mModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
+ mModel->setFilterRegExp(reg);
} else if (command == 1000) { //reset
mMyDataProvider->resetModel();
} else if (command == 1001) { //reset
@@ -190,7 +190,7 @@
mTestVal = 500;
timeout();
} else if (command == 1003) {
- mTestVal = 0;
+ mTestVal = -1;
}
}
@@ -205,9 +205,13 @@
action.setData ( QVariant(101 + mTestVal%4) );
processAction(&action);
- if (mTestVal>0){
+
+ if (mTestVal>=0){
mTestVal--;
- mTimer->start(1000);
+ if (mTestVal==0){
+ mTestVal = 500;
+ }
+ mTimer->start(2000);
}
}
--- a/hgcacheproxymodel/tsrc/unit/bmhelper.cpp Mon May 03 13:32:54 2010 +0300
+++ b/hgcacheproxymodel/tsrc/unit/bmhelper.cpp Fri May 14 16:57:01 2010 +0300
@@ -36,7 +36,11 @@
end = mBuffer.size() - 1;
for ( int i = start; i <= end; i++){
- mBuffer.replace(i, false);
+ if (mBuffer.value(i) == true){
+ mBuffer.replace(i, false);
+ } else {
+// qWarning()<<QString("release released item %1").arg(i);
+ }
}
}
@@ -47,9 +51,13 @@
start = 0;
if (end>mBuffer.size() - 1)
end = mBuffer.size() - 1;
-
+
for ( int i = start; i <= end; i++){
- mBuffer.replace(i, true);
+ if (mBuffer.value(i) == false){
+ mBuffer.replace(i, true);
+ } else {
+// qWarning()<<QString("request requested item %1").arg(i);
+ }
}
}
--- a/hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.cpp Mon May 03 13:32:54 2010 +0300
+++ b/hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.cpp Fri May 14 16:57:01 2010 +0300
@@ -13,7 +13,7 @@
*
* Description:
*
-* Version : %version: 3 %
+* Version : %version: 5 %
*/
#include <QtTest/QtTest>
#include <hgwidgets/hgcacheproxymodel.h>
@@ -294,9 +294,8 @@
int bufferSize = 100;
bmh = new BMHelper(totalsize);
bm = new HgBufferManager(bmh, bufferSize, 40, 0, totalsize);
-
totalsize--;
- bmh->itemCountChanged(0, true, totalsize);
+ bmh->itemCountChanged(0, true, totalsize);
bm->itemCountChanged(0, true, totalsize);
QVERIFY(bmh->isIntergal(bufferSize));
@@ -833,6 +832,12 @@
testQAbstractItemModel(cp, 200, 1);
cp->setDataProvider(0);
QVERIFY(cp->DataProvider() == 0);
+
+ cp->setDataProvider(dph);
+ QVERIFY(cp->DataProvider() == dph);
+
+ cp->setDataProvider(dph);
+ QVERIFY(cp->DataProvider() == dph);
}
void TestCacheProxy::testCP_SignalsForward()
@@ -1034,50 +1039,50 @@
}
-//void TestCacheProxy::testCP_Filter()
-//{
-// cp = new HgCacheProxyModel();
-// cph = new CacheProxyHelper(cp);
-// dph = new DataProviderHelper(200);
-// cp->setDataProvider(dph, 50, 20);
-//
-// QModelIndex idx = cp->index(1, 0);
-// QVariant res = cp->data(idx, Qt::DisplayRole);
-// QCOMPARE(res.isValid(), true);
-// QCOMPARE(res.toString().startsWith("item"), true);
-//
-// QRegExp regexp = QRegExp("ITEM*", Qt::CaseSensitive, QRegExp::Wildcard);
-//
-// cp->setFilterRegExp(regexp);
-// QVERIFY(cp->filterRegExp() == regexp);
-// cp->setFilterCaseSensitivity(Qt::CaseSensitive);
-// QCOMPARE(cp->filterCaseSensitivity(), Qt::CaseSensitive);
-//
-// idx = cp->index(1, 0);
-// res = cp->data(idx, Qt::DisplayRole);
-// QCOMPARE(res.isValid(), true);
-// QCOMPARE(res.toString().startsWith("item"), false);
-//
-// cp->setFilterKeyColumn(1);
-// QCOMPARE(cp->filterKeyColumn (), 1);
-// cp->setFilterKeyColumn(0);
-//
-// cp->setFilterRole(Qt::UserRole+1);
-// QCOMPARE(cp->filterRole(), Qt::UserRole+1);
-// cp->setFilterRole(Qt::DisplayRole);
-//
-// regexp = QRegExp("ITEM*", Qt::CaseInsensitive, QRegExp::Wildcard);
-// cp->setFilterRegExp(regexp);
-// QVERIFY(cp->filterRegExp() == regexp);
-// cp->setFilterCaseSensitivity(Qt::CaseInsensitive);
-// QCOMPARE(cp->filterCaseSensitivity(), Qt::CaseInsensitive);
-//
-// idx = cp->index(1, 0);
-// res = cp->data(idx, Qt::DisplayRole);
-// QCOMPARE(res.isValid(), true);
-// QCOMPARE(res.toString().startsWith("item"), true);
-//
-//}
+void TestCacheProxy::testCP_Filter()
+{
+ cp = new HgCacheProxyModel();
+ cph = new CacheProxyHelper(cp);
+ dph = new DataProviderHelper(200);
+ cp->setDataProvider(dph, 50, 20);
+
+ QModelIndex idx = cp->index(1, 0);
+ QVariant res = cp->data(idx, Qt::DisplayRole);
+ QCOMPARE(res.isValid(), true);
+ QCOMPARE(res.toString().startsWith("item"), true);
+
+ QRegExp regexp = QRegExp("ITEM*", Qt::CaseSensitive, QRegExp::Wildcard);
+
+ cp->setFilterRegExp(regexp);
+ QVERIFY(cp->filterRegExp() == regexp);
+ cp->setFilterCaseSensitivity(Qt::CaseSensitive);
+ QCOMPARE(cp->filterCaseSensitivity(), Qt::CaseSensitive);
+
+ idx = cp->index(1, 0);
+ res = cp->data(idx, Qt::DisplayRole);
+ QCOMPARE(res.isValid(), true);
+ QCOMPARE(res.toString().startsWith("item"), false);
+
+ cp->setFilterKeyColumn(1);
+ QCOMPARE(cp->filterKeyColumn (), 1);
+ cp->setFilterKeyColumn(0);
+
+ cp->setFilterRole(Qt::UserRole+1);
+ QCOMPARE(cp->filterRole(), Qt::UserRole+1);
+ cp->setFilterRole(Qt::DisplayRole);
+
+ regexp = QRegExp("ITEM*", Qt::CaseInsensitive, QRegExp::Wildcard);
+ cp->setFilterRegExp(regexp);
+ QVERIFY(cp->filterRegExp() == regexp);
+ cp->setFilterCaseSensitivity(Qt::CaseInsensitive);
+ QCOMPARE(cp->filterCaseSensitivity(), Qt::CaseInsensitive);
+
+ idx = cp->index(1, 0);
+ res = cp->data(idx, Qt::DisplayRole);
+ QCOMPARE(res.isValid(), true);
+ QCOMPARE(res.toString().startsWith("item"), true);
+
+}
#ifdef _CACHEPROXYDATAMODEL_UNITTEST_LOG_TO_C
@@ -1085,8 +1090,8 @@
{
QApplication app(argc, argv);
TestCacheProxy tc;
- int c = 3;
- char* v[] = {argv[0], "-o", "c:/test.txt"};
+ int c = 5;
+ char* v[] = {argv[0], "-o", "c:/test.txt", "-maxwarnings", "0"};
return QTest::qExec(&tc, c, v);
}
#else
--- a/hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.h Mon May 03 13:32:54 2010 +0300
+++ b/hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.h Fri May 14 16:57:01 2010 +0300
@@ -13,7 +13,7 @@
*
* Description:
*
-* Version : %version: 3 %
+* Version : %version: 5 %
*/
#ifndef TestCacheProxy_H
#define TestCacheProxy_H
@@ -62,7 +62,7 @@
void testCP_ResizeCache();
void testCP_Data();
void testCP_Sort();
-// void testCP_Filter();
+ void testCP_Filter();
private:
BMHelper* bmh;
--- a/hgcacheproxymodel/tsrc/unit/unittest_hgcacheproxymodel.pro Mon May 03 13:32:54 2010 +0300
+++ b/hgcacheproxymodel/tsrc/unit/unittest_hgcacheproxymodel.pro Fri May 14 16:57:01 2010 +0300
@@ -32,15 +32,13 @@
bmhelper.cpp \
../../src/hgbuffermanager.cpp \
dataproviderhelper.cpp \
- cacheproxyhelper.cpp \
-# simpledataprovider.cpp\
+ cacheproxyhelper.cpp
HEADERS += test_hgcacheproxydatamodel.h \
bmhelper.h \
../../inc/hgbuffermanager.h \
dataproviderhelper.h \
- cacheproxyhelper.h \
-# simpledataprovider.h\
+ cacheproxyhelper.h
CONFIG += qtestlib console
--- a/hgwidgets_plat/ganeswidgets_api/inc/hgmediawall.h Mon May 03 13:32:54 2010 +0300
+++ b/hgwidgets_plat/ganeswidgets_api/inc/hgmediawall.h Fri May 14 16:57:01 2010 +0300
@@ -58,7 +58,11 @@
void enableReflections(bool enabled);
bool reflectionsEnabled() const;
-
+
+signals:
+
+ void animationAboutToEnd(const QModelIndex& targetIndex);
+
protected:
HgMediawall(HgMediawallPrivate &dd, QGraphicsItem *parent);
--- a/hgwidgets_plat/hgcacheproxymodel_api/inc/hgcacheproxymodel.h Mon May 03 13:32:54 2010 +0300
+++ b/hgwidgets_plat/hgcacheproxymodel_api/inc/hgcacheproxymodel.h Fri May 14 16:57:01 2010 +0300
@@ -13,7 +13,7 @@
*
* Description:
*
-* Version : %version: 2 %
+* Version : %version: 5 %
*/
#ifndef HGCACHEPROXYMODEL_H_
@@ -47,69 +47,69 @@
virtual void request(int start, int end, HgRequestOrder order = HgRequestOrderAscending) = 0;
};
-class HgCacheProxyModel : public QAbstractItemModel, public HgBufferManagerObserver, public HgDataProviderModelObserver
+class CACHEPROXYMODEL_EXPORT HgCacheProxyModel : public QAbstractItemModel, public HgBufferManagerObserver, public HgDataProviderModelObserver
{
Q_OBJECT
public:
- CACHEPROXYMODEL_EXPORT HgCacheProxyModel(QObject *parent = 0);
- CACHEPROXYMODEL_EXPORT ~HgCacheProxyModel();
+ HgCacheProxyModel(QObject *parent = 0);
+ ~HgCacheProxyModel();
- CACHEPROXYMODEL_EXPORT void setDataProvider(HgDataProviderModel *dataProvider, int cacheSize = KDefaultCacheSize, int cacheTreshold = KDefaultCacheTreshold);
- CACHEPROXYMODEL_EXPORT HgDataProviderModel* DataProvider();
- CACHEPROXYMODEL_EXPORT void resizeCache(int newSize, int newTreshold);
+ void setDataProvider(HgDataProviderModel *dataProvider, int cacheSize = KDefaultCacheSize, int cacheTreshold = KDefaultCacheTreshold);
+ HgDataProviderModel* DataProvider();
+ void resizeCache(int newSize, int newTreshold);
//from QAbstractItemModel
- CACHEPROXYMODEL_EXPORT virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- CACHEPROXYMODEL_EXPORT virtual QModelIndex parent(const QModelIndex &child) const;
- CACHEPROXYMODEL_EXPORT virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- CACHEPROXYMODEL_EXPORT virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
- CACHEPROXYMODEL_EXPORT virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
- CACHEPROXYMODEL_EXPORT virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- CACHEPROXYMODEL_EXPORT virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
- CACHEPROXYMODEL_EXPORT virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- CACHEPROXYMODEL_EXPORT virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole);
- CACHEPROXYMODEL_EXPORT virtual QMap<int, QVariant> itemData(const QModelIndex &index) const;
- CACHEPROXYMODEL_EXPORT virtual bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles);
- CACHEPROXYMODEL_EXPORT virtual QStringList mimeTypes() const;
- CACHEPROXYMODEL_EXPORT virtual QMimeData *mimeData(const QModelIndexList &indexes) const;
- CACHEPROXYMODEL_EXPORT virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
- CACHEPROXYMODEL_EXPORT virtual Qt::DropActions supportedDropActions() const;
- CACHEPROXYMODEL_EXPORT virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
- CACHEPROXYMODEL_EXPORT virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex());
- CACHEPROXYMODEL_EXPORT virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
- CACHEPROXYMODEL_EXPORT virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex());
- CACHEPROXYMODEL_EXPORT virtual void fetchMore(const QModelIndex &parent);
- CACHEPROXYMODEL_EXPORT virtual bool canFetchMore(const QModelIndex &parent) const;
- CACHEPROXYMODEL_EXPORT virtual Qt::ItemFlags flags(const QModelIndex &index) const;
- CACHEPROXYMODEL_EXPORT virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
- CACHEPROXYMODEL_EXPORT virtual QModelIndex buddy(const QModelIndex &index) const;
- CACHEPROXYMODEL_EXPORT virtual QModelIndexList match(const QModelIndex &start, int role,
+ virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ virtual QModelIndex parent(const QModelIndex &child) const;
+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
+ virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
+ virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole);
+ virtual QMap<int, QVariant> itemData(const QModelIndex &index) const;
+ virtual bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles);
+ virtual QStringList mimeTypes() const;
+ virtual QMimeData *mimeData(const QModelIndexList &indexes) const;
+ virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
+ virtual Qt::DropActions supportedDropActions() const;
+ virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
+ virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex());
+ virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
+ virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex());
+ virtual void fetchMore(const QModelIndex &parent);
+ virtual bool canFetchMore(const QModelIndex &parent) const;
+ virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+ virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
+ virtual QModelIndex buddy(const QModelIndex &index) const;
+ virtual QModelIndexList match(const QModelIndex &start, int role,
const QVariant &value, int hits = 1,
Qt::MatchFlags flags =
Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const;
- CACHEPROXYMODEL_EXPORT virtual QSize span(const QModelIndex &index) const;
+ virtual QSize span(const QModelIndex &index) const;
// for sorting
- CACHEPROXYMODEL_EXPORT Qt::CaseSensitivity sortCaseSensitivity() const;
- CACHEPROXYMODEL_EXPORT void setSortCaseSensitivity(Qt::CaseSensitivity cs);
- CACHEPROXYMODEL_EXPORT bool isSortLocaleAware() const;
- CACHEPROXYMODEL_EXPORT void setSortLocaleAware(bool on);
- CACHEPROXYMODEL_EXPORT int sortColumn() const;
- CACHEPROXYMODEL_EXPORT Qt::SortOrder sortOrder() const;
- CACHEPROXYMODEL_EXPORT bool dynamicSortFilter() const;
- CACHEPROXYMODEL_EXPORT void setDynamicSortFilter(bool enable);
- CACHEPROXYMODEL_EXPORT int sortRole() const;
- CACHEPROXYMODEL_EXPORT void setSortRole(int role);
+ Qt::CaseSensitivity sortCaseSensitivity() const;
+ void setSortCaseSensitivity(Qt::CaseSensitivity cs);
+ bool isSortLocaleAware() const;
+ void setSortLocaleAware(bool on);
+ int sortColumn() const;
+ Qt::SortOrder sortOrder() const;
+ bool dynamicSortFilter() const;
+ void setDynamicSortFilter(bool enable);
+ int sortRole() const;
+ void setSortRole(int role);
//for filtering
-// CACHEPROXYMODEL_EXPORT QRegExp filterRegExp() const;
-// CACHEPROXYMODEL_EXPORT void setFilterRegExp(const QRegExp ®Exp);
-// CACHEPROXYMODEL_EXPORT int filterKeyColumn() const;
-// CACHEPROXYMODEL_EXPORT void setFilterKeyColumn(int column);
-// CACHEPROXYMODEL_EXPORT Qt::CaseSensitivity filterCaseSensitivity() const;
-// CACHEPROXYMODEL_EXPORT void setFilterCaseSensitivity(Qt::CaseSensitivity cs);
-// CACHEPROXYMODEL_EXPORT int filterRole() const;
-// CACHEPROXYMODEL_EXPORT void setFilterRole(int role);
+ QRegExp filterRegExp() const;
+ void setFilterRegExp(const QRegExp ®Exp);
+ int filterKeyColumn() const;
+ void setFilterKeyColumn(int column);
+ Qt::CaseSensitivity filterCaseSensitivity() const;
+ void setFilterCaseSensitivity(Qt::CaseSensitivity cs);
+ int filterRole() const;
+ void setFilterRole(int role);
public slots:
virtual bool submit();
@@ -117,8 +117,8 @@
public:
//from HgBufferManagerObserver
- CACHEPROXYMODEL_EXPORT virtual void release(int start, int end);
- CACHEPROXYMODEL_EXPORT virtual void request(int start, int end, HgRequestOrder order = HgRequestOrderAscending);
+ virtual void release(int start, int end);
+ virtual void request(int start, int end, HgRequestOrder order = HgRequestOrderAscending);
private:
int count()const;
@@ -126,32 +126,41 @@
QModelIndex mapToSource(int row, int col) const;
int mapToDataProviderIndex(int myIndex) const;
int mapFromDataProviderIndex(int myIndex) const;
- void cleanupForBMResetIfNeeded();
- void resetBMIfNeeded();
+ void cleanupForBMReset();
+ void resetBM();
void releaseAll();
void setBufferPosition(int pos) const;
private slots:
- void sourceReset();
- void sourceAboutToBeReset();
- void sourceRowsInserted(const QModelIndex &source_parent, int start, int end);
- void sourceRowsRemoved(const QModelIndex &source_parent, int start, int end);
- void dataUpdated(QModelIndex from, QModelIndex to);
+ void sourceColumnsAboutToBeInserted( const QModelIndex & parent, int start, int end);
+ void sourceColumnsAboutToBeMoved( const QModelIndex & sourceParent, int sourceStart, int sourceEnd, const QModelIndex & destinationParent, int destinationColumn );
+ void sourceColumnsAboutToBeRemoved( const QModelIndex & parent, int start, int end);
+ void sourceColumnsInserted( const QModelIndex & parent, int start, int end );
+ void sourceColumnsMoved( const QModelIndex & sourceParent, int sourceStart, int sourceEnd, const QModelIndex & destinationParent, int destinationColumn );
+ void sourceColumnsRemoved( const QModelIndex & parent, int start, int end );
+ void sourceDataChanged( const QModelIndex & topLeft, const QModelIndex & bottomRight );
+ void sourceHeaderDataChanged( Qt::Orientation orientation, int first, int last );
+ void sourceLayoutAboutToBeChanged();
+ void sourceLayoutChanged();
+ void sourceModelAboutToBeReset();
+ void sourceModelReset();
+ void sourceRowsAboutToBeInserted( const QModelIndex & parent, int start, int end );
+ void sourceRowsAboutToBeMoved( const QModelIndex & sourceParent, int sourceStart, int sourceEnd, const QModelIndex & destinationParent, int destinationRow );
+ void sourceRowsAboutToBeRemoved( const QModelIndex & parent, int start, int end );
+ void sourceRowsInserted( const QModelIndex & parent, int start, int end );
+ void sourceRowsMoved( const QModelIndex & sourceParent, int sourceStart, int sourceEnd, const QModelIndex & destinationParent, int destinationRow );
+ void sourceRowsRemoved( const QModelIndex & parent, int start, int end );
//from HgDataProviderModelObserver
public:
- CACHEPROXYMODEL_EXPORT virtual void dataUpdated(int from, int to);
+ virtual void dataUpdated(int from, int to);
private:
HgBufferManager* mBufferManager;
QSortFilterProxyModel* mSortFilterProxyModel;
HgDataProviderModel* mDataProviderModel;
- mutable bool mResetNeeded;
mutable bool mSupressBM;
mutable int mCurrentPos;
- bool mSortParameterChanged;
- bool mFilterParameterChanged;
-
};
#endif // HGCACHEPROXYMODEL_H_
--- a/hgwidgets_plat/hgcacheproxymodel_api/inc/hgdataprovidermodel.h Mon May 03 13:32:54 2010 +0300
+++ b/hgwidgets_plat/hgcacheproxymodel_api/inc/hgdataprovidermodel.h Fri May 14 16:57:01 2010 +0300
@@ -13,7 +13,7 @@
*
* Description:
*
-* Version : %version: 3 %
+* Version : %version: 5 %
*/
#ifndef HGDATAPROVIDERMODEL_H_
#define HGDATAPROVIDERMODEL_H_
@@ -119,13 +119,13 @@
QList< QPixmap* > mFreePixmaps;
QMap< int, QPixmap* > mUsedPixmaps;
int mUnallocatedPixmaps;
- QMutex mQPixmapsLock;
+// QMutex mQPixmapsLock;
HgDataProviderModelObserver *mObserver;
};
inline bool HgDataProviderModel::isIndexValid(int idx) const
{
- return ((0 <= idx) &&
+ return ((idx >= 0) &&
(idx < mCache->size()) &&
(mCache->at(idx)));
}