Ejemplo n.º 1
0
ClientGUI::ClientGUI(QWidget *parent) :
QMainWindow(parent)
{
	qDebug("Client UI setup");
	setupUi(this);
	move(100,22);
	
	m_tcpSocket = new QTcpSocket(this);
		
	// network widgets
	connect(pushButtonConnect, SIGNAL(clicked()), this, SLOT(hostAction()));
	connect(pushButtonSend, SIGNAL(clicked()), this, SLOT(sendToHost()));
	connect(lineEditCommand, SIGNAL(returnPressed()), this, SLOT(sendToHost()));
	
	connect(m_tcpSocket, SIGNAL(readyRead()), this, SLOT(readFromHost()));
	connect(m_tcpSocket, SIGNAL(disconnected()), this, SLOT(hostDisconnect()));
	connect(m_tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
             this, SLOT(hostError(QAbstractSocket::SocketError)));

	pushButtonSend->setEnabled(false);
	pushButtonConnect->setText("Connect");
	
	ipAddress = "NULL";
	lineEditAddress->setText(QHostAddress(QHostAddress::LocalHost).toString());
	lineEditPort->setText(QString::number(50657));
	lineEditPort->setFocus();
}
Ejemplo n.º 2
0
static void
breakGoal(PceGoal g)
{ char buf[LINESIZE];
  char *s;

start:
  writef(" ? ");
  Cflush();
  s = Cgetline(buf, sizeof(buf));

  if ( s )
  { int argc = 0;
    char *argv[100];
    char *q;
    Int numarg = DEFAULT;

    for(q = s; *q; )
    { while(*q && isspace(*q))
	q++;
      if ( *q == EOS )
	break;
      argv[argc++] = q;
      while(*q && !isspace(*q))
	q++;
      if ( *q != EOS )
	*q++ = EOS;
    }

    if ( argc >= 2 && isdigit(argv[1][0]) )
      numarg = toInt(atoi(argv[1]));

    if ( argc == 0 )
      return;

    switch(argv[0][0])
    { case 'g':
	ServiceMode(PCE_EXEC_SERVICE,
		    if ( argv[0][1] == 'h' )
		      hostAction(HOST_BACKTRACE,
				 isDefault(numarg) ? 5 : valInt(numarg));
		    else
		      pceBackTrace(g, isDefault(numarg) ? 5 : valInt(numarg)));
        goto again;
      case 'b':
	if ( !hostAction(HOST_BREAK) )
	  send(HostObject(), NAME_break, EAV);
        goto again;
      case 'a':
	if ( !hostAction(HOST_ABORT) )
	  send(HostObject(), NAME_abort, EAV);
        goto again;			/* should not happen */
      case 'e':
      { Error e;

	if ( argc == 2 )
	{ if ( !(e = getConvertError(ClassError, CtoName(argv[1]))) )
	  { writef("No such error: %s\n", CtoName(argv[1]));
	    goto again;
	  }
	} else
	{ if ( !(e = getConvertError(ClassError, PCE->last_error)) )
	  { writef("No current error\n");
	    goto again;
	  }
	}

	if ( !e )
	{ writef("No current error\n");
	  goto again;
	}

	switch(argv[0][1])
	{ case 'i':
	    assign(e, kind, NAME_ignored);
	    break;
	  case 'e':
	    assign(e, kind, NAME_error);
	    break;
	  case 'f':
	    assign(e, kind, NAME_fatal);
	    break;
	  default:
	  case 'w':
	    assign(e, kind, NAME_warning);
	    break;
	}

	writef("Switched error \"%s\" to ->kind \"%s\"\n",
	       e->id, e->kind);

	goto again;
      }
      case 'q':
	debuggingPce(PCE, OFF);
	send(PCE, NAME_die, EAV);
        exit(1);			/* should not happen */
      case 'c':
      case EOS:
	return;
      case '?':
      case 'h':
	actionHelp();
        goto again;
      default:
	writef("Unknown option. (? for help)\n");
        goto again;
    }
  } else
  { hostAction(HOST_HALT);