Exemplo n.º 1
0
Arquivo: Gfm.cpp Projeto: r043v/g.m4kr
void mGfm2h(int **Gfm, int nb, const char *path, const char *name, int archive=1, int startFrm=-1)
{ char nm[42], pt[1024] ; int size ; unsigned char *Gf ;
  int bin = Form1->createBin->Checked ;
  if(bin) { if(nb>1) {  sprintf(Form1->msg,"do you really want create %i files ?",nb) ;
                        if(Form1->ask(Form1->msg)!=6) return ; // if no, return
                     }
            strcpy(pt+512,path) ;
            int n=512 ; while(pt[++n] != '.') ; pt[n]=0 ;  if(n>1000) return ;
  }
  for(int c=0;c<nb;c++)
  {  sprintf(nm,"%s%i",name,c+startFrm+(startFrm < 0)) ;
     if(bin){ if(nb>1) sprintf(pt,"%s%i.gfm",pt+512,c) ;
                 else  sprintf(pt,"%s.gfm",pt+512) ;
            }
     if(archive) { Gf = Gfm2data(Gfm[c],&size) ;
                   if(Gf){  if(bin) saveGfm(Gf,pt) ;
                            else toHeader(path, nm, Gf, size);
                            free(Gf) ;
                         }
     }    else { if(bin) saveGfm(Gfm[c],pt) ;
                  else gfm2h(Gfm[c], path, nm);
               } 
  };
 if(!bin && startFrm < 0) // if some frame converted, add array
 { FILE *f = fopen(path,"a") ;
   if(archive) fprintf(f,"\n\nint * data2Gfm(unsigned char *data) ;\n\nint* %s[%i] = { data2Gfm(%s0)",name,nb,name);
   else        fprintf(f,"\n\nint* %s[%i] = { %s0",name,nb,name);

   for(int c=1;c<nb;c++)
        if(archive) fprintf(f,", data2Gfm(%s%i)",name,c) ;
         else       fprintf(f,", %s%i",name,c) ;

   fprintf(f," };") ; fclose(f) ;
 }
}
Exemplo n.º 2
0
void mGfm2h(int **Gfm, int nb, const char *path, const char *name)
{ char nm[42] ; int size ; unsigned char *Gf ;
  FILE *f = fopen(path,"w") ; fclose(f) ;
  for(int c=0;c<nb;c++)
  {  printf("\n\n .. convert frame %i\n",c) ; //system("pause") ;
     sprintf(nm,"%s%i",name,c) ;
     Gf = Gfm2data(Gfm[c],&size) ;
     toHeader(path, nm, Gf, size); free(Gf) ;
  };
  f = fopen(path,"a") ;
  fprintf(f,"\n\nint * data2Gfm(unsigned char *data) ;\n\nint* %s[%i] = { data2Gfm(%s0)",name,nb,name);
  for(int c=1;c<nb;c++) fprintf(f,", data2Gfm(%s%i)",name,c) ; fprintf(f," };") ; fclose(f) ;
}
Exemplo n.º 3
0
    QNetworkReply* Request::exec()
    {
        QNetworkRequest request(_url);
        QByteArray authHeader = toHeader().toUtf8();
        if (!authHeader.isEmpty()) {
            request.setRawHeader("Authorization", authHeader);
        }
        request.setHeader(QNetworkRequest::ContentTypeHeader, _contentType);

        if (_reply != 0 && _reply->parent() == this) {
            delete _reply;
            _reply = 0;
        }

        switch (_method) {
            case POST: {
                _reply = getNetworkAccessManager()->post(request, getBody());
            }
            break;
            case PUT: {
                _reply = getNetworkAccessManager()->put(request, getBody());
            }
            break;
            case DELETE: {
                _reply = getNetworkAccessManager()->deleteResource(request);
            }
            break;
            default: {
                _reply = getNetworkAccessManager()->get(request);
            }
        }

        connect(_reply, SIGNAL(finished()), this, SLOT(replyFinished()));
        _reply->setParent(this);

        return _reply;
    }