void DialogLoadSurfaceOverlay::OnOK()
{
  if (ui->checkBoxRegistration->isChecked() && GetRegistration().isEmpty())
  {
    QMessageBox::warning(this, "Error", "Please enter a valid registration file name");
  }
  else
    accept();
}
Ejemplo n.º 2
0
BOOL CSettingDlg::OnInitDialog()
{
    CDialogEx::OnInitDialog();

    CString strTemp;

    // default
    if (!ExistRegistration())
    {
        SetRegistration(m_strAddedSize, m_nWidth,m_nHeight, m_nFpsIndex, m_nYuvFormat, m_fLoop);
    }
    // read
    GetRegistration(m_strAddedSize, m_nWidth, m_nHeight, m_nFpsIndex, m_nYuvFormat, m_fLoop);

    int pos = 0;  
    strTemp = m_strAddedSize.Tokenize(_T(";"), pos);
    m_strArrAddedSize.Add(strTemp);
    while (strTemp != _T(""))
    {
        strTemp = m_strAddedSize.Tokenize(_T(";"), pos);
        m_strArrAddedSize.Add(strTemp);
    }

    // 不知为何,最后一个是空的,这里删除,否则后面再添加时会多一个空字符串
    m_strArrAddedSize.RemoveAt(m_strArrAddedSize.GetCount()-1);

    int nResolutionIdx = -1;
    for (int i = 0; i < m_strArrAddedSize.GetCount(); i++)
    {
        m_cbResolution.AddString(m_strArrAddedSize[i]);
        int width = 0;
        int height = 0;
        swscanf_s(m_strArrAddedSize[i].GetBuffer(), _T("%dx%d"), &width, &height);
        if (width == m_nWidth && height == m_nHeight)
            nResolutionIdx = i;
    }

    m_cbYuvFormat.SetCurSel(m_nYuvFormat);
    m_cbFps.SetCurSel(m_nFpsIndex);
    m_cbResolution.SetCurSel(nResolutionIdx);
    m_nYuvFormat = m_cbYuvFormat.GetCurSel();
    m_cbFps.GetWindowText(strTemp);
    swscanf_s(strTemp.GetBuffer(), _T("%d"), &m_nFps);

    GetDlgItem(IDC_APPLY)->EnableWindow(FALSE);

    UpdateData(FALSE);
    return TRUE;  // return TRUE unless you set the focus to a control
}
Ejemplo n.º 3
0
BOOL CHandleRegistrationMap_PS::GetParameter(EParameterType p_eParameterType, HANDLE p_hPS_Handle, CStdString p_Name, CStdString& p_rValue, CErrorInfo* p_ErrorInfo)
{
    BOOL oIsLocked = FALSE;
    BOOL oResult = FALSE;
    CHandleRegistration_PS* pRegistration = 0;
    CLayerManagerBase* pManager = 0;
    CProtocolStackBase* pProtocolStack = 0;
    HANDLE h_Handle = 0;

    //GetRegistration
    if(GetRegistration(p_hPS_Handle, &pRegistration) && (pRegistration != 0))
    {
        //Lock
        oIsLocked = pRegistration->IsLocked();
        if(oIsLocked || pRegistration->DoLock())
        {
            if(pRegistration->GetRegistrationValues(&pProtocolStack, &pManager, &h_Handle) && pProtocolStack && pManager && h_Handle)
            {
                if(PT_PROTOCOL_STACK == p_eParameterType)
                {
                    //Set ProtocolStack Parameter
                    oResult = pProtocolStack->GetParameter(p_Name, p_rValue);
                    if(!oResult && m_pErrorHandling)
                        m_pErrorHandling->GetError(k_Error_BadParameter, p_ErrorInfo);
                }
                else if(PT_PROTOCOL_STACK > p_eParameterType)
                {
                    //Forward Parameter to next layer
                    oResult = pManager->GetParameter(p_eParameterType, h_Handle, p_Name, p_rValue, p_ErrorInfo);
                }
            }

            //Unlock
            if(pRegistration && !oIsLocked) pRegistration->DoUnlock();
        }
    }

    return oResult;
}