mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
cleaned up the code, added icon for groups, only save/restore expanded items when changes are expected
This commit is contained in:
parent
1181e26bc5
commit
fdea4febbe
@ -40,6 +40,7 @@
|
||||
|
||||
#define IS_MESSAGE_UNREAD(flags) (flags & (RS_MSG_NEW | RS_MSG_UNREAD_BY_USER))
|
||||
|
||||
#define IMAGE_GROUP24 ":/images/user/group24.png"
|
||||
#define IMAGE_STAR_ON ":/images/star-on-16.png"
|
||||
#define IMAGE_STAR_OFF ":/images/star-off-16.png"
|
||||
|
||||
@ -111,20 +112,6 @@ int RsFriendListModel::columnCount(const QModelIndex &parent) const
|
||||
return COLUMN_THREAD_NB_COLUMNS ;
|
||||
}
|
||||
|
||||
// bool RsFriendListModel::getProfileData(const QModelIndex& i,Rs::Msgs::MessageInfo& fmpe) const
|
||||
// {
|
||||
// if(!i.isValid())
|
||||
// return true;
|
||||
//
|
||||
// quintptr ref = i.internalId();
|
||||
// uint32_t index = 0;
|
||||
//
|
||||
// if(!convertInternalIdToMsgIndex(ref,index) || index >= mMessages.size())
|
||||
// return false ;
|
||||
//
|
||||
// return rsMsgs->getMessage(mMessages[index].msgId,fmpe);
|
||||
// }
|
||||
|
||||
bool RsFriendListModel::hasChildren(const QModelIndex &parent) const
|
||||
{
|
||||
if(!parent.isValid())
|
||||
@ -670,7 +657,7 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const
|
||||
if(!node)
|
||||
return QVariant();
|
||||
|
||||
#ifndef DEBUG_MODEL
|
||||
#ifdef DEBUG_MODEL
|
||||
std::cerr << node->node_info.location.c_str() ;
|
||||
#endif
|
||||
switch(col)
|
||||
@ -800,6 +787,8 @@ QVariant RsFriendListModel::decorationRole(const EntryIndex& entry,int col) cons
|
||||
|
||||
switch(entry.type)
|
||||
{
|
||||
case ENTRY_TYPE_GROUP: return QVariant(QIcon(IMAGE_GROUP24));
|
||||
|
||||
case ENTRY_TYPE_NODE:
|
||||
{
|
||||
const HierarchicalNodeInformation *hn = getNodeInfo(entry);
|
||||
@ -812,8 +801,8 @@ QVariant RsFriendListModel::decorationRole(const EntryIndex& entry,int col) cons
|
||||
|
||||
return QVariant(QIcon(sslAvatar));
|
||||
}
|
||||
default: return QVariant();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void RsFriendListModel::clear()
|
||||
|
@ -153,7 +153,7 @@ private:
|
||||
bool m_showOfflineNodes;
|
||||
};
|
||||
|
||||
NewFriendList::NewFriendList(QWidget *parent) : RsAutoUpdatePage(1000,parent), ui(new Ui::NewFriendList())
|
||||
NewFriendList::NewFriendList(QWidget *parent) : RsAutoUpdatePage(5000,parent), ui(new Ui::NewFriendList())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@ -1127,11 +1127,13 @@ void NewFriendList::checkInternalData(bool force)
|
||||
std::set<QString> expanded_indexes;
|
||||
std::set<QString> selected_indexes;
|
||||
|
||||
saveExpandedPathsAndSelection(expanded_indexes, selected_indexes);
|
||||
if(force)
|
||||
saveExpandedPathsAndSelection(expanded_indexes, selected_indexes);
|
||||
|
||||
mModel->checkInternalData(force);
|
||||
|
||||
restoreExpandedPathsAndSelection(expanded_indexes, selected_indexes);
|
||||
if(force)
|
||||
restoreExpandedPathsAndSelection(expanded_indexes, selected_indexes);
|
||||
}
|
||||
|
||||
void NewFriendList::exportFriendlistClicked()
|
||||
|
Loading…
Reference in New Issue
Block a user