QTfrontend/ui/widget/chatwidget.cpp
changeset 11865 047be82b6f67
parent 11812 92b3b0fcb41f
child 12897 fc47fc4af6bd
equal deleted inserted replaced
11864:bff919afc63f 11865:047be82b6f67
   268     connect(acKick, SIGNAL(triggered(bool)), this, SLOT(onKick()));
   268     connect(acKick, SIGNAL(triggered(bool)), this, SLOT(onKick()));
   269     acBan = new QAction(QAction::tr("Ban"), chatNicks);
   269     acBan = new QAction(QAction::tr("Ban"), chatNicks);
   270     acBan->setIcon(QIcon(":/res/ban.png"));
   270     acBan->setIcon(QIcon(":/res/ban.png"));
   271     acBan->setData(QVariant(true));
   271     acBan->setData(QVariant(true));
   272     connect(acBan, SIGNAL(triggered(bool)), this, SLOT(onBan()));
   272     connect(acBan, SIGNAL(triggered(bool)), this, SLOT(onBan()));
       
   273     acDelegate = new QAction(QAction::tr("Delegate room control"), chatNicks);
       
   274     acDelegate->setIcon(QIcon(":/res/chat/roomadmin.png"));
       
   275     acDelegate->setData(QVariant(true));
       
   276     connect(acDelegate, SIGNAL(triggered(bool)), this, SLOT(onDelegate()));
   273     acFollow = new QAction(QAction::tr("Follow"), chatNicks);
   277     acFollow = new QAction(QAction::tr("Follow"), chatNicks);
   274     acFollow->setIcon(QIcon(":/res/follow.png"));
   278     acFollow->setIcon(QIcon(":/res/follow.png"));
   275     acFollow->setData(QVariant(false));
   279     acFollow->setData(QVariant(false));
   276     connect(acFollow, SIGNAL(triggered(bool)), this, SLOT(onFollow()));
   280     connect(acFollow, SIGNAL(triggered(bool)), this, SLOT(onFollow()));
   277     acIgnore = new QAction(QAction::tr("Ignore"), chatNicks);
   281     acIgnore = new QAction(QAction::tr("Ignore"), chatNicks);
   622 
   626 
   623     if(mil.size())
   627     if(mil.size())
   624         emit ban(mil[0].data().toString());
   628         emit ban(mil[0].data().toString());
   625 }
   629 }
   626 
   630 
       
   631 void HWChatWidget::onDelegate()
       
   632 {
       
   633     QModelIndexList mil = chatNicks->selectionModel()->selectedRows();
       
   634 
       
   635     if(mil.size())
       
   636         emit delegate(mil[0].data().toString());
       
   637 }
       
   638 
   627 void HWChatWidget::onInfo()
   639 void HWChatWidget::onInfo()
   628 {
   640 {
   629     QModelIndexList mil = chatNicks->selectionModel()->selectedRows();
   641     QModelIndexList mil = chatNicks->selectionModel()->selectedRows();
   630 
   642 
   631     if(mil.size())
   643     if(mil.size())
   730 
   742 
   731 void HWChatWidget::adminAccess(bool b)
   743 void HWChatWidget::adminAccess(bool b)
   732 {
   744 {
   733     chatNicks->removeAction(acKick);
   745     chatNicks->removeAction(acKick);
   734     //chatNicks->removeAction(acBan);
   746     //chatNicks->removeAction(acBan);
       
   747     chatNicks->removeAction(acDelegate);
   735 
   748 
   736     m_isAdmin = b;
   749     m_isAdmin = b;
   737 
   750 
   738     if(b)
   751     if(b)
   739     {
   752     {
   740         chatNicks->insertAction(0, acKick);
   753         chatNicks->insertAction(0, acKick);
   741         //chatNicks->insertAction(0, acBan);
   754         //chatNicks->insertAction(0, acBan);
       
   755         chatNicks->insertAction(acFriend, acDelegate);
   742     }
   756     }
   743 }
   757 }
   744 
   758 
   745 void HWChatWidget::dragEnterEvent(QDragEnterEvent * event)
   759 void HWChatWidget::dragEnterEvent(QDragEnterEvent * event)
   746 {
   760 {
   929 
   943 
   930     if (m_isAdmin)
   944     if (m_isAdmin)
   931     {
   945     {
   932         acKick->setVisible(!isSelf && isOnline);
   946         acKick->setVisible(!isSelf && isOnline);
   933         acBan->setVisible(!isSelf);
   947         acBan->setVisible(!isSelf);
       
   948         acDelegate->setVisible(!isSelf && players->isFlagSet(m_userNick, PlayersListModel::InRoom));
   934     }
   949     }
   935 
   950 
   936     m_nicksMenu->clear();
   951     m_nicksMenu->clear();
   937 
   952 
   938     foreach(QAction * action, chatNicks->actions())
   953     foreach(QAction * action, chatNicks->actions())