MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    m_remoteAddr = QHostAddress(REMOTE_IP_STRING);
    m_remotePort = REMOTE_PORT;
    m_tickCount = 0;
    m_sendCount = 0;
    m_recvCount = 0;
    m_isConnected = false;

    memset((void *)&m_machineData, 0, sizeof(m_machineData));

    m_timer = new QTimer(this);
    m_timer->setInterval((int)(1000.0 / CONNECTION_FREQ));

    ui->setupUi(this);

    ui->pushButtonConnect->connect(
                ui->pushButtonConnect,
                SIGNAL(clicked()),
                this,
                SLOT(OnPushbuttonConnectClicked()));

    ui->lineEditCmd->connect(
                ui->lineEditCmd,
                SIGNAL(returnPressed()),
                this,
                SLOT(OnCommandLineReturned()));

    m_tcpSocket = new QTcpSocket();
    m_tcpSocket->connect(
                m_tcpSocket,
                SIGNAL(readyRead()),
                this,
                SLOT(OnDatagramReceived()));

    m_timer->connect(
                m_timer,
                SIGNAL(timeout()),
                this,
                SLOT(OnTimerTick()));

    m_tcpSocket->connect(
                m_tcpSocket,
                SIGNAL(disconnected()),
                this,
                SLOT(OnSocketDisconnected()));

    ui->lineEditIP->setText(REMOTE_IP_STRING);

    QString txt;
    ui->lineEditPort->setText(txt.sprintf("%d", REMOTE_PORT));
    ui->lineEditCmd->setFocus();

    InitializePloting();

    m_paramSetWindow = new ParamSetWindow(this);
}
Esempio n. 2
0
void EventDispatcher::Update(Observable &o,I_ObservableData *d) {
	unsigned int tick=OnTimerTick() ;
	if (tick) {
		timer_->SetPeriod(float(tick)) ;
	} else {
		timer_->Stop() ;
	};
} ;
Esempio n. 3
0
void ProjectGenerator::OnSourceSelected(const nuiEvent& rEvent)
{
  nuiDialogSelectDirectory* pDialog = (nuiDialogSelectDirectory*)rEvent.mpUser;
  mNuiSourcePath = pDialog->GetSelectedDirectory();
  mpNuiSource->SetText(mNuiSourcePath);
  
  OnTimerTick(rEvent);

  GetPreferences().SetString(PREFERENCES_PROJECTGENERATOR, _T("nuiSourcePath"), mNuiSourcePath);
}
Esempio n. 4
0
TimeLabel::TimeLabel(nuiAttrib<uint64>& rPositionAttrib, nuiAttrib<uint64>& rLengthAttrib, double SampleRate)
: mPosAttrib(rPositionAttrib),
  mLengthAttrib(rLengthAttrib),
  mSampleRate(SampleRate),
  mTimer(1.f / 20.f),
  mEventSink(this)
{
  OnTimerTick(NULL);
  mEventSink.Connect(mTimer.Tick, &TimeLabel::OnTimerTick);
  mTimer.Start(false, true);
}
Esempio n. 5
0
ProjectGenerator::ProjectGenerator()
: nuiSimpleContainer(), mEventSink(this)
{
  SetObjectName(_T("ProjectGenerator"));
  mpTimer = NULL;
  
  GetPreferences().GetString(PREFERENCES_PROJECTGENERATOR, _T("nuiSourcePath"), mNuiSourcePath);
  if (!GetPreferences().GetString(PREFERENCES_PROJECTGENERATOR, _T("nuiTargetPath"), mProjectTargetPath))
  {
    nglPath userPath(ePathUser);
    mProjectTargetPath = userPath.GetPathName();    
  }
  mProjectTargetPath.Append(_T("/newNuiProject"));
  
  
  
  nuiVBox* pVBox = new nuiVBox(0);
  pVBox->SetExpand(nuiExpandShrinkAndGrow);
  AddChild(pVBox);
  
  pVBox->AddCell(BuildBlocSourceDirectory());

  pVBox->AddCell(new nuiSeparator(nuiHorizontal));
  
  pVBox->AddCell(BuildBlocProjectDirectory());

  pVBox->AddCell(new nuiSeparator(nuiHorizontal));
  
  pVBox->AddCell(BuildBlocOptions());

  pVBox->AddCell(new nuiSeparator(nuiHorizontal));
  
  pVBox->AddCell(BuildBlocButtons());
  
  
  
  
  mpTimer = new nuiTimer(0.5 /*0.5s*/);
  mEventSink.Connect(mpTimer->Tick, &ProjectGenerator::OnTimerTick);
  
  if (mNuiSourcePath != nglString::Null)
  {
    nuiEvent event;
    OnTimerTick(event);
  }
}