# HG changeset patch # User hgs # Date 1277373569 -10800 # Node ID 1cdcc61142d2858fd4609ec6f63384ba9592a894 # Parent 4fa04caf0f435953926126f5f3a077413df5c309 201025 diff -r 4fa04caf0f43 -r 1cdcc61142d2 bwins/hgcacheproxymodelu.def --- a/bwins/hgcacheproxymodelu.def Fri Jun 11 14:43:11 2010 +0300 +++ b/bwins/hgcacheproxymodelu.def Thu Jun 24 12:59:29 2010 +0300 @@ -11,126 +11,129 @@ ??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 > *, 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 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, bool) - ?resizeCache@HgCacheProxyModel@@QAEXHH@Z @ 43 NONAME ; void HgCacheProxyModel::resizeCache(int, int) - ?doInsertItem@HgDataProviderModel@@AAEXHPAV?$QList@U?$QPair@VQVariant@@H@@@@_N@Z @ 44 NONAME ; void HgDataProviderModel::doInsertItem(int, class QList > *, bool) - ?mapToDataProviderIndex@HgCacheProxyModel@@ABEHH@Z @ 45 NONAME ; int HgCacheProxyModel::mapToDataProviderIndex(int) const - ?qt_metacast@HgCacheProxyModel@@UAEPAXPBD@Z @ 46 NONAME ; void * HgCacheProxyModel::qt_metacast(char const *) - ?request@HgCacheProxyModel@@UAEXHHW4HgRequestOrder@HgBufferManagerObserver@@@Z @ 47 NONAME ; void HgCacheProxyModel::request(int, int, enum HgBufferManagerObserver::HgRequestOrder) - ?mimeTypes@HgCacheProxyModel@@UBE?AVQStringList@@XZ @ 48 NONAME ; class QStringList HgCacheProxyModel::mimeTypes(void) const - ?sortCaseSensitivity@HgCacheProxyModel@@QBE?AW4CaseSensitivity@Qt@@XZ @ 49 NONAME ; enum Qt::CaseSensitivity HgCacheProxyModel::sortCaseSensitivity(void) const - ?setItemData@HgCacheProxyModel@@UAE_NABVQModelIndex@@ABV?$QMap@HVQVariant@@@@@Z @ 50 NONAME ; bool HgCacheProxyModel::setItemData(class QModelIndex const &, class QMap const &) - ?staticMetaObject@HgCacheProxyModel@@2UQMetaObject@@B @ 51 NONAME ; struct QMetaObject const HgCacheProxyModel::staticMetaObject - ?rowCount@HgCacheProxyModel@@UBEHABVQModelIndex@@@Z @ 52 NONAME ; int HgCacheProxyModel::rowCount(class QModelIndex const &) const - ??_EHgDataProviderModel@@UAE@I@Z @ 53 NONAME ; HgDataProviderModel::~HgDataProviderModel(unsigned int) - ?newItem@HgDataProviderModel@@IAEXPAV?$QList@U?$QPair@VQVariant@@H@@@@_N@Z @ 54 NONAME ; void HgDataProviderModel::newItem(class QList > *, bool) - ?setHeaderData@HgCacheProxyModel@@UAE_NHW4Orientation@Qt@@ABVQVariant@@H@Z @ 55 NONAME ; bool HgCacheProxyModel::setHeaderData(int, enum Qt::Orientation, class QVariant const &, int) - ?releaseAll@HgCacheProxyModel@@AAEXXZ @ 56 NONAME ; void HgCacheProxyModel::releaseAll(void) - ?setSortRole@HgCacheProxyModel@@QAEXH@Z @ 57 NONAME ; void HgCacheProxyModel::setSortRole(int) - ?trUtf8@HgDataProviderModel@@SA?AVQString@@PBD0@Z @ 58 NONAME ; class QString HgDataProviderModel::trUtf8(char const *, char const *) - ?flags@HgCacheProxyModel@@UBE?AV?$QFlags@W4ItemFlag@Qt@@@@ABVQModelIndex@@@Z @ 59 NONAME ; class QFlags HgCacheProxyModel::flags(class QModelIndex const &) const - ?DataProvider@HgCacheProxyModel@@QAEPAVHgDataProviderModel@@XZ @ 60 NONAME ; class HgDataProviderModel * HgCacheProxyModel::DataProvider(void) - ?insertItem@HgDataProviderModel@@IAEXHU?$QPair@VQVariant@@H@@_N@Z @ 61 NONAME ; void HgDataProviderModel::insertItem(int, struct QPair, bool) - ?sourceColumnsAboutToBeInserted@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 62 NONAME ; void HgCacheProxyModel::sourceColumnsAboutToBeInserted(class QModelIndex const &, int, int) - ?data@HgCacheProxyModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 63 NONAME ; class QVariant HgCacheProxyModel::data(class QModelIndex const &, int) const - ?createIcon@HgDataProviderModel@@IAE?AVQVariant@@HVQPixmap@@@Z @ 64 NONAME ; class QVariant HgDataProviderModel::createIcon(int, class QPixmap) - ?parent@HgCacheProxyModel@@UBE?AVQModelIndex@@ABV2@@Z @ 65 NONAME ; class QModelIndex HgCacheProxyModel::parent(class QModelIndex const &) const - ?parent@HgDataProviderModel@@UBE?AVQModelIndex@@ABV2@@Z @ 66 NONAME ; class QModelIndex HgDataProviderModel::parent(class QModelIndex const &) const - ?setDataProvider@HgCacheProxyModel@@QAEXPAVHgDataProviderModel@@HH@Z @ 67 NONAME ; void HgCacheProxyModel::setDataProvider(class HgDataProviderModel *, int, int) - ?release@HgDataProviderModel@@QAEXV?$QList@H@@_N@Z @ 68 NONAME ; void HgDataProviderModel::release(class QList, bool) - ?qt_metacast@HgDataProviderModel@@UAEPAXPBD@Z @ 69 NONAME ; void * HgDataProviderModel::qt_metacast(char const *) - ?mapToSource@HgCacheProxyModel@@ABE?AVQModelIndex@@ABV2@@Z @ 70 NONAME ; class QModelIndex HgCacheProxyModel::mapToSource(class QModelIndex const &) const - ?sourceDataChanged@HgCacheProxyModel@@AAEXABVQModelIndex@@0@Z @ 71 NONAME ; void HgCacheProxyModel::sourceDataChanged(class QModelIndex const &, class QModelIndex const &) - ?sourceRowsAboutToBeRemoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 72 NONAME ; void HgCacheProxyModel::sourceRowsAboutToBeRemoved(class QModelIndex const &, int, int) - ?columnCount@HgCacheProxyModel@@UBEHABVQModelIndex@@@Z @ 73 NONAME ; int HgCacheProxyModel::columnCount(class QModelIndex const &) const - ?mapToSource@HgCacheProxyModel@@ABE?AVQModelIndex@@HH@Z @ 74 NONAME ; class QModelIndex HgCacheProxyModel::mapToSource(int, int) const - ?tr@HgDataProviderModel@@SA?AVQString@@PBD0@Z @ 75 NONAME ; class QString HgDataProviderModel::tr(char const *, char const *) - ?sourceRowsRemoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 76 NONAME ; void HgCacheProxyModel::sourceRowsRemoved(class QModelIndex const &, int, int) - ?sourceHeaderDataChanged@HgCacheProxyModel@@AAEXW4Orientation@Qt@@HH@Z @ 77 NONAME ; void HgCacheProxyModel::sourceHeaderDataChanged(enum Qt::Orientation, int, int) - ??1HgCacheProxyModel@@UAE@XZ @ 78 NONAME ; HgCacheProxyModel::~HgCacheProxyModel(void) - ?registerObserver@HgDataProviderModel@@QAEXPAVHgDataProviderModelObserver@@@Z @ 79 NONAME ; void HgDataProviderModel::registerObserver(class HgDataProviderModelObserver *) - ?sourceRowsAboutToBeMoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH0H@Z @ 80 NONAME ; void HgCacheProxyModel::sourceRowsAboutToBeMoved(class QModelIndex const &, int, int, class QModelIndex const &, int) - ??0HgCacheProxyModel@@QAE@PAVQObject@@@Z @ 81 NONAME ; HgCacheProxyModel::HgCacheProxyModel(class QObject *) - ?supportedDropActions@HgCacheProxyModel@@UBE?AV?$QFlags@W4DropAction@Qt@@@@XZ @ 82 NONAME ; class QFlags HgCacheProxyModel::supportedDropActions(void) const - ?updateIcon@HgDataProviderModel@@IAE_NHVQVariant@@_N@Z @ 83 NONAME ; bool HgDataProviderModel::updateIcon(int, class QVariant, bool) - ?index@HgDataProviderModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 84 NONAME ; class QModelIndex HgDataProviderModel::index(int, int, class QModelIndex const &) const - ?sort@HgCacheProxyModel@@UAEXHW4SortOrder@Qt@@@Z @ 85 NONAME ; void HgCacheProxyModel::sort(int, enum Qt::SortOrder) - ?releasePixmap@HgDataProviderModel@@IAEXH@Z @ 86 NONAME ; void HgDataProviderModel::releasePixmap(int) - ?sourceRowsMoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH0H@Z @ 87 NONAME ; void HgCacheProxyModel::sourceRowsMoved(class QModelIndex const &, int, int, class QModelIndex const &, int) - ?removeColumns@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 88 NONAME ; bool HgCacheProxyModel::removeColumns(int, int, class QModelIndex const &) - ?insertRows@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 89 NONAME ; bool HgCacheProxyModel::insertRows(int, int, class QModelIndex const &) - ?tr@HgCacheProxyModel@@SA?AVQString@@PBD0H@Z @ 90 NONAME ; class QString HgCacheProxyModel::tr(char const *, char const *, int) - ?insertItem@HgDataProviderModel@@IAEXHPAV?$QList@U?$QPair@VQVariant@@H@@@@_N@Z @ 91 NONAME ; void HgDataProviderModel::insertItem(int, class QList > *, bool) - ?revert@HgCacheProxyModel@@UAEXXZ @ 92 NONAME ; void HgCacheProxyModel::revert(void) - ?dynamicSortFilter@HgCacheProxyModel@@QBE_NXZ @ 93 NONAME ; bool HgCacheProxyModel::dynamicSortFilter(void) const - ?data@HgDataProviderModel@@IBE?AVQVariant@@HH@Z @ 94 NONAME ; class QVariant HgDataProviderModel::data(int, int) const - ?rowCount@HgDataProviderModel@@UBEHABVQModelIndex@@@Z @ 95 NONAME ; int HgDataProviderModel::rowCount(class QModelIndex const &) const - ?setFilterCaseSensitivity@HgCacheProxyModel@@QAEXW4CaseSensitivity@Qt@@@Z @ 96 NONAME ; void HgCacheProxyModel::setFilterCaseSensitivity(enum Qt::CaseSensitivity) - ?count@HgCacheProxyModel@@ABEHXZ @ 97 NONAME ; int HgCacheProxyModel::count(void) const - ?sortOrder@HgCacheProxyModel@@QBE?AW4SortOrder@Qt@@XZ @ 98 NONAME ; enum Qt::SortOrder HgCacheProxyModel::sortOrder(void) const - ?removeRows@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 99 NONAME ; bool HgCacheProxyModel::removeRows(int, int, class QModelIndex const &) - ?getStaticMetaObject@HgDataProviderModel@@SAABUQMetaObject@@XZ @ 100 NONAME ; struct QMetaObject const & HgDataProviderModel::getStaticMetaObject(void) - ?setBufferPosition@HgCacheProxyModel@@ABEXH@Z @ 101 NONAME ; void HgCacheProxyModel::setBufferPosition(int) const - ?dataUpdated@HgCacheProxyModel@@UAEXHH@Z @ 102 NONAME ; void HgCacheProxyModel::dataUpdated(int, int) - ?sourceRowsAboutToBeInserted@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 103 NONAME ; void HgCacheProxyModel::sourceRowsAboutToBeInserted(class QModelIndex const &, int, int) - ?fetchMore@HgCacheProxyModel@@UAEXABVQModelIndex@@@Z @ 104 NONAME ; void HgCacheProxyModel::fetchMore(class QModelIndex const &) - ?filterCaseSensitivity@HgCacheProxyModel@@QBE?AW4CaseSensitivity@Qt@@XZ @ 105 NONAME ; enum Qt::CaseSensitivity HgCacheProxyModel::filterCaseSensitivity(void) const - ?newItem@HgDataProviderModel@@IAEXU?$QPair@VQVariant@@H@@_N@Z @ 106 NONAME ; void HgDataProviderModel::newItem(struct QPair, bool) - ?setDynamicSortFilter@HgCacheProxyModel@@QAEX_N@Z @ 107 NONAME ; void HgCacheProxyModel::setDynamicSortFilter(bool) - ?sourceModelReset@HgCacheProxyModel@@AAEXXZ @ 108 NONAME ; void HgCacheProxyModel::sourceModelReset(void) - ?index@HgCacheProxyModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 109 NONAME ; class QModelIndex HgCacheProxyModel::index(int, int, class QModelIndex const &) const - ?removeItems@HgDataProviderModel@@IAEXHH@Z @ 110 NONAME ; void HgDataProviderModel::removeItems(int, int) - ?count@HgDataProviderModel@@IBEHXZ @ 111 NONAME ; int HgDataProviderModel::count(void) const - ?sourceColumnsInserted@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 112 NONAME ; void HgCacheProxyModel::sourceColumnsInserted(class QModelIndex const &, int, int) - ?tr@HgCacheProxyModel@@SA?AVQString@@PBD0@Z @ 113 NONAME ; class QString HgCacheProxyModel::tr(char const *, char const *) - ?qt_metacall@HgCacheProxyModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 114 NONAME ; int HgCacheProxyModel::qt_metacall(enum QMetaObject::Call, int, void * *) - ?setData@HgCacheProxyModel@@UAE_NABVQModelIndex@@ABVQVariant@@H@Z @ 115 NONAME ; bool HgCacheProxyModel::setData(class QModelIndex const &, class QVariant const &, int) - ?mimeData@HgCacheProxyModel@@UBEPAVQMimeData@@ABV?$QList@VQModelIndex@@@@@Z @ 116 NONAME ; class QMimeData * HgCacheProxyModel::mimeData(class QList const &) const - ?match@HgCacheProxyModel@@UBE?AV?$QList@VQModelIndex@@@@ABVQModelIndex@@HABVQVariant@@HV?$QFlags@W4MatchFlag@Qt@@@@@Z @ 117 NONAME ; class QList HgCacheProxyModel::match(class QModelIndex const &, int, class QVariant const &, int, class QFlags) const - ?update@HgDataProviderModel@@IAE_NHVQVariant@@H_N@Z @ 118 NONAME ; bool HgDataProviderModel::update(int, class QVariant, int, bool) - ?sourceRowsInserted@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 119 NONAME ; void HgCacheProxyModel::sourceRowsInserted(class QModelIndex const &, int, int) - ?release@HgCacheProxyModel@@UAEXHH@Z @ 120 NONAME ; void HgCacheProxyModel::release(int, int) - ?resetModel@HgDataProviderModel@@QAEXXZ @ 121 NONAME ; void HgDataProviderModel::resetModel(void) - ?span@HgCacheProxyModel@@UBE?AVQSize@@ABVQModelIndex@@@Z @ 122 NONAME ; class QSize HgCacheProxyModel::span(class QModelIndex const &) const - ?insertColumns@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 123 NONAME ; bool HgCacheProxyModel::insertColumns(int, int, class QModelIndex const &) - ??_EHgCacheProxyModel@@UAE@I@Z @ 124 NONAME ; HgCacheProxyModel::~HgCacheProxyModel(unsigned int) - ?filterRole@HgCacheProxyModel@@QBEHXZ @ 125 NONAME ; int HgCacheProxyModel::filterRole(void) const - ?metaObject@HgDataProviderModel@@UBEPBUQMetaObject@@XZ @ 126 NONAME ; struct QMetaObject const * HgDataProviderModel::metaObject(void) const - ?resetIcon@HgDataProviderModel@@IAEXH@Z @ 127 NONAME ; void HgDataProviderModel::resetIcon(int) - ?sourceLayoutAboutToBeChanged@HgCacheProxyModel@@AAEXXZ @ 128 NONAME ; void HgCacheProxyModel::sourceLayoutAboutToBeChanged(void) - ?metaObject@HgCacheProxyModel@@UBEPBUQMetaObject@@XZ @ 129 NONAME ; struct QMetaObject const * HgCacheProxyModel::metaObject(void) const - ?getPixmap@HgDataProviderModel@@AAEPAVQPixmap@@H@Z @ 130 NONAME ; class QPixmap * HgDataProviderModel::getPixmap(int) - ?sourceModelAboutToBeReset@HgCacheProxyModel@@AAEXXZ @ 131 NONAME ; void HgCacheProxyModel::sourceModelAboutToBeReset(void) - ?qt_metacall@HgDataProviderModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 132 NONAME ; int HgDataProviderModel::qt_metacall(enum QMetaObject::Call, int, void * *) - ?filterKeyColumn@HgCacheProxyModel@@QBEHXZ @ 133 NONAME ; int HgCacheProxyModel::filterKeyColumn(void) const - ?getData@HgDataProviderModel@@MBE?AVQVariant@@HH@Z @ 134 NONAME ; class QVariant HgDataProviderModel::getData(int, int) const + ?clearItem@HgDataProviderModel@@IAEXH_N@Z @ 13 NONAME ; void HgDataProviderModel::clearItem(int, bool) + ?columnCount@HgDataProviderModel@@UBEHABVQModelIndex@@@Z @ 14 NONAME ; int HgDataProviderModel::columnCount(class QModelIndex const &) const + ?update@HgDataProviderModel@@IAE_NHPAV?$QList@U?$QPair@VQVariant@@H@@@@_N@Z @ 15 NONAME ; bool HgDataProviderModel::update(int, class QList > *, bool) + ?doResetModel@HgDataProviderModel@@MAEXXZ @ 16 NONAME ; void HgDataProviderModel::doResetModel(void) + ?canFetchMore@HgCacheProxyModel@@UBE_NABVQModelIndex@@@Z @ 17 NONAME ; bool HgCacheProxyModel::canFetchMore(class QModelIndex const &) const + ?emitDataChanged@HgDataProviderModel@@IAEXHH_N@Z @ 18 NONAME ; void HgDataProviderModel::emitDataChanged(int, int, bool) + ?staticMetaObject@HgDataProviderModel@@2UQMetaObject@@B @ 19 NONAME ; struct QMetaObject const HgDataProviderModel::staticMetaObject + ?mapFromDataProviderIndex@HgCacheProxyModel@@ABEHH@Z @ 20 NONAME ; int HgCacheProxyModel::mapFromDataProviderIndex(int) const + ?sourceLayoutChanged@HgCacheProxyModel@@AAEXXZ @ 21 NONAME ; void HgCacheProxyModel::sourceLayoutChanged(void) + ?data@HgDataProviderModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 22 NONAME ; class QVariant HgDataProviderModel::data(class QModelIndex const &, int) const + ?setSortCaseSensitivity@HgCacheProxyModel@@QAEXW4CaseSensitivity@Qt@@@Z @ 23 NONAME ; void HgCacheProxyModel::setSortCaseSensitivity(enum Qt::CaseSensitivity) + ?itemData@HgCacheProxyModel@@UBE?AV?$QMap@HVQVariant@@@@ABVQModelIndex@@@Z @ 24 NONAME ; class QMap HgCacheProxyModel::itemData(class QModelIndex const &) const + ?removeItems@HgDataProviderModel@@IAEXHH_N@Z @ 25 NONAME ; void HgDataProviderModel::removeItems(int, int, bool) + ?submit@HgCacheProxyModel@@UAE_NXZ @ 26 NONAME ; bool HgCacheProxyModel::submit(void) + ?sourceColumnsAboutToBeRemoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 27 NONAME ; void HgCacheProxyModel::sourceColumnsAboutToBeRemoved(class QModelIndex const &, int, int) + ?hasChildren@HgCacheProxyModel@@UBE_NABVQModelIndex@@@Z @ 28 NONAME ; bool HgCacheProxyModel::hasChildren(class QModelIndex const &) const + ?sourceColumnsRemoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 29 NONAME ; void HgCacheProxyModel::sourceColumnsRemoved(class QModelIndex const &, int, int) + ?trUtf8@HgDataProviderModel@@SA?AVQString@@PBD0H@Z @ 30 NONAME ; class QString HgDataProviderModel::trUtf8(char const *, char const *, int) + ?tr@HgDataProviderModel@@SA?AVQString@@PBD0H@Z @ 31 NONAME ; class QString HgDataProviderModel::tr(char const *, char const *, int) + ?setFilterRole@HgCacheProxyModel@@QAEXH@Z @ 32 NONAME ; void HgCacheProxyModel::setFilterRole(int) + ?setSortLocaleAware@HgCacheProxyModel@@QAEX_N@Z @ 33 NONAME ; void HgCacheProxyModel::setSortLocaleAware(bool) + ?trUtf8@HgCacheProxyModel@@SA?AVQString@@PBD0H@Z @ 34 NONAME ; class QString HgCacheProxyModel::trUtf8(char const *, char const *, int) + ?getStaticMetaObject@HgCacheProxyModel@@SAABUQMetaObject@@XZ @ 35 NONAME ; struct QMetaObject const & HgCacheProxyModel::getStaticMetaObject(void) + ?sourceColumnsAboutToBeMoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH0H@Z @ 36 NONAME ; void HgCacheProxyModel::sourceColumnsAboutToBeMoved(class QModelIndex const &, int, int, class QModelIndex const &, int) + ?clearCache@HgDataProviderModel@@IAEXXZ @ 37 NONAME ; void HgDataProviderModel::clearCache(void) + ??1HgDataProviderModel@@UAE@XZ @ 38 NONAME ; HgDataProviderModel::~HgDataProviderModel(void) + ?sourceColumnsMoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH0H@Z @ 39 NONAME ; void HgCacheProxyModel::sourceColumnsMoved(class QModelIndex const &, int, int, class QModelIndex const &, int) + ?isSortLocaleAware@HgCacheProxyModel@@QBE_NXZ @ 40 NONAME ; bool HgCacheProxyModel::isSortLocaleAware(void) const + ?isIndexValid@HgDataProviderModel@@IBE_NH@Z @ 41 NONAME ; bool HgDataProviderModel::isIndexValid(int) const + ?sortColumn@HgCacheProxyModel@@QBEHXZ @ 42 NONAME ; int HgCacheProxyModel::sortColumn(void) const + ?request@HgDataProviderModel@@QAEXV?$QList@H@@_N@Z @ 43 NONAME ; void HgDataProviderModel::request(class QList, bool) + ?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 > *, 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 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 > *, bool) + ?setHeaderData@HgCacheProxyModel@@UAE_NHW4Orientation@Qt@@ABVQVariant@@H@Z @ 56 NONAME ; bool HgCacheProxyModel::setHeaderData(int, enum Qt::Orientation, class QVariant const &, int) + ?releaseAll@HgCacheProxyModel@@AAEXXZ @ 57 NONAME ; void HgCacheProxyModel::releaseAll(void) + ?setSortRole@HgCacheProxyModel@@QAEXH@Z @ 58 NONAME ; void HgCacheProxyModel::setSortRole(int) + ?trUtf8@HgDataProviderModel@@SA?AVQString@@PBD0@Z @ 59 NONAME ; class QString HgDataProviderModel::trUtf8(char const *, char const *) + ?flags@HgCacheProxyModel@@UBE?AV?$QFlags@W4ItemFlag@Qt@@@@ABVQModelIndex@@@Z @ 60 NONAME ; class QFlags HgCacheProxyModel::flags(class QModelIndex const &) const + ?DataProvider@HgCacheProxyModel@@QAEPAVHgDataProviderModel@@XZ @ 61 NONAME ; class HgDataProviderModel * HgCacheProxyModel::DataProvider(void) + ?insertItem@HgDataProviderModel@@IAEXHU?$QPair@VQVariant@@H@@_N@Z @ 62 NONAME ; void HgDataProviderModel::insertItem(int, struct QPair, bool) + ?getData@HgDataProviderModel@@MBE?AVQVariant@@HH@Z @ 63 NONAME ; class QVariant HgDataProviderModel::getData(int, int) const + ?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 + ?removeItem@HgDataProviderModel@@IAEXH_N@Z @ 69 NONAME ; void HgDataProviderModel::removeItem(int, bool) + ?setDataProvider@HgCacheProxyModel@@QAEXPAVHgDataProviderModel@@HH@Z @ 70 NONAME ; void HgCacheProxyModel::setDataProvider(class HgDataProviderModel *, int, int) + ?release@HgDataProviderModel@@QAEXV?$QList@H@@_N@Z @ 71 NONAME ; void HgDataProviderModel::release(class QList, bool) + ?qt_metacast@HgDataProviderModel@@UAEPAXPBD@Z @ 72 NONAME ; void * HgDataProviderModel::qt_metacast(char const *) + ?mapToSource@HgCacheProxyModel@@ABE?AVQModelIndex@@ABV2@@Z @ 73 NONAME ; class QModelIndex HgCacheProxyModel::mapToSource(class QModelIndex const &) const + ?sourceDataChanged@HgCacheProxyModel@@AAEXABVQModelIndex@@0@Z @ 74 NONAME ; void HgCacheProxyModel::sourceDataChanged(class QModelIndex const &, class QModelIndex const &) + ?sourceRowsAboutToBeRemoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 75 NONAME ; void HgCacheProxyModel::sourceRowsAboutToBeRemoved(class QModelIndex const &, int, int) + ?columnCount@HgCacheProxyModel@@UBEHABVQModelIndex@@@Z @ 76 NONAME ; int HgCacheProxyModel::columnCount(class QModelIndex const &) const + ?mapToSource@HgCacheProxyModel@@ABE?AVQModelIndex@@HH@Z @ 77 NONAME ; class QModelIndex HgCacheProxyModel::mapToSource(int, int) const + ?tr@HgDataProviderModel@@SA?AVQString@@PBD0@Z @ 78 NONAME ; class QString HgDataProviderModel::tr(char const *, char const *) + ?sourceRowsRemoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 79 NONAME ; void HgCacheProxyModel::sourceRowsRemoved(class QModelIndex const &, int, int) + ?sourceHeaderDataChanged@HgCacheProxyModel@@AAEXW4Orientation@Qt@@HH@Z @ 80 NONAME ; void HgCacheProxyModel::sourceHeaderDataChanged(enum Qt::Orientation, int, int) + ??1HgCacheProxyModel@@UAE@XZ @ 81 NONAME ; HgCacheProxyModel::~HgCacheProxyModel(void) + ?registerObserver@HgDataProviderModel@@QAEXPAVHgDataProviderModelObserver@@@Z @ 82 NONAME ; void HgDataProviderModel::registerObserver(class HgDataProviderModelObserver *) + ?sourceRowsAboutToBeMoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH0H@Z @ 83 NONAME ; void HgCacheProxyModel::sourceRowsAboutToBeMoved(class QModelIndex const &, int, int, class QModelIndex const &, int) + ??0HgCacheProxyModel@@QAE@PAVQObject@@@Z @ 84 NONAME ; HgCacheProxyModel::HgCacheProxyModel(class QObject *) + ?supportedDropActions@HgCacheProxyModel@@UBE?AV?$QFlags@W4DropAction@Qt@@@@XZ @ 85 NONAME ; class QFlags HgCacheProxyModel::supportedDropActions(void) const + ?updateIcon@HgDataProviderModel@@IAE_NHVQVariant@@_N@Z @ 86 NONAME ; bool HgDataProviderModel::updateIcon(int, class QVariant, bool) + ?index@HgDataProviderModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 87 NONAME ; class QModelIndex HgDataProviderModel::index(int, int, class QModelIndex const &) const + ?sort@HgCacheProxyModel@@UAEXHW4SortOrder@Qt@@@Z @ 88 NONAME ; void HgCacheProxyModel::sort(int, enum Qt::SortOrder) + ?releasePixmap@HgDataProviderModel@@IAEXH@Z @ 89 NONAME ; void HgDataProviderModel::releasePixmap(int) + ?sourceRowsMoved@HgCacheProxyModel@@AAEXABVQModelIndex@@HH0H@Z @ 90 NONAME ; void HgCacheProxyModel::sourceRowsMoved(class QModelIndex const &, int, int, class QModelIndex const &, int) + ?removeColumns@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 91 NONAME ; bool HgCacheProxyModel::removeColumns(int, int, class QModelIndex const &) + ?insertRows@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 92 NONAME ; bool HgCacheProxyModel::insertRows(int, int, class QModelIndex const &) + ?tr@HgCacheProxyModel@@SA?AVQString@@PBD0H@Z @ 93 NONAME ; class QString HgCacheProxyModel::tr(char const *, char const *, int) + ?insertItem@HgDataProviderModel@@IAEXHPAV?$QList@U?$QPair@VQVariant@@H@@@@_N@Z @ 94 NONAME ; void HgDataProviderModel::insertItem(int, class QList > *, bool) + ?revert@HgCacheProxyModel@@UAEXXZ @ 95 NONAME ; void HgCacheProxyModel::revert(void) + ?dynamicSortFilter@HgCacheProxyModel@@QBE_NXZ @ 96 NONAME ; bool HgCacheProxyModel::dynamicSortFilter(void) const + ?data@HgDataProviderModel@@IBE?AVQVariant@@HH@Z @ 97 NONAME ; class QVariant HgDataProviderModel::data(int, int) const + ?rowCount@HgDataProviderModel@@UBEHABVQModelIndex@@@Z @ 98 NONAME ; int HgDataProviderModel::rowCount(class QModelIndex const &) const + ?setFilterCaseSensitivity@HgCacheProxyModel@@QAEXW4CaseSensitivity@Qt@@@Z @ 99 NONAME ; void HgCacheProxyModel::setFilterCaseSensitivity(enum Qt::CaseSensitivity) + ?count@HgCacheProxyModel@@ABEHXZ @ 100 NONAME ; int HgCacheProxyModel::count(void) const + ?sortOrder@HgCacheProxyModel@@QBE?AW4SortOrder@Qt@@XZ @ 101 NONAME ; enum Qt::SortOrder HgCacheProxyModel::sortOrder(void) const + ?removeRows@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 102 NONAME ; bool HgCacheProxyModel::removeRows(int, int, class QModelIndex const &) + ?getStaticMetaObject@HgDataProviderModel@@SAABUQMetaObject@@XZ @ 103 NONAME ; struct QMetaObject const & HgDataProviderModel::getStaticMetaObject(void) + ?setBufferPosition@HgCacheProxyModel@@ABEXH@Z @ 104 NONAME ; void HgCacheProxyModel::setBufferPosition(int) const + ?dataUpdated@HgCacheProxyModel@@UAEXHH@Z @ 105 NONAME ; void HgCacheProxyModel::dataUpdated(int, int) + ?sourceRowsAboutToBeInserted@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 106 NONAME ; void HgCacheProxyModel::sourceRowsAboutToBeInserted(class QModelIndex const &, int, int) + ?fetchMore@HgCacheProxyModel@@UAEXABVQModelIndex@@@Z @ 107 NONAME ; void HgCacheProxyModel::fetchMore(class QModelIndex const &) + ?filterCaseSensitivity@HgCacheProxyModel@@QBE?AW4CaseSensitivity@Qt@@XZ @ 108 NONAME ; enum Qt::CaseSensitivity HgCacheProxyModel::filterCaseSensitivity(void) const + ?newItem@HgDataProviderModel@@IAEXU?$QPair@VQVariant@@H@@_N@Z @ 109 NONAME ; void HgDataProviderModel::newItem(struct QPair, bool) + ?setDynamicSortFilter@HgCacheProxyModel@@QAEX_N@Z @ 110 NONAME ; void HgCacheProxyModel::setDynamicSortFilter(bool) + ?sourceModelReset@HgCacheProxyModel@@AAEXXZ @ 111 NONAME ; void HgCacheProxyModel::sourceModelReset(void) + ?index@HgCacheProxyModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 112 NONAME ; class QModelIndex HgCacheProxyModel::index(int, int, class QModelIndex const &) const + ?setIconMode@HgDataProviderModel@@QAEXW4HgDataProviderIconMode@1@@Z @ 113 NONAME ; void HgDataProviderModel::setIconMode(enum HgDataProviderModel::HgDataProviderIconMode) + ?count@HgDataProviderModel@@IBEHXZ @ 114 NONAME ; int HgDataProviderModel::count(void) const + ?sourceColumnsInserted@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 115 NONAME ; void HgCacheProxyModel::sourceColumnsInserted(class QModelIndex const &, int, int) + ?tr@HgCacheProxyModel@@SA?AVQString@@PBD0@Z @ 116 NONAME ; class QString HgCacheProxyModel::tr(char const *, char const *) + ?qt_metacall@HgCacheProxyModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 117 NONAME ; int HgCacheProxyModel::qt_metacall(enum QMetaObject::Call, int, void * *) + ?setData@HgCacheProxyModel@@UAE_NABVQModelIndex@@ABVQVariant@@H@Z @ 118 NONAME ; bool HgCacheProxyModel::setData(class QModelIndex const &, class QVariant const &, int) + ?mimeData@HgCacheProxyModel@@UBEPAVQMimeData@@ABV?$QList@VQModelIndex@@@@@Z @ 119 NONAME ; class QMimeData * HgCacheProxyModel::mimeData(class QList const &) const + ?iconMode@HgDataProviderModel@@QAE?AW4HgDataProviderIconMode@1@XZ @ 120 NONAME ; enum HgDataProviderModel::HgDataProviderIconMode HgDataProviderModel::iconMode(void) + ?update@HgDataProviderModel@@IAE_NHVQVariant@@H_N@Z @ 121 NONAME ; bool HgDataProviderModel::update(int, class QVariant, int, bool) + ?match@HgCacheProxyModel@@UBE?AV?$QList@VQModelIndex@@@@ABVQModelIndex@@HABVQVariant@@HV?$QFlags@W4MatchFlag@Qt@@@@@Z @ 122 NONAME ; class QList HgCacheProxyModel::match(class QModelIndex const &, int, class QVariant const &, int, class QFlags) const + ?sourceRowsInserted@HgCacheProxyModel@@AAEXABVQModelIndex@@HH@Z @ 123 NONAME ; void HgCacheProxyModel::sourceRowsInserted(class QModelIndex const &, int, int) + ?release@HgCacheProxyModel@@UAEXHH@Z @ 124 NONAME ; void HgCacheProxyModel::release(int, int) + ?resetModel@HgDataProviderModel@@QAEXXZ @ 125 NONAME ; void HgDataProviderModel::resetModel(void) + ?span@HgCacheProxyModel@@UBE?AVQSize@@ABVQModelIndex@@@Z @ 126 NONAME ; class QSize HgCacheProxyModel::span(class QModelIndex const &) const + ?insertColumns@HgCacheProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 127 NONAME ; bool HgCacheProxyModel::insertColumns(int, int, class QModelIndex const &) + ??_EHgCacheProxyModel@@UAE@I@Z @ 128 NONAME ; HgCacheProxyModel::~HgCacheProxyModel(unsigned int) + ?filterRole@HgCacheProxyModel@@QBEHXZ @ 129 NONAME ; int HgCacheProxyModel::filterRole(void) const + ?metaObject@HgDataProviderModel@@UBEPBUQMetaObject@@XZ @ 130 NONAME ; struct QMetaObject const * HgDataProviderModel::metaObject(void) const + ?resetIcon@HgDataProviderModel@@IAEXH@Z @ 131 NONAME ; void HgDataProviderModel::resetIcon(int) + ?sourceLayoutAboutToBeChanged@HgCacheProxyModel@@AAEXXZ @ 132 NONAME ; void HgCacheProxyModel::sourceLayoutAboutToBeChanged(void) + ?metaObject@HgCacheProxyModel@@UBEPBUQMetaObject@@XZ @ 133 NONAME ; struct QMetaObject const * HgCacheProxyModel::metaObject(void) const + ?getPixmap@HgDataProviderModel@@AAEPAVQPixmap@@H@Z @ 134 NONAME ; class QPixmap * HgDataProviderModel::getPixmap(int) + ?sourceModelAboutToBeReset@HgCacheProxyModel@@AAEXXZ @ 135 NONAME ; void HgCacheProxyModel::sourceModelAboutToBeReset(void) + ?qt_metacall@HgDataProviderModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 136 NONAME ; int HgDataProviderModel::qt_metacall(enum QMetaObject::Call, int, void * *) + ?filterKeyColumn@HgCacheProxyModel@@QBEHXZ @ 137 NONAME ; int HgCacheProxyModel::filterKeyColumn(void) const diff -r 4fa04caf0f43 -r 1cdcc61142d2 eabi/hgcacheproxymodelu.def --- a/eabi/hgcacheproxymodelu.def Fri Jun 11 14:43:11 2010 +0300 +++ b/eabi/hgcacheproxymodelu.def Thu Jun 24 12:59:29 2010 +0300 @@ -57,78 +57,81 @@ _ZN19HgDataProviderModel10createIconEi7QPixmap @ 56 NONAME _ZN19HgDataProviderModel10insertItemEi5QPairI8QVariantiEb @ 57 NONAME _ZN19HgDataProviderModel10insertItemEiP5QListI5QPairI8QVariantiEEb @ 58 NONAME - _ZN19HgDataProviderModel10removeItemEi @ 59 NONAME + _ZN19HgDataProviderModel10removeItemEib @ 59 NONAME _ZN19HgDataProviderModel10resetModelEv @ 60 NONAME _ZN19HgDataProviderModel10updateIconEi8QVariantb @ 61 NONAME _ZN19HgDataProviderModel11qt_metacallEN11QMetaObject4CallEiPPv @ 62 NONAME _ZN19HgDataProviderModel11qt_metacastEPKc @ 63 NONAME - _ZN19HgDataProviderModel11removeItemsEii @ 64 NONAME - _ZN19HgDataProviderModel12doInsertItemEiP5QListI5QPairI8QVariantiEEb @ 65 NONAME - _ZN19HgDataProviderModel13releasePixmapEi @ 66 NONAME - _ZN19HgDataProviderModel15emitDataChangedEiib @ 67 NONAME - _ZN19HgDataProviderModel16registerObserverEP27HgDataProviderModelObserver @ 68 NONAME - _ZN19HgDataProviderModel16staticMetaObjectE @ 69 NONAME DATA 16 - _ZN19HgDataProviderModel17resizeQPixmapPoolEi @ 70 NONAME - _ZN19HgDataProviderModel19getStaticMetaObjectEv @ 71 NONAME - _ZN19HgDataProviderModel6updateEi8QVariantib @ 72 NONAME - _ZN19HgDataProviderModel6updateEiP5QListI5QPairI8QVariantiEEb @ 73 NONAME - _ZN19HgDataProviderModel7newItemE5QPairI8QVariantiEb @ 74 NONAME - _ZN19HgDataProviderModel7newItemEP5QListI5QPairI8QVariantiEEb @ 75 NONAME - _ZN19HgDataProviderModel7releaseE5QListIiEb @ 76 NONAME - _ZN19HgDataProviderModel7requestE5QListIiEb @ 77 NONAME - _ZN19HgDataProviderModel9getPixmapEi @ 78 NONAME - _ZN19HgDataProviderModel9resetIconEi @ 79 NONAME - _ZN19HgDataProviderModelC2EP7QObject @ 80 NONAME - _ZN19HgDataProviderModelD0Ev @ 81 NONAME - _ZN19HgDataProviderModelD1Ev @ 82 NONAME - _ZN19HgDataProviderModelD2Ev @ 83 NONAME - _ZNK17HgCacheProxyModel10filterRoleEv @ 84 NONAME - _ZNK17HgCacheProxyModel10headerDataEiN2Qt11OrientationEi @ 85 NONAME - _ZNK17HgCacheProxyModel10metaObjectEv @ 86 NONAME - _ZNK17HgCacheProxyModel10sortColumnEv @ 87 NONAME - _ZNK17HgCacheProxyModel11columnCountERK11QModelIndex @ 88 NONAME - _ZNK17HgCacheProxyModel11hasChildrenERK11QModelIndex @ 89 NONAME - _ZNK17HgCacheProxyModel11mapToSourceERK11QModelIndex @ 90 NONAME - _ZNK17HgCacheProxyModel11mapToSourceEii @ 91 NONAME - _ZNK17HgCacheProxyModel12canFetchMoreERK11QModelIndex @ 92 NONAME - _ZNK17HgCacheProxyModel12filterRegExpEv @ 93 NONAME - _ZNK17HgCacheProxyModel15filterKeyColumnEv @ 94 NONAME - _ZNK17HgCacheProxyModel17dynamicSortFilterEv @ 95 NONAME - _ZNK17HgCacheProxyModel17isSortLocaleAwareEv @ 96 NONAME - _ZNK17HgCacheProxyModel17setBufferPositionEi @ 97 NONAME - _ZNK17HgCacheProxyModel19sortCaseSensitivityEv @ 98 NONAME - _ZNK17HgCacheProxyModel20supportedDropActionsEv @ 99 NONAME - _ZNK17HgCacheProxyModel21filterCaseSensitivityEv @ 100 NONAME - _ZNK17HgCacheProxyModel22mapToDataProviderIndexEi @ 101 NONAME - _ZNK17HgCacheProxyModel24mapFromDataProviderIndexEi @ 102 NONAME - _ZNK17HgCacheProxyModel4dataERK11QModelIndexi @ 103 NONAME - _ZNK17HgCacheProxyModel4spanERK11QModelIndex @ 104 NONAME - _ZNK17HgCacheProxyModel5buddyERK11QModelIndex @ 105 NONAME - _ZNK17HgCacheProxyModel5countEv @ 106 NONAME - _ZNK17HgCacheProxyModel5flagsERK11QModelIndex @ 107 NONAME - _ZNK17HgCacheProxyModel5indexEiiRK11QModelIndex @ 108 NONAME - _ZNK17HgCacheProxyModel5matchERK11QModelIndexiRK8QVarianti6QFlagsIN2Qt9MatchFlagEE @ 109 NONAME - _ZNK17HgCacheProxyModel6parentERK11QModelIndex @ 110 NONAME - _ZNK17HgCacheProxyModel8itemDataERK11QModelIndex @ 111 NONAME - _ZNK17HgCacheProxyModel8mimeDataERK5QListI11QModelIndexE @ 112 NONAME - _ZNK17HgCacheProxyModel8rowCountERK11QModelIndex @ 113 NONAME - _ZNK17HgCacheProxyModel8sortRoleEv @ 114 NONAME - _ZNK17HgCacheProxyModel9mimeTypesEv @ 115 NONAME - _ZNK17HgCacheProxyModel9sortOrderEv @ 116 NONAME - _ZNK19HgDataProviderModel10metaObjectEv @ 117 NONAME - _ZNK19HgDataProviderModel11columnCountERK11QModelIndex @ 118 NONAME - _ZNK19HgDataProviderModel4dataERK11QModelIndexi @ 119 NONAME - _ZNK19HgDataProviderModel4dataEii @ 120 NONAME - _ZNK19HgDataProviderModel5countEv @ 121 NONAME - _ZNK19HgDataProviderModel5indexEiiRK11QModelIndex @ 122 NONAME - _ZNK19HgDataProviderModel6parentERK11QModelIndex @ 123 NONAME - _ZNK19HgDataProviderModel8itemDataERK11QModelIndex @ 124 NONAME - _ZNK19HgDataProviderModel8rowCountERK11QModelIndex @ 125 NONAME - _ZTI17HgCacheProxyModel @ 126 NONAME - _ZTI19HgDataProviderModel @ 127 NONAME - _ZTV17HgCacheProxyModel @ 128 NONAME - _ZTV19HgDataProviderModel @ 129 NONAME - _ZThn12_N17HgCacheProxyModel11dataUpdatedEii @ 130 NONAME - _ZThn8_N17HgCacheProxyModel7releaseEii @ 131 NONAME - _ZThn8_N17HgCacheProxyModel7requestEiiN23HgBufferManagerObserver14HgRequestOrderE @ 132 NONAME + _ZN19HgDataProviderModel11removeItemsEiib @ 64 NONAME + _ZN19HgDataProviderModel11setIconModeENS_22HgDataProviderIconModeE @ 65 NONAME + _ZN19HgDataProviderModel12doInsertItemEiP5QListI5QPairI8QVariantiEEb @ 66 NONAME + _ZN19HgDataProviderModel13releasePixmapEi @ 67 NONAME + _ZN19HgDataProviderModel15emitDataChangedEiib @ 68 NONAME + _ZN19HgDataProviderModel16registerObserverEP27HgDataProviderModelObserver @ 69 NONAME + _ZN19HgDataProviderModel16staticMetaObjectE @ 70 NONAME DATA 16 + _ZN19HgDataProviderModel17resizeQPixmapPoolEi @ 71 NONAME + _ZN19HgDataProviderModel19getStaticMetaObjectEv @ 72 NONAME + _ZN19HgDataProviderModel6updateEi8QVariantib @ 73 NONAME + _ZN19HgDataProviderModel6updateEiP5QListI5QPairI8QVariantiEEb @ 74 NONAME + _ZN19HgDataProviderModel7newItemE5QPairI8QVariantiEb @ 75 NONAME + _ZN19HgDataProviderModel7newItemEP5QListI5QPairI8QVariantiEEb @ 76 NONAME + _ZN19HgDataProviderModel7releaseE5QListIiEb @ 77 NONAME + _ZN19HgDataProviderModel7requestE5QListIiEb @ 78 NONAME + _ZN19HgDataProviderModel8iconModeEv @ 79 NONAME + _ZN19HgDataProviderModel9clearItemEib @ 80 NONAME + _ZN19HgDataProviderModel9getPixmapEi @ 81 NONAME + _ZN19HgDataProviderModel9resetIconEi @ 82 NONAME + _ZN19HgDataProviderModelC2EP7QObject @ 83 NONAME + _ZN19HgDataProviderModelD0Ev @ 84 NONAME + _ZN19HgDataProviderModelD1Ev @ 85 NONAME + _ZN19HgDataProviderModelD2Ev @ 86 NONAME + _ZNK17HgCacheProxyModel10filterRoleEv @ 87 NONAME + _ZNK17HgCacheProxyModel10headerDataEiN2Qt11OrientationEi @ 88 NONAME + _ZNK17HgCacheProxyModel10metaObjectEv @ 89 NONAME + _ZNK17HgCacheProxyModel10sortColumnEv @ 90 NONAME + _ZNK17HgCacheProxyModel11columnCountERK11QModelIndex @ 91 NONAME + _ZNK17HgCacheProxyModel11hasChildrenERK11QModelIndex @ 92 NONAME + _ZNK17HgCacheProxyModel11mapToSourceERK11QModelIndex @ 93 NONAME + _ZNK17HgCacheProxyModel11mapToSourceEii @ 94 NONAME + _ZNK17HgCacheProxyModel12canFetchMoreERK11QModelIndex @ 95 NONAME + _ZNK17HgCacheProxyModel12filterRegExpEv @ 96 NONAME + _ZNK17HgCacheProxyModel15filterKeyColumnEv @ 97 NONAME + _ZNK17HgCacheProxyModel17dynamicSortFilterEv @ 98 NONAME + _ZNK17HgCacheProxyModel17isSortLocaleAwareEv @ 99 NONAME + _ZNK17HgCacheProxyModel17setBufferPositionEi @ 100 NONAME + _ZNK17HgCacheProxyModel19sortCaseSensitivityEv @ 101 NONAME + _ZNK17HgCacheProxyModel20supportedDropActionsEv @ 102 NONAME + _ZNK17HgCacheProxyModel21filterCaseSensitivityEv @ 103 NONAME + _ZNK17HgCacheProxyModel22mapToDataProviderIndexEi @ 104 NONAME + _ZNK17HgCacheProxyModel24mapFromDataProviderIndexEi @ 105 NONAME + _ZNK17HgCacheProxyModel4dataERK11QModelIndexi @ 106 NONAME + _ZNK17HgCacheProxyModel4spanERK11QModelIndex @ 107 NONAME + _ZNK17HgCacheProxyModel5buddyERK11QModelIndex @ 108 NONAME + _ZNK17HgCacheProxyModel5countEv @ 109 NONAME + _ZNK17HgCacheProxyModel5flagsERK11QModelIndex @ 110 NONAME + _ZNK17HgCacheProxyModel5indexEiiRK11QModelIndex @ 111 NONAME + _ZNK17HgCacheProxyModel5matchERK11QModelIndexiRK8QVarianti6QFlagsIN2Qt9MatchFlagEE @ 112 NONAME + _ZNK17HgCacheProxyModel6parentERK11QModelIndex @ 113 NONAME + _ZNK17HgCacheProxyModel8itemDataERK11QModelIndex @ 114 NONAME + _ZNK17HgCacheProxyModel8mimeDataERK5QListI11QModelIndexE @ 115 NONAME + _ZNK17HgCacheProxyModel8rowCountERK11QModelIndex @ 116 NONAME + _ZNK17HgCacheProxyModel8sortRoleEv @ 117 NONAME + _ZNK17HgCacheProxyModel9mimeTypesEv @ 118 NONAME + _ZNK17HgCacheProxyModel9sortOrderEv @ 119 NONAME + _ZNK19HgDataProviderModel10metaObjectEv @ 120 NONAME + _ZNK19HgDataProviderModel11columnCountERK11QModelIndex @ 121 NONAME + _ZNK19HgDataProviderModel4dataERK11QModelIndexi @ 122 NONAME + _ZNK19HgDataProviderModel4dataEii @ 123 NONAME + _ZNK19HgDataProviderModel5countEv @ 124 NONAME + _ZNK19HgDataProviderModel5indexEiiRK11QModelIndex @ 125 NONAME + _ZNK19HgDataProviderModel6parentERK11QModelIndex @ 126 NONAME + _ZNK19HgDataProviderModel8itemDataERK11QModelIndex @ 127 NONAME + _ZNK19HgDataProviderModel8rowCountERK11QModelIndex @ 128 NONAME + _ZTI17HgCacheProxyModel @ 129 NONAME + _ZTI19HgDataProviderModel @ 130 NONAME + _ZTV17HgCacheProxyModel @ 131 NONAME + _ZTV19HgDataProviderModel @ 132 NONAME + _ZThn12_N17HgCacheProxyModel11dataUpdatedEii @ 133 NONAME + _ZThn8_N17HgCacheProxyModel7releaseEii @ 134 NONAME + _ZThn8_N17HgCacheProxyModel7requestEiiN23HgBufferManagerObserver14HgRequestOrderE @ 135 NONAME diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/ganeswidgets.pro --- a/ganeswidgets/ganeswidgets.pro Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/ganeswidgets.pro Thu Jun 24 12:59:29 2010 +0300 @@ -28,14 +28,17 @@ -llibOpenVGU.dll symbian { TARGET.EPOCALLOWDLLDATA = 1 + + #the def files are located in the root of hgwidgets so this is needed + defFilePath=.. } # Input SOURCES += src/hgwidgets.cpp \ src/hgwidgets_p.cpp \ - src/HgContainer.cpp \ + src/hgcontainer.cpp \ src/hgwidgetitem.cpp \ - src/HgScrollBufferManager.cpp \ + src/hgscrollbuffermanager.cpp \ src/hgquad.cpp \ src/hgquadrenderer.cpp \ src/hgvgquadrenderer.cpp \ @@ -43,7 +46,7 @@ src/hgmediawallrenderer.cpp \ src/hgspring.cpp \ src/hgdrag.cpp \ - src/HgImageFader.cpp \ + src/hgimagefader.cpp \ src/hglongpressvisualizer.cpp \ src/hgcoverflowcontainer.cpp \ src/hggridcontainer.cpp \ diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/inc/HgContainer.h --- a/ganeswidgets/inc/HgContainer.h Fri Jun 11 14:43:11 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,227 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef HGCONTAINER_H -#define HGCONTAINER_H - -#include -#include -#include - -#include "hgmediawalldataprovider.h" -#include "hgdrag.h" -#include "hgspring.h" - -class HgWidgetItem; -class HgQuadRenderer; -class HgMediaWallRenderer; -class QPanGesture; -class HbAbstractViewItem; -class HbGestureSceneFilter; -class HgLongPressVisualizer; - -class HgContainer: public HbWidget, public HgMediaWallDataProvider -{ - Q_OBJECT - Q_DISABLE_COPY(HgContainer) - -public: - explicit HgContainer(QGraphicsItem* parent = 0); - virtual ~HgContainer(); - - void setItemCount(int count); - int itemCount() const; - int rowCount() const; - - QList items() const; - HgWidgetItem* itemByIndex(const QModelIndex &index) const; - HgWidgetItem* itemByIndex(const int &index) const; - - void setSelectionModel(QItemSelectionModel *selectionModel, const QModelIndex &defaultItem); - QItemSelectionModel *selectionModel() const; - void setSelectionMode(HgWidget::SelectionMode mode, bool resetSelection); - HgWidget::SelectionMode selectionMode() const; - - void dimensions(qreal &screenSize, qreal &worldSize); - Qt::Orientation orientation() const; - void setOrientation(Qt::Orientation orientation, bool animate=true); - - // new size for the widget. calls resize. - void scrollToPosition(qreal value, bool animate = false); - virtual void scrollToPosition(const QPointF& pos, bool animate); - void scrollTo(const QModelIndex &index); - - void itemDataChanged(const QModelIndex &firstIndex, const QModelIndex &lastIndex); - - void addItems(int start, int end); - void removeItems(int start, int end); - void moveItems(int start, int end, int destination); - - bool getItemPoints(int index, QPolygonF& points); - - QList getVisibleItemIndices() const; - - virtual void itemDataChanged(const int &firstIndex, const int &lastIndex); - - void init(Qt::Orientation scrollDirection); - - void setDefaultImage(QImage defaultImage); - - void setItemSizePolicy(HgWidget::ItemSizePolicy policy); - HgWidget::ItemSizePolicy itemSizePolicy() const; - - void setItemSize(const QSizeF& size); - QSizeF itemSize() const; - - void setItemSpacing(const QSizeF& size); - QSizeF itemSpacing() const; - - Qt::Orientation scrollDirection() const; - qreal scrollPosition() const; - -signals: - - // emit this signal when scrolling. for example scrollbar can be connected to this signal. - void scrollPositionChanged(qreal value, bool scrollBarAnimation); - void centerItemChanged(const QModelIndex &index); - void activated(const QModelIndex &index); - void longPressed(const QModelIndex &index, const QPointF &coords); - void scrollingStarted(); - void scrollingEnded(); - -protected slots: - - virtual void onScrollingStarted(); - virtual void onScrollingEnded(); - -private slots: - - void updateBySpringPosition(); - void redraw(); - void updateLongPressVisualizer(); - -protected: // from HgMediaWallDataProvider - - int imageCount() const; - const HgImage *image(int index) const; - int flags(int index) const; - const HgImage *indicator(int flags) const; - -protected: // events - - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - - virtual void resizeEvent(QGraphicsSceneResizeEvent *event); - - // this needs to be implemented for gesture framework to work - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - // From HbWidget for gestures. - virtual void gestureEvent(QGestureEvent *event); -protected: - - virtual HgMediaWallRenderer* createRenderer(Qt::Orientation scrollDirection)=0; - virtual qreal getCameraDistance(qreal springVelocity); - virtual qreal getCameraRotationY(qreal springVelocity); - virtual void handleTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex); - virtual void handleLongTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex); - virtual void onScrollPositionChanged(qreal pos); - -protected: - - enum ItemActionType - { - LongTap = 1, - DoubleTap, - NormalTap, - TapStart, - LongTapStart - }; - - qreal worldWidth() const; - void initSpringForScrollBar(); - void initSpringForScrolling(); - void boundSpring(); - bool handlePanning(QPanGesture *gesture); - bool handleTap(Qt::GestureState state, const QPointF &pos); - bool handleLongTap(Qt::GestureState state, const QPointF &pos); - bool handleItemAction(const QPointF &pos, ItemActionType action); - - void selectItem(int index); - void updateSelectedItem(); - void unselectItem(); - - bool hasItemAt(const QPointF& pos); - HgWidgetItem* getItemAt(const QPointF& pos, int& index); - void startLongPressWatcher(const QPointF& pos); - void stopLongPressWatcher(); - bool updateSelectionModel(HgWidgetItem* item); - - - virtual void updateItemSizeAndSpacing(); - virtual QSizeF getAutoItemSize() const; - virtual QSizeF getAutoItemSpacing() const; - -protected: // data - - QList mItems; - //int mRowCount; - //int mColumnCount; - - //HbLabel *mLabel; - HgQuadRenderer *mQuadRenderer; - HgMediaWallRenderer *mRenderer; - - HgSpring mSpring; - HgDrag mDrag; - - QTime mTapDuration; // Temp hack until HbTapGesture is available - QTime mDoubleTapDuration; - int mTapCount; - - bool mAnimateUsingScrollBar; - - HgWidget::SelectionMode mSelectionMode; - QItemSelectionModel *mSelectionModel; - HgImage *mMarkImageOn; - HgImage *mMarkImageOff; - - qreal mSpringVelAtDragStart; - bool mDragged; - int mFramesDragged; - - HbAbstractViewItem* mHitItemView; - QPixmap mHitItemPixmap; - - HgLongPressVisualizer* mLongPressVisualizer; - QTimer* mLongPressTimer; - HgWidgetItem* mHitItem; - int mHitItemIndex; - - QPointF mOffsetAtDragStart; - QTime mLongTapDuration; - bool mScrollBarPressed; - - HgWidget::ItemSizePolicy mItemSizePolicy; - QSizeF mUserItemSize; - QSizeF mUserItemSpacing; - - Qt::Orientation mOrientation; - QModelIndex mDelayedScrollToIndex; - bool mIgnoreGestureAction; -}; - -#endif diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/inc/HgImageFader.h --- a/ganeswidgets/inc/HgImageFader.h Fri Jun 11 14:43:11 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef HGIMAGEFADER_H_ -#define HGIMAGEFADER_H_ - -#include -#include -#include - -class HgImage; - -class HgImageFader : public QObject -{ - Q_OBJECT -public: - HgImageFader(); - virtual ~HgImageFader(); - void addImage(HgImage* image); - void removeImage(HgImage* image); - void fadeImages(); -signals: - void doUpdate(); -private slots: - void doFading(); -private: - QTimer mTimer; - QLinkedList mImages; -}; - -#endif /* HGIMAGEFADER_H_ */ diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/inc/HgScrollBufferManager.h --- a/ganeswidgets/inc/HgScrollBufferManager.h Fri Jun 11 14:43:11 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef HGSCROLLBUFFERMANAGER_H_ -#define HGSCROLLBUFFERMANAGER_H_ - -#include -#include - -class UpdatePair -{ -public: - UpdatePair(int start, int count); - - int start() const; - int end() const; - - bool adjacent(int start, int count) const; - bool contains(const UpdatePair &other) const; - void extend(int start, int count); - void subtract(int start, int count); - - void shiftRight(int count); - void shiftLeft(int count); - - bool operator== (const UpdatePair &other) const; - bool operator< (const UpdatePair &other) const; - -private: - int mStart; - int mCount; -}; - -class UpdateBuffer : public QList -{ -public: - UpdateBuffer(); - - void add(int start, int count); - void remove(int start, int count); - void shiftRight(int startingFrom, int amount); - void shiftLeft(int startingFrom, int amount); -}; - -class HgScrollBufferManager: public QObject - { - Q_OBJECT -public: - - HgScrollBufferManager( - int bufferSize, - int bufferTreshold, - int initialPosition, - int totalCount); - - virtual ~HgScrollBufferManager(); - - void resetBuffer(int aPosition, int aTotalCount); - - void scrollPositionChanged(int newPosition); - - bool positionInsideBuffer(int position); - - void addItems(int start, int count); - void removeItems(int start, int end); - void moveItems(int start, int end, int target); - - void flushRequestBuffers(); - - void currentBuffer(int& bufferStart, int& bufferEnd); - -signals: - - void releaseItems(int releaseStart, int releaseEnd); - void requestItems(int requestStart, int requestEnd); - -protected slots: - - void timeout(); - -protected: - - void init(); - void asyncUpdate(); - - int changeBufferPosition(int newPos); - - void simpleAddItems(int start, int end); - void simpleRemoveItems(int start, int end); - - void appendRequestBuffer(int start, int end); - void appendReleaseBuffer(int start, int end); - -private: - - int mBufferSize; - int mBufferTreshold; - int mBufferPosition; - int mDiff; - int mTotalCount; - - bool mResetOrdered; - - int mRequestStart; - int mRequestCount; - int mReleaseStart; - int mReleaseCount; - QTimer mTimer; - bool mFirstTime; - - UpdateBuffer mRequestBuffer; - UpdateBuffer mReleaseBuffer; - -private: - Q_DISABLE_COPY(HgScrollBufferManager) - }; - -#endif /*HGSCROLLBUFFERMANAGER_H_*/ diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/inc/hgcenteritemarea.h --- a/ganeswidgets/inc/hgcenteritemarea.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/inc/hgcenteritemarea.h Thu Jun 24 12:59:29 2010 +0300 @@ -18,7 +18,7 @@ #ifndef HGCENTERICONAREA_H #define HGCENTERICONAREA_H -#include +#include class HgCenterItemArea: public HbWidget { diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/inc/hgcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ganeswidgets/inc/hgcontainer.h Thu Jun 24 12:59:29 2010 +0300 @@ -0,0 +1,227 @@ +/* +* 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: +* +*/ + +#ifndef HGCONTAINER_H +#define HGCONTAINER_H + +#include +#include +#include + +#include "hgmediawalldataprovider.h" +#include "hgdrag.h" +#include "hgspring.h" + +class HgWidgetItem; +class HgQuadRenderer; +class HgMediaWallRenderer; +class QPanGesture; +class HbAbstractViewItem; +class HbGestureSceneFilter; +class HgLongPressVisualizer; + +class HgContainer: public HbWidget, public HgMediaWallDataProvider +{ + Q_OBJECT + Q_DISABLE_COPY(HgContainer) + +public: + explicit HgContainer(QGraphicsItem* parent = 0); + virtual ~HgContainer(); + + void setItemCount(int count); + int itemCount() const; + int rowCount() const; + + QList items() const; + HgWidgetItem* itemByIndex(const QModelIndex &index) const; + HgWidgetItem* itemByIndex(const int &index) const; + + void setSelectionModel(QItemSelectionModel *selectionModel, const QModelIndex &defaultItem); + QItemSelectionModel *selectionModel() const; + void setSelectionMode(HgWidget::SelectionMode mode, bool resetSelection); + HgWidget::SelectionMode selectionMode() const; + + void dimensions(qreal &screenSize, qreal &worldSize); + Qt::Orientation orientation() const; + void setOrientation(Qt::Orientation orientation, bool animate=true); + + // new size for the widget. calls resize. + void scrollToPosition(qreal value, bool animate = false); + virtual void scrollToPosition(const QPointF& pos, bool animate); + void scrollTo(const QModelIndex &index); + + void itemDataChanged(const QModelIndex &firstIndex, const QModelIndex &lastIndex); + + void addItems(int start, int end); + void removeItems(int start, int end); + void moveItems(int start, int end, int destination); + + bool getItemPoints(int index, QPolygonF& points); + + QList getVisibleItemIndices() const; + + virtual void itemDataChanged(const int &firstIndex, const int &lastIndex); + + void init(Qt::Orientation scrollDirection); + + void setDefaultImage(QImage defaultImage); + + void setItemSizePolicy(HgWidget::ItemSizePolicy policy); + HgWidget::ItemSizePolicy itemSizePolicy() const; + + void setItemSize(const QSizeF& size); + QSizeF itemSize() const; + + void setItemSpacing(const QSizeF& size); + QSizeF itemSpacing() const; + + Qt::Orientation scrollDirection() const; + qreal scrollPosition() const; + +signals: + + // emit this signal when scrolling. for example scrollbar can be connected to this signal. + void scrollPositionChanged(qreal value, bool scrollBarAnimation); + void centerItemChanged(const QModelIndex &index); + void activated(const QModelIndex &index); + void longPressed(const QModelIndex &index, const QPointF &coords); + void scrollingStarted(); + void scrollingEnded(); + +protected slots: + + virtual void onScrollingStarted(); + virtual void onScrollingEnded(); + +private slots: + + void updateBySpringPosition(); + void redraw(); + void updateLongPressVisualizer(); + +protected: // from HgMediaWallDataProvider + + int imageCount() const; + const HgImage *image(int index) const; + int flags(int index) const; + const HgImage *indicator(int flags) const; + +protected: // events + + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + + virtual void resizeEvent(QGraphicsSceneResizeEvent *event); + + // this needs to be implemented for gesture framework to work + virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); + // From HbWidget for gestures. + virtual void gestureEvent(QGestureEvent *event); +protected: + + virtual HgMediaWallRenderer* createRenderer(Qt::Orientation scrollDirection)=0; + virtual qreal getCameraDistance(qreal springVelocity); + virtual qreal getCameraRotationY(qreal springVelocity); + virtual void handleTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex); + virtual void handleLongTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex); + virtual void onScrollPositionChanged(qreal pos); + +protected: + + enum ItemActionType + { + LongTap = 1, + DoubleTap, + NormalTap, + TapStart, + LongTapStart + }; + + qreal worldWidth() const; + void initSpringForScrollBar(); + void initSpringForScrolling(); + void boundSpring(); + bool handlePanning(QPanGesture *gesture); + bool handleTap(Qt::GestureState state, const QPointF &pos); + bool handleLongTap(Qt::GestureState state, const QPointF &pos); + bool handleItemAction(const QPointF &pos, ItemActionType action); + + void selectItem(int index); + void updateSelectedItem(); + void unselectItem(); + + bool hasItemAt(const QPointF& pos); + HgWidgetItem* getItemAt(const QPointF& pos, int& index); + void startLongPressWatcher(const QPointF& pos); + void stopLongPressWatcher(); + bool updateSelectionModel(HgWidgetItem* item); + + + virtual void updateItemSizeAndSpacing(); + virtual QSizeF getAutoItemSize() const; + virtual QSizeF getAutoItemSpacing() const; + +protected: // data + + QList mItems; + //int mRowCount; + //int mColumnCount; + + //HbLabel *mLabel; + HgQuadRenderer *mQuadRenderer; + HgMediaWallRenderer *mRenderer; + + HgSpring mSpring; + HgDrag mDrag; + + QTime mTapDuration; // Temp hack until HbTapGesture is available + QTime mDoubleTapDuration; + int mTapCount; + + bool mAnimateUsingScrollBar; + + HgWidget::SelectionMode mSelectionMode; + QItemSelectionModel *mSelectionModel; + HgImage *mMarkImageOn; + HgImage *mMarkImageOff; + + qreal mSpringVelAtDragStart; + bool mDragged; + int mFramesDragged; + + HbAbstractViewItem* mHitItemView; + QPixmap mHitItemPixmap; + + HgLongPressVisualizer* mLongPressVisualizer; + QTimer* mLongPressTimer; + HgWidgetItem* mHitItem; + int mHitItemIndex; + + QPointF mOffsetAtDragStart; + QTime mLongTapDuration; + bool mScrollBarPressed; + + HgWidget::ItemSizePolicy mItemSizePolicy; + QSizeF mUserItemSize; + QSizeF mUserItemSpacing; + + Qt::Orientation mOrientation; + QModelIndex mDelayedScrollToIndex; + bool mIgnoreGestureAction; +}; + +#endif diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/inc/hgcoverflowcontainer.h --- a/ganeswidgets/inc/hgcoverflowcontainer.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/inc/hgcoverflowcontainer.h Thu Jun 24 12:59:29 2010 +0300 @@ -19,7 +19,7 @@ #define HGCOVERFLOWCONTAINER_H #include -#include "HgContainer.h" +#include "hgcontainer.h" class HgCenterItemArea; diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/inc/hggridcontainer.h --- a/ganeswidgets/inc/hggridcontainer.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/inc/hggridcontainer.h Thu Jun 24 12:59:29 2010 +0300 @@ -18,7 +18,7 @@ #ifndef HGGRIDCONTAINER_H #define HGGRIDCONTAINER_H -#include "HgContainer.h" +#include "hgcontainer.h" class HbLabel; class HgWidgetItem; diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/inc/hgimagefader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ganeswidgets/inc/hgimagefader.h Thu Jun 24 12:59:29 2010 +0300 @@ -0,0 +1,45 @@ +/* +* 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 HGIMAGEFADER_H_ +#define HGIMAGEFADER_H_ + +#include +#include +#include + +class HgImage; + +class HgImageFader : public QObject +{ + Q_OBJECT +public: + HgImageFader(); + virtual ~HgImageFader(); + void addImage(HgImage* image); + void removeImage(HgImage* image); + void fadeImages(); +signals: + void doUpdate(); +private slots: + void doFading(); +private: + QTimer mTimer; + QLinkedList mImages; +}; + +#endif /* HGIMAGEFADER_H_ */ diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/inc/hgindexfeedback.h --- a/ganeswidgets/inc/hgindexfeedback.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/inc/hgindexfeedback.h Thu Jun 24 12:59:29 2010 +0300 @@ -18,8 +18,8 @@ #ifndef HGINDEXFEEDBACK_H #define HGINDEXFEEDBACK_H -#include -#include +#include +#include #include class HbScrollBar; diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/inc/hglongpressvisualizer.h --- a/ganeswidgets/inc/hglongpressvisualizer.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/inc/hglongpressvisualizer.h Thu Jun 24 12:59:29 2010 +0300 @@ -19,7 +19,7 @@ #define HGLONGPRESSVISUALIZER_H #include -#include +#include #include #include "hgmediawalldataprovider.h" diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/inc/hgscrollbuffermanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ganeswidgets/inc/hgscrollbuffermanager.h Thu Jun 24 12:59:29 2010 +0300 @@ -0,0 +1,133 @@ +/* +* 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 HGSCROLLBUFFERMANAGER_H_ +#define HGSCROLLBUFFERMANAGER_H_ + +#include +#include + +class UpdatePair +{ +public: + UpdatePair(int start, int count); + + int start() const; + int end() const; + + bool adjacent(int start, int count) const; + bool contains(const UpdatePair &other) const; + void extend(int start, int count); + void subtract(int start, int count); + + void shiftRight(int count); + void shiftLeft(int count); + + bool operator== (const UpdatePair &other) const; + bool operator< (const UpdatePair &other) const; + +private: + int mStart; + int mCount; +}; + +class UpdateBuffer : public QList +{ +public: + UpdateBuffer(); + + void add(int start, int count); + void remove(int start, int count); + void shiftRight(int startingFrom, int amount); + void shiftLeft(int startingFrom, int amount); +}; + +class HgScrollBufferManager: public QObject + { + Q_OBJECT +public: + + HgScrollBufferManager( + int bufferSize, + int bufferTreshold, + int initialPosition, + int totalCount); + + virtual ~HgScrollBufferManager(); + + void resetBuffer(int aPosition, int aTotalCount); + + void scrollPositionChanged(int newPosition); + + bool positionInsideBuffer(int position); + + void addItems(int start, int count); + void removeItems(int start, int end); + void moveItems(int start, int end, int target); + + void flushRequestBuffers(); + + void currentBuffer(int& bufferStart, int& bufferEnd); + +signals: + + void releaseItems(int releaseStart, int releaseEnd); + void requestItems(int requestStart, int requestEnd); + +protected slots: + + void timeout(); + +protected: + + void init(); + void asyncUpdate(); + + int changeBufferPosition(int newPos); + + void simpleAddItems(int start, int end); + void simpleRemoveItems(int start, int end); + + void appendRequestBuffer(int start, int end); + void appendReleaseBuffer(int start, int end); + +private: + + int mBufferSize; + int mBufferTreshold; + int mBufferPosition; + int mDiff; + int mTotalCount; + + bool mResetOrdered; + + int mRequestStart; + int mRequestCount; + int mReleaseStart; + int mReleaseCount; + QTimer mTimer; + bool mFirstTime; + + UpdateBuffer mRequestBuffer; + UpdateBuffer mReleaseBuffer; + +private: + Q_DISABLE_COPY(HgScrollBufferManager) + }; + +#endif /*HGSCROLLBUFFERMANAGER_H_*/ diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/HgContainer.cpp --- a/ganeswidgets/src/HgContainer.cpp Fri Jun 11 14:43:11 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1176 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include -#include "HgContainer.h" -#include "hgmediawallrenderer.h" -#include "hgquad.h" -#include "hgvgquadrenderer.h" -#include "hgvgimage.h" -#include "hgwidgetitem.h" -#include "trace.h" - -#include -#include -#include -#include -#include -#include -#include "hglongpressvisualizer.h" - -static const qreal KSpringKScrolling(50.0); -static const qreal KSpringKScrollBar(10.0); -static const qreal KSpringDampingScrolling(20.0); -static const qreal KSpringDampingScrollBar(5.0); -static const qreal KFramesToZeroVelocity(60.0); -static const int KLongTapDuration(400); - - -HgContainer::HgContainer(QGraphicsItem* parent) : - HbWidget(parent), - mQuadRenderer(0), - mRenderer(0), - mTapCount(0), - mAnimateUsingScrollBar(false), - mSelectionMode(HgWidget::NoSelection), - mSelectionModel(0), - mMarkImageOn(0), - mMarkImageOff(0), - mSpringVelAtDragStart(0), - mDragged(false), - mFramesDragged(0), - mHitItemView(NULL), - mLongPressVisualizer(NULL), - mLongPressTimer(NULL), - mHitItemIndex(-1), - mItemSizePolicy(HgWidget::ItemSizeAutomatic), - mOrientation(Qt::Vertical), - mDelayedScrollToIndex(), - mIgnoreGestureAction(false) -{ - FUNC_LOG; - - grabGesture(Qt::PanGesture); - grabGesture(Qt::TapGesture); -} - -HgContainer::~HgContainer() -{ - FUNC_LOG; - - qDeleteAll(mItems); - mItems.clear(); - delete mMarkImageOn; - delete mMarkImageOff; - delete mRenderer; -} - -void HgContainer::setItemCount(int itemCount) -{ - FUNC_LOG; - - qDeleteAll(mItems); - mItems.clear(); - for (int i=0; igetRowCount() : 0; -} - -QList HgContainer::items() const -{ - return mItems; -} - -HgWidgetItem* HgContainer::itemByIndex(const QModelIndex& index) const -{ - foreach (HgWidgetItem* item, mItems) { - if (item->modelIndex() == index) - return item; - } - - return 0; -} - -HgWidgetItem* HgContainer::itemByIndex(const int& index) const -{ - if (mItems.count() > index && index >= 0) - return mItems.at(index); - else - return 0; -} - -/*! - Changes the selection model of the container. - Ownership is not transferred. - Widget is redrawn to make new selection visible. -*/ -void HgContainer::setSelectionModel(QItemSelectionModel *selectionModel, const QModelIndex &defaultItem) -{ - FUNC_LOG; - HANDLE_ERROR_NULL(selectionModel); // Parameter is always a valid QItemSelectionModel - - if (mSelectionModel == selectionModel) return; - - bool defaultCurrentSet(false); - - if (!selectionModel->currentIndex().isValid()) { // If there is valid current item, do not change it - if (!mSelectionModel && defaultItem.isValid()) { // mSelectionModel is 0 when called first time - selectionModel->setCurrentIndex(defaultItem, QItemSelectionModel::Current); - defaultCurrentSet = true; - } - else if (mSelectionModel && mSelectionModel->currentIndex().isValid()) { - selectionModel->setCurrentIndex(mSelectionModel->currentIndex(), - QItemSelectionModel::Current); - } - } - - mSelectionModel = selectionModel; - - if (mSelectionModel->currentIndex().isValid() && !defaultCurrentSet) { - scrollTo(mSelectionModel->currentIndex()); - } - else { - update(); - } -} - -/*! - Returns the selection model of the container. - Ownership is not transferred. -*/ -QItemSelectionModel *HgContainer::selectionModel() const -{ - FUNC_LOG; - - return mSelectionModel; -} - -/*! - Changes the selection mode of the container (no selection/multiselection). -*/ -void HgContainer::setSelectionMode(HgWidget::SelectionMode mode, bool resetSelection) -{ - FUNC_LOG; - - if (mSelectionMode != mode) { - mSelectionMode = mode; - - if (mSelectionModel && resetSelection) { - mSelectionModel->clearSelection(); - update(); - } - } -} - -/*! - Returns the selection mode of the container (no selection/multiselection). -*/ -HgWidget::SelectionMode HgContainer::selectionMode() const -{ - FUNC_LOG; - - return mSelectionMode; -} - -void HgContainer::dimensions(qreal &screenSize, qreal &worldSize) -{ - const QRectF containerRect(rect()); - - 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(); - } - else{ - screenSize = containerRect.width()/(mRenderer->getImageSize().width() + mRenderer->getSpacing().width()); - worldSize = worldWidth(); - } -} - -Qt::Orientation HgContainer::orientation() const -{ - FUNC_LOG; - - return mOrientation; -} - -void HgContainer::setOrientation(Qt::Orientation orientation, bool animate) -{ - FUNC_LOG; - - mOrientation = orientation; - mRenderer->setOrientation(orientation); - mRenderer->setScrollDirection(orientation, animate); - if (mSpring.isActive()) { - // Need to stop scrolling. - mSpring.cancel(); - } -} - -void HgContainer::scrollToPosition(qreal value, bool animate) -{ - FUNC_LOG; - - scrollToPosition(QPointF(value*worldWidth(), 0), animate); -} - -void HgContainer::scrollToPosition(const QPointF& pos, bool animate) -{ - FUNC_LOG; - - mAnimateUsingScrollBar = animate; - initSpringForScrollBar(); - - if (animate) - mSpring.animateToPos(pos); - else - mSpring.gotoPos(pos); -} - -void HgContainer::scrollTo(const QModelIndex &index) -{ - FUNC_LOG; - INFO("Scrolling to" << index); - - 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; - return; - } - - // 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(); - } - } -} - -void HgContainer::itemDataChanged(const QModelIndex &firstIndex, const QModelIndex &lastIndex) -{ - FUNC_LOG; - - // TODO, fix this - int columns = firstIndex.model()->columnCount(QModelIndex()); - - // Check this!! - int index = columns*firstIndex.row()+firstIndex.column(); - int index2 = columns*lastIndex.row()+lastIndex.column(); - - // convert indeces to match one dimensional item array - itemDataChanged( index, index2 ); -} - -void HgContainer::addItems(int start, int end) -{ - FUNC_LOG; - HANDLE_ERROR_NULL(mSelectionModel); - - int first = qBound(0, start, mItems.count()-1); - int last = qBound(0, end, mItems.count()-1); - for (int i = 0; i <= end-start; i++) { - HgWidgetItem* item = new HgWidgetItem(mQuadRenderer); - mItems.insert(start, item); - } - scrollTo(mSelectionModel->currentIndex()); -} - -void HgContainer::removeItems(int start, int end) -{ - FUNC_LOG; - HANDLE_ERROR_NULL(mSelectionModel); - - int first = qBound(0, start, mItems.count()-1); - int last = qBound(0, end, mItems.count()-1); - for (int i = last; i >= first; i--) { - delete mItems.at(i); - mItems.removeAt(i); - } - scrollTo(mSelectionModel->currentIndex()); -} - -void HgContainer::moveItems(int start, int end, int destination) -{ - FUNC_LOG; - HANDLE_ERROR_NULL(mSelectionModel); - - int first = qBound(0, start, mItems.count()-1); - int last = qBound(0, end, mItems.count()-1); - int target = qBound(0, destination, mItems.count()-1); - - if (target < first) { - for (int i = 0; i <= last-first; i++) { - mItems.move(first+i, target+i); - } - } - else if (target > last) { - for (int i = 0; i <= last-first; i++) { - mItems.move(last-i, target); - } - } - // else do nothing - scrollTo(mSelectionModel->currentIndex()); -} - -int HgContainer::imageCount() const -{ - return mItems.count(); -} - -const HgImage *HgContainer::image(int index) const -{ - return mItems[index]->image(); -} - -int HgContainer::flags(int index) const -{ - if (index >= 0 && index < itemCount()) { - if (mSelectionMode != HgWidget::NoSelection) { - if (mSelectionModel && mSelectionModel->isSelected(mSelectionModel->model()->index(index, 0))) { - return 1; // TODO: Assign flag to mark indicator - } else - return 2; - } - } - return 0; -} - -const HgImage *HgContainer::indicator(int flags) const -{ - if (flags & 1) { - return mMarkImageOn; - } - else if (flags & 2) { - return mMarkImageOff; - } - - return 0; -} - -void HgContainer::updateBySpringPosition() -{ - // spring works always in one dimension, that is, x coord. - qreal pos = mSpring.pos().x(); - - onScrollPositionChanged(pos); - - emit scrollPositionChanged(pos, mAnimateUsingScrollBar); - update(); -} - -void HgContainer::redraw() -{ - update(); -} - -void HgContainer::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - 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()) - { - qreal pos = mSpring.pos().x(); - onScrollPositionChanged(pos); - emit scrollPositionChanged(pos, true); - } - - 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 - // zero when dragging starts - qreal springVel = mSpring.velocity().x(); - if (mDragged) { - qreal t = qBound(mFramesDragged / KFramesToZeroVelocity, 0.0f, 1.0f); - springVel = mSpringVelAtDragStart * (1.0f - t); - mFramesDragged++; - } - - // setup rendering and draw the current view - mRenderer->setCameraDistance(getCameraDistance(springVel)); - mRenderer->setCameraRotationY(getCameraRotationY(springVel)); - mRenderer->draw(mSpring.startPos(), mSpring.pos(), mSpring.endPos(), - springVel, painter, sceneTransform(), rect()); - - painter->setRenderHint(QPainter::SmoothPixmapTransform, false); -} - -void HgContainer::resizeEvent(QGraphicsSceneResizeEvent *event) -{ - 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); -} - -void HgContainer::gestureEvent(QGestureEvent *event) -{ - FUNC_LOG; - - if (mItems.count() == 0) { - // we have no items so no need to handle the gesture. - event->ignore(); - return; - } - - bool eventHandled(false); - // Event may contain more than one gesture type - HbTapGesture *tap = 0; - if (QGesture *gesture = event->gesture(Qt::TapGesture)) { - tap = static_cast(event->gesture(Qt::TapGesture)); - if (tap->tapStyleHint() == HbTapGesture::TapAndHold) { - eventHandled = handleLongTap(tap->state(), - mapFromScene(event->mapToGraphicsScene(tap->hotSpot()))); - - } else { - eventHandled = handleTap(tap->state(), - mapFromScene(event->mapToGraphicsScene(tap->hotSpot()))); - } - } - if (QGesture *pan = event->gesture(Qt::PanGesture)) { - eventHandled = handlePanning(static_cast(pan)); - } else if( mIgnoreGestureAction && tap && tap->state() == Qt::GestureCanceled ) { - // user has tapped or long pressed in grid while scrolling so we need to - // stop the 3d effect. - mSpring.resetVelocity(); - update(); - mIgnoreGestureAction = false; - } - - eventHandled ? event->accept() : event->ignore(); -} - -void HgContainer::init(Qt::Orientation scrollDirection) -{ - FUNC_LOG; - - mRenderer = createRenderer(scrollDirection); - mOrientation = scrollDirection; - - mQuadRenderer = mRenderer->getRenderer(); - - // Fetch icons for marking mode (on and off states). - - mMarkImageOn = mQuadRenderer->createNativeImage(); - HANDLE_ERROR_NULL(mMarkImageOn); - mMarkImageOff = mQuadRenderer->createNativeImage(); - HANDLE_ERROR_NULL(mMarkImageOff); - - // Since there is no way to create the icons directly currently - // lets create HbCheckBox and ask primitives from it. - HbCheckBox* checkBox = new HbCheckBox(); - checkBox->setCheckState(Qt::Checked); - QGraphicsItem *icon = checkBox->HbWidget::primitive("icon"); - HbIconItem *iconItem = 0; - if (icon) { - iconItem = static_cast(icon); - if (mMarkImageOn) { - mMarkImageOn->setPixmap(iconItem->icon().pixmap()); - } - } - checkBox->setCheckState(Qt::Unchecked); - icon = checkBox->HbWidget::primitive("icon"); - if (icon) { - iconItem = static_cast(icon); - if (mMarkImageOff) { - mMarkImageOff->setPixmap(iconItem->icon().pixmap()); - } - } - delete checkBox; - - 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(ended()), SLOT(onScrollingEnded())); - connect(mRenderer, SIGNAL(renderingNeeded()), SLOT(redraw())); - -} - -qreal HgContainer::worldWidth() const -{ - return (qreal)mRenderer->getWorldWidth(); -} - -void HgContainer::initSpringForScrollBar() -{ - FUNC_LOG; - - mSpring.setDamping(KSpringDampingScrollBar); - mSpring.setK(KSpringKScrollBar); -} - -void HgContainer::initSpringForScrolling() -{ - FUNC_LOG; - - mSpring.setDamping(KSpringDampingScrolling); - mSpring.setK(KSpringKScrolling); -} - -void HgContainer::boundSpring() -{ - FUNC_LOG; - - qreal x = mSpring.endPos().x(); - x = qBound(qreal(0), x, worldWidth()); - if (mRenderer->coverflowModeEnabled()) { - qreal i = floorf(x); - x = (x - i > 0.5f) ? ceilf(x) : i; - mSpring.animateToPos(QPointF(x, 0)); - } - - mSpring.animateToPos(QPointF(x, 0)); - -} - -bool HgContainer::handlePanning(QPanGesture *gesture) -{ - mAnimateUsingScrollBar = false; - initSpringForScrolling(); - - qreal pos = mSpring.pos().x(); - qreal delta(0); - qreal itemSide(0); - - if (mOrientation == mRenderer->getScrollDirection()) { - delta = gesture->delta().y(); - } - else { - delta = gesture->delta().x(); - } - - if (mRenderer->getScrollDirection() == Qt::Vertical) - itemSide = mRenderer->getImageSize().height()+mRenderer->getSpacing().height(); - else - itemSide = mRenderer->getImageSize().width()+mRenderer->getSpacing().width(); - - if (gesture->state() == Qt::GestureStarted) { - mOffsetAtDragStart = gesture->offset(); - } - else if (gesture->state() == Qt::GestureUpdated) { - QPointF offset = gesture->offset(); - QPointF offsetDelta = offset - mOffsetAtDragStart; - if (!mDragged && (qAbs(offsetDelta.x()) > 8 || - qAbs(offsetDelta.y()) > 8)) { - mDragged = true; - mDrag.reset(delta, mSpring.pos().x()); - mDragged = true; - mSpringVelAtDragStart = mSpring.velocity().x(); - mFramesDragged = 0; - } - - if (mDragged) - { - emit scrollingStarted(); - - qreal newPosition = mDrag.update(delta, pos, itemSide); - if (qAbs(newPosition - mSpring.pos().x()) > 0.01f) { - mSpring.gotoPos(QPointF(newPosition, 0)); - if (mRenderer->coverflowModeEnabled()) { - emit scrollPositionChanged(newPosition,true); - update(); - } else { - updateBySpringPosition(); - } - } - } - } - else if (mDragged && gesture->state() == Qt::GestureFinished) { - mDrag.update(delta, pos, itemSide); - mDragged = false; - qreal newPos(0); - if (mDrag.finish(pos, mRenderer->coverflowModeEnabled(), newPos)) { - mSpring.animateToPos(QPointF(qBound(qreal(0), newPos, worldWidth()), 0)); - HgWidgetItem* item = itemByIndex(newPos); - if (item && item->modelIndex() != mSelectionModel->currentIndex()) { - // mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); - } - } - else { - boundSpring(); - } - } - else if(!mDragged && gesture->state() == Qt::GestureFinished) { - if (!mRenderer->coverflowModeEnabled()) { - mSpring.resetVelocity(); - update(); - } - } - else if (gesture->state() == Qt::GestureCanceled) { - boundSpring(); - } - - return true; -} - -bool HgContainer::handleTap(Qt::GestureState state, const QPointF &pos) -{ - FUNC_LOG; - - bool handleGesture = false; - - if (hasItemAt(pos)) { - switch (state) - { - case Qt::GestureStarted: - { - if (mRenderer->coverflowModeEnabled() || !mSpring.isActive()) { - mIgnoreGestureAction = false; - startLongPressWatcher(pos); - } else if(mSpring.isActive()) { - mSpring.cancel(); - mIgnoreGestureAction = true; - } - break; - } - case Qt::GestureFinished: - handleGesture = handleItemAction(pos, NormalTap); - case Qt::GestureUpdated: - case Qt::GestureCanceled: - default: - stopLongPressWatcher(); - break; - } - - handleGesture = true; - } else { - mIgnoreGestureAction = true; - } - return handleGesture; -} - -bool HgContainer::handleLongTap(Qt::GestureState state, const QPointF &pos) -{ - FUNC_LOG; - - bool handleGesture = false; - - if (hasItemAt(pos)) { - - switch (state) - { - case Qt::GestureUpdated: - handleItemAction(pos,LongTap); - case Qt::GestureStarted: - case Qt::GestureCanceled: - case Qt::GestureFinished: - default: - stopLongPressWatcher(); - break; - } - handleGesture = true; - } else { - mIgnoreGestureAction = true; - } - - return handleGesture; -} - -/*! - Handle tap, lang tap and double tap action. - Finds out the item in the tap position and sends out suitable signal, - Sets the item as the current item and in multiselection mode toggles the - item selection status. -*/ -bool HgContainer::handleItemAction(const QPointF &pos, ItemActionType action) -{ - FUNC_LOG; - - // If there is content, mSelectionModel must always exist - either default or client-provided - if (!mSelectionModel) return false; - - int index = -1; - mHitItem = getItemAt(pos, index); - if (mHitItem) - { - HgWidgetItem* item = itemByIndex(index); - if (item && action != DoubleTap) { - if (action == LongTap) { - INFO("Long tap:" << item->modelIndex().row()); - - if (!mRenderer->coverflowModeEnabled()) { - selectItem(index); - } else { - mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); - } - - if (!mIgnoreGestureAction) { - emit longPressed(item->modelIndex(), pos); - } else { - mSpring.resetVelocity(); - update(); - mIgnoreGestureAction = false; - } - } - else if (mSelectionMode == HgWidget::MultiSelection) { - mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); - INFO("Select:" << item->modelIndex().row()); - mSelectionModel->select(item->modelIndex(), QItemSelectionModel::Toggle); - update(); // It would be enough to update the item - } - else if (mSelectionMode == HgWidget::SingleSelection) { - mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); - INFO("Select:" << item->modelIndex().row()); - mSelectionModel->select(item->modelIndex(), QItemSelectionModel::ClearAndSelect); - update(); // It would be enough to update the item - } - else if (mSelectionMode == HgWidget::ContiguousSelection) { - mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); - QModelIndex newSelected = item->modelIndex(); - QModelIndexList oldSelection = mSelectionModel->selectedIndexes(); - INFO("Select:" << newSelected.row()); - if (oldSelection.count() > 0 && !mSelectionModel->isSelected(newSelected)) { - if (newSelected.row() < oldSelection.front().row()) { - mSelectionModel->select(QItemSelection(newSelected, oldSelection.back()), - QItemSelectionModel::Select); - } - else { // newSelected.row() > oldSelection.back().row() - mSelectionModel->select(QItemSelection(oldSelection.front(), newSelected), - QItemSelectionModel::Select); - } - } - else { - mSelectionModel->select(newSelected, QItemSelectionModel::Select); - } - update(); // It would be enough to update the item - } - else { - INFO("Tap:" << item->modelIndex().row()); - - if (mRenderer->coverflowModeEnabled()) { //coverflow and t-bone modes - if (qAbs(qreal(index) - mSpring.pos().x()) < 0.01f) - { - mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); - emit activated(item->modelIndex()); - } - else - { - mSpring.animateToPos(QPointF(index, 0)); - } - } - else { //grid mode - if (!mIgnoreGestureAction) { - // Current should be topleft item. -// mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); - selectItem(index); - emit activated(item->modelIndex()); - } else { - mSpring.resetVelocity(); - update(); - mIgnoreGestureAction = false; - } - } - } - } - - return true; - } - else { - INFO("No quad at pos:" << pos); - - unselectItem(); - return false; - } -} - -bool HgContainer::getItemPoints(int index, QPolygonF& points) -{ - return mRenderer->getItemPoints(index, points); -} - -QList HgContainer::getVisibleItemIndices() const -{ - QList quads = mRenderer->getVisibleQuads(); - QList result; - for (int i = 0; i < quads.count(); i++) { - bool ok; - int index = quads.at(i)->userData().toInt(&ok); - HgWidgetItem *item = itemByIndex(index); - if (item) - result.append(item->modelIndex()); - } - qSort(result); - return result; -} - -void HgContainer::itemDataChanged(const int &firstIndex, const int &lastIndex) -{ - FUNC_LOG; - - int firstItemOnScreen = 0, lastItemOnScreen = 0; - firstItemOnScreen = mSpring.pos().x(); - firstItemOnScreen *= rowCount(); - - int itemsOnScreen = mRenderer->getVisibleQuads().count(); - lastItemOnScreen = firstItemOnScreen+itemsOnScreen; - - if ( itemsOnScreen == 0 || (firstIndex >= firstItemOnScreen && firstIndex < lastItemOnScreen) || - (lastIndex >= firstItemOnScreen && lastIndex < lastItemOnScreen)) { - update(); - } -} - -void HgContainer::selectItem(int index) -{ - Q_UNUSED(index) - // TODO: replace this with own selection implementation -/* if (index < 0 && index >= mItems.count()) - return; - - mHitItemIndex = index; - - if (mHitItemView) - { - delete mHitItemView; - mHitItemView = NULL; - } - - mHitItemView = new HbGridViewItem(this); - mHitItemView->setVisible(false); - mHitItemView->setPos(QPointF(0,0)); - mHitItemView->setPressed(true, false); - - const QImage& image = mItems[mHitItemIndex]->image()->getQImage(); - if (image.isNull()) - { - mHitItemView->setVisible(false); - return; - } - - QPixmap pixmap = QPixmap::fromImage(image); - HbIcon icon(pixmap.scaled(mRenderer->getImageSize().toSize(), Qt::IgnoreAspectRatio)); - QGraphicsItem* item = mHitItemView->style()->createPrimitive(HbStyle::P_GridViewItem_icon, mHitItemView); - HbIconItem *iconItem = static_cast(item); - iconItem->setAlignment(Qt::AlignCenter); - iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio); - iconItem->setIcon(icon); - - mHitItemView->resize(mRenderer->getImageSize().width(), - mRenderer->getImageSize().height()); - */ -} - -void HgContainer::updateSelectedItem() -{ - if (!mHitItemView || mHitItemIndex == -1) - return; - - QPolygonF points; - if (!getItemPoints(mHitItemIndex, points)) - { - // the item was not rendered, we must hide - // our qt item - mHitItemView->setVisible(false); - return; - } - - QRectF bounds = points.boundingRect(); - if (!(rect().contains(bounds) || rect().intersects(bounds))) - { - mHitItemView->setVisible(false); - return; - } - - QPolygonF img; - img.append(QPointF(3,mHitItemView->boundingRect().height()-3)); - img.append(QPointF(mHitItemView->boundingRect().width()-3,mHitItemView->boundingRect().height()-3)); - img.append(QPointF(mHitItemView->boundingRect().width()-3,3)); - img.append(QPointF(3,3)); - - QTransform t; - QTransform::quadToQuad(img, points, t); - - //t.translate(50,50); - bool bOk; - mHitItemView->setTransform(t * this->transform().inverted(&bOk)); - mHitItemView->setVisible(true); -} - -void HgContainer::unselectItem() -{ - mHitItemIndex = -1; - if (mHitItemView) - { - mHitItemView->setVisible(false); - } -} - -void HgContainer::updateLongPressVisualizer() -{ - int elapsed = mLongTapDuration.elapsed(); - - if (elapsed > 80) - { - int frame = 100.0f * qreal(elapsed - 80) / qreal(KLongTapDuration - 80); - mLongPressVisualizer->setFrame(frame); - } -} - -bool HgContainer::hasItemAt(const QPointF& pos) -{ - int dummy; - HgWidgetItem *item = getItemAt(pos, dummy); - if (item) { - return item->modelIndex().isValid(); - } - return false; -} - -HgWidgetItem* HgContainer::getItemAt(const QPointF& pos, int& index) -{ - HgQuad* quad = mRenderer->getQuadAt(pos); - if (quad) - { - bool ok; - index = quad->userData().toInt(&ok); - - HgWidgetItem* item = itemByIndex(index); - return item; - } - return NULL; -} - -void HgContainer::startLongPressWatcher(const QPointF& pos) -{ - if (!mLongPressVisualizer) - { - mLongPressVisualizer = new HgLongPressVisualizer(this); - mLongPressVisualizer->setZValue(zValue()+1); - } - - mLongPressVisualizer->start(pos); - - if (!mLongPressTimer) - { - mLongPressTimer = new QTimer(this); - QObject::connect(mLongPressTimer, SIGNAL(timeout()), this, SLOT(updateLongPressVisualizer())); - } - - mLongPressTimer->start(20); - - mLongTapDuration.start(); -} - -void HgContainer::stopLongPressWatcher() -{ - if (mLongPressTimer && mLongPressVisualizer) - { - mLongPressTimer->stop(); - mLongPressVisualizer->stop(); - } -} - -qreal HgContainer::getCameraDistance(qreal springVelocity) -{ - Q_UNUSED(springVelocity) - return 0; -} - -qreal HgContainer::getCameraRotationY(qreal springVelocity) -{ - Q_UNUSED(springVelocity) - return 0; -} - -void HgContainer::handleTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex) -{ - Q_UNUSED(pos) - Q_UNUSED(hitItem) - Q_UNUSED(hitItemIndex) -} - -void HgContainer::handleLongTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex) -{ - Q_UNUSED(pos) - Q_UNUSED(hitItem) - Q_UNUSED(hitItemIndex) -} - -void HgContainer::onScrollPositionChanged(qreal pos) -{ - Q_UNUSED(pos) -} - -void HgContainer::onScrollingStarted() -{ - // By default do nothing -} - -void HgContainer::onScrollingEnded() -{ - // By default do nothing -} - -void HgContainer::setDefaultImage(QImage defaultImage) -{ - HgQuadRenderer *renderer = mRenderer->getRenderer(); - if (renderer) { - QImage scaled = defaultImage.scaled(mRenderer->getImageSize().toSize()); - renderer->setDefaultImage(scaled); - } -} - -void HgContainer::setItemSizePolicy(HgWidget::ItemSizePolicy policy) -{ - if (policy != mItemSizePolicy) - { - mItemSizePolicy = policy; - - updateItemSizeAndSpacing(); - } -} - -HgWidget::ItemSizePolicy HgContainer::itemSizePolicy() const -{ - return mItemSizePolicy; -} - -void HgContainer::setItemSize(const QSizeF& size) -{ - mUserItemSize = size; - updateItemSizeAndSpacing(); -} - -QSizeF HgContainer::itemSize() const -{ - return mRenderer->getImageSize(); -} - -void HgContainer::setItemSpacing(const QSizeF& spacing) -{ - mUserItemSpacing = spacing; - updateItemSizeAndSpacing(); -} - -QSizeF HgContainer::itemSpacing() const -{ - return mRenderer->getSpacing(); -} - -void HgContainer::updateItemSizeAndSpacing() -{ - if (mItemSizePolicy == HgWidget::ItemSizeUserDefined) - { - mRenderer->setImageSize(mUserItemSize); - mRenderer->setSpacing(mUserItemSpacing); - } -} - -QSizeF HgContainer::getAutoItemSize() const -{ - return mUserItemSize; -} - -QSizeF HgContainer::getAutoItemSpacing() const -{ - return mUserItemSpacing; -} - -Qt::Orientation HgContainer::scrollDirection() const -{ - return mRenderer->getScrollDirection(); -} - -qreal HgContainer::scrollPosition() const -{ - return mSpring.pos().x(); -} - -// EOF diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/HgImageFader.cpp --- a/ganeswidgets/src/HgImageFader.cpp Fri Jun 11 14:43:11 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#include "HgImageFader.h" -#include "hgimage.h" - -HgImageFader::HgImageFader() -{ - QObject::connect(&mTimer, SIGNAL(timeout()), this, SLOT(doFading())); -} - -HgImageFader::~HgImageFader() -{ - if (mTimer.isActive()) - mTimer.stop(); -} - -void HgImageFader::addImage(HgImage* image) -{ - mImages.push_back(image); -} - -void HgImageFader::removeImage(HgImage* image) -{ - mImages.removeOne(image); -} - -void HgImageFader::fadeImages() -{ - if (!mImages.empty() && !mTimer.isActive()) - { - mTimer.start(10); - } -} - -void HgImageFader::doFading() -{ - QLinkedList::iterator i = mImages.begin(); - while (i != mImages.end()) - { - HgImage* image = (*i); - image->setAlpha(image->alpha() + 0.1f); - if (image->alpha() >= 1.0f) - { - image->setAlpha(1.0f); - i = mImages.erase(i); - } - else - { - i++; - } - } - - //emit doUpdate(); - - if (mImages.empty()) - { - mTimer.stop(); - } -} diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/HgScrollBufferManager.cpp --- a/ganeswidgets/src/HgScrollBufferManager.cpp Fri Jun 11 14:43:11 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,589 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#include - -#include "HgScrollBufferManager.h" -#include "trace.h" - -// ----------------------------------------------------------------------------- -// HgScrollBufferManager::HgScrollBufferManager() -// ----------------------------------------------------------------------------- -// -HgScrollBufferManager::HgScrollBufferManager( - int bufferSize, - int bufferTreshold, - int initialPosition, - int totalCount ) -: mBufferSize( bufferSize ), - mBufferTreshold( bufferTreshold ), - mBufferPosition( initialPosition ), - mDiff(0), - mTotalCount( totalCount ), - mResetOrdered(false), - mRequestStart(0), - mRequestCount(0), - mReleaseStart(0), - mReleaseCount(0), - mFirstTime(true) - { - init(); - } - -// ----------------------------------------------------------------------------- -// HgScrollBufferManager::init() -// ----------------------------------------------------------------------------- -// -void HgScrollBufferManager::init() - { - mResetOrdered = ETrue; - mTimer.setSingleShot(true); - connect(&mTimer, SIGNAL(timeout()), this, SLOT(timeout())); - } - -// ----------------------------------------------------------------------------- -// HgScrollBufferManager::~HgScrollBufferManager() -// ----------------------------------------------------------------------------- -// -HgScrollBufferManager::~HgScrollBufferManager() - { - mTimer.stop(); - } - -// ----------------------------------------------------------------------------- -// HgScrollBufferManager::resetBuffer() -// ----------------------------------------------------------------------------- -// -void HgScrollBufferManager::resetBuffer( int aPosition, int totalCount ) - { - if( !mResetOrdered ) - { - // release Old buffer - mReleaseStart = mBufferPosition; - mReleaseCount = mBufferSize; - } - - // set position and count - mBufferPosition = aPosition - (mBufferSize / 2); - mTotalCount = totalCount; - mDiff = 0; - - if( mBufferPosition + mBufferSize > mTotalCount - 1 ) - { - mBufferPosition = mTotalCount - mBufferSize; - } - - if(mBufferPosition < 0 ) - { - mBufferPosition = 0; - } - - //request new Buffer - mRequestStart = mBufferPosition; - mRequestCount = mBufferSize; - mResetOrdered = ETrue; - asyncUpdate(); - } - -void HgScrollBufferManager::scrollPositionChanged( int newPosition ) - { - // If all the items fit in the buffer no need to move the buffer. - if( mTotalCount <= mBufferSize ) return; - - bool forceUpdate = EFalse; - newPosition -= mBufferSize / 2; // normalize index to Buffer start - - if(newPosition < 0) - { - newPosition = 0; - forceUpdate = ETrue; - } - else if( newPosition > mTotalCount - mBufferSize ) - { - newPosition = mTotalCount - mBufferSize; - forceUpdate = ETrue; - } - - mDiff = mBufferPosition - newPosition; - - // Too large change reset whole buffer - if( mDiff >= mBufferSize || -mDiff >= mBufferSize || mResetOrdered ) - { - resetBuffer(newPosition + (mBufferSize/2), mTotalCount ); - } - // Move Up - else if( mDiff >= mBufferTreshold ) - { - mRequestCount = mDiff; - mReleaseCount = mDiff; - asyncUpdate(); - } - // Move Down - else if( -mDiff >= mBufferTreshold ) - { - mRequestCount = -mDiff; - mReleaseCount = -mDiff; - asyncUpdate(); - } - // Top or bottom has been reached - else if( forceUpdate && mDiff ) - { - int diff = mDiff < 0 ? -mDiff : mDiff; - mRequestCount = diff; - mReleaseCount = diff; - asyncUpdate(); - } - } - -void HgScrollBufferManager::timeout() -{ - mFirstTime = false; - - if(mResetOrdered) - { - mResetOrdered = EFalse; - } - else - { - if(mDiff < 0) - { - mReleaseStart = mBufferPosition; - mRequestStart = mBufferPosition + mBufferSize; - } - else if( mDiff > 0) - { - mReleaseStart = mBufferPosition + mBufferSize - mDiff; - mRequestStart = mBufferPosition - mDiff; - } - } - - // Release - int end = mReleaseStart + mReleaseCount < mTotalCount ? - mReleaseStart + mReleaseCount: mTotalCount; - end--; - if(end >= mReleaseStart ) - { - emit releaseItems( mReleaseStart, end ); - } - - mReleaseCount = 0; - - // Request - end = mRequestStart + mRequestCount < mTotalCount ? - mRequestStart + mRequestCount : mTotalCount; - - end--; - if(end >= mRequestStart ) - { - emit requestItems( mRequestStart, end ); - } - - mRequestCount = 0; - - // Move Buffer - mBufferPosition -= mDiff; - // Reset Diff - mDiff = 0; -} - -bool HgScrollBufferManager::positionInsideBuffer( int position ) -{ - return position >= mBufferPosition && position <= (mBufferPosition+mBufferSize); -} - -void HgScrollBufferManager::asyncUpdate() -{ - if (!mTimer.isActive() && mFirstTime) { - mTimer.start(0); - } else if (!mTimer.isActive()){ - timeout(); - } -} - -void HgScrollBufferManager::currentBuffer(int& bufferStart, int& bufferEnd) -{ - bufferStart = mBufferPosition; - bufferEnd = mBufferPosition+mBufferSize > mTotalCount-1 ? - mTotalCount-1 : mBufferPosition+mBufferSize; -} - -void HgScrollBufferManager::addItems(int start, int end) -{ - FUNC_LOG; - - mTotalCount += (end-start+1); - int lastBufferItem = mBufferPosition+mBufferSize-1; - - if (start < mBufferPosition) { - simpleAddItems(start, end); - // New items push the buffer forward, items inside the buffer do not change - } - // Check buffer higher limit - else if (start <= lastBufferItem && end > lastBufferItem) { - simpleAddItems(start, lastBufferItem); - // Items added after the buffer are ignored - } - else { - simpleAddItems(start, end); - } -} - -void HgScrollBufferManager::removeItems(int start, int end) -{ - FUNC_LOG; - - int lastBufferItem = mBufferPosition+mBufferSize-1; - int removedItemCount = end-start+1; - - if (mTotalCount < mBufferSize) { - // Do nothing - } - else if (start > lastBufferItem) { - // Do nothing - } - else if (end < mBufferPosition) { - mTotalCount = mTotalCount-removedItemCount; - simpleRemoveItems(start, end); - } - else if (start < mBufferPosition && end > lastBufferItem) { - mTotalCount = mTotalCount-removedItemCount; - mBufferPosition = qBound(0, mBufferPosition, mTotalCount-mBufferSize); - resetBuffer(mBufferPosition, mTotalCount); - } - // Check buffer higher limit - else if (start <= lastBufferItem && end > lastBufferItem) { - mTotalCount = mTotalCount-(end-lastBufferItem); - simpleRemoveItems(lastBufferItem+1, end); - mTotalCount = mTotalCount-(lastBufferItem-start+1); - simpleRemoveItems(start, lastBufferItem); - // Order does matter - mTotalCount = mTotalCount-(end-lastBufferItem); - simpleRemoveItems(lastBufferItem+1, end); - mTotalCount = mTotalCount-(lastBufferItem-start+1); - simpleRemoveItems(start, lastBufferItem); - } - // Check buffer lower limit - else if (start < mBufferPosition && end >= mBufferPosition) { - // Order does matter - mTotalCount = mTotalCount-(end-mBufferPosition+1); - simpleRemoveItems(mBufferPosition, end); - mTotalCount = mTotalCount-(mBufferPosition-start); - simpleRemoveItems(start, mBufferPosition-1); - } - else { - mTotalCount = mTotalCount-removedItemCount; - simpleRemoveItems(start, end); - } -} - -void HgScrollBufferManager::moveItems(int start, int end, int target) -{ - int lastBufferItem = mBufferPosition+mBufferSize-1; - - INFO("Move" << start << "-" << end << "to" << target << ",buffer:" << mBufferPosition << "-" << lastBufferItem << "total count:" << mTotalCount); - - if (mTotalCount < mBufferSize) { - // Do nothing - } - else if (start < mBufferPosition && end > lastBufferItem) { - resetBuffer(mBufferPosition, mTotalCount); - } - else if (start > lastBufferItem && target > lastBufferItem) { - // Do nothing - } - else if (start > lastBufferItem && target < mBufferPosition) { - simpleAddItems(start, end); - } - else if (end < mBufferPosition && target < mBufferPosition) { - // Do nothing - } - else if (end < mBufferPosition && target > lastBufferItem) { - simpleRemoveItems(start, end); - } - else if (start >= mBufferPosition && end <= lastBufferItem && - target >= mBufferPosition && target <= lastBufferItem) { - // Do nothing - } - else { - // Rare and complicated use cases: reset the whole buffer - resetBuffer(mBufferPosition, mTotalCount); - } -} - -void HgScrollBufferManager::flushRequestBuffers() -{ - FUNC_LOG; - - qSort(mReleaseBuffer); - int releaseCount = mReleaseBuffer.count(); - int lastReleased = -1; - for (int i = 0; i < releaseCount; i++) { - UpdatePair update = mReleaseBuffer.at(i); - emit releaseItems(qMax(lastReleased+1, update.start()), update.end()); - lastReleased = update.end(); - } - mReleaseBuffer.clear(); - - qSort(mRequestBuffer); - int requestCount = mRequestBuffer.count(); - int lastRequested = -1; - for (int i = 0; i < requestCount; i++) { - UpdatePair update = mRequestBuffer.at(i); - emit requestItems(qMax(lastRequested+1, update.start()), update.end()); - lastRequested = update.end(); - } - mRequestBuffer.clear(); -} - -int HgScrollBufferManager::changeBufferPosition(int newPos) -{ - FUNC_LOG; - INFO("Change buffer position to" << newPos << "total count:" << mTotalCount); - HANDLE_ERROR_BOOL((newPos >= 0)); - HANDLE_ERROR_BOOL((newPos+mBufferSize <= mTotalCount)); - - int bufferShift = newPos-mBufferPosition; - if (bufferShift > 0) { - mRequestBuffer.shiftRight(mBufferPosition, bufferShift); - mReleaseBuffer.shiftRight(mBufferPosition, bufferShift); - } - else if (bufferShift < 0) { - mRequestBuffer.shiftLeft(mBufferPosition, -bufferShift); - mReleaseBuffer.shiftLeft(mBufferPosition, -bufferShift); - } - mBufferPosition = newPos; - return bufferShift; -} - -/** - This function manages only simple item additions: all items are either - outside the buffer or inside it. - Firs call prepare, then update model, then call fecth. -*/ -void HgScrollBufferManager::simpleAddItems(int start, int end) -{ - FUNC_LOG; - - int lastBufferItem = mBufferPosition+mBufferSize-1; - int numAddedItems = end-start+1; // [start, end] inclusive - - if (mTotalCount < mBufferSize) { - appendRequestBuffer(start, numAddedItems); - } - else if (start > lastBufferItem) { - // Do nothing - } - else if (start <= mBufferPosition) { - changeBufferPosition(mBufferPosition+numAddedItems); - // No need to fetch items, the indexes just change - } - else { - // free from end - appendReleaseBuffer(lastBufferItem+1-numAddedItems, numAddedItems); - mReleaseBuffer.shiftRight(start, numAddedItems); - mRequestBuffer.shiftRight(start, numAddedItems); - appendRequestBuffer(start, numAddedItems); - } -} - -/** - This function manages only simple item removals: all items are either - outside the buffer or inside it. - Firs call prepare, then update model, then call fecth. -*/ -void HgScrollBufferManager::simpleRemoveItems(int start, int end) -{ - FUNC_LOG; - - int lastBufferItem = mBufferPosition+mBufferSize-1; - int numRemovedItems = end-start+1; // [start, end] inclusive - - if (start > lastBufferItem) { - // Do nothing - } - else if (end < mBufferPosition) { - changeBufferPosition(qMax(0, mBufferPosition-numRemovedItems)); - // No need to fetch items, the indexes just change - } - else { - if (mTotalCount < mBufferPosition+mBufferSize) { - // Buffer is at the end of items - int bufferShift = changeBufferPosition(qMax(0, mTotalCount-mBufferSize)); - // Fetch from beginning - // Releasing removed items has been done outside this class - appendRequestBuffer(mBufferPosition, qAbs(bufferShift)); - } - else { - // Fetch from end - appendRequestBuffer(lastBufferItem+1-numRemovedItems, numRemovedItems); - } - } -} - -void HgScrollBufferManager::appendRequestBuffer(int start, int count) -{ - FUNC_LOG; - INFO("Request items" << start << ":" << count) - - mRequestBuffer.add(start, count); - mReleaseBuffer.remove(start, count); -} - -void HgScrollBufferManager::appendReleaseBuffer(int start, int count) -{ - FUNC_LOG; - INFO("Release items" << start << ":" << count) - - mReleaseBuffer.add(start, count); - mRequestBuffer.remove(start, count); -} - -UpdatePair::UpdatePair(int start, int count) : mStart(start), mCount(count) -{ - HANDLE_ERROR_BOOL(mCount > 0); -} - -int UpdatePair::start() const -{ - return mStart; -} - -int UpdatePair::end() const -{ - return mStart+mCount-1; -} - -bool UpdatePair::adjacent(int start, int count) const -{ - if (start+count < mStart) return false; - if (start > mStart+mCount) return false; - return true; -} - -bool UpdatePair::contains(const UpdatePair &other) const -{ - if (other.mStart+other.mCount-1 < mStart) return false; - if (other.mStart > mStart+mCount-1) return false; - return true; -} - -void UpdatePair::extend(int start, int count) -{ - int end = qMax(mStart+mCount, start+count); - mStart = qMin(mStart, start); - mCount = end-mStart; - INFO("Pair extended to:" << mStart << ":" << mCount); -} - -void UpdatePair::subtract(int start, int count) -{ - int end = qMin(mStart+mCount, start+count); - mStart = qMax(mStart, start); - mCount = end-mStart; - INFO("Pair reduced to:" << mStart << ":" << mCount); -} - -void UpdatePair::shiftRight(int count) -{ - mStart += count; - INFO("Pair shifted to:" << mStart << ":" << mCount); -} - -void UpdatePair::shiftLeft(int count) -{ - mStart -= count; - HANDLE_ERROR_BOOL((mStart >= 0)); - INFO("Pair shifted to:" << mStart << ":" << mCount); -} - -bool UpdatePair::operator== (const UpdatePair &other) const -{ - return mStart == other.mStart && mCount == other.mCount; -} - -bool UpdatePair::operator< (const UpdatePair &other) const -{ - return (mStart < other.mStart || mStart == other.mStart && mCount < other.mCount); -} - -UpdateBuffer::UpdateBuffer() -{ - FUNC_LOG; -} - -void UpdateBuffer::add(int start, int count) -{ - FUNC_LOG; - - int itemCount = this->count(); - for (int i = 0; i < itemCount; i++) { - if (at(i).contains(UpdatePair(start, count))) { - // It is already there - return; - } - if (at(i).adjacent(start, count)) { - (*this)[i].extend(start, count); - return; - } - } - append(UpdatePair(start, count)); -} - -void UpdateBuffer::remove(int start, int count) -{ - FUNC_LOG; - - int itemCount = this->count(); - for (int i = itemCount-1; i >= 0; i--) { - UpdatePair pair = at(i); - UpdatePair comp = UpdatePair(start, count); - if (comp.contains(pair)) { - INFO("Removing pair" << pair.start() << "-" << pair.end()); - removeAt(i); - } - else if (pair.contains(comp)) { - // Subtraction from middle is not applicable in mediawall use cases - (*this)[i].subtract(start, count); - } - // Item may be present in multiple pairs. - } -} - -void UpdateBuffer::shiftRight(int startingFrom, int amount) -{ - FUNC_LOG; - - int itemCount = this->count(); - for (int i = 0; i < itemCount; i++) { - if (at(i).start() >= startingFrom) { - (*this)[i].shiftRight(amount); - } - } -} - -void UpdateBuffer::shiftLeft(int startingFrom, int amount) -{ - FUNC_LOG; - - int itemCount = this->count(); - for (int i = 0; i < itemCount; i++) { - if (at(i).start() >= startingFrom) { - (*this)[i].shiftLeft(amount); - } - } -} diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/hgcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ganeswidgets/src/hgcontainer.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -0,0 +1,1178 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include +#include "hgcontainer.h" +#include "hgmediawallrenderer.h" +#include "hgquad.h" +#include "hgvgquadrenderer.h" +#include "hgvgimage.h" +#include "hgwidgetitem.h" +#include "trace.h" + +#include +#include +#include +#include +#include +#include +#include "hglongpressvisualizer.h" + +static const qreal KSpringKScrolling(50.0); +static const qreal KSpringKScrollBar(10.0); +static const qreal KSpringDampingScrolling(20.0); +static const qreal KSpringDampingScrollBar(5.0); +static const qreal KFramesToZeroVelocity(60.0); +static const int KLongTapDuration(400); + + +HgContainer::HgContainer(QGraphicsItem* parent) : + HbWidget(parent), + mQuadRenderer(0), + mRenderer(0), + mTapCount(0), + mAnimateUsingScrollBar(false), + mSelectionMode(HgWidget::NoSelection), + mSelectionModel(0), + mMarkImageOn(0), + mMarkImageOff(0), + mSpringVelAtDragStart(0), + mDragged(false), + mFramesDragged(0), + mHitItemView(NULL), + mLongPressVisualizer(NULL), + mLongPressTimer(NULL), + mHitItemIndex(-1), + mItemSizePolicy(HgWidget::ItemSizeAutomatic), + mOrientation(Qt::Vertical), + mDelayedScrollToIndex(), + mIgnoreGestureAction(false) +{ + FUNC_LOG; + + setFlag(QGraphicsItem::ItemHasNoContents, false); + + grabGesture(Qt::PanGesture); + grabGesture(Qt::TapGesture); +} + +HgContainer::~HgContainer() +{ + FUNC_LOG; + + qDeleteAll(mItems); + mItems.clear(); + delete mMarkImageOn; + delete mMarkImageOff; + delete mRenderer; +} + +void HgContainer::setItemCount(int itemCount) +{ + FUNC_LOG; + + qDeleteAll(mItems); + mItems.clear(); + for (int i=0; igetRowCount() : 0; +} + +QList HgContainer::items() const +{ + return mItems; +} + +HgWidgetItem* HgContainer::itemByIndex(const QModelIndex& index) const +{ + foreach (HgWidgetItem* item, mItems) { + if (item->modelIndex() == index) + return item; + } + + return 0; +} + +HgWidgetItem* HgContainer::itemByIndex(const int& index) const +{ + if (mItems.count() > index && index >= 0) + return mItems.at(index); + else + return 0; +} + +/*! + Changes the selection model of the container. + Ownership is not transferred. + Widget is redrawn to make new selection visible. +*/ +void HgContainer::setSelectionModel(QItemSelectionModel *selectionModel, const QModelIndex &defaultItem) +{ + FUNC_LOG; + HANDLE_ERROR_NULL(selectionModel); // Parameter is always a valid QItemSelectionModel + + if (mSelectionModel == selectionModel) return; + + bool defaultCurrentSet(false); + + if (!selectionModel->currentIndex().isValid()) { // If there is valid current item, do not change it + if (!mSelectionModel && defaultItem.isValid()) { // mSelectionModel is 0 when called first time + selectionModel->setCurrentIndex(defaultItem, QItemSelectionModel::Current); + defaultCurrentSet = true; + } + else if (mSelectionModel && mSelectionModel->currentIndex().isValid()) { + selectionModel->setCurrentIndex(mSelectionModel->currentIndex(), + QItemSelectionModel::Current); + } + } + + mSelectionModel = selectionModel; + + if (mSelectionModel->currentIndex().isValid() && !defaultCurrentSet) { + scrollTo(mSelectionModel->currentIndex()); + } + else { + update(); + } +} + +/*! + Returns the selection model of the container. + Ownership is not transferred. +*/ +QItemSelectionModel *HgContainer::selectionModel() const +{ + FUNC_LOG; + + return mSelectionModel; +} + +/*! + Changes the selection mode of the container (no selection/multiselection). +*/ +void HgContainer::setSelectionMode(HgWidget::SelectionMode mode, bool resetSelection) +{ + FUNC_LOG; + + if (mSelectionMode != mode) { + mSelectionMode = mode; + + if (mSelectionModel && resetSelection) { + mSelectionModel->clearSelection(); + update(); + } + } +} + +/*! + Returns the selection mode of the container (no selection/multiselection). +*/ +HgWidget::SelectionMode HgContainer::selectionMode() const +{ + FUNC_LOG; + + return mSelectionMode; +} + +void HgContainer::dimensions(qreal &screenSize, qreal &worldSize) +{ + const QRectF containerRect(rect()); + + 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(); + } + else{ + screenSize = containerRect.width()/(mRenderer->getImageSize().width() + mRenderer->getSpacing().width()); + worldSize = worldWidth(); + } +} + +Qt::Orientation HgContainer::orientation() const +{ + FUNC_LOG; + + return mOrientation; +} + +void HgContainer::setOrientation(Qt::Orientation orientation, bool animate) +{ + FUNC_LOG; + + mOrientation = orientation; + mRenderer->setOrientation(orientation); + mRenderer->setScrollDirection(orientation, animate); + if (mSpring.isActive()) { + // Need to stop scrolling. + mSpring.cancel(); + } +} + +void HgContainer::scrollToPosition(qreal value, bool animate) +{ + FUNC_LOG; + + scrollToPosition(QPointF(value*worldWidth(), 0), animate); +} + +void HgContainer::scrollToPosition(const QPointF& pos, bool animate) +{ + FUNC_LOG; + + mAnimateUsingScrollBar = animate; + initSpringForScrollBar(); + + if (animate) + mSpring.animateToPos(pos); + else + mSpring.gotoPos(pos); +} + +void HgContainer::scrollTo(const QModelIndex &index) +{ + FUNC_LOG; + INFO("Scrolling to" << index); + + 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; + return; + } + + // 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(); + } + } +} + +void HgContainer::itemDataChanged(const QModelIndex &firstIndex, const QModelIndex &lastIndex) +{ + FUNC_LOG; + + // TODO, fix this + int columns = firstIndex.model()->columnCount(QModelIndex()); + + // Check this!! + int index = columns*firstIndex.row()+firstIndex.column(); + int index2 = columns*lastIndex.row()+lastIndex.column(); + + // convert indeces to match one dimensional item array + itemDataChanged( index, index2 ); +} + +void HgContainer::addItems(int start, int end) +{ + FUNC_LOG; + HANDLE_ERROR_NULL(mSelectionModel); + + int first = qBound(0, start, mItems.count()-1); + int last = qBound(0, end, mItems.count()-1); + for (int i = 0; i <= end-start; i++) { + HgWidgetItem* item = new HgWidgetItem(mQuadRenderer); + mItems.insert(start, item); + } + scrollTo(mSelectionModel->currentIndex()); +} + +void HgContainer::removeItems(int start, int end) +{ + FUNC_LOG; + HANDLE_ERROR_NULL(mSelectionModel); + + int first = qBound(0, start, mItems.count()-1); + int last = qBound(0, end, mItems.count()-1); + for (int i = last; i >= first; i--) { + delete mItems.at(i); + mItems.removeAt(i); + } + scrollTo(mSelectionModel->currentIndex()); +} + +void HgContainer::moveItems(int start, int end, int destination) +{ + FUNC_LOG; + HANDLE_ERROR_NULL(mSelectionModel); + + int first = qBound(0, start, mItems.count()-1); + int last = qBound(0, end, mItems.count()-1); + int target = qBound(0, destination, mItems.count()-1); + + if (target < first) { + for (int i = 0; i <= last-first; i++) { + mItems.move(first+i, target+i); + } + } + else if (target > last) { + for (int i = 0; i <= last-first; i++) { + mItems.move(last-i, target); + } + } + // else do nothing + scrollTo(mSelectionModel->currentIndex()); +} + +int HgContainer::imageCount() const +{ + return mItems.count(); +} + +const HgImage *HgContainer::image(int index) const +{ + return mItems[index]->image(); +} + +int HgContainer::flags(int index) const +{ + if (index >= 0 && index < itemCount()) { + if (mSelectionMode != HgWidget::NoSelection) { + if (mSelectionModel && mSelectionModel->isSelected(mSelectionModel->model()->index(index, 0))) { + return 1; // TODO: Assign flag to mark indicator + } else + return 2; + } + } + return 0; +} + +const HgImage *HgContainer::indicator(int flags) const +{ + if (flags & 1) { + return mMarkImageOn; + } + else if (flags & 2) { + return mMarkImageOff; + } + + return 0; +} + +void HgContainer::updateBySpringPosition() +{ + // spring works always in one dimension, that is, x coord. + qreal pos = mSpring.pos().x(); + + onScrollPositionChanged(pos); + + emit scrollPositionChanged(pos, mAnimateUsingScrollBar); + update(); +} + +void HgContainer::redraw() +{ + update(); +} + +void HgContainer::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + 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()) + { + qreal pos = mSpring.pos().x(); + onScrollPositionChanged(pos); + emit scrollPositionChanged(pos, true); + } + + 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 + // zero when dragging starts + qreal springVel = mSpring.velocity().x(); + if (mDragged) { + qreal t = qBound(mFramesDragged / KFramesToZeroVelocity, 0.0f, 1.0f); + springVel = mSpringVelAtDragStart * (1.0f - t); + mFramesDragged++; + } + + // setup rendering and draw the current view + mRenderer->setCameraDistance(getCameraDistance(springVel)); + mRenderer->setCameraRotationY(getCameraRotationY(springVel)); + mRenderer->draw(mSpring.startPos(), mSpring.pos(), mSpring.endPos(), + springVel, painter, sceneTransform(), rect()); + + painter->setRenderHint(QPainter::SmoothPixmapTransform, (hints.testFlag(QPainter::SmoothPixmapTransform)) ); +} + +void HgContainer::resizeEvent(QGraphicsSceneResizeEvent *event) +{ + 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); +} + +void HgContainer::gestureEvent(QGestureEvent *event) +{ + FUNC_LOG; + + if (mItems.count() == 0) { + // we have no items so no need to handle the gesture. + event->ignore(); + return; + } + + bool eventHandled(false); + // Event may contain more than one gesture type + HbTapGesture *tap = 0; + if (QGesture *gesture = event->gesture(Qt::TapGesture)) { + tap = static_cast(event->gesture(Qt::TapGesture)); + if (tap->tapStyleHint() == HbTapGesture::TapAndHold) { + eventHandled = handleLongTap(tap->state(), + mapFromScene(event->mapToGraphicsScene(tap->hotSpot()))); + + } else { + eventHandled = handleTap(tap->state(), + mapFromScene(event->mapToGraphicsScene(tap->hotSpot()))); + } + } + if (QGesture *pan = event->gesture(Qt::PanGesture)) { + eventHandled = handlePanning(static_cast(pan)); + } else if( mIgnoreGestureAction && tap && tap->state() == Qt::GestureCanceled ) { + // user has tapped or long pressed in grid while scrolling so we need to + // stop the 3d effect. + mSpring.resetVelocity(); + update(); + mIgnoreGestureAction = false; + } + + eventHandled ? event->accept() : event->ignore(); +} + +void HgContainer::init(Qt::Orientation scrollDirection) +{ + FUNC_LOG; + + mRenderer = createRenderer(scrollDirection); + mOrientation = scrollDirection; + + mQuadRenderer = mRenderer->getRenderer(); + + // Fetch icons for marking mode (on and off states). + + mMarkImageOn = mQuadRenderer->createNativeImage(); + HANDLE_ERROR_NULL(mMarkImageOn); + mMarkImageOff = mQuadRenderer->createNativeImage(); + HANDLE_ERROR_NULL(mMarkImageOff); + + // Since there is no way to create the icons directly currently + // lets create HbCheckBox and ask primitives from it. + HbCheckBox* checkBox = new HbCheckBox(); + checkBox->setCheckState(Qt::Checked); + QGraphicsItem *icon = checkBox->HbWidget::primitive("icon"); + HbIconItem *iconItem = 0; + if (icon) { + iconItem = static_cast(icon); + if (mMarkImageOn) { + mMarkImageOn->setPixmap(iconItem->icon().pixmap()); + } + } + checkBox->setCheckState(Qt::Unchecked); + icon = checkBox->HbWidget::primitive("icon"); + if (icon) { + iconItem = static_cast(icon); + if (mMarkImageOff) { + mMarkImageOff->setPixmap(iconItem->icon().pixmap()); + } + } + delete checkBox; + + 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(ended()), SLOT(onScrollingEnded())); + connect(mRenderer, SIGNAL(renderingNeeded()), SLOT(redraw())); + +} + +qreal HgContainer::worldWidth() const +{ + return (qreal)mRenderer->getWorldWidth(); +} + +void HgContainer::initSpringForScrollBar() +{ + FUNC_LOG; + + mSpring.setDamping(KSpringDampingScrollBar); + mSpring.setK(KSpringKScrollBar); +} + +void HgContainer::initSpringForScrolling() +{ + FUNC_LOG; + + mSpring.setDamping(KSpringDampingScrolling); + mSpring.setK(KSpringKScrolling); +} + +void HgContainer::boundSpring() +{ + FUNC_LOG; + + qreal x = mSpring.endPos().x(); + x = qBound(qreal(0), x, worldWidth()); + if (mRenderer->coverflowModeEnabled()) { + qreal i = floorf(x); + x = (x - i > 0.5f) ? ceilf(x) : i; + mSpring.animateToPos(QPointF(x, 0)); + } + + mSpring.animateToPos(QPointF(x, 0)); + +} + +bool HgContainer::handlePanning(QPanGesture *gesture) +{ + mAnimateUsingScrollBar = false; + initSpringForScrolling(); + + qreal pos = mSpring.pos().x(); + qreal delta(0); + qreal itemSide(0); + + if (mOrientation == mRenderer->getScrollDirection()) { + delta = gesture->delta().y(); + } + else { + delta = gesture->delta().x(); + } + + if (mRenderer->getScrollDirection() == Qt::Vertical) + itemSide = mRenderer->getImageSize().height()+mRenderer->getSpacing().height(); + else + itemSide = mRenderer->getImageSize().width()+mRenderer->getSpacing().width(); + + if (gesture->state() == Qt::GestureStarted) { + mOffsetAtDragStart = gesture->offset(); + } + else if (gesture->state() == Qt::GestureUpdated) { + QPointF offset = gesture->offset(); + QPointF offsetDelta = offset - mOffsetAtDragStart; + if (!mDragged && (qAbs(offsetDelta.x()) > 8 || + qAbs(offsetDelta.y()) > 8)) { + mDragged = true; + mDrag.reset(delta, mSpring.pos().x()); + mDragged = true; + mSpringVelAtDragStart = mSpring.velocity().x(); + mFramesDragged = 0; + } + + if (mDragged) + { + emit scrollingStarted(); + + qreal newPosition = mDrag.update(delta, pos, itemSide); + if (qAbs(newPosition - mSpring.pos().x()) > 0.01f) { + mSpring.gotoPos(QPointF(newPosition, 0)); + if (mRenderer->coverflowModeEnabled()) { + emit scrollPositionChanged(newPosition,true); + update(); + } else { + updateBySpringPosition(); + } + } + } + } + else if (mDragged && gesture->state() == Qt::GestureFinished) { + mDrag.update(delta, pos, itemSide); + mDragged = false; + qreal newPos(0); + if (mDrag.finish(pos, mRenderer->coverflowModeEnabled(), newPos)) { + mSpring.animateToPos(QPointF(qBound(qreal(0), newPos, worldWidth()), 0)); + HgWidgetItem* item = itemByIndex(newPos); + if (item && item->modelIndex() != mSelectionModel->currentIndex()) { + // mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); + } + } + else { + boundSpring(); + } + } + else if(!mDragged && gesture->state() == Qt::GestureFinished) { + if (!mRenderer->coverflowModeEnabled()) { + mSpring.resetVelocity(); + update(); + } + } + else if (gesture->state() == Qt::GestureCanceled) { + boundSpring(); + } + + return true; +} + +bool HgContainer::handleTap(Qt::GestureState state, const QPointF &pos) +{ + FUNC_LOG; + + bool handleGesture = false; + + if (hasItemAt(pos)) { + switch (state) + { + case Qt::GestureStarted: + { + if (mRenderer->coverflowModeEnabled() || !mSpring.isActive()) { + mIgnoreGestureAction = false; + startLongPressWatcher(pos); + } else if(mSpring.isActive()) { + mSpring.cancel(); + mIgnoreGestureAction = true; + } + break; + } + case Qt::GestureFinished: + handleGesture = handleItemAction(pos, NormalTap); + case Qt::GestureUpdated: + case Qt::GestureCanceled: + default: + stopLongPressWatcher(); + break; + } + + handleGesture = true; + } else { + mIgnoreGestureAction = true; + } + return handleGesture; +} + +bool HgContainer::handleLongTap(Qt::GestureState state, const QPointF &pos) +{ + FUNC_LOG; + + bool handleGesture = false; + + if (hasItemAt(pos)) { + + switch (state) + { + case Qt::GestureUpdated: + handleItemAction(pos,LongTap); + case Qt::GestureStarted: + case Qt::GestureCanceled: + case Qt::GestureFinished: + default: + stopLongPressWatcher(); + break; + } + handleGesture = true; + } else { + mIgnoreGestureAction = true; + } + + return handleGesture; +} + +/*! + Handle tap, lang tap and double tap action. + Finds out the item in the tap position and sends out suitable signal, + Sets the item as the current item and in multiselection mode toggles the + item selection status. +*/ +bool HgContainer::handleItemAction(const QPointF &pos, ItemActionType action) +{ + FUNC_LOG; + + // If there is content, mSelectionModel must always exist - either default or client-provided + if (!mSelectionModel) return false; + + int index = -1; + mHitItem = getItemAt(pos, index); + if (mHitItem) + { + HgWidgetItem* item = itemByIndex(index); + if (item && action != DoubleTap) { + if (action == LongTap) { + INFO("Long tap:" << item->modelIndex().row()); + + if (!mRenderer->coverflowModeEnabled()) { + selectItem(index); + } else { + mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); + } + + if (!mIgnoreGestureAction) { + emit longPressed(item->modelIndex(), pos); + } else { + mSpring.resetVelocity(); + update(); + mIgnoreGestureAction = false; + } + } + else if (mSelectionMode == HgWidget::MultiSelection) { + mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); + INFO("Select:" << item->modelIndex().row()); + mSelectionModel->select(item->modelIndex(), QItemSelectionModel::Toggle); + update(); // It would be enough to update the item + } + else if (mSelectionMode == HgWidget::SingleSelection) { + mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); + INFO("Select:" << item->modelIndex().row()); + mSelectionModel->select(item->modelIndex(), QItemSelectionModel::ClearAndSelect); + update(); // It would be enough to update the item + } + else if (mSelectionMode == HgWidget::ContiguousSelection) { + mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); + QModelIndex newSelected = item->modelIndex(); + QModelIndexList oldSelection = mSelectionModel->selectedIndexes(); + INFO("Select:" << newSelected.row()); + if (oldSelection.count() > 0 && !mSelectionModel->isSelected(newSelected)) { + if (newSelected.row() < oldSelection.front().row()) { + mSelectionModel->select(QItemSelection(newSelected, oldSelection.back()), + QItemSelectionModel::Select); + } + else { // newSelected.row() > oldSelection.back().row() + mSelectionModel->select(QItemSelection(oldSelection.front(), newSelected), + QItemSelectionModel::Select); + } + } + else { + mSelectionModel->select(newSelected, QItemSelectionModel::Select); + } + update(); // It would be enough to update the item + } + else { + INFO("Tap:" << item->modelIndex().row()); + + if (mRenderer->coverflowModeEnabled()) { //coverflow and t-bone modes + if (qAbs(qreal(index) - mSpring.pos().x()) < 0.01f) + { + mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); + emit activated(item->modelIndex()); + } + else + { + mSpring.animateToPos(QPointF(index, 0)); + } + } + else { //grid mode + if (!mIgnoreGestureAction) { + // Current should be topleft item. +// mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); + selectItem(index); + emit activated(item->modelIndex()); + } else { + mSpring.resetVelocity(); + update(); + mIgnoreGestureAction = false; + } + } + } + } + + return true; + } + else { + INFO("No quad at pos:" << pos); + + unselectItem(); + return false; + } +} + +bool HgContainer::getItemPoints(int index, QPolygonF& points) +{ + return mRenderer->getItemPoints(index, points); +} + +QList HgContainer::getVisibleItemIndices() const +{ + QList quads = mRenderer->getVisibleQuads(); + QList result; + for (int i = 0; i < quads.count(); i++) { + bool ok; + int index = quads.at(i)->userData().toInt(&ok); + HgWidgetItem *item = itemByIndex(index); + if (item) + result.append(item->modelIndex()); + } + qSort(result); + return result; +} + +void HgContainer::itemDataChanged(const int &firstIndex, const int &lastIndex) +{ + FUNC_LOG; + + int firstItemOnScreen = 0, lastItemOnScreen = 0; + firstItemOnScreen = mSpring.pos().x(); + firstItemOnScreen *= rowCount(); + + int itemsOnScreen = mRenderer->getVisibleQuads().count(); + lastItemOnScreen = firstItemOnScreen+itemsOnScreen; + + if ( itemsOnScreen == 0 || (firstIndex >= firstItemOnScreen && firstIndex < lastItemOnScreen) || + (lastIndex >= firstItemOnScreen && lastIndex < lastItemOnScreen)) { + update(); + } +} + +void HgContainer::selectItem(int index) +{ + Q_UNUSED(index) + // TODO: replace this with own selection implementation +/* if (index < 0 && index >= mItems.count()) + return; + + mHitItemIndex = index; + + if (mHitItemView) + { + delete mHitItemView; + mHitItemView = NULL; + } + + mHitItemView = new HbGridViewItem(this); + mHitItemView->setVisible(false); + mHitItemView->setPos(QPointF(0,0)); + mHitItemView->setPressed(true, false); + + const QImage& image = mItems[mHitItemIndex]->image()->getQImage(); + if (image.isNull()) + { + mHitItemView->setVisible(false); + return; + } + + QPixmap pixmap = QPixmap::fromImage(image); + HbIcon icon(pixmap.scaled(mRenderer->getImageSize().toSize(), Qt::IgnoreAspectRatio)); + QGraphicsItem* item = mHitItemView->style()->createPrimitive(HbStyle::P_GridViewItem_icon, mHitItemView); + HbIconItem *iconItem = static_cast(item); + iconItem->setAlignment(Qt::AlignCenter); + iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio); + iconItem->setIcon(icon); + + mHitItemView->resize(mRenderer->getImageSize().width(), + mRenderer->getImageSize().height()); + */ +} + +void HgContainer::updateSelectedItem() +{ + if (!mHitItemView || mHitItemIndex == -1) + return; + + QPolygonF points; + if (!getItemPoints(mHitItemIndex, points)) + { + // the item was not rendered, we must hide + // our qt item + mHitItemView->setVisible(false); + return; + } + + QRectF bounds = points.boundingRect(); + if (!(rect().contains(bounds) || rect().intersects(bounds))) + { + mHitItemView->setVisible(false); + return; + } + + QPolygonF img; + img.append(QPointF(3,mHitItemView->boundingRect().height()-3)); + img.append(QPointF(mHitItemView->boundingRect().width()-3,mHitItemView->boundingRect().height()-3)); + img.append(QPointF(mHitItemView->boundingRect().width()-3,3)); + img.append(QPointF(3,3)); + + QTransform t; + QTransform::quadToQuad(img, points, t); + + //t.translate(50,50); + bool bOk; + mHitItemView->setTransform(t * this->transform().inverted(&bOk)); + mHitItemView->setVisible(true); +} + +void HgContainer::unselectItem() +{ + mHitItemIndex = -1; + if (mHitItemView) + { + mHitItemView->setVisible(false); + } +} + +void HgContainer::updateLongPressVisualizer() +{ + int elapsed = mLongTapDuration.elapsed(); + + if (elapsed > 80) + { + int frame = 100.0f * qreal(elapsed - 80) / qreal(KLongTapDuration - 80); + mLongPressVisualizer->setFrame(frame); + } +} + +bool HgContainer::hasItemAt(const QPointF& pos) +{ + int dummy; + HgWidgetItem *item = getItemAt(pos, dummy); + if (item) { + return item->modelIndex().isValid(); + } + return false; +} + +HgWidgetItem* HgContainer::getItemAt(const QPointF& pos, int& index) +{ + HgQuad* quad = mRenderer->getQuadAt(pos); + if (quad) + { + bool ok; + index = quad->userData().toInt(&ok); + + HgWidgetItem* item = itemByIndex(index); + return item; + } + return NULL; +} + +void HgContainer::startLongPressWatcher(const QPointF& pos) +{ + if (!mLongPressVisualizer) + { + mLongPressVisualizer = new HgLongPressVisualizer(this); + mLongPressVisualizer->setZValue(zValue()+1); + } + + mLongPressVisualizer->start(pos); + + if (!mLongPressTimer) + { + mLongPressTimer = new QTimer(this); + QObject::connect(mLongPressTimer, SIGNAL(timeout()), this, SLOT(updateLongPressVisualizer())); + } + + mLongPressTimer->start(20); + + mLongTapDuration.start(); +} + +void HgContainer::stopLongPressWatcher() +{ + if (mLongPressTimer && mLongPressVisualizer) + { + mLongPressTimer->stop(); + mLongPressVisualizer->stop(); + } +} + +qreal HgContainer::getCameraDistance(qreal springVelocity) +{ + Q_UNUSED(springVelocity) + return 0; +} + +qreal HgContainer::getCameraRotationY(qreal springVelocity) +{ + Q_UNUSED(springVelocity) + return 0; +} + +void HgContainer::handleTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex) +{ + Q_UNUSED(pos) + Q_UNUSED(hitItem) + Q_UNUSED(hitItemIndex) +} + +void HgContainer::handleLongTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex) +{ + Q_UNUSED(pos) + Q_UNUSED(hitItem) + Q_UNUSED(hitItemIndex) +} + +void HgContainer::onScrollPositionChanged(qreal pos) +{ + Q_UNUSED(pos) +} + +void HgContainer::onScrollingStarted() +{ + // By default do nothing +} + +void HgContainer::onScrollingEnded() +{ + // By default do nothing +} + +void HgContainer::setDefaultImage(QImage defaultImage) +{ + HgQuadRenderer *renderer = mRenderer->getRenderer(); + if (renderer) { + QImage scaled = defaultImage.scaled(mRenderer->getImageSize().toSize()); + renderer->setDefaultImage(scaled); + } +} + +void HgContainer::setItemSizePolicy(HgWidget::ItemSizePolicy policy) +{ + if (policy != mItemSizePolicy) + { + mItemSizePolicy = policy; + + updateItemSizeAndSpacing(); + } +} + +HgWidget::ItemSizePolicy HgContainer::itemSizePolicy() const +{ + return mItemSizePolicy; +} + +void HgContainer::setItemSize(const QSizeF& size) +{ + mUserItemSize = size; + updateItemSizeAndSpacing(); +} + +QSizeF HgContainer::itemSize() const +{ + return mRenderer->getImageSize(); +} + +void HgContainer::setItemSpacing(const QSizeF& spacing) +{ + mUserItemSpacing = spacing; + updateItemSizeAndSpacing(); +} + +QSizeF HgContainer::itemSpacing() const +{ + return mRenderer->getSpacing(); +} + +void HgContainer::updateItemSizeAndSpacing() +{ + if (mItemSizePolicy == HgWidget::ItemSizeUserDefined) + { + mRenderer->setImageSize(mUserItemSize); + mRenderer->setSpacing(mUserItemSpacing); + } +} + +QSizeF HgContainer::getAutoItemSize() const +{ + return mUserItemSize; +} + +QSizeF HgContainer::getAutoItemSpacing() const +{ + return mUserItemSpacing; +} + +Qt::Orientation HgContainer::scrollDirection() const +{ + return mRenderer->getScrollDirection(); +} + +qreal HgContainer::scrollPosition() const +{ + return mSpring.pos().x(); +} + +// EOF diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/hgcoverflowcontainer.cpp --- a/ganeswidgets/src/hgcoverflowcontainer.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/src/hgcoverflowcontainer.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include "hgcoverflowcontainer.h" #include "hgmediawallrenderer.h" #include "hgwidgetitem.h" @@ -46,9 +46,10 @@ // events void HgCoverflowContainer::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + QPainter::RenderHints hints = painter->renderHints(); painter->setRenderHint(QPainter::Antialiasing, true); HgContainer::paint(painter, option, widget); - painter->setRenderHint(QPainter::Antialiasing, false); + painter->setRenderHint(QPainter::Antialiasing, (hints.testFlag(QPainter::Antialiasing)) ); } // from HgContainer diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/hgimagefader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ganeswidgets/src/hgimagefader.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -0,0 +1,73 @@ +/* +* 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 "hgimagefader.h" +#include "hgimage.h" + +HgImageFader::HgImageFader() +{ + QObject::connect(&mTimer, SIGNAL(timeout()), this, SLOT(doFading())); +} + +HgImageFader::~HgImageFader() +{ + if (mTimer.isActive()) + mTimer.stop(); +} + +void HgImageFader::addImage(HgImage* image) +{ + mImages.push_back(image); +} + +void HgImageFader::removeImage(HgImage* image) +{ + mImages.removeOne(image); +} + +void HgImageFader::fadeImages() +{ + if (!mImages.empty() && !mTimer.isActive()) + { + mTimer.start(10); + } +} + +void HgImageFader::doFading() +{ + QLinkedList::iterator i = mImages.begin(); + while (i != mImages.end()) + { + HgImage* image = (*i); + image->setAlpha(image->alpha() + 0.1f); + if (image->alpha() >= 1.0f) + { + image->setAlpha(1.0f); + i = mImages.erase(i); + } + else + { + i++; + } + } + + //emit doUpdate(); + + if (mImages.empty()) + { + mTimer.stop(); + } +} diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/hgindexfeedback.cpp --- a/ganeswidgets/src/hgindexfeedback.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/src/hgindexfeedback.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -18,13 +18,13 @@ #include "hgindexfeedback.h" #include "hgindexfeedback_p.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include -#include +#include #include #include diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/hgindexfeedback_p.cpp --- a/ganeswidgets/src/hgindexfeedback_p.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/src/hgindexfeedback_p.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -18,11 +18,11 @@ #include "hgindexfeedback.h" #include "hgindexfeedback_p.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/hglongpressvisualizer.cpp --- a/ganeswidgets/src/hglongpressvisualizer.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/src/hglongpressvisualizer.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -27,7 +27,7 @@ active(false), spanAngle(0) { - + setFlag(QGraphicsItem::ItemHasNoContents, false); } HgLongPressVisualizer::~HgLongPressVisualizer() @@ -42,10 +42,14 @@ Q_UNUSED(widget); if (active) { + QPen oldPen = painter->pen(); + QPen pen( Qt::lightGray ); pen.setWidth(5); painter->setPen(pen); painter->drawArc(rect, 90*16, -spanAngle*16); + + painter->setPen(oldPen); //revert the painter to its old state } } diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/hgmediawall_p.cpp --- a/ganeswidgets/src/hgmediawall_p.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/src/hgmediawall_p.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -15,7 +15,7 @@ * */ -#include +#include #include "hgmediawall_p.h" #include "hgwidgetitem.h" #include "hgcoverflowcontainer.h" diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/hgmediawallrenderer.cpp --- a/ganeswidgets/src/hgmediawallrenderer.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/src/hgmediawallrenderer.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -19,7 +19,7 @@ #include "hgquadrenderer.h" #include "hgquad.h" #include "hgimage.h" -#include "HgImageFader.h" +#include "hgimagefader.h" #include "hgvgquadrenderer.h" #include "hgqtquadrenderer.h" #include diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/hgscrollbuffermanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ganeswidgets/src/hgscrollbuffermanager.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -0,0 +1,589 @@ +/* +* 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 + +#include "hgscrollbuffermanager.h" +#include "trace.h" + +// ----------------------------------------------------------------------------- +// HgScrollBufferManager::HgScrollBufferManager() +// ----------------------------------------------------------------------------- +// +HgScrollBufferManager::HgScrollBufferManager( + int bufferSize, + int bufferTreshold, + int initialPosition, + int totalCount ) +: mBufferSize( bufferSize ), + mBufferTreshold( bufferTreshold ), + mBufferPosition( initialPosition ), + mDiff(0), + mTotalCount( totalCount ), + mResetOrdered(false), + mRequestStart(0), + mRequestCount(0), + mReleaseStart(0), + mReleaseCount(0), + mFirstTime(true) + { + init(); + } + +// ----------------------------------------------------------------------------- +// HgScrollBufferManager::init() +// ----------------------------------------------------------------------------- +// +void HgScrollBufferManager::init() + { + mResetOrdered = ETrue; + mTimer.setSingleShot(true); + connect(&mTimer, SIGNAL(timeout()), this, SLOT(timeout())); + } + +// ----------------------------------------------------------------------------- +// HgScrollBufferManager::~HgScrollBufferManager() +// ----------------------------------------------------------------------------- +// +HgScrollBufferManager::~HgScrollBufferManager() + { + mTimer.stop(); + } + +// ----------------------------------------------------------------------------- +// HgScrollBufferManager::resetBuffer() +// ----------------------------------------------------------------------------- +// +void HgScrollBufferManager::resetBuffer( int aPosition, int totalCount ) + { + if( !mResetOrdered ) + { + // release Old buffer + mReleaseStart = mBufferPosition; + mReleaseCount = mBufferSize; + } + + // set position and count + mBufferPosition = aPosition - (mBufferSize / 2); + mTotalCount = totalCount; + mDiff = 0; + + if( mBufferPosition + mBufferSize > mTotalCount - 1 ) + { + mBufferPosition = mTotalCount - mBufferSize; + } + + if(mBufferPosition < 0 ) + { + mBufferPosition = 0; + } + + //request new Buffer + mRequestStart = mBufferPosition; + mRequestCount = mBufferSize; + mResetOrdered = ETrue; + asyncUpdate(); + } + +void HgScrollBufferManager::scrollPositionChanged( int newPosition ) + { + // If all the items fit in the buffer no need to move the buffer. + if( mTotalCount <= mBufferSize ) return; + + bool forceUpdate = EFalse; + newPosition -= mBufferSize / 2; // normalize index to Buffer start + + if(newPosition < 0) + { + newPosition = 0; + forceUpdate = ETrue; + } + else if( newPosition > mTotalCount - mBufferSize ) + { + newPosition = mTotalCount - mBufferSize; + forceUpdate = ETrue; + } + + mDiff = mBufferPosition - newPosition; + + // Too large change reset whole buffer + if( mDiff >= mBufferSize || -mDiff >= mBufferSize || mResetOrdered ) + { + resetBuffer(newPosition + (mBufferSize/2), mTotalCount ); + } + // Move Up + else if( mDiff >= mBufferTreshold ) + { + mRequestCount = mDiff; + mReleaseCount = mDiff; + asyncUpdate(); + } + // Move Down + else if( -mDiff >= mBufferTreshold ) + { + mRequestCount = -mDiff; + mReleaseCount = -mDiff; + asyncUpdate(); + } + // Top or bottom has been reached + else if( forceUpdate && mDiff ) + { + int diff = mDiff < 0 ? -mDiff : mDiff; + mRequestCount = diff; + mReleaseCount = diff; + asyncUpdate(); + } + } + +void HgScrollBufferManager::timeout() +{ + mFirstTime = false; + + if(mResetOrdered) + { + mResetOrdered = EFalse; + } + else + { + if(mDiff < 0) + { + mReleaseStart = mBufferPosition; + mRequestStart = mBufferPosition + mBufferSize; + } + else if( mDiff > 0) + { + mReleaseStart = mBufferPosition + mBufferSize - mDiff; + mRequestStart = mBufferPosition - mDiff; + } + } + + // Release + int end = mReleaseStart + mReleaseCount < mTotalCount ? + mReleaseStart + mReleaseCount: mTotalCount; + end--; + if(end >= mReleaseStart ) + { + emit releaseItems( mReleaseStart, end ); + } + + mReleaseCount = 0; + + // Request + end = mRequestStart + mRequestCount < mTotalCount ? + mRequestStart + mRequestCount : mTotalCount; + + end--; + if(end >= mRequestStart ) + { + emit requestItems( mRequestStart, end ); + } + + mRequestCount = 0; + + // Move Buffer + mBufferPosition -= mDiff; + // Reset Diff + mDiff = 0; +} + +bool HgScrollBufferManager::positionInsideBuffer( int position ) +{ + return position >= mBufferPosition && position <= (mBufferPosition+mBufferSize); +} + +void HgScrollBufferManager::asyncUpdate() +{ + if (!mTimer.isActive() && mFirstTime) { + mTimer.start(0); + } else if (!mTimer.isActive()){ + timeout(); + } +} + +void HgScrollBufferManager::currentBuffer(int& bufferStart, int& bufferEnd) +{ + bufferStart = mBufferPosition; + bufferEnd = mBufferPosition+mBufferSize > mTotalCount-1 ? + mTotalCount-1 : mBufferPosition+mBufferSize; +} + +void HgScrollBufferManager::addItems(int start, int end) +{ + FUNC_LOG; + + mTotalCount += (end-start+1); + int lastBufferItem = mBufferPosition+mBufferSize-1; + + if (start < mBufferPosition) { + simpleAddItems(start, end); + // New items push the buffer forward, items inside the buffer do not change + } + // Check buffer higher limit + else if (start <= lastBufferItem && end > lastBufferItem) { + simpleAddItems(start, lastBufferItem); + // Items added after the buffer are ignored + } + else { + simpleAddItems(start, end); + } +} + +void HgScrollBufferManager::removeItems(int start, int end) +{ + FUNC_LOG; + + int lastBufferItem = mBufferPosition+mBufferSize-1; + int removedItemCount = end-start+1; + + if (mTotalCount < mBufferSize) { + // Do nothing + } + else if (start > lastBufferItem) { + // Do nothing + } + else if (end < mBufferPosition) { + mTotalCount = mTotalCount-removedItemCount; + simpleRemoveItems(start, end); + } + else if (start < mBufferPosition && end > lastBufferItem) { + mTotalCount = mTotalCount-removedItemCount; + mBufferPosition = qBound(0, mBufferPosition, mTotalCount-mBufferSize); + resetBuffer(mBufferPosition, mTotalCount); + } + // Check buffer higher limit + else if (start <= lastBufferItem && end > lastBufferItem) { + mTotalCount = mTotalCount-(end-lastBufferItem); + simpleRemoveItems(lastBufferItem+1, end); + mTotalCount = mTotalCount-(lastBufferItem-start+1); + simpleRemoveItems(start, lastBufferItem); + // Order does matter + mTotalCount = mTotalCount-(end-lastBufferItem); + simpleRemoveItems(lastBufferItem+1, end); + mTotalCount = mTotalCount-(lastBufferItem-start+1); + simpleRemoveItems(start, lastBufferItem); + } + // Check buffer lower limit + else if (start < mBufferPosition && end >= mBufferPosition) { + // Order does matter + mTotalCount = mTotalCount-(end-mBufferPosition+1); + simpleRemoveItems(mBufferPosition, end); + mTotalCount = mTotalCount-(mBufferPosition-start); + simpleRemoveItems(start, mBufferPosition-1); + } + else { + mTotalCount = mTotalCount-removedItemCount; + simpleRemoveItems(start, end); + } +} + +void HgScrollBufferManager::moveItems(int start, int end, int target) +{ + int lastBufferItem = mBufferPosition+mBufferSize-1; + + INFO("Move" << start << "-" << end << "to" << target << ",buffer:" << mBufferPosition << "-" << lastBufferItem << "total count:" << mTotalCount); + + if (mTotalCount < mBufferSize) { + // Do nothing + } + else if (start < mBufferPosition && end > lastBufferItem) { + resetBuffer(mBufferPosition, mTotalCount); + } + else if (start > lastBufferItem && target > lastBufferItem) { + // Do nothing + } + else if (start > lastBufferItem && target < mBufferPosition) { + simpleAddItems(start, end); + } + else if (end < mBufferPosition && target < mBufferPosition) { + // Do nothing + } + else if (end < mBufferPosition && target > lastBufferItem) { + simpleRemoveItems(start, end); + } + else if (start >= mBufferPosition && end <= lastBufferItem && + target >= mBufferPosition && target <= lastBufferItem) { + // Do nothing + } + else { + // Rare and complicated use cases: reset the whole buffer + resetBuffer(mBufferPosition, mTotalCount); + } +} + +void HgScrollBufferManager::flushRequestBuffers() +{ + FUNC_LOG; + + qSort(mReleaseBuffer); + int releaseCount = mReleaseBuffer.count(); + int lastReleased = -1; + for (int i = 0; i < releaseCount; i++) { + UpdatePair update = mReleaseBuffer.at(i); + emit releaseItems(qMax(lastReleased+1, update.start()), update.end()); + lastReleased = update.end(); + } + mReleaseBuffer.clear(); + + qSort(mRequestBuffer); + int requestCount = mRequestBuffer.count(); + int lastRequested = -1; + for (int i = 0; i < requestCount; i++) { + UpdatePair update = mRequestBuffer.at(i); + emit requestItems(qMax(lastRequested+1, update.start()), update.end()); + lastRequested = update.end(); + } + mRequestBuffer.clear(); +} + +int HgScrollBufferManager::changeBufferPosition(int newPos) +{ + FUNC_LOG; + INFO("Change buffer position to" << newPos << "total count:" << mTotalCount); + HANDLE_ERROR_BOOL((newPos >= 0)); + HANDLE_ERROR_BOOL((newPos+mBufferSize <= mTotalCount)); + + int bufferShift = newPos-mBufferPosition; + if (bufferShift > 0) { + mRequestBuffer.shiftRight(mBufferPosition, bufferShift); + mReleaseBuffer.shiftRight(mBufferPosition, bufferShift); + } + else if (bufferShift < 0) { + mRequestBuffer.shiftLeft(mBufferPosition, -bufferShift); + mReleaseBuffer.shiftLeft(mBufferPosition, -bufferShift); + } + mBufferPosition = newPos; + return bufferShift; +} + +/** + This function manages only simple item additions: all items are either + outside the buffer or inside it. + Firs call prepare, then update model, then call fecth. +*/ +void HgScrollBufferManager::simpleAddItems(int start, int end) +{ + FUNC_LOG; + + int lastBufferItem = mBufferPosition+mBufferSize-1; + int numAddedItems = end-start+1; // [start, end] inclusive + + if (mTotalCount < mBufferSize) { + appendRequestBuffer(start, numAddedItems); + } + else if (start > lastBufferItem) { + // Do nothing + } + else if (start <= mBufferPosition) { + changeBufferPosition(mBufferPosition+numAddedItems); + // No need to fetch items, the indexes just change + } + else { + // free from end + appendReleaseBuffer(lastBufferItem+1-numAddedItems, numAddedItems); + mReleaseBuffer.shiftRight(start, numAddedItems); + mRequestBuffer.shiftRight(start, numAddedItems); + appendRequestBuffer(start, numAddedItems); + } +} + +/** + This function manages only simple item removals: all items are either + outside the buffer or inside it. + Firs call prepare, then update model, then call fecth. +*/ +void HgScrollBufferManager::simpleRemoveItems(int start, int end) +{ + FUNC_LOG; + + int lastBufferItem = mBufferPosition+mBufferSize-1; + int numRemovedItems = end-start+1; // [start, end] inclusive + + if (start > lastBufferItem) { + // Do nothing + } + else if (end < mBufferPosition) { + changeBufferPosition(qMax(0, mBufferPosition-numRemovedItems)); + // No need to fetch items, the indexes just change + } + else { + if (mTotalCount < mBufferPosition+mBufferSize) { + // Buffer is at the end of items + int bufferShift = changeBufferPosition(qMax(0, mTotalCount-mBufferSize)); + // Fetch from beginning + // Releasing removed items has been done outside this class + appendRequestBuffer(mBufferPosition, qAbs(bufferShift)); + } + else { + // Fetch from end + appendRequestBuffer(lastBufferItem+1-numRemovedItems, numRemovedItems); + } + } +} + +void HgScrollBufferManager::appendRequestBuffer(int start, int count) +{ + FUNC_LOG; + INFO("Request items" << start << ":" << count) + + mRequestBuffer.add(start, count); + mReleaseBuffer.remove(start, count); +} + +void HgScrollBufferManager::appendReleaseBuffer(int start, int count) +{ + FUNC_LOG; + INFO("Release items" << start << ":" << count) + + mReleaseBuffer.add(start, count); + mRequestBuffer.remove(start, count); +} + +UpdatePair::UpdatePair(int start, int count) : mStart(start), mCount(count) +{ + HANDLE_ERROR_BOOL(mCount > 0); +} + +int UpdatePair::start() const +{ + return mStart; +} + +int UpdatePair::end() const +{ + return mStart+mCount-1; +} + +bool UpdatePair::adjacent(int start, int count) const +{ + if (start+count < mStart) return false; + if (start > mStart+mCount) return false; + return true; +} + +bool UpdatePair::contains(const UpdatePair &other) const +{ + if (other.mStart+other.mCount-1 < mStart) return false; + if (other.mStart > mStart+mCount-1) return false; + return true; +} + +void UpdatePair::extend(int start, int count) +{ + int end = qMax(mStart+mCount, start+count); + mStart = qMin(mStart, start); + mCount = end-mStart; + INFO("Pair extended to:" << mStart << ":" << mCount); +} + +void UpdatePair::subtract(int start, int count) +{ + int end = qMin(mStart+mCount, start+count); + mStart = qMax(mStart, start); + mCount = end-mStart; + INFO("Pair reduced to:" << mStart << ":" << mCount); +} + +void UpdatePair::shiftRight(int count) +{ + mStart += count; + INFO("Pair shifted to:" << mStart << ":" << mCount); +} + +void UpdatePair::shiftLeft(int count) +{ + mStart -= count; + HANDLE_ERROR_BOOL((mStart >= 0)); + INFO("Pair shifted to:" << mStart << ":" << mCount); +} + +bool UpdatePair::operator== (const UpdatePair &other) const +{ + return mStart == other.mStart && mCount == other.mCount; +} + +bool UpdatePair::operator< (const UpdatePair &other) const +{ + return (mStart < other.mStart || mStart == other.mStart && mCount < other.mCount); +} + +UpdateBuffer::UpdateBuffer() +{ + FUNC_LOG; +} + +void UpdateBuffer::add(int start, int count) +{ + FUNC_LOG; + + int itemCount = this->count(); + for (int i = 0; i < itemCount; i++) { + if (at(i).contains(UpdatePair(start, count))) { + // It is already there + return; + } + if (at(i).adjacent(start, count)) { + (*this)[i].extend(start, count); + return; + } + } + append(UpdatePair(start, count)); +} + +void UpdateBuffer::remove(int start, int count) +{ + FUNC_LOG; + + int itemCount = this->count(); + for (int i = itemCount-1; i >= 0; i--) { + UpdatePair pair = at(i); + UpdatePair comp = UpdatePair(start, count); + if (comp.contains(pair)) { + INFO("Removing pair" << pair.start() << "-" << pair.end()); + removeAt(i); + } + else if (pair.contains(comp)) { + // Subtraction from middle is not applicable in mediawall use cases + (*this)[i].subtract(start, count); + } + // Item may be present in multiple pairs. + } +} + +void UpdateBuffer::shiftRight(int startingFrom, int amount) +{ + FUNC_LOG; + + int itemCount = this->count(); + for (int i = 0; i < itemCount; i++) { + if (at(i).start() >= startingFrom) { + (*this)[i].shiftRight(amount); + } + } +} + +void UpdateBuffer::shiftLeft(int startingFrom, int amount) +{ + FUNC_LOG; + + int itemCount = this->count(); + for (int i = 0; i < itemCount; i++) { + if (at(i).start() >= startingFrom) { + (*this)[i].shiftLeft(amount); + } + } +} diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/hgvgimage.cpp --- a/ganeswidgets/src/hgvgimage.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/src/hgvgimage.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -16,7 +16,7 @@ */ #include "hgvgimage.h" -#include "HgImageFader.h" +#include "hgimagefader.h" #include "hgvgquadrenderer.h" const int KMaxMirrorWidth(128); diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/hgvgquadrenderer.cpp --- a/ganeswidgets/src/hgvgquadrenderer.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/src/hgvgquadrenderer.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -20,7 +20,7 @@ #include "hgquad.h" #include "hgvgimage.h" #include "trace.h" -#include "HgImageFader.h" +#include "hgimagefader.h" #include #include diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/hgwidgets.cpp --- a/ganeswidgets/src/hgwidgets.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/src/hgwidgets.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -23,9 +23,9 @@ #include #include "hgwidgets_p.h" -#include "HgContainer.h" +#include "hgcontainer.h" #include "hgwidgetitem.h" -#include "HgScrollBufferManager.h" +#include "hgscrollBufferManager.h" #include "hggridcontainer.h" #include "trace.h" diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/src/hgwidgets_p.cpp --- a/ganeswidgets/src/hgwidgets_p.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/src/hgwidgets_p.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -20,9 +20,9 @@ #include #include "hgwidgets_p.h" -#include "HgContainer.h" +#include "hgcontainer.h" #include "hgcoverflowcontainer.h" -#include "HgScrollBufferManager.h" +#include "hgscrollbuffermanager.h" #include "hgwidgetitem.h" #include "trace.h" //#include "hgindexfeedback.h" diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgcoveritem.h --- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgcoveritem.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgcoveritem.h Thu Jun 24 12:59:29 2010 +0300 @@ -18,8 +18,8 @@ #define HGCOVERITEM_H_ #include -#include -#include +#include +#include class HgCoverItem : public HbIconItem { diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgflipwidget.h --- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgflipwidget.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgflipwidget.h Thu Jun 24 12:59:29 2010 +0300 @@ -17,8 +17,8 @@ #ifndef HGFLIPWIDGET_H_ #define HGFLIPWIDGET_H_ -#include -#include +#include +#include class HbAction; class HbLabel; diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgitemsizedialog.h --- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgitemsizedialog.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgitemsizedialog.h Thu Jun 24 12:59:29 2010 +0300 @@ -17,10 +17,10 @@ #ifndef HGITEMSIZEDIALOG_H_ #define HGITEMSIZEDIALOG_H_ -#include -#include -#include -#include +#include +#include +#include +#include class HgItemSizeDialog : public HbDialog { diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgselectiondialog.h --- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgselectiondialog.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgselectiondialog.h Thu Jun 24 12:59:29 2010 +0300 @@ -18,7 +18,7 @@ #ifndef HGSELECTIONDIALOG_H #define HGSELECTIONDIALOG_H -#include +#include class HbPushButton; class HbLabel; diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgtestview.h --- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgtestview.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgtestview.h Thu Jun 24 12:59:29 2010 +0300 @@ -17,7 +17,7 @@ #ifndef HGTESTVIEW_H_ #define HGTESTVIEW_H_ -#include +#include class HbAction; class HbLabel; diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgetoptionsview.h --- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgetoptionsview.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgetoptionsview.h Thu Jun 24 12:59:29 2010 +0300 @@ -18,7 +18,7 @@ #ifndef HGWIDGETOPTIONSVIEW_H_ #define HGWIDGETOPTIONSVIEW_H_ -#include +#include #include #include "hgtestdefs.h" diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestalbumartmanager.h --- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestalbumartmanager.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestalbumartmanager.h Thu Jun 24 12:59:29 2010 +0300 @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include class HgWidgetTestAlbumArtManager : public QObject diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestdatamodel.h --- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestdatamodel.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestdatamodel.h Thu Jun 24 12:59:29 2010 +0300 @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -98,13 +98,13 @@ QPixmap mDefaultPixmap; bool mSilentDataFetch; - ThumbnailManager* mWrapper; - QStringList mWaitingThumbnails; - bool mThumbnailRequestPending; - int mThumbnailRequestIndex; - int mThumbnailRequestID; + ThumbnailManager* mWrapper; + QStringList mWaitingThumbnails; + bool mThumbnailRequestPending; + int mThumbnailRequestIndex; + int mThumbnailRequestID; - QFileInfoList mFileInfoList; + QFileInfoList mFileInfoList; }; #endif // HgWidgetTestDataModel_H diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestview.h --- a/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestview.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/inc/hgwidgettestview.h Thu Jun 24 12:59:29 2010 +0300 @@ -18,7 +18,7 @@ #ifndef HGWIDGETTESTVIEW_H_ #define HGWIDGETTESTVIEW_H_ -#include +#include #include #include "hgtestdefs.h" @@ -112,11 +112,11 @@ QModelIndex mFlippedIndex; HbLabel* mFrontItem; HbView* mOptionsView; - HgItemSizeDialog* mItemSizeDialog; - HgItemSizeDialog* mItemPosDialog; - QParallelAnimationGroup* mAnimationGroup; - HbDialog* mDialog; - HgCoverItem* mCoverItem; + HgItemSizeDialog *mItemSizeDialog; + HgItemSizeDialog *mItemPosDialog; + QParallelAnimationGroup *mAnimationGroup; + HbDialog *mDialog; + HgCoverItem *mCoverItem; }; diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/src/hgcoveritem.cpp --- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgcoveritem.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgcoveritem.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -23,6 +23,7 @@ void HgCoverItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { + Q_UNUSED(event); emit close(); } diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/src/hgflipwidget.cpp --- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgflipwidget.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgflipwidget.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -18,12 +18,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/src/hgitemsizedialog.cpp --- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgitemsizedialog.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgitemsizedialog.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -18,8 +18,8 @@ #include #include -#include -#include +#include +#include #include "trace.h" diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/src/hgselectiondialog.cpp --- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgselectiondialog.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgselectiondialog.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -15,9 +15,9 @@ * */ -#include -#include -#include +#include +#include +#include #include #include #include "hgselectiondialog.h" diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/src/hgtestview.cpp --- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgtestview.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgtestview.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -16,10 +16,10 @@ */ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "hgtestview.h" #include "trace.h" diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgetoptionsview.cpp --- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgetoptionsview.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgetoptionsview.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -15,10 +15,10 @@ * */ -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestdatamodel.cpp --- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestdatamodel.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestdatamodel.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include @@ -57,12 +57,12 @@ mImageType(ImageTypeNone), // mDefaultIcon((":/images/default.svg")), mUseLowResImages(false), + mBufferManager(0), + mSilentDataFetch(false), mWrapper( new ThumbnailManager() ), mThumbnailRequestPending(false), mThumbnailRequestIndex(-1), - mThumbnailRequestID(-1), - mBufferManager(0), - mSilentDataFetch(false) + mThumbnailRequestID(-1) { FUNC_LOG; mWrapper->setQualityPreference( ThumbnailManager::OptimizeForPerformance ); @@ -596,6 +596,8 @@ void HgWidgetTestDataModel::thumbnailReady( QPixmap pixmap, void* data, int /*id*/, int error ) { + Q_UNUSED(data); + if (!error && !pixmap.isNull() ){ // int idx = reinterpret_cast(data); if (mImageType == ImageTypeQPixmap || mImageType == ImageTypeHbIcon) diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestview.cpp --- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestview.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestview.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -15,14 +15,14 @@ * */ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -39,7 +39,7 @@ #include "hgcoveritem.h" #include #include -#include +#include static const int GRIDBUFFERSIZE(400); static const int COVERFLOWBUFFERSIZE(100); @@ -56,9 +56,9 @@ mOptionsView(0), mItemSizeDialog(0), mItemPosDialog(0), + mAnimationGroup(0), mDialog(0), - mCoverItem(0), - mAnimationGroup(0) + mCoverItem(0) { mModel = new HgWidgetTestDataModel(this); mSelectionModel = new QItemSelectionModel(mModel, this); diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/fute/HgWidgetTest/src/main.cpp --- a/ganeswidgets/tsrc/fute/HgWidgetTest/src/main.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/fute/HgWidgetTest/src/main.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -15,8 +15,8 @@ * */ -#include -#include +#include +#include #include "hgwidgettestview.h" int main(int argc, char **argv) diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/unit/hbautotest.cpp --- a/ganeswidgets/tsrc/unit/hbautotest.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/unit/hbautotest.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -16,8 +16,8 @@ */ #include "hbautotest.h" -#include -#include +#include +#include const qreal STEP = 10; //How many pixels to drag before sending an event diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/unit/hbautotest.h --- a/ganeswidgets/tsrc/unit/hbautotest.h Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/unit/hbautotest.h Thu Jun 24 12:59:29 2010 +0300 @@ -19,7 +19,7 @@ #define HBAUTOTEST_H #include -#include +#include #include class HbMainWindow; diff -r 4fa04caf0f43 -r 1cdcc61142d2 ganeswidgets/tsrc/unit/unittest_ganeswidgets.cpp --- a/ganeswidgets/tsrc/unit/unittest_ganeswidgets.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/ganeswidgets/tsrc/unit/unittest_ganeswidgets.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -19,11 +19,11 @@ #include #include #include "hbautotest.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/hgcacheproxymodel.pro --- a/hgcacheproxymodel/hgcacheproxymodel.pro Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/hgcacheproxymodel.pro Thu Jun 24 12:59:29 2010 +0300 @@ -19,6 +19,9 @@ symbian { TARGET.EPOCALLOWDLLDATA = 1 TARGET.CAPABILITY = ALL -TCB + + #the def files are located in the root of hgwidgets so this is needed + defFilePath=.. } DEFINES += BUILD_CACHEPROXYMODEL diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/src/hgbuffermanager.cpp --- a/hgcacheproxymodel/src/hgbuffermanager.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/src/hgbuffermanager.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -13,7 +13,7 @@ * * Description: * -* Version : %version: 5 % +* Version : %version: 6 % */ #include "hgbuffermanager.h" #include @@ -201,11 +201,24 @@ mBufferPosition = 0; } - //request new Buffer - mRequestStart = mBufferPosition; - mRequestCount = mBufferSize; - mResetOrdered = true; - calculate(); + if (mBufferPosition>1){ + mObserver->release(0, mBufferPosition-1); + } + + mObserver->request( mBufferPosition, + mBufferPosition + mBufferSize -1 ); + + if (mBufferPosition + mBufferSize < mTotalCount){ + mObserver->release(mBufferPosition + mBufferSize, mTotalCount); + } + + mDiff = 0; + mResetOrdered = false; + mRequestStart = 0; + mRequestCount = 0; + mReleaseStart = 0; + mReleaseCount = 0; + } void HgBufferManager::aboutToRemoveItem(int pos) diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/src/hgcacheproxymodel.cpp --- a/hgcacheproxymodel/src/hgcacheproxymodel.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/src/hgcacheproxymodel.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -13,7 +13,7 @@ * * Description: * -* Version : %version: 10 % +* Version : %version: 11 % */ #include #include @@ -582,20 +582,12 @@ { TX_ENTRY emit layoutAboutToBeChanged(); - mSupressBM = true; - releaseAll(); TX_EXIT } void HgCacheProxyModel::sourceLayoutChanged() { TX_ENTRY - mSupressBM = true; - if (mBufferManager){ - mCurrentPos = 0; - mBufferManager->resetBuffer( mCurrentPos, count() ); - } - mSupressBM = false; emit layoutChanged(); TX_EXIT } diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/src/hgdataprovidermodel.cpp --- a/hgcacheproxymodel/src/hgdataprovidermodel.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/src/hgdataprovidermodel.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -13,7 +13,7 @@ * * Description: * -* Version : %version: 12 % +* Version : %version: 15 % */ #include #include @@ -31,7 +31,8 @@ mCache(new QList*>()), mCacheSize(0), mUnallocatedPixmaps(0), - mObserver(0) + mObserver(0), + mIconMode(HgDataProviderIconHbIcon) { TX_ENTRY TX_EXIT @@ -250,6 +251,21 @@ doInsertItem(pos, &list, silent); } +void HgDataProviderModel::clearItem(int pos, bool silent) +{ + bool change = false; + if ( isIndexValid(pos)){ + mDataLock.lock(); + mCache->at(pos)->clear(); + mDataLock.unlock(); + change = true; + } + + if ( change && !silent){ + emit dataChanged( index(pos, 0), index(pos, 0) ); + } +} + void HgDataProviderModel::doInsertItem(int pos, QList< QPair< QVariant, int > >* list, bool silent) { if (pos >mCache->count() || pos <0){ @@ -274,12 +290,12 @@ } -void HgDataProviderModel::removeItem(int pos) +void HgDataProviderModel::removeItem(int pos, bool silent) { - removeItems(pos, 1); + removeItems(pos, 1, silent); } -void HgDataProviderModel::removeItems(int pos, int size) +void HgDataProviderModel::removeItems(int pos, int size, bool silent) { if (pos >=mCache->count()){ return; @@ -290,19 +306,26 @@ if (size >mCache->count()){ size = mCache->count(); - } else if (size <0){ + } + if (size <=0){ return; } + if (!silent){ + beginRemoveRows(QModelIndex(),pos, pos+size-1); + } else { + qWarning("Removing items without notifying might be danger."); + } - beginRemoveRows(QModelIndex(),pos, pos+size-1); mDataLock.lock(); for (int i=0; icount(); i++){ mCache->removeAt(pos); } mDataLock.unlock(); - endRemoveRows(); + + if (!silent) + endRemoveRows(); } - + void HgDataProviderModel::resetModel() { beginResetModel(); @@ -310,6 +333,16 @@ endResetModel(); } +void HgDataProviderModel::setIconMode(HgDataProviderModel::HgDataProviderIconMode mode) +{ + mIconMode = mode; +} + +HgDataProviderModel::HgDataProviderIconMode HgDataProviderModel::iconMode() +{ + return mIconMode; +} + void HgDataProviderModel::emitDataChanged(int from, int to, bool silent) { if ( !silent ){ @@ -348,7 +381,7 @@ 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 { mFreePixmaps.append(pix); @@ -362,6 +395,7 @@ QVariant HgDataProviderModel::createIcon(int index, QPixmap aPixmap) { TX_ENTRY + QVariant res; QPixmap* pix = getPixmap(index); if (pix){ if ( pix->pixmapData() ) { @@ -372,10 +406,29 @@ mQPixmapsLock.lock(); mUsedPixmaps.insert(index, pix); mQPixmapsLock.unlock(); - return HbIcon(QIcon(*pix)); + switch (mIconMode){ + case HgDataProviderIconHbIcon : + res = HbIcon(QIcon(*pix)); + break; + case HgDataProviderIconQIcon : + res = QIcon(*pix); + break; + case HgDataProviderIconQImage : + res = pix->toImage(); + break; + case HgDataProviderIconQPixmap: + res = *pix; + break; + default: + break; + } } - TX_EXIT_ARGS( QString("No pixmap avilable")); - return QVariant(); + + if (res.isNull()){ + TX_EXIT_ARGS( QString("No pixmap avilable")); + } + + return res; } QPixmap* HgDataProviderModel::getPixmap(int idx) diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/hgcacheproxymodeltestapp.pro --- a/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/hgcacheproxymodeltestapp.pro Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/hgcacheproxymodeltestapp.pro Thu Jun 24 12:59:29 2010 +0300 @@ -10,7 +10,7 @@ # Description: TEMPLATE = app -CONFIG += qtestlib console hb +CONFIG += hb TARGET = hgcacheproxymodeltestapp DEPENDPATH += . \ @@ -25,6 +25,7 @@ -TCB } LIBS += -lhgcacheproxymodel \ + -lganeswidgets \ -lharvesterclient.dll \ -lmdeclient.dll \ -lthumbnailmanagerqt.dll \ diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/main.cpp --- a/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/main.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/main.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -13,16 +13,16 @@ * * Description: * -* Version : %version: 1 % +* Version : %version: 2 % */ #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include "mywindow.h" diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mydataprovider.cpp --- a/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mydataprovider.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mydataprovider.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -13,16 +13,13 @@ * * Description: * -* Version : %version: 5 % +* Version : %version: 7 % */ #include #include "hglogger.h" -#include +#include #include "mydataprovider.h" -//#include "x:\sf\mw\qt\src\openvg\qpixmapdata_vg_p.h" -//typedef VGImage (*pfnVgCreateEGLImageTargetKHR)(VGeglImageKHR); - const int KItemIdRole = Qt::UserRole+1; const int KThumbnailsPriority = EPriorityLess; //standard priority @@ -30,7 +27,7 @@ MyDataProvider::MyDataProvider(QObject *parent) : HgDataProviderModel(parent), -mDefaultIcon(new HbIcon(QIcon(QPixmap(":/icons/default.png")))), +mDefaultIcon(QIcon(QPixmap(":/icons/default.png"))), mScheduler(new CActiveSchedulerWait()), mWrapper( new ThumbnailManager() ), mThumbnailRequestPending(false), @@ -42,6 +39,7 @@ { // TX_ENTRY Q_UNUSED(parent); + mWrapper->setThumbnailSize( mThumbnailsize ); mWrapper->setQualityPreference( ThumbnailManager::OptimizeForPerformance ); @@ -54,7 +52,6 @@ MyDataProvider::~MyDataProvider() { // TX_ENTRY - delete mDefaultIcon; delete mWrapper; delete mScheduler; // TX_EXIT @@ -165,7 +162,7 @@ QVariant MyDataProvider::defaultIcon() const { - return *mDefaultIcon; + return mDefaultIcon; } void MyDataProvider::HandleSessionOpened(CMdESession& aSession, TInt aError) diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mydataprovider.h --- a/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mydataprovider.h Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mydataprovider.h Thu Jun 24 12:59:29 2010 +0300 @@ -13,7 +13,7 @@ * * Description: * -* Version : %version: 4 % +* Version : %version: 5 % */ #ifndef MYDATAPROVIDER2_H #define MYDATAPROVIDER2_H @@ -69,7 +69,7 @@ void testInsertItem(int pos, QList< QPair< QVariant, int > >* data); private: - HbIcon* mDefaultIcon; + QVariant mDefaultIcon; CActiveSchedulerWait* mScheduler; ThumbnailManager* mWrapper; QList mWaitingThumbnails; diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mywindow.cpp --- a/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mywindow.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mywindow.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -13,13 +13,13 @@ * * Description: * -* Version : %version: 5 % +* Version : %version: 8 % */ #include "mywindow.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -27,17 +27,21 @@ #include #include #include -#include -#include +#include +#include #include #include #include +#include +#include #include "mydataprovider.h" #include "hglogger.h" const int KGridViewCommand = 1; const int KListViewCommand = 2; +const int KMediaWallViewCommand = 3; +const int KHgGridViewCommand = 4; const int KSort1Command = 1101; const int KSort2Command = 1102; @@ -69,6 +73,10 @@ const int KRemoveCustomCommand = 2207; const int KShowImagesCommand = 2300; const int KShowAudioCommand = 2301; +const int KHbIconModeCommand = 2400; +const int KQIconModeCommand = 2401; +const int KQImageModeCommand = 2402; +const int KQPixmapModeCommand = 2403; const int KResetCommand = 10000; @@ -122,10 +130,16 @@ void MyWindow::addChangeViewMenu(HbMenu* parent) { HbMenu *viewSubMenu = parent->addMenu("Change view"); - HbAction* action = viewSubMenu->addAction("GridView"); + HbAction* action = viewSubMenu->addAction("Orbit Grid View"); action->setData(QVariant(KGridViewCommand)); - action = viewSubMenu->addAction("ListView"); + action = viewSubMenu->addAction("Orbit List View"); action->setData(QVariant(KListViewCommand)); + action = viewSubMenu->addAction("Hg MediaWall"); + action->setData(QVariant(KMediaWallViewCommand)); + action = viewSubMenu->addAction("Hg Grid"); + action->setData(QVariant(KHgGridViewCommand)); + + } void MyWindow::addCacheProxyModelMenu(HbMenu* parent) @@ -211,6 +225,15 @@ action = dpSubMenu->addAction("Show Audio"); action->setData(QVariant(KShowAudioCommand)); + action = dpSubMenu->addAction("HbIcon Mode"); + action->setData(QVariant(KHbIconModeCommand)); + action = dpSubMenu->addAction("QIcon Mode"); + action->setData(QVariant(KQIconModeCommand)); + action = dpSubMenu->addAction("QImage Mode"); + action->setData(QVariant(KQImageModeCommand)); + action = dpSubMenu->addAction("QPixmap Mode"); + action->setData(QVariant(KQPixmapModeCommand)); + } @@ -246,6 +269,20 @@ mView = view; break; } + case KMediaWallViewCommand : { + HgMediawall * view = new HgMediawall(); + view->setModel(mModel); + mMainView->setWidget( view ); + mView = view; + break; + } + case KHgGridViewCommand : { + HgGrid * view = new HgGrid(Qt::Vertical); + view->setModel(mModel); + mMainView->setWidget( view ); + mView = view; + break; + } case KSort1Command : { mModel->setSortRole(Qt::UserRole+2); mModel->sort(0); @@ -372,10 +409,11 @@ break; } case KInsertCustomCommand : { - int val = HbInputDialog::getInteger( QString("Insert at position:")); - QList< QPair< QVariant, int > >* data = new QList< QPair< QVariant, int > >(); - data->append( QPair< QVariant, int >(QString("NEW ITEM!!!!"), Qt::DisplayRole) ); - mMyDataProvider->testInsertItem(val, data); + //TODO fix me +// int val = HbInputDialog::getInteger( QString("Insert at position:")); +// QList< QPair< QVariant, int > >* data = new QList< QPair< QVariant, int > >(); +// data->append( QPair< QVariant, int >(QString("NEW ITEM!!!!"), Qt::DisplayRole) ); +// mMyDataProvider->testInsertItem(val, data); break; } case KRemove0Command : { @@ -407,8 +445,9 @@ break; } case KRemoveCustomCommand : { - int val = HbInputDialog::getInteger( QString("Remove from position:")); - mMyDataProvider->testRemoveItem(val); + //TODO fix me +// int val = HbInputDialog::getInteger( QString("Remove from position:")); +// mMyDataProvider->testRemoveItem(val); break; } case KShowImagesCommand : { @@ -421,6 +460,23 @@ mMyDataProvider->changeMode(1); break; } + + case KHbIconModeCommand : { + mMyDataProvider->setIconMode(HgDataProviderModel::HgDataProviderIconHbIcon); + break; + } + case KQIconModeCommand : { + mMyDataProvider->setIconMode(HgDataProviderModel::HgDataProviderIconQIcon); + break; + } + case KQImageModeCommand : { + mMyDataProvider->setIconMode(HgDataProviderModel::HgDataProviderIconQImage); + break; + } + case KQPixmapModeCommand : { + mMyDataProvider->setIconMode(HgDataProviderModel::HgDataProviderIconQPixmap); + break; + } case KResetCommand : { mMyDataProvider->resetModel(); break; diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mywindow.h --- a/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mywindow.h Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mywindow.h Thu Jun 24 12:59:29 2010 +0300 @@ -13,26 +13,26 @@ * * Description: * -* Version : %version: 4 % +* Version : %version: 6 % */ #ifndef CONTENTWIDGET_H #define CONTENTWIDGET_H -#include +#include #include #include #include -#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include class QTimer; @@ -67,7 +67,7 @@ void addDataProviderMenu(HbMenu* parent); private: - HbAbstractItemView* mView; + HbWidget* mView; HgCacheProxyModel *mModel; MyDataProvider *mMyDataProvider; diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/tsrc/unit/bmhelper.cpp --- a/hgcacheproxymodel/tsrc/unit/bmhelper.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/tsrc/unit/bmhelper.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -13,7 +13,7 @@ * * Description: * -* Version : %version: 5 % +* Version : %version: 6 % */ #include "bmhelper.h" #include @@ -122,6 +122,22 @@ return mBuffer.count(); } +void BMHelper::resizeCache(int newSize) +{ + int diff = totalSize() - newSize; + + while (diff != 0){ + if (diff >0){ + remove(mBuffer.count()-1); + diff--; + }else{ + insert(mBuffer.count()); + diff++; + } + } + +} + void BMHelper::remove(int pos) { if ( pos <0 || pos > mBuffer.count()){ diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/tsrc/unit/cacheproxyhelper.cpp --- a/hgcacheproxymodel/tsrc/unit/cacheproxyhelper.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/tsrc/unit/cacheproxyhelper.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -13,58 +13,91 @@ * * Description: * -* Version : %version: 1 % +* Version : %version: 3 % */ #include "cacheproxyhelper.h" +#include + CacheProxyHelper::CacheProxyHelper(HgCacheProxyModel *model, QObject *parent): QObject(parent), mModel(model) { ASSERT(mModel!=0); - - connect(mModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(slotDataChanged(QModelIndex,QModelIndex))); + bool res; - connect(mModel, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), - this, SLOT(slotHeaderDataChanged(Qt::Orientation,int,int))); + res = connect(mModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), + this, SLOT(slotDataChanged(QModelIndex,QModelIndex))); + QCOMPARE(res, true); - connect(mModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), + res = connect(mModel, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), + this, SLOT(slotHeaderDataChanged(Qt::Orientation,int,int))); + QCOMPARE(res, true); + + res = connect(mModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), this, SLOT(slotRowsAboutToBeInserted(QModelIndex,int,int))); + QCOMPARE(res, true); - connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), + res = connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(slotRowsInserted(QModelIndex,int,int))); + QCOMPARE(res, true); - connect(mModel, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), + res = connect(mModel, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), this, SLOT(slotColumnsAboutToBeInserted(QModelIndex,int,int))); + QCOMPARE(res, true); - connect(mModel, SIGNAL(columnsInserted(QModelIndex,int,int)), + res = connect(mModel, SIGNAL(columnsInserted(QModelIndex,int,int)), this, SLOT(slotColumnsInserted(QModelIndex,int,int))); + QCOMPARE(res, true); - connect(mModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), + res = connect(mModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(slotRowsAboutToBeRemoved(QModelIndex,int,int))); + QCOMPARE(res, true); + + res = connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(slotRowsRemoved(QModelIndex,int,int))); + QCOMPARE(res, true); - connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SLOT(slotRowsRemoved(QModelIndex,int,int))); - - connect(mModel, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), + res = connect(mModel, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(slotColumnsAboutToBeRemoved(QModelIndex,int,int))); + QCOMPARE(res, true); - connect(mModel, SIGNAL(columnsRemoved(QModelIndex,int,int)), + res = connect(mModel, SIGNAL(columnsRemoved(QModelIndex,int,int)), this, SLOT(slotColumnsRemoved(QModelIndex,int,int))); + QCOMPARE(res, true); - connect(mModel, SIGNAL(layoutAboutToBeChanged()), + res = connect(mModel, SIGNAL(layoutAboutToBeChanged()), this, SLOT(slotLayoutAboutToBeChanged())); + QCOMPARE(res, true); - connect(mModel, SIGNAL(layoutChanged()), + res = connect(mModel, SIGNAL(layoutChanged()), this, SLOT(slotLayoutChanged())); + QCOMPARE(res, true); + + res = connect(mModel, SIGNAL(modelAboutToBeReset()), + this, SLOT(slotModelAboutToBeReset())); + QCOMPARE(res, true); + + res = connect(mModel, SIGNAL(modelReset()), + this, SLOT(slotModelReset())); + QCOMPARE(res, true); - connect(mModel, SIGNAL(modelAboutToBeReset()), - this, SLOT(slotModelAboutToBeReset())); - - connect(mModel, SIGNAL(modelReset()), - this, SLOT(slotModelReset())); - + res = connect(mModel, SIGNAL(rowsAboutToBeMoved(const QModelIndex&, int, int, const QModelIndex&, int)), + this, SLOT(slotRowsAboutToBeMoved(const QModelIndex&, int, int, const QModelIndex&, int))); + QCOMPARE(res, true); + + res = connect(mModel, SIGNAL(rowsMoved(const QModelIndex&, int, int, const QModelIndex&, int)), + this, SLOT(slotRowsMoved(const QModelIndex&, int, int, const QModelIndex&, int))); + QCOMPARE(res, true); + + res = connect(mModel, SIGNAL(columnsAboutToBeMoved(const QModelIndex&, int, int, const QModelIndex&, int)), + this, SLOT(slotColumnsAboutToBeMoved(const QModelIndex&, int, int, const QModelIndex&, int))); + QCOMPARE(res, true); + + res = connect(mModel, SIGNAL(columnsMoved(const QModelIndex&, int, int, const QModelIndex&, int)), + this, SLOT(slotColumnsMoved(const QModelIndex&, int, int, const QModelIndex&, int))); + QCOMPARE(res, true); + } CacheProxyHelper::~CacheProxyHelper() @@ -181,6 +214,39 @@ mSignalModelReset = true; } + +void CacheProxyHelper::slotRowsAboutToBeMoved(const QModelIndex&, int from, int to, const QModelIndex&, int) +{ + QPair< int, int > p; + p.first = from; + p.second = to; + mSignalRowsAboutToBeMoved.append(p); +} + +void CacheProxyHelper::slotRowsMoved(const QModelIndex&, int from, int to, const QModelIndex&, int) +{ + QPair< int, int > p; + p.first = from; + p.second = to; + mSignalRowsMoved.append(p); +} + +void CacheProxyHelper::slotColumnsAboutToBeMoved(const QModelIndex&, int from, int to, const QModelIndex&, int) +{ + QPair< int, int > p; + p.first = from; + p.second = to; + mSignalColumnsAboutToBeMoved.append(p); +} + +void CacheProxyHelper::slotColumnsMoved(const QModelIndex&, int from, int to, const QModelIndex&, int) +{ + QPair< int, int > p; + p.first = from; + p.second = to; + mSignalColumnsMoved.append(p); +} + QList< QPair< int, int > > CacheProxyHelper::getSignalDataChanged() { QList< QPair< int, int > > res = mSignalDataChanged; @@ -279,6 +345,32 @@ return res; } +QList< QPair< int, int > > CacheProxyHelper::getSignalRowsAboutToBeMoved() +{ + QList< QPair< int, int > > res = mSignalRowsAboutToBeMoved; + mSignalRowsAboutToBeMoved.clear(); + return res; +} + +QList< QPair< int, int > > CacheProxyHelper::getSignalRowsMoved() +{ + QList< QPair< int, int > > res = mSignalRowsMoved; + mSignalRowsMoved.clear(); + return res; +} + +QList< QPair< int, int > > CacheProxyHelper::getSignalColumnsAboutToBeMoved() +{ + QList< QPair< int, int > > res = mSignalColumnsAboutToBeMoved; + mSignalColumnsAboutToBeMoved.clear(); + return res; +} + +QList< QPair< int, int > > CacheProxyHelper::getSignalColumnsMoved() +{ + QList< QPair< int, int > > res = mSignalColumnsMoved; + mSignalColumnsMoved.clear(); + return res; +} - diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/tsrc/unit/cacheproxyhelper.h --- a/hgcacheproxymodel/tsrc/unit/cacheproxyhelper.h Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/tsrc/unit/cacheproxyhelper.h Thu Jun 24 12:59:29 2010 +0300 @@ -42,6 +42,11 @@ void slotLayoutChanged(); void slotModelAboutToBeReset(); void slotModelReset(); + void slotRowsAboutToBeMoved(const QModelIndex&, int, int, const QModelIndex&, int); + void slotRowsMoved(const QModelIndex&, int, int, const QModelIndex&, int); + void slotColumnsAboutToBeMoved(const QModelIndex&, int, int, const QModelIndex&, int); + void slotColumnsMoved(const QModelIndex&, int, int, const QModelIndex&, int); + public: QList< QPair< int, int > > getSignalDataChanged(); @@ -58,6 +63,10 @@ bool getSignalLayoutChanged(); bool getSignalModelAboutToBeReset(); bool getSignalModelReset(); + QList< QPair< int, int > > getSignalRowsAboutToBeMoved(); + QList< QPair< int, int > > getSignalRowsMoved(); + QList< QPair< int, int > > getSignalColumnsAboutToBeMoved(); + QList< QPair< int, int > > getSignalColumnsMoved(); private: HgCacheProxyModel* mModel; @@ -76,6 +85,10 @@ bool mSignalLayoutChanged; bool mSignalModelAboutToBeReset; bool mSignalModelReset; + QList< QPair< int, int > > mSignalRowsAboutToBeMoved; + QList< QPair< int, int > > mSignalRowsMoved; + QList< QPair< int, int > > mSignalColumnsAboutToBeMoved; + QList< QPair< int, int > > mSignalColumnsMoved; }; diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/tsrc/unit/dataproviderhelper.cpp --- a/hgcacheproxymodel/tsrc/unit/dataproviderhelper.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/tsrc/unit/dataproviderhelper.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -13,10 +13,11 @@ * * Description: * -* Version : %version: 5 % +* Version : %version: 6 % */ #include "dataproviderhelper.h" #include +#include const int KRole1 = Qt::UserRole+1; const int KRole2 = Qt::UserRole+2; @@ -43,26 +44,33 @@ newItem(&list, true); } - connect(this, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(slotDataUpdated(QModelIndex,QModelIndex))); + bool res = connect(this, SIGNAL(dataChanged(QModelIndex,QModelIndex)), + this, SLOT(slotDataUpdated(QModelIndex,QModelIndex))); + QCOMPARE(res, true); - connect(this, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), - this, SLOT(slotRowsAboutToBeInserted(QModelIndex,int,int))); - - connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(slotRowsInserted(QModelIndex,int,int))); + res = connect(this, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(slotRowsAboutToBeInserted(QModelIndex,int,int))); + QCOMPARE(res, true); + + res = connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(slotRowsInserted(QModelIndex,int,int))); + QCOMPARE(res, true); - connect(this, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), - this, SLOT(slotRowsAboutToBeRemoved(QModelIndex,int,int))); - - connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SLOT(slotRowsRemoved(QModelIndex,int,int))); + res = connect(this, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(slotRowsAboutToBeRemoved(QModelIndex,int,int))); + QCOMPARE(res, true); + + res = connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(slotRowsRemoved(QModelIndex,int,int))); + QCOMPARE(res, true); - connect(this, SIGNAL(modelAboutToBeReset()), - this, SLOT(slotModelAboutToBeReset())); + res = connect(this, SIGNAL(modelAboutToBeReset()), + this, SLOT(slotModelAboutToBeReset())); + QCOMPARE(res, true); - connect(this, SIGNAL(modelReset()), - this, SLOT(slotModelReset())); + res = connect(this, SIGNAL(modelReset()), + this, SLOT(slotModelReset())); + QCOMPARE(res, true); } DataProviderHelper::~DataProviderHelper() @@ -313,6 +321,49 @@ endResetModel(); } +bool DataProviderHelper::testEmitColumnsAboutToBeMoved(int from, int to) +{ + return beginMoveColumns(parent(index(0,0)), from, to, parent(index(0,0)), 0); +} + +void DataProviderHelper::testEmitColumnsMoved(int from, int to) +{ + endMoveColumns(); +} + +bool DataProviderHelper::testEmitRowsAboutToBeMoved(int from, int to) +{ + return beginMoveRows(parent(index(0,0)), from, to, parent(index(0,0)), 0); +} + +void DataProviderHelper::testEmitRowsMoved(int from, int to) +{ + endMoveRows(); +} + +void DataProviderHelper::testChangeIconMode(HgDataProviderModel::HgDataProviderIconMode mode) +{ + setIconMode(mode); +} + +HgDataProviderModel::HgDataProviderIconMode DataProviderHelper::testIconMode() +{ + return iconMode(); +} + +void DataProviderHelper::testClearItem(int pos, bool silent ) +{ + clearItem(pos, silent); +} +QModelIndex DataProviderHelper::testCreateIndex(int row, int col) +{ + return createIndex(row, col); +} +int DataProviderHelper::getCount() +{ + return count(); +} + void DataProviderHelper::dataUpdated(int from, int to) { QPair< int, int > p; diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/tsrc/unit/dataproviderhelper.h --- a/hgcacheproxymodel/tsrc/unit/dataproviderhelper.h Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/tsrc/unit/dataproviderhelper.h Thu Jun 24 12:59:29 2010 +0300 @@ -76,6 +76,19 @@ void testEmitLayoutChanged(); void testEmitModelAboutToBeReset(); void testEmitModelReset(); + + bool testEmitColumnsAboutToBeMoved(int from, int to); + void testEmitColumnsMoved(int from, int to); + bool testEmitRowsAboutToBeMoved(int from, int to); + void testEmitRowsMoved(int from, int to); + + + void testChangeIconMode(HgDataProviderIconMode mode); + HgDataProviderIconMode testIconMode(); + + void testClearItem(int pos, bool silent); + QModelIndex testCreateIndex(int row, int col); + int getCount(); //from HgDataProviderModelObserver public: diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.cpp --- a/hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.cpp Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.cpp Thu Jun 24 12:59:29 2010 +0300 @@ -13,7 +13,7 @@ * * Description: * -* Version : %version: 8 % +* Version : %version: 10 % */ #include #include @@ -25,6 +25,11 @@ #include "dataproviderhelper.h" #include "cacheproxyhelper.h" #include +#include +#include +#include +#include + // ======== MEMBER FUNCTIONS ======== void TestCacheProxy::testQAbstractItemModel(QAbstractItemModel* model, int rows, int columns) @@ -84,10 +89,7 @@ QVERIFY(idx.isValid() == false); QVERIFY(model->columnCount() == columns); QVERIFY(model->rowCount() == rows); - -// QVERIFY(model->hasChildren() == false); -// QVERIFY(model->headerData(0, Qt::Horizontal).isValid == false); - + } void TestCacheProxy::initTestCase() @@ -384,6 +386,24 @@ QCOMPARE(bmh->totalSize(), totalsize); + bm->aboutToRemoveItem(totalsize+10); + bmh->remove(totalsize+10); + bm->removedItem(totalsize+10); + QVERIFY(bmh->isIntergal(bufferSize)); +// totalsize--; //no item remove since totalsize+200 is outside + QCOMPARE(bmh->totalSize(), totalsize); + + + bm->resetBuffer(0, 10); + bmh->resizeCache(10); + bm->aboutToRemoveItem(1); + bmh->remove(1); + bm->removedItem(1); + QCOMPARE(bmh->totalSize(), 9); + + bmh->resizeCache(totalsize); + bm->resetBuffer(0, totalsize); + //insert bm->setPosition(0); @@ -440,6 +460,15 @@ QVERIFY(bmh->isIntergal(bufferSize)); // totalsize++; //no insert QCOMPARE(bmh->totalSize(), totalsize); + + bm->setPosition(2*totalsize); + bm->aboutToInsertItem(2*totalsize); + bmh->insert(2*totalsize); + bm->insertedItem(2*totalsize); + QVERIFY(bmh->isIntergal(bufferSize)); +// totalsize++; //no insert + QCOMPARE(bmh->totalSize(), totalsize); + } @@ -619,6 +648,23 @@ res = dph->data(idx, Qt::DecorationRole); QVERIFY(res == dph->defaultIcon()); + dph->testClearItem(2, false); + updates = dph->getSignalDataUpdated(); + QVERIFY(updates.count() == 1); //1 update + QVERIFY(updates[0].first == 2); //for 2 + QVERIFY(updates[0].second == 2); //for 2 + QVERIFY(dph->itemData(idx).count() == 0 ); //for 2 + + QVERIFY(dph->itemData( dph->testCreateIndex(999999, 0)).count() == 0 ); + + dph->testClearItem(2, true); + updates = dph->getSignalDataUpdated(); + QVERIFY(updates.count() == 0); //no updates + + dph->testClearItem(-10, true); + updates = dph->getSignalDataUpdated(); + QVERIFY(updates.count() == 0); //no updates + idx = dph->index(3, 0); res = dph->data(idx, Qt::DecorationRole); QVERIFY(res == dph->defaultIcon()); @@ -838,7 +884,7 @@ res = dph->data(idx, Qt::DisplayRole); QCOMPARE(res.isValid(), false); - + } void TestCacheProxy::testDP_QPixmapPool() @@ -885,6 +931,60 @@ dph->resizeQPixmapPool(1); res = dph->testCreateIcon(10, pix); QVERIFY(res.isValid() == false); + + dph->resizeQPixmapPool(110); + for ( int i = 0; i < 100; i ++) + dph->testCreateIcon(i, pix); + + for ( int i = 20; i < 40; i ++) + dph->testReleasePixmap(i); + + dph->resizeQPixmapPool(50); + dph->testReleasePixmap(5); + + dph->resizeQPixmapPool(1); + dph->testReleasePixmap(0); + dph->testReleasePixmap(2); + dph->testReleasePixmap(1); + dph->resizeQPixmapPool(10); + + + +} + +void TestCacheProxy::testDP_IconMode() +{ + dph = new DataProviderHelper(100); + QCOMPARE( dph->testIconMode(), HgDataProviderModel::HgDataProviderIconHbIcon); + dph->resizeQPixmapPool(10); + QPixmap pix; + QVariant res = dph->testCreateIcon(0, pix); + QVERIFY(res.isValid() == true); + QVERIFY(res.canConvert()); + + dph->testChangeIconMode(HgDataProviderModel::HgDataProviderIconHbIcon); + res = dph->testCreateIcon(0, pix); + QVERIFY(res.isValid() == true); + QVERIFY(res.canConvert()); + + dph->testChangeIconMode(HgDataProviderModel::HgDataProviderIconQIcon); + res = dph->testCreateIcon(0, pix); + QVERIFY(res.isValid() == true); + QVERIFY(res.canConvert()); + + dph->testChangeIconMode(HgDataProviderModel::HgDataProviderIconQImage); + res = dph->testCreateIcon(0, pix); + QVERIFY(res.isValid() == true); + QVERIFY(res.canConvert()); + + dph->testChangeIconMode(HgDataProviderModel::HgDataProviderIconQPixmap); + res = dph->testCreateIcon(0, pix); + QVERIFY(res.isValid() == true); + QVERIFY(res.canConvert()); + + dph->testChangeIconMode( (HgDataProviderModel::HgDataProviderIconMode)10 ); + res = dph->testCreateIcon(0, pix); + QVERIFY(res.isValid() == false); } void TestCacheProxy::testCP_QAbstractItemModel() @@ -912,6 +1012,65 @@ dph->testRemoveItems(0, 1);//should remove item + QModelIndex idx = cp->index(0,0); + QCOMPARE(cp->hasChildren(idx), true); + QSize s1 = cp->span(idx); + QSize s2 = cp->span(cp->index(1, 0)); + QVERIFY(s1 == s2); + cp->submit(); + cp->revert(); + Qt::ItemFlags f1 = cp->flags(idx); + Qt::ItemFlags f2 = cp->flags(cp->index(1, 0)); + QVERIFY(f1 == f2); + + QVariant res = cp->headerData(0, Qt::Horizontal, Qt::DecorationRole); + QCOMPARE(res.isValid(), false); + //default implementation ignores that + cp->setHeaderData(0, Qt::Horizontal, QString("headerdata"), Qt::DecorationRole); + res = cp->headerData(0, Qt::Horizontal, Qt::DecorationRole); + QCOMPARE(res.isValid(), false); + + QStringList li = cp->mimeTypes(); + QCOMPARE(li.count(), 1); + + QModelIndexList li2; + li2<< idx; + QMimeData* md1 = cp->mimeData(li2); + QVERIFY(md1 != NULL); + QCOMPARE(cp->dropMimeData(NULL, Qt::MoveAction, 10, 0, QModelIndex() ), false); + QCOMPARE(cp->supportedDragActions(), Qt::CopyAction); + + QCOMPARE(cp->canFetchMore(idx), false); + cp->fetchMore(idx); + + QModelIndex idx2 = cp->buddy(idx); + QCOMPARE(idx2.row(), idx.row()); + QCOMPARE(idx2.column(), idx.column()); + + li2 = cp->match(idx, Qt::DisplayRole, QString("ITEM"), 1000, Qt::MatchContains); + QCOMPARE(li2.count(), dph->getCount()); + + + + cp->setDataProvider(NULL); + QVERIFY(cp->DataProvider() == NULL); + idx = cp->index(100,0); + res = dph->data(idx, Qt::DisplayRole); + QCOMPARE(res.isValid(), false); + + QCOMPARE(cp->insertRows(0, 10), false); //default implementation returns false + QCOMPARE(cp->removeRows(0, 10), false);//default implementation returns false + + QCOMPARE(cp->insertRow(0), false); //default implementation returns false + QCOMPARE(cp->removeRow(0), false);//default implementation returns false + + QCOMPARE(cp->insertColumns(0, 10), false); //default implementation returns false + QCOMPARE(cp->removeColumns(0, 10), false);//default implementation returns false + + QCOMPARE(cp->insertColumn(0), false); //default implementation returns false + QCOMPARE(cp->removeColumn(0), false);//default implementation returns false + + } void TestCacheProxy::testCP_SignalsForward() @@ -960,6 +1119,67 @@ QVERIFY(cp->columnCount() == 1); QVERIFY(cp->rowCount() == 1000); + cph->getSignalDataChanged(); + dph->testEmitDataChanged(dph->index(0,0), dph->index(10,0)); + resList = cph->getSignalDataChanged(); + QCOMPARE(resList.count(), 1); + QCOMPARE(resList[0].first, 0); + QCOMPARE(resList[0].second, 10); + + cph->getSignalColumnsAboutToBeInserted(); + cph->getSignalColumnsInserted(); + dph->testEmitColumnsInsert(dph->index(0,0),0, 10); + resList = cph->getSignalColumnsAboutToBeInserted(); + QCOMPARE(resList.count(), 1); + QCOMPARE(resList[0].first, 0); + QCOMPARE(resList[0].second, 10); + resList = cph->getSignalColumnsInserted(); + QCOMPARE(resList.count(), 1); + QCOMPARE(resList[0].first, 0); + QCOMPARE(resList[0].second, 10); + + cph->getSignalColumnsAboutToBeRemoved(); + cph->getSignalColumnsRemoved(); + dph->testEmitColumnsRemove(dph->index(0,0),0, 10); + resList = cph->getSignalColumnsAboutToBeRemoved(); + QCOMPARE(resList.count(), 1); + QCOMPARE(resList[0].first, 0); + QCOMPARE(resList[0].second, 10); + resList = cph->getSignalColumnsRemoved(); + QCOMPARE(resList.count(), 1); + QCOMPARE(resList[0].first, 0); + QCOMPARE(resList[0].second, 10); + +// cph->getSignalColumnsAboutToBeMoved(); +// cph->getSignalColumnsMoved(); +// QCOMPARE(dph->testEmitColumnsAboutToBeMoved(0, 10), false); +// resList = cph->getSignalColumnsAboutToBeMoved(); +// QCOMPARE(resList.count(), 0); + +// dph->testEmitColumnsMoved(0, 10); +// resList = cph->getSignalColumnsMoved(); +// QCOMPARE(resList.count(), 0); + + +// cph->getSignalRowsAboutToBeMoved(); +// cph->getSignalRowsMoved(); +// QCOMPARE(dph->testEmitRowsAboutToBeMoved(0, 10), false); +// resList = cph->getSignalRowsAboutToBeMoved(); +// QCOMPARE(resList.count(), 0); + +// dph->testEmitRowsMoved(0, 10); +// resList = cph->getSignalRowsMoved(); +// QCOMPARE(resList.count(), 0); + + + cph->getSignalHeaderDataChanged(); + dph->testEmitHeaderDataChanged(Qt::Horizontal, 0, 0); + resList = cph->getSignalHeaderDataChanged(); + QCOMPARE(resList.count(), 1); + QCOMPARE(resList[0].first, 0); + QCOMPARE(resList[0].second, 0); + + } void TestCacheProxy::testCP_ResizeCache() @@ -1065,6 +1285,10 @@ cp->setDataProvider(NULL, 50, 20); res = cp->data(idx, v); QCOMPARE(res.isValid(), false); + cp->request(0, 100, HgBufferManagerObserver::HgRequestOrderAscending); + QCOMPARE(dph->getLastRequest().count(), 0); + cp->release(0, 100); + QCOMPARE(dph->getLastRelease().count(), 0); } diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.h --- a/hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.h Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.h Thu Jun 24 12:59:29 2010 +0300 @@ -13,7 +13,7 @@ * * Description: * -* Version : %version: 5 % +* Version : %version: 6 % */ #ifndef TestCacheProxy_H #define TestCacheProxy_H @@ -55,6 +55,7 @@ void testDP_RequestReleaseAndData(); void testDP_CacheManagment(); void testDP_QPixmapPool(); + void testDP_IconMode(); //HgCacheProxyModel void testCP_QAbstractItemModel(); diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgcacheproxymodel/tsrc/unit/unittest_hgcacheproxymodel.pro --- a/hgcacheproxymodel/tsrc/unit/unittest_hgcacheproxymodel.pro Fri Jun 11 14:43:11 2010 +0300 +++ b/hgcacheproxymodel/tsrc/unit/unittest_hgcacheproxymodel.pro Thu Jun 24 12:59:29 2010 +0300 @@ -15,9 +15,10 @@ #fix that later #CONFIG += symbian_test +CONFIG += hb +INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE $$APP_LAYER_SYSTEMINCLUDE + INCLUDEPATH += . \ - $$APP_LAYER_SYSTEMINCLUDE \ - $$MW_LAYER_SYSTEMINCLUDE \ ../../inc TARGET.CAPABILITY = ALL -TCB diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgwidgets_plat/ganeswidgets_api/inc/hgwidgets.h --- a/hgwidgets_plat/ganeswidgets_api/inc/hgwidgets.h Fri Jun 11 14:43:11 2010 +0300 +++ b/hgwidgets_plat/ganeswidgets_api/inc/hgwidgets.h Thu Jun 24 12:59:29 2010 +0300 @@ -19,9 +19,9 @@ #define HGWIDGET_H #include -#include +#include #include -#include +#include #ifdef BUILD_HG_WIDGETS # define HG_WIDGETS_EXPORT Q_DECL_EXPORT diff -r 4fa04caf0f43 -r 1cdcc61142d2 hgwidgets_plat/hgcacheproxymodel_api/inc/hgdataprovidermodel.h --- a/hgwidgets_plat/hgcacheproxymodel_api/inc/hgdataprovidermodel.h Fri Jun 11 14:43:11 2010 +0300 +++ b/hgwidgets_plat/hgcacheproxymodel_api/inc/hgdataprovidermodel.h Thu Jun 24 12:59:29 2010 +0300 @@ -13,7 +13,7 @@ * * Description: * -* Version : %version: 8 % +* Version : %version: 11 % */ #ifndef HGDATAPROVIDERMODEL_H_ #define HGDATAPROVIDERMODEL_H_ @@ -79,13 +79,14 @@ void newItem(QPair< QVariant, int > item, bool silent = true); void insertItem(int pos, QList< QPair< QVariant, int > >* list = NULL, bool silent = true); void insertItem(int pos, QPair< QVariant, int > item, bool silent = true); + void clearItem(int pos, bool silent = false); private: void doInsertItem(int pos, QList< QPair< QVariant, int > >* list, bool silent); protected: - void removeItem(int pos); - void removeItems(int pos, int size); + void removeItem(int pos, bool silent = false); + void removeItems(int pos, int size, bool silent = false); virtual QVariant defaultIcon() const = 0; inline bool containsRole(int idx, int role) const; @@ -93,10 +94,20 @@ public: void resetModel(); - + + enum HgDataProviderIconMode { + HgDataProviderIconHbIcon, + HgDataProviderIconQIcon, + HgDataProviderIconQImage, + HgDataProviderIconQPixmap + }; + + void setIconMode(HgDataProviderIconMode mode); + HgDataProviderIconMode iconMode(); + protected: virtual void doResetModel() {}; - virtual QVariant getData(int idx, int role) const {return QVariant(); }; + virtual QVariant getData(int idx, int role) const {Q_UNUSED(idx); Q_UNUSED(role); return QVariant(); }; // helpers fot emits protected: @@ -123,6 +134,7 @@ QMutex mQPixmapsLock; QMutex mDataLock; HgDataProviderModelObserver *mObserver; + HgDataProviderIconMode mIconMode; }; inline bool HgDataProviderModel::isIndexValid(int idx) const