示例#1
0
void FriendsListDialog::slot_showPopupWatches(const QPoint & iPoint)
{
    popup_item = watchesView->indexAt(iPoint);
    if (popup_item != QModelIndex())
    {
        popup_playerlisting = watchesListModel->playerListingFromIndex(popup_item);
        if(popup_playerlisting->name == connection->getUsername())
            return;

        QMenu menu(watchesView);
        menu.addAction(tr("Match"), this, SLOT(slot_popupMatch()));
        menu.addAction(tr("Talk"), this, SLOT(slot_popupTalk()));
        menu.addSeparator();
        menu.addAction(tr("Add to Friends"), this, SLOT(slot_addFriend()));
        //Maybe we don't want to have match and talk as fan options?
        menu.addAction(tr("Remove from Watches"), this, SLOT(slot_removeWatch()));
        menu.addAction(tr("Block"), this, SLOT(slot_addBlock()));
        menu.exec(watchesView->mapToGlobal(iPoint));
    }
}
示例#2
0
文件: room.cpp 项目: iamsyt/qgo
void Room::slot_showPopup(const QPoint & iPoint)
{
	popup_item = playerView->indexAt(iPoint);
	if (popup_item != QModelIndex())
	{
		/* If we have the listing now, we don't need to look it up
		 * again later FIXME */
		QModelIndex translated = popup_item;
		popup_playerlisting = playerListModel->playerListingFromIndex(translated);
		if(popup_playerlisting->name == connection->getUsername())
			return;
			
    	QMenu menu(playerView);
	menu.addAction(tr("Stats"), this, SLOT(slot_popupStats()));
	QAction * matchAct = new QAction(tr("Match"), 0);
	if(popup_playerlisting->info.contains("X"))
		matchAct->setEnabled(false);
	else
		connect(matchAct, SIGNAL(triggered()), this, SLOT(slot_popupMatch()));
		
	menu.addAction(matchAct);
	
		
	menu.addAction(tr("Talk"), this, SLOT(slot_popupTalk()));
	menu.addSeparator();
    	if(popup_playerlisting->friendWatchType == PlayerListing::friended)
    		menu.addAction(tr("Remove from Friends"), this, SLOT(slot_removeFriend()));
    	else
    		menu.addAction(tr("Add to Friends"), this, SLOT(slot_addFriend()));
    	if(popup_playerlisting->friendWatchType == PlayerListing::watched)
    		menu.addAction(tr("Remove from Watches"), this, SLOT(slot_removeWatch()));
    	else
    		menu.addAction(tr("Add to Watches"), this, SLOT(slot_addWatch()));
    	menu.addAction(tr("Block"), this, SLOT(slot_addBlock()));
    	menu.exec(playerView->mapToGlobal(iPoint));
	delete matchAct;
	}
}