Exemplo n.º 1
0
/**
 * @brief MainWindow::MainWindow
 * @param parent
 */
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    connected = false;
    canHandle = -1;
    busOn = false;

    uitimer.setInterval(100);
    uitimer.start();

    connect(&uitimer, SIGNAL(timeout()), this, SLOT(uiUpdate()));

    connect(ui->lineEdit_CanByte0, SIGNAL(textChanged(QString)), this, SLOT(on_bytes_changed()));
    connect(ui->lineEdit_CanByte1, SIGNAL(textChanged(QString)), this, SLOT(on_bytes_changed()));
    connect(ui->lineEdit_CanByte2, SIGNAL(textChanged(QString)), this, SLOT(on_bytes_changed()));
    connect(ui->lineEdit_CanByte3, SIGNAL(textChanged(QString)), this, SLOT(on_bytes_changed()));
    connect(ui->lineEdit_CanByte4, SIGNAL(textChanged(QString)), this, SLOT(on_bytes_changed()));
    connect(ui->lineEdit_CanByte5, SIGNAL(textChanged(QString)), this, SLOT(on_bytes_changed()));
    connect(ui->lineEdit_CanByte6, SIGNAL(textChanged(QString)), this, SLOT(on_bytes_changed()));
    connect(ui->lineEdit_CanByte7, SIGNAL(textChanged(QString)), this, SLOT(on_bytes_changed()));

    canInitializeLibrary();
    on_pushButtonRefresh_clicked();

    ui->progressBarBusLoad->setMinimum(0);
    ui->progressBarBusLoad->setMaximum(10000);
    ui->comboBoxBaud->setCurrentIndex(2);
}
Exemplo n.º 2
0
void DebuggerRegistersView::emulatorEvent(EmulatorEvent event)
{
	if (event == EMULATOR_EVENT_REGISTERS_CHANGED ||
		event == EMULATOR_EVENT_EMULATION_STEP ||
		event == EMULATOR_EVENT_EMULATION_STOP)
	{
		uiUpdate();
	}
}
Exemplo n.º 3
0
void TopLevel::newPage(){

  if(!display_is_setup)
    SetupDisplay();

  XDefineCursor(qtdisplay, Win, WorkCursor);
  XFlush(qtdisplay);

  freeImages();

  int k = -1;

  if(!thispage) {
    XDefineCursor(qtdisplay, Win, ReadyCursor);
    return;
  }

  if (Pimage(thispage) == NULL){

    while((k != 0) && (k != 3) && (k !=1))
      k = GetImage(thispage);

  }

  if (k == 3 ){

    XDefineCursor(qtdisplay, Win, ReadyCursor);
    FreeFax();
    /*    KMessageBox::sorry(i18n("Bad fax file k=3"));*/
    return;
  }

  if (k == 0 ){

    XDefineCursor(qtdisplay, Win, ReadyCursor);
    FreeFax();
    /*    KMessageBox::sorry(i18n("Bad fax file k=0"));*/
    return;
 }

  Image =  Images[0] = Pimage(thispage);

  setCaption(QFile::decodeName(thispage->name));

  Image = generateZoomImages(oz);
  
  PaneWidth = Image->width;
  PaneHeight = Image->height;
  Refresh = 1;

  XDefineCursor(qtdisplay, Win, ReadyCursor);
  uiUpdate();

}
Exemplo n.º 4
0
/********
 * main()
 ********/
int main( int argc, char *argv[] )
{
	struct packet  p;
	char          *device;
	int			   sd;
	char 		   buffer[2000];
	int			   bytes_read = 0;
	
	
	/* comprobamos que el usuario es root */
	if( getuid() )
	{
	    printf( "You must be root to run this program\n" );
	    exit(1);	
	}
	
	/* procesamos la línea de comandos */
	processCommandLine( argc, argv, &device );
	
	/* inicializamos el gestor de conexiones */
	cntInitConnections();
	
	/* inicializamos el sniffer */
	sd = initSniffer( device );
	
	/* inicializamos la interfaz de usuario */
	if( uiInit() == -1 )
	{
		printf( "Error inicializando la interfaz de usuario\n" );
		exit(1);
	}
		
	/* bucle principal */
	for(;;)
	{
		/* actualizamos interfaz de usuario */
		if( uiUpdate() == FALSE )
			break;
		
		/* si ha llegado un paquete, lo procesamos en la interfaz de usuario, por ahora */
		if( bytes_read > 0 )
			uiProcessPacket( &p );
		/* refrescamos la interfaz de usuario */
		uiRefresh();
		
		/* leemos un paquete si hay */
		bytes_read = readPacket( sd, buffer, 2000, &p );
	}
	
	/* salimos de la aplicación */
	uiEnd();
	endSniffer( device, sd );
}
Exemplo n.º 5
0
void TopLevel::zoom( int factor )
{
  if(!thispage || !Image || !faxqtwin || !display_is_setup)
    return;

  Resize = Refresh = 1;

  Image = generateZoomImages(factor);

  PaneWidth = Image->width;
  PaneHeight = Image->height;

  resizeView();
  putImage();

  uiUpdate();

  updateZoomActions();
}
Exemplo n.º 6
0
void TopLevel::FreeFax()
{
  if(display_is_setup)
    XClearWindow(qtdisplay, Win);

  freeImages();

  pagenode *pn;
  for (pn = firstpage; pn; pn = pn->next){
    if(Pimage(pn)){
       FreeImage(Pimage(pn));
       pn->extra = NULL;
    }
  }

  Image = NULL;

  for (pn = firstpage; pn; pn = pn->next){
    if(pn->pathname){
       free(pn->pathname);
    }
  }


  if(firstpage){
    for(pn = firstpage->next; pn; pn = pn->next){
      if(pn->prev){
	free(pn->prev);
      }
    }
  }

  if(lastpage)
    free(lastpage);

  firstpage = lastpage = viewpage = thispage = auxpage = NULL;

  uiUpdate();
}
Exemplo n.º 7
0
void TopLevel::resizeView()
{
  if(!faxqtwin || !display_is_setup)
    return;

//printf("In resizeView() entered\n");

  qwindow_width = faxqtwin->width();
  qwindow_height = faxqtwin->height();

  if( hsb->isVisible())
    qwindow_height -= 16;

  if( vsb->isVisible())
    qwindow_width  -= 16;

  if(Image){
    PaneWidth = Image->width;
    PaneHeight = Image->height;
  }

  //  printf("faxw %d qtw %d\n", PaneWidth , faxqtwin->width());

  if( (PaneHeight  > qwindow_height ) &&
      (PaneWidth  > qwindow_width)){

    vsb->setGeometry(faxqtwin->width() - 16,0,16,faxqtwin->height()-16);
    hsb->setGeometry(0,faxqtwin->height() - 16 ,faxqtwin->width()-16,16);

    qwindow_width = faxqtwin->width() -16;
    qwindow_height = faxqtwin->height()-16;


    vsb->raise();
    vsb->show();
    hsb->show();
  }
  else{

    if( PaneHeight  > qwindow_height){
      vsb->setGeometry(faxqtwin->width() - 16,0,16,faxqtwin->height());


      qwindow_width = faxqtwin->width() -16 ;
      qwindow_height = faxqtwin->height();


      vsb->show();
      hsb->hide();
      hsb->raise();
    }
     else
       vsb->hide();

    if( PaneWidth  > qwindow_width ){
      hsb->setGeometry(0,faxqtwin->height() - 16 ,faxqtwin->width(),16);
      hsb->show();
      hsb->raise();
      vsb->hide();
      qwindow_width = faxqtwin->width() ;
      qwindow_height = faxqtwin->height() -16;

    }
    else
      hsb->hide();

  }

  if(Image){
    hsb->setRange(0,QMAX(0,Image->width - qwindow_width));
    hsb->setSteps(5,qwindow_width/2);
    //    printf("hsb range: %d\n",QMAX(0,Image->width - qwindow_width));
    vsb->setRange(0,QMAX(0,Image->height - qwindow_height));
    vsb->setSteps(5,qwindow_height/2);
    //    printf("vsb range: %d\n",QMAX(0,Image->height - qwindow_height));
    //    printf("vsb QMIN %d vdb QMAX %d\n",vsb->QMINValue(),vsb->QMAXValue());
  }


  Resize = 1;
  uiUpdate();

}