@@ -55,6 +55,7 @@ class AssetTablePriv {
5555 // retrieve units for asset
5656 uint8_t units = OWNER_UNITS;
5757 bool fIsAdministrator = true ;
58+ std::string ipfsHash = " " ;
5859
5960 if (setAssetsToSkip.count (bal->first ))
6061 continue ;
@@ -67,6 +68,7 @@ class AssetTablePriv {
6768 return ;
6869 }
6970 units = assetData.units ;
71+ ipfsHash = assetData.strIPFSHash ;
7072 // If we have the administrator asset, add it to the skip listå
7173 if (balances.count (bal->first + OWNER_TAG)) {
7274 setAssetsToSkip.insert (bal->first + OWNER_TAG);
@@ -82,7 +84,7 @@ class AssetTablePriv {
8284 continue ;
8385 }
8486 }
85- cachedBalances.append (AssetRecord (bal->first , bal->second , units, fIsAdministrator ));
87+ cachedBalances.append (AssetRecord (bal->first , bal->second , units, fIsAdministrator , EncodeAssetData (ipfsHash) ));
8688 }
8789 }
8890 }
@@ -158,8 +160,25 @@ QVariant AssetTableModel::data(const QModelIndex &index, int role) const
158160 case FormattedAmountRole:
159161 return QString::fromStdString (rec->formattedQuantity ());
160162 case AdministratorRole:
161- {
162163 return rec->fIsAdministrator ;
164+ case AssetIPFSHashRole:
165+ return QString::fromStdString (rec->ipfshash );
166+ case AssetIPFSHashDecorationRole:
167+ {
168+ if (index.column () == Quantity)
169+ return QVariant ();
170+
171+ if (rec->ipfshash .size () == 0 )
172+ return QVariant ();
173+
174+ QPixmap pixmap;
175+
176+ if (darkModeEnabled)
177+ pixmap = QPixmap::fromImage (QImage (" :/icons/external_link_dark" ));
178+ else
179+ pixmap = QPixmap::fromImage (QImage (" :/icons/external_link" ));
180+
181+ return pixmap;
163182 }
164183 case Qt::DecorationRole:
165184 {
@@ -235,7 +254,7 @@ QModelIndex AssetTableModel::index(int row, int column, const QModelIndex &paren
235254
236255QString AssetTableModel::formatTooltip (const AssetRecord *rec) const
237256{
238- QString tooltip = formatAssetName (rec) + QString (" \n " ) + formatAssetQuantity (rec);
257+ QString tooltip = formatAssetName (rec) + QString (" \n " ) + formatAssetQuantity (rec) + QString ( " \n " ) + formatAssetData (rec) ;
239258 return tooltip;
240259}
241260
@@ -247,4 +266,9 @@ QString AssetTableModel::formatAssetName(const AssetRecord *wtx) const
247266QString AssetTableModel::formatAssetQuantity (const AssetRecord *wtx) const
248267{
249268 return QString::fromStdString (wtx->formattedQuantity ());
269+ }
270+
271+ QString AssetTableModel::formatAssetData (const AssetRecord *wtx) const
272+ {
273+ return QString::fromStdString (wtx->ipfshash );
250274}
0 commit comments