コード例 #1
0
int RemoteBranchModel::findBranchByName(const QString &name) const
{
    const int count = branchCount();
    for (int i = 0; i < count; i++)
        if (branchName(i) == name)
            return i;
    return -1;
}
コード例 #2
0
QVariant RemoteBranchModel::data(const QModelIndex &index, int role) const
{
    const int row = index.row();
    switch (role) {
        case Qt::DisplayRole:
        return branchName(row);
        case Qt::ToolTipRole:
        if (m_branches.at(row).toolTip.isEmpty())
            m_branches.at(row).toolTip = toolTip(m_branches.at(row).currentSHA);
        return m_branches.at(row).toolTip;
        break;
        default:
        break;
    }
    return QVariant();
}
コード例 #3
0
CString OTagGroup::FindTagName(CString target)
{
   int delimiter = target.Find( _T('.') );
   BOOL bFoundTag = TRUE;
   if( delimiter == -1 )   // tag name if no delimiter
   {
	   if(bFoundTag)
	   {
		  POSITION pos = tags.GetHeadPosition();
		  while( pos )
		  {
			OModbusTag* pTag = tags.GetNext( pos );
			if( pTag->name.CompareNoCase( target ) == 0 )
			{
				bFoundTag = FALSE;
				return GetPathName() + target;
			}
		  }
		}
	   if(bFoundTag)
	   {
		   CString branchName = target;
		   POSITION pos = groups.GetHeadPosition();
		   while( pos )
		   {
			 OTagGroup* pBranch = groups.GetNext( pos );
             if( pBranch->name.CompareNoCase( branchName ) == 0 )
                return target;
		   }
	   }
    }
   else
   {
      CString branchName( target.Left( delimiter ) );
      POSITION pos = groups.GetHeadPosition();
      while( pos )
      {
         OTagGroup* pBranch = groups.GetNext( pos );
         if( pBranch->name.CompareNoCase( branchName ) == 0 )
            return pBranch->FindTagName( target.Mid( delimiter+1 ) );
      }
   }
   return "";
}