changed from std::string to RsPgpId to represent openned items in FriendList

This commit is contained in:
csoler 2016-11-27 12:21:14 +01:00
parent f3d7948238
commit 6937d870b0
4 changed files with 10 additions and 11 deletions

View File

@ -57,7 +57,7 @@
MessengerWindow* MessengerWindow::_instance = NULL;
std::set<std::string> MessengerWindow::expandedPeers ;
std::set<RsPgpId> MessengerWindow::expandedPeers ;
std::set<RsNodeGroupId> MessengerWindow::expandedGroups ;
/*static*/ void MessengerWindow::showYourself ()
@ -99,7 +99,7 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WindowFlags flags)
connect(NotifyQt::getInstance(), SIGNAL(ownStatusMessageChanged()), this, SLOT(loadmystatusmessage()));
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateOwnStatus(QString,int)));
for (std::set<std::string>::iterator peerIt = expandedPeers.begin(); peerIt != expandedPeers.end(); ++peerIt) {
for (std::set<RsPgpId>::iterator peerIt = expandedPeers.begin(); peerIt != expandedPeers.end(); ++peerIt) {
ui.friendList->addPeerToExpand(*peerIt);
}
expandedPeers.clear();

View File

@ -67,7 +67,7 @@ private:
/** Qt Designer generated object */
Ui::MessengerWindow ui;
static std::set<std::string> expandedPeers ;
static std::set<RsPgpId> expandedPeers ;
static std::set<RsNodeGroupId> expandedGroups ;
};

View File

@ -1196,7 +1196,7 @@ void FriendList::insertPeers()
gpgItem->setFont(i, gpgFont);
}
if (openPeers.find(gpgId.toStdString()) != openPeers.end()) {
if (openPeers.find(gpgId) != openPeers.end()) {
gpgItem->setExpanded(true);
}
}
@ -1253,14 +1253,14 @@ bool FriendList::getExpandedGroups(std::set<RsNodeGroupId> &groups) const
/**
* Returns a list with all gpg ids that are expanded
*/
bool FriendList::getExpandedPeers(std::set<std::string> &peers) const
bool FriendList::getExpandedPeers(std::set<RsPgpId> &peers) const
{
peers.clear();
QTreeWidgetItemIterator it(ui->peerTreeWidget);
while (*it) {
QTreeWidgetItem *item = *it;
if (item->type() == TYPE_GPG && item->isExpanded()) {
peers.insert(peers.end(), getRsId(item));
peers.insert(peers.end(), RsPgpId(getRsId(item)));
}
++it;
}
@ -2282,7 +2282,7 @@ void FriendList::addGroupToExpand(const RsNodeGroupId &groupId)
* Add a gpgId to the openPeers list. These peers
* will be expanded, when they're added to the QTreeWidget
*/
void FriendList::addPeerToExpand(const std::string &gpgId)
void FriendList::addPeerToExpand(const RsPgpId& gpgId)
{
openPeers.insert(gpgId);
}

View File

@ -65,8 +65,8 @@ public:
void processSettings(bool load);
void addGroupToExpand(const RsNodeGroupId &groupId);
bool getExpandedGroups(std::set<RsNodeGroupId> &groups) const;
void addPeerToExpand(const std::string &gpgId);
bool getExpandedPeers(std::set<std::string> &peers) const;
void addPeerToExpand(const RsPgpId &gpgId);
bool getExpandedPeers(std::set<RsPgpId> &peers) const;
std::string getSelectedGroupId() const;
@ -120,8 +120,7 @@ private:
bool groupsHasChanged;
std::set<RsNodeGroupId> openGroups;
#warning this would needs an ID, not a std::string.
std::set<std::string> openPeers;
std::set<RsPgpId> openPeers;
/* Color definitions (for standard see qss.default) */
QColor mTextColorGroup;