mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed tooltip and proper display of IDs in forums. Commented out class GxsIdTreeWidgetItem, which is unused and very similar to GxsIdRSTreeWidgetItem. fixed display of from field in messages. Still, it would be better to use a clean GxsIdRSTreeWidget instead of this QListWidget class
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7541 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2cbeecbe73
commit
c873421914
@ -1110,6 +1110,15 @@ void MessagesDialog::insertMessages()
|
|||||||
text = "RetroShare";
|
text = "RetroShare";
|
||||||
} else {
|
} else {
|
||||||
text = QString::fromUtf8(rsPeers->getPeerName(it->srcId).c_str());
|
text = QString::fromUtf8(rsPeers->getPeerName(it->srcId).c_str());
|
||||||
|
std::cerr << "(messages) getting name for id " << it->srcId << " => \"" << text.toStdString() << "\"" << std::endl;
|
||||||
|
if(text == "")
|
||||||
|
{
|
||||||
|
RsIdentityDetails details;
|
||||||
|
if (rsIdentity->getIdDetails(RsGxsId(it->srcId), details) && !details.mNickname.empty())
|
||||||
|
text = QString::fromUtf8(details.mNickname.c_str()) ;
|
||||||
|
else
|
||||||
|
text = "GXS_id(" + QString::fromStdString(it->srcId.toStdString())+")" ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (gotInfo || rsMsgs->getMessage(it->msgId, msgInfo)) {
|
if (gotInfo || rsMsgs->getMessage(it->msgId, msgInfo)) {
|
||||||
|
@ -408,7 +408,7 @@ void GxsCommentTreeWidget::service_loadThread(const uint32_t &token)
|
|||||||
std::cerr << "GxsCommentTreeWidget::service_loadThread() Got Comment: " << comment.mMeta.mMsgId;
|
std::cerr << "GxsCommentTreeWidget::service_loadThread() Got Comment: " << comment.mMeta.mMsgId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
GxsIdTreeWidgetItem *item = new GxsIdTreeWidgetItem();
|
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(NULL);
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -169,7 +169,7 @@ bool GxsIdDetails::MakeIdDesc(const RsGxsId &id, bool doIcons, QString &str, std
|
|||||||
|
|
||||||
if (!rsIdentity->getIdDetails(id, details))
|
if (!rsIdentity->getIdDetails(id, details))
|
||||||
{
|
{
|
||||||
std::cerr << "GxsIdTreeWidget::MakeIdDesc() FAILED TO GET ID";
|
std::cerr << "GxsIdTreeWidget::MakeIdDesc() FAILED TO GET ID " << id;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
str = QObject::tr("Loading... ") + QString::fromStdString(id.toStdString().substr(0,5));
|
str = QObject::tr("Loading... ") + QString::fromStdString(id.toStdString().substr(0,5));
|
||||||
|
@ -102,7 +102,7 @@ void GxsIdRSItemDelegate::paint( QPainter * painter,
|
|||||||
std::cerr << "GxsIdRSItemDelegate::paint()";
|
std::cerr << "GxsIdRSItemDelegate::paint()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
RsGxsId id ( mTree->ItemTextFromIndex(index, mGxsIdColumn).toStdString());
|
RsGxsId id ( mTree->ItemIdFromIndex(index, mGxsIdColumn));
|
||||||
paintGxsId(painter, option, id);
|
paintGxsId(painter, option, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,18 @@ void GxsIdRSTreeWidget::setGxsIdColumn(int col)
|
|||||||
setItemDelegateForColumn(col, mIdDelegate);
|
setItemDelegateForColumn(col, mIdDelegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RsGxsId GxsIdRSTreeWidget::ItemIdFromIndex(const QModelIndex & index, int column ) const
|
||||||
|
{
|
||||||
|
// get real item.
|
||||||
|
QTreeWidgetItem *item = itemFromIndex(index);
|
||||||
|
if (!item)
|
||||||
|
{
|
||||||
|
std::cerr << "GxsIdTreeWidget::ItemTextFromIndex() Invalid Item";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return RsGxsId();
|
||||||
|
}
|
||||||
|
return RsGxsId(item->data(column,Qt::UserRole).toString().toStdString());
|
||||||
|
}
|
||||||
QString GxsIdRSTreeWidget::ItemTextFromIndex(const QModelIndex & index, int column ) const
|
QString GxsIdRSTreeWidget::ItemTextFromIndex(const QModelIndex & index, int column ) const
|
||||||
{
|
{
|
||||||
// get real item.
|
// get real item.
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
|
#include "retroshare/rsgxsifacetypes.h"
|
||||||
#include "gui/common/RSTreeWidget.h"
|
#include "gui/common/RSTreeWidget.h"
|
||||||
|
|
||||||
/*****
|
/*****
|
||||||
@ -88,6 +89,7 @@ public:
|
|||||||
|
|
||||||
void setGxsIdColumn(int col);
|
void setGxsIdColumn(int col);
|
||||||
QString ItemTextFromIndex(const QModelIndex & index, int column ) const;
|
QString ItemTextFromIndex(const QModelIndex & index, int column ) const;
|
||||||
|
RsGxsId ItemIdFromIndex(const QModelIndex & index, int column ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GxsIdRSItemDelegate *mIdDelegate;
|
GxsIdRSItemDelegate *mIdDelegate;
|
||||||
|
@ -93,12 +93,12 @@ void GxsIdRSTreeWidgetItem::loadId()
|
|||||||
setIcon(mColumn, combinedIcon);
|
setIcon(mColumn, combinedIcon);
|
||||||
}
|
}
|
||||||
setToolTip(mColumn,comment) ;
|
setToolTip(mColumn,comment) ;
|
||||||
|
setText(mColumn, desc);
|
||||||
|
setData(mColumn,Qt::UserRole, QString::fromStdString(mId.toStdString()));
|
||||||
|
|
||||||
setText(mColumn, desc);
|
if (loaded)
|
||||||
|
|
||||||
if (loaded)
|
|
||||||
{
|
{
|
||||||
std::cerr << " GxsIdRSTreeWidgetItem::loadId() Loaded Okay";
|
std::cerr << " GxsIdRSTreeWidgetItem::loadId() Loaded Okay";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -113,6 +113,7 @@ void GxsIdRSTreeWidgetItem::loadId()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
GxsIdTreeWidgetItem::GxsIdTreeWidgetItem(QTreeWidget *parent)
|
GxsIdTreeWidgetItem::GxsIdTreeWidgetItem(QTreeWidget *parent)
|
||||||
: QObject(NULL), QTreeWidgetItem(parent), mCount(0), mColumn(0)
|
: QObject(NULL), QTreeWidgetItem(parent), mCount(0), mColumn(0)
|
||||||
@ -193,3 +194,4 @@ void GxsIdTreeWidgetItem::loadId()
|
|||||||
connect(rApp, SIGNAL(secondTick()), this, SLOT(loadId()));
|
connect(rApp, SIGNAL(secondTick()), this, SLOT(loadId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -57,6 +57,7 @@ private:
|
|||||||
int mColumn;
|
int mColumn;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
class GxsIdTreeWidgetItem : public QObject, public QTreeWidgetItem
|
class GxsIdTreeWidgetItem : public QObject, public QTreeWidgetItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -78,5 +79,6 @@ private:
|
|||||||
int mCount;
|
int mCount;
|
||||||
int mColumn;
|
int mColumn;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -782,7 +782,7 @@ void GxsForumThreadWidget::fillThreadStatus(QString text)
|
|||||||
|
|
||||||
QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn)
|
QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn)
|
||||||
{
|
{
|
||||||
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole);
|
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole);
|
||||||
item->moveToThread(ui->threadTreeWidget->thread());
|
item->moveToThread(ui->threadTreeWidget->thread());
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
@ -810,8 +810,8 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
|
|||||||
item->setText(COLUMN_THREAD_DATE, text);
|
item->setText(COLUMN_THREAD_DATE, text);
|
||||||
item->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort);
|
item->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort);
|
||||||
|
|
||||||
item->setText(COLUMN_THREAD_AUTHOR, QString::fromStdString(msg.mMeta.mAuthorId.toStdString()));
|
//item->setText(COLUMN_THREAD_AUTHOR, QString::fromStdString(msg.mMeta.mAuthorId.toStdString()));
|
||||||
//item->setId(msg.mMeta.mAuthorId, COLUMN_THREAD_AUTHOR);
|
item->setId(msg.mMeta.mAuthorId, COLUMN_THREAD_AUTHOR);
|
||||||
//#TODO
|
//#TODO
|
||||||
#if 0
|
#if 0
|
||||||
text = QString::fromUtf8(authorName.c_str());
|
text = QString::fromUtf8(authorName.c_str());
|
||||||
|
Loading…
Reference in New Issue
Block a user