示例#1
0
bool DrawElement::setDrawWidget(OGLWidget *value)
{


    if(value == pDrawWidget && value != NULL)
    {
        //  qDebug() << "VALUE  " << fboWrapper.errorStatus;
        if(fboWrapper.errorStatus != 0 &&  pDrawWidget->isInit()){
            setFBOWrapper(pDrawWidget->initFboWrapper(pDrawWidget->getWax(),pDrawWidget->getWay()));//TODO
            for (int i = 0; i <effects.length(); i++)
                effects[i].setShaderWrapper(pDrawWidget->getShaderPrograms()[effects[i].getShaderWrapperIndex()]);
        }
        return false;
    }


    if(pDrawWidget != NULL)
    {
        disconnect(pDrawWidget, SIGNAL(startSignal()), this, SLOT(start()));
        disconnect(pDrawWidget, SIGNAL(stopSignal()), this, SLOT(stop()));
        disconnect(pDrawWidget, SIGNAL(pauseSignal()), this, SLOT(pause()));
    }


    pDrawWidget = value;

    connect(pDrawWidget, SIGNAL(startSignal()), this, SLOT(start()));
    connect(pDrawWidget, SIGNAL(stopSignal()), this, SLOT(stop()));
    connect(pDrawWidget, SIGNAL(pauseSignal()), this, SLOT(pause()));

    for (int i = 0; i <effects.length(); i++)
        effects[i].setShaderWrapper(pDrawWidget->getShaderPrograms()[effects[i].getShaderWrapperIndex()]);

    // qDebug() << "before alpha effect created";
    // qDebug() << "pDrawWidget->getShaderPrograms().length:"<<pDrawWidget->getShaderPrograms().length();


    if(fboWrapper.errorStatus != 0  && pDrawWidget->isInit())
    {
        // qDebug()<<"BEFORE SETFBOWRAPPER";
        setFBOWrapper(pDrawWidget->initFboWrapper(pDrawWidget->getWax(),pDrawWidget->getWay()));//TODO


        //qDebug()<<"AFTER SETFBOWRAPPER";

    }
    return true;

}
示例#2
0
// renyang - 傳送訊號
void Transmitter::emitSignal(signal_type type)
{
#ifdef REN_DEBUG
	qWarning("Transmitter::emitSignal(signal_type type)");
#endif
	switch(type)
	{
		if (working)
		{
			case SIGNAL_FINISH:
				// renyang - Call會執行stopCall()
				emit finishSignal();
				break;
			case SIGNAL_START:
				// renyang - Call::startRecorder()
				emit startSignal();
				break;
			case SIGNAL_RINGMESSAGE:
				// renyang - Call::ringMessage()
				emit ringMessage();
				break;
		}
		default:
			break;
	}
}
示例#3
0
DrawElement::DrawElement(OGLWidget *drawWidget, QObject *parent) : QObject(parent)
{
    playTimeUntilFreeze = 1000;
    group_wich_el_belong = NULL;
    startDrawTime = 0;
    pDrawWidget = drawWidget;
    bPause = false;
    x = 0;
    y = 0;
    z = 0;
    width = 100;
    height = 100;
    keyCouter = 0;
    lifeTime = -1;
    icon = QImage();
    typeId = Element_type::Empty;
    fboWrapper.errorStatus = -1;

    show_text_cursor = false;
    use_anim_time = 2;
    if(pDrawWidget != NULL)
    {
        connect(pDrawWidget, SIGNAL(startSignal()), this, SLOT(start()));
        connect(pDrawWidget, SIGNAL(stopSignal()), this, SLOT(stop()));
        connect(pDrawWidget, SIGNAL(pauseSignal()), this, SLOT(pause()));
    }

    // qDebug() << "RRRR BEFORE";
    // if (pDrawWidget)
    //fboWrapper=pDrawWidget->initFboWrapper();
    //qDebug() << "RRRR AFTER";
}
示例#4
0
文件: main.c 项目: daid/F3B
int luaStartSignal(lua_State* L)
{
	int num = luaL_checknumber(L, 1);
	int length = luaL_checknumber(L, 2);
	DEBUG(DEBUG_LUA, "Start Signal: %i: %i\n", num, length);
	startSignal(num, length);
	return 0;
}
示例#5
0
void MainWindow::homeSlot()
{
	MainWidget *mw = new MainWidget();
	ui.scrollArea->setWidget(mw);
	WidgetFactory::SetCurrentWidget(WidgetFactory::Home);

	connect(mw, SIGNAL(startSignal()), this, SLOT(reportSlot()));
	connect(mw, SIGNAL(recordSignal(QString)), this, SLOT(recordSlot(QString)));

	changeSlot("");
}
示例#6
0
int getData(char *buffer, char *data) 
{
    size_t len = 0;

    startSignal(8);
    readData(8, buffer);
    dispData(buffer, BUFFER_SIZE);
    len = rawToBinary(buffer, data, THRESHOLD);
    dispData(data, DATA_SIZE);
    printf("len: %d\n", len);
    while (!(len == DATA_SIZE && validData(data))) {
        delay(2000); // wait 2 sec before next iteration.
        startSignal(8);
        readData(8, buffer);
        dispData(buffer, BUFFER_SIZE);
        len = rawToBinary(buffer, data, THRESHOLD);
        dispData(data, DATA_SIZE);
    printf("len: %d\n", len);
    }

    return len;
} 
示例#7
0
DrawElement::~DrawElement()
{


    qDebug() << "delete DrawElement";
    if(pDrawWidget != NULL)
    {
        pDrawWidget->deleteFBO(fboWrapper);
        disconnect(pDrawWidget, SIGNAL(startSignal()), this, SLOT(start()));
        disconnect(pDrawWidget, SIGNAL(stopSignal()), this, SLOT(stop()));
        disconnect(pDrawWidget, SIGNAL(pauseSignal()), this, SLOT(pause()));
    }
    if(group_wich_el_belong != NULL)
    {
        void *gr_temp = group_wich_el_belong;
        group_wich_el_belong->deInitGroupBlocks();
        delete gr_temp;
    }
    qDebug() << "delete end";
}
示例#8
0
Call::Call(int callId, QString myName)
{
#ifdef REN_DEBUG
	qWarning(QString("Call::Call(int %1, QString %2)").arg(callId).arg(myName));
#endif
	id = callId;
	sd = -1;

	dec_state = NULL;
	dec_state = speex_decoder_init(&speex_uwb_mode);
	// renyang - Initializes and allocates resources for a SpeexBits struct
	speex_bits_init(&bits);

	int enh = 1;
	speex_decoder_ctl(dec_state, SPEEX_SET_ENH, &enh);
	speex_decoder_ctl(dec_state, SPEEX_GET_FRAME_SIZE, &frame_size);

	if ((outBuffer = (float *) malloc(frame_size*4*sizeof(float)))==NULL)
		throw Error(Error::IHU_ERR_MEMORY);
	if ((soundBuffer = (float *) malloc(MAXBUFSIZE*sizeof(float)))==NULL)
		throw Error(Error::IHU_ERR_MEMORY);
	readyFrames = 0;

	rsa = new Rsa(RSA_STRENGTH);
	transmitter = new Transmitter(rsa);
	receiver = new Receiver(rsa);
	// renyang-modify 建立一個ip handler
	sctpiphandler = new SctpIPHandler();

	// renyang-modify - 當某一個ip沒有一段時間後, 沒有辦法收到data, 要處理
	connect(sctpiphandler,SIGNAL(SigAddressConfrim(QString)),this,SLOT(SlotAddressConfirm(QString)));
	// renyang-modify - 當多次沒有收到資料, 宣告這一個ip失聯
	connect(sctpiphandler,SIGNAL(SigAddressFail(QString)),this,SLOT(SlotAddressFail(QString)));
	// renyang-modify - 某一個ip有收到資料, 宣告這一個ip復活啦
	connect(sctpiphandler,SIGNAL(SigAddressAvailable(QString)),this,SLOT(SlotAddressAvailable(QString)));

	stopTimer = new QTimer(this);

	active = false;
	muteRec = false;
	mutePlay = false;
	callFree = true;
	aborted = false;
	recording = false;

	// renyang-modify - 初始化IPChanging, 表示最近沒有改變primary address
	IPChanging = false;
	// renyang-modify - 建立一個Timer來計數改完primary address後多久要改回IPChanging=false
	IPChangingTimer = new QTimer(this);
	connect(IPChangingTimer,SIGNAL(timeout()),this,SLOT(resetIPChanging()));

	// renyang-modify - 初始化傳送與接收image的index
	recvImage_index = sendImage_index = 0;

	transmitter->setMyName(myName);

	srand(time(NULL));

	connect( receiver, SIGNAL(newSocket(int,int,struct sockaddr_in)), this, SLOT(newConnection(int,int,struct sockaddr_in)) );
	connect( receiver, SIGNAL(keyRequest()), this, SLOT(sendKeyRequest()) );
	connect( receiver, SIGNAL(sendNewKey()), this, SLOT(sendKey()) );
	connect( receiver, SIGNAL(newKey(QString)), this, SLOT(receivedNewKey(QString)) );
	// renyang - 沒有再接收到client端傳送過來的訊息, 結束此Call
	connect( receiver, SIGNAL(finishSignal()), this, SLOT(stopCall()) );
	connect( receiver, SIGNAL(error(QString)), this, SLOT(abortCall(QString)) );
	connect( receiver, SIGNAL(warning(QString)), this, SLOT(warning(QString)) );
	connect( receiver, SIGNAL(message(QString)), this, SLOT(warning(QString)) );
	// renyang - 對方接受通話, 或是本地端接受通話
	connect( receiver, SIGNAL(connectedSignal()), this, SLOT(connected()) );
	connect( receiver, SIGNAL(ringSignal()), this, SLOT(playRing()) );
	connect( receiver, SIGNAL(initSignal()), this, SLOT(playInit()) );
	connect( receiver, SIGNAL(newAudioData(char*, int)), this, SLOT(decodeAudioData(char*, int)) );
	connect( receiver, SIGNAL(ringReplySignal()), transmitter, SLOT(sendRingReplyPacket()) );

	// renyang-modify - 接收由receiver傳送上來的peer address
	connect (receiver,SIGNAL(SignalgetIps(QStringList)),this,SLOT(SlotgetIps(QStringList)));
	// renyang-modify - 當Receiver接收到與之前的primary不同時, 要求改變primary address
	connect (receiver,SIGNAL(setPrimaddrSignal(QString)),this,SLOT(setPrimaddr(QString)));
	// renyang-modify - 當Receiver接收到事件時, 會通知上層的Call, 以便修改CallTab的ip list情況
	connect (receiver,SIGNAL(SigAddressEvent(QString,QString)),this,SLOT(SlotAddressEvent(QString,QString)));
	// renyang-modify - 對方要求影像
	connect (receiver,SIGNAL(requestImage()),this,SLOT(SlotGetImage()));
	// renyang-modify - 由receiver接收到image資料, 並處理這一些資料
	connect (receiver,SIGNAL(newVideoData(char *,int)),this,SLOT(decodeVideoData(char *,int)));
	// renyang-modify - 當收到想要接收目前封包的下一部分時...
	connect (receiver,SIGNAL(requestNextImage()),this,SLOT(sendVideo()));
	// renyang-modify - 接收到完整的image,準備把它放到video_label
	connect (receiver,SIGNAL(completeImage()),this,SLOT(processImage()));
	// renyang-modify - 跟對方要求影像失敗
	connect (receiver,SIGNAL(requestImageFail()),this,SLOT(SlotrequestImageFail()));
	// renyang-modify - end

	connect( transmitter, SIGNAL(ringMessage()), this, SLOT(ringMessage()) );
	connect( transmitter, SIGNAL(finishSignal()), this, SLOT(stopCall()) );
	connect( transmitter, SIGNAL(error(QString)), this, SLOT(abortCall(QString)) );
	connect( transmitter, SIGNAL(message(QString)), this, SLOT(message(QString)) );
	connect( transmitter, SIGNAL(startSignal()), this, SLOT(startRecorder()) );

	connect( stopTimer, SIGNAL(timeout()), this, SLOT(close()) );

	// renyang-modify - 初始化streamno
	streamno = 1;

}