Beispiel #1
0
void ContactModel::addContact(QSharedPointer<Contact> contact)
{
  // contacts.push_back(contact);
  beginInsertRows(QModelIndex(), rowCount(), rowCount());
  // contacts << contact;
  contacts.push_back(contact);
  endInsertRows();
  connect(contact.data(), SIGNAL(contactChanged()),SLOT(drawPins()));
  emit dataChanged(createIndex(0,0),createIndex(contacts.size(),0));
}
Beispiel #2
0
//--------------------------------------------------------------
void TCPClient::update(){
    
    //get data from host (3dsmax)
    ofSetColor(255, 255, 255);
    string message = "TCP SERVER EasyPin 006 TRANSFORM \n\nconnect on port: "+ofToString(TCP.getPort());
    ofDrawBitmapString(message, 80, 80);
    
    //for each connected client lets get the data being sent and lets print it to the screen
	for(unsigned int i = 0; i < (unsigned int)TCP.getLastID(); i++)
    {
		if(!TCP.isClientConnected(i) )continue;
        
        //we only want to update the text we have recieved there is data
		string str = TCP.receive(i);
        
		if(str.length() > 0)
        {
			storeText.push_back(str);
            
            for(int i = 0; i < size; i++)
                pixels[i] = 255  - str[i]; //invert values here because it doesn't work in maxscript
		}
	}
    
    
    //draw info about TCP
    if(TCP.isClientConnected(0))
    {
        //calculate where to draw the text
        int xPos = 80;
        int yPos = 150;
        
        //get the ip and port of the client
        string port = ofToString( TCP.getClientPort(0) );
        string ip   = TCP.getClientIP(0);
        string info = "client "+ofToString(0)+" -connected from "+ip+" on port: "+port;
        string storeInfo = "stored frames: " + ofToString(storeText.size()) + " fIdx: " + ofToString(frameIndex);
        
        //draw the info text and the received text bellow it
        ofDrawBitmapString(info, xPos, yPos);
        ofDrawBitmapString(storeInfo, xPos, yPos + 35);
        
        if(bPause)
            ofDrawBitmapString("PLAYBACK PAUSED", xPos, yPos + 70);
        
        if(bMentionError)
            ofDrawBitmapString("ERROR in received data: please clear array [c]", xPos, yPos + 105);
    }
    
    if (bStop)
        drawPins(pixels);
	else
        playBack(storeText, frameIndex, sequenceFPS, bPause, bStop);
}
Beispiel #3
0
void TCPClient::playBack(vector <string> & _strFrames, int & _frameIndex, int _sequenceFPS, bool _pause, bool _stop)
{
    if(_strFrames.size() != 0)
    {
        if(!bPause)
        {
            _frameIndex = (int)((ofGetElapsedTimef() - elapsedTime) * _sequenceFPS) % _strFrames.size();
        }
        
        if (!bStop) {
            unsigned char * theColors = new unsigned char[size];
            for(int i = 0; i < size; i++)
            {
                theColors[i] = 255  - _strFrames[_frameIndex][i]; //invert values here because it doesn't work in maxscript
            }
            drawPins(theColors);
        }
    }
}