Пример #1
0
Widget::Widget(QWidget *parent) :
		QWidget(parent),
		ui(new Ui::Widget)
{
		ui->setupUi(this);

		this->playStatus = false;
		this->pauseStatus = true;

		ui->videoSlider->setRange(0, 100);
		ui->listWidget->setVisible(false);
		ui->addFileButton->setVisible(false);

		connect(ui->playButton, SIGNAL(clicked()), this, SLOT(playOrPause()));
		connect(ui->videoSlider,SIGNAL(sliderMoved(int)),this, SLOT(seek(int)));
		connect(ui->openButton, SIGNAL(toggled(bool)), this,SLOT(openVideo(bool)));
		connect(ui->stopButton, SIGNAL(clicked()),this,SLOT(stop()));
		connect(ui->kuaijinButton, SIGNAL(clicked()), this, SLOT(kuaijin()));
		connect(ui->kuaituiButton,SIGNAL(clicked()), this,SLOT(kuaitui()));
		connect(ui->addFileButton,SIGNAL(clicked()), this, SLOT(addFileList()));
		connect(ui->listWidget,SIGNAL(doubleClicked(QModelIndex)), this, SLOT(selectFile()));
		connect(ui->prevButton, SIGNAL(clicked()), this,SLOT(prevVideo()));
		connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(nextVideo()));
		connect(ui->muteButton, SIGNAL(toggled(bool)), this, SLOT(MuteOrNot(bool)));
		connect(ui->soundAddButton, SIGNAL(clicked()), this, SLOT(soundAdd()));
		connect(ui->soundSubButton, SIGNAL(clicked()), this, SLOT(soundSub()));

		timer = new QTimer(this);
		connect(timer,SIGNAL(timeout()),this,SLOT(get_time_pos()));
		timer->start(1000);

}
Пример #2
0
int main( int argc, char** argv )
{
    osg::ref_ptr<ReadAndShareCallback> sharer = new ReadAndShareCallback;
    osgDB::Registry::instance()->setReadFileCallback( sharer.get() );
    
    osg::ref_ptr<osg::Group> root = new osg::Group;
    addFileList( root.get(), "files.txt" );
    
    osgViewer::Viewer viewer;
    viewer.setSceneData( root.get() );
    viewer.addEventHandler( new RemoveModelHandler(sharer.get()) );
    viewer.addEventHandler( new osgViewer::StatsHandler );
    return viewer.run();
}
Пример #3
0
// puts file from client into memory and directory
int store(rio_t *rio, int connfd)
{
	size_t num; 
	char nameBuf[NAME_SIZE]; 
	char FileName[NAME_SIZE]; 
	char FileSize[4];
	unsigned int filesize, netOrder, stat, replySize; 
	char data_in_file[FILE_SIZE];
	char  *data, *reply; 
	FILE *file; 
	unsigned int maxBytes = 4; 

	if((num = Rio_readnb(rio, nameBuf, NAME_SIZE)) == NAME_SIZE) 
	{
        memcpy(&FileName, &nameBuf, NAME_SIZE);
        printf("Filename  = %s\n", FileName);
    } 
    else 
    {
        printf("Filename  = NONE\n");
        stat = -1;
    }

    if((num = Rio_readnb(rio,FileSize,maxBytes)) == maxBytes)
    {
    	memcpy(&netOrder,&FileSize,maxBytes);
    	filesize = ntohl(netOrder); 
    }
    else
    {
    	stat = -1; 
    }

    if((num = Rio_readnb(rio,data_in_file,filesize)) == filesize)
    {
    	data = (char*) malloc(sizeof(char)*filesize); 

    	if(data == NULL)
    	{
    		fprintf(stderr, "Memory Error\n"); 
    		return -1; 
    	}

    	memcpy(data,&data_in_file,filesize);
    }
    else
    {
    	stat = -1; 
    }

    if((file = Fopen(nameBuf,"w")) != NULL)
    {
    	Fwrite(data, sizeof(char), filesize, file);
    	Fclose(file); 

    	if(addFileList(FileName) == 0)
    	{
    		stat = 0; 
    	} 
    	else
    	{
    		stat = -1; 
    	}
    }
    else
    {
    	stat = -1; 
    }

    free(data); 
    unsigned int currStat = 4; 
    replySize = currStat;

    reply = (char*) malloc (sizeof(char*)*replySize);
    if(reply == NULL) { fprintf(stderr, "Memory Error\n"); return -1; }
    char *replyBuf = reply;

    
    netOrder = htonl(stat);
    memcpy(replyBuf, &netOrder, currStat);
    replyBuf += currStat;

    Rio_writen(connfd, reply, replySize);
    free(reply);

    return stat;

}