Beispiel #1
0
bool uploadModule::drawForeground()
{
  bool ret=0;
  if (isUploading()) {
    ofSetColor(0, 0, 0,192);
    ofRect(0, 0, ofGetWidth(), ofGetHeight());
		ofSetColor(255, 255, 255);
		spinner.draw((ofGetWidth())/2,ofGetHeight()/2, 300);
    ofSetColor(white);
		label.drawString("Uploading: do not unplug", ofGetWidth()/2, ofGetHeight()/4);
    ofSetColor(gray);
    ofRect(ofGetWidth()/4, ofGetHeight()*7/8., ofGetWidth()/2, 30);
    ofSetColor(orange);
    ofRect(ofGetWidth()/4+5, ofGetHeight()*7/8.+5, (ofGetWidth()/2-10)*prog.percentDone(), 20);
    ret=true;
    label.setSize(20);
    label.drawString(prog.report(), ofGetWidth()/2, ofGetHeight()*7/8.+60);
    label.setSize(70);
	}
  else if(uploaded.running()){
    ret=true;
    ofSetColor(0, 0, 0,192);
    ofRect(0, 0, ofGetWidth(), ofGetHeight());
    ofRectangle k=label.getBoundingBox("You may now unplug the robot.", ofGetWidth()/2, ofGetHeight()/2);
    drawStyledBox(k.x-50, k.y-50, k.width+100, k.height+100);
    ofSetColor(white);
		label.drawString("You may now unplug the robot.", ofGetWidth()/2, ofGetHeight()/2);
  }
  return ret;
}
Beispiel #2
0
bool uploadModule::clickDown(int _x, int _y)
{
  bool ret=0;
  if(blocks->base.uploadBut.clickDown(_x, _y)&&!isUploading()){
    ret=true;
    upload();
  }
  return ret;
}
Beispiel #3
0
/**
 * @param tokens message tokens
 */
bool SessionState::handleMessage(const QStringList& tokens)
{
    if(tokens[0] == "SAY") {
        int userid = tokens.at(1).toInt();
        if(hasUser(userid))
            emit chatMessage(user(userid).name(), tokens.at(2));
        else
            qWarning() << "Got chat message from unknown user:"******"USER") {
        updateUser(tokens);
    } else if(tokens[0] == "PART") {
        partUser(tokens);
    } else if(tokens[0] == "SLOCK") {
        emit syncWait();
    } else if(tokens[0] == "SUNLOCK") {
        emit syncDone();
    } else if(tokens[0] == "BOARD") {
        update(Session(tokens));
    } else if(tokens[0] == "RASTER") {
        releaseRaster();
        expectRaster_ = tokens.at(1).toInt();
        if(expectRaster_ == 0)
            emit rasterReceived(100);
    } else if(tokens[0] == "GIVERASTER") {
        emit syncRequest();
    } else if(tokens[0] == "MORE") {
        if(isUploading())
            sendRasterChunk();
        else
            qWarning() << "Got request for more raster data, but we're not uploading anything!";
    } else if(tokens[0] == "ANNOTATE") {
        protocol::Annotation a(tokens);
        if(!a.isValid())
            qWarning() << "Received an invalid annotation";
        else
            emit annotation(a);
    } else if(tokens[0] == "RMANNOTATION") {
        emit rmAnnotation(tokens.at(1).toInt());
    } else
        return false;
    return true;
}