コード例 #1
0
ファイル: SelectAttrib.cpp プロジェクト: HoverRace/HoverRace
void CDocAttrib::OnBrowseBackgroundName()
{
	if(mCurrentDoc != NULL) {
		CString szFilter;
		szFilter.LoadString(IDS_BACKGROUND_FILTER);
		// static char BASED_CODE szFilter[] = "PCX 128colors (*.pcx)|*.pcx||";

		CFileDialog lDialog(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter, this);

		if(lDialog.DoModal() == IDOK) {
			CString lText = lDialog.GetPathName();

			mBackgroundName.SetWindowText(lText);
			mCurrentDoc->SetBackImageName(lText);
		}
	}
}
コード例 #2
0
ファイル: startupdialog.cpp プロジェクト: icebreaker/slider3d
void StartupDialog::addPath(void)
{
	QFileDialog lDialog(this);
	lDialog.setFileMode(QFileDialog::DirectoryOnly);

	QString lPath = lDialog.getExistingDirectory();

	if( lPath.isEmpty() )
		return;

	//! Make sure it has a trailing slash
	if( !lPath.endsWith(QDir::separator()) )
		lPath += QDir::separator();

	ui->paths->addItem(lPath);

	Settings *lSettings = &Settings::getInstance();
	lSettings->mPaths << lPath;
}
コード例 #3
0
ファイル: MainWindow.cpp プロジェクト: ZeitgeberH/eyetracker
/*
 * Method:    OnToolClick()
 * Purpose:   called when the user click on of the tools on the
 *            toll bar
 * Comments:  none
 */
void CMainWindow::OnToolClick(wxCommandEvent& aEvent)
{
    wxTreeItemId   lItem = iTree->GetSelection();
   
    if(lItem.IsOk() && lItem != iRoot || aEvent.GetId() == ID_SEEK)
    {
        CTreeItemData* lData = (CTreeItemData *)iTree->GetItemData(lItem);
    
        switch(aEvent.GetId())
        {
            case ID_INFO:
            {
                if(!lData->iInfo)
                {
                    // create the info window
                    CInfoWindow* lWindow = new CInfoWindow(*this,lData->iData);

                    if(lWindow)
                    {
                        // keep a pointer to it
                        lData->iInfo = lWindow;
                        // and show the window
                        lWindow->Show(true);
                    }
                }
                else
                    lData->iInfo->Raise();

                break;
            }
            case ID_CTRL:
            {
                if(!lData->iCtrl)
                {
                    if(!lData->iHandle)
                        lData->iHandle = OpenCamera(lData->iData.UniqueId,lData->iOwner);

                    if(lData->iHandle)
                    {
                        // create the info window
                        CCtrlWindow* lWindow = new CCtrlWindow(*this,lData->iData,lData->iHandle,lData->iOwner);

                        if(lWindow)
                        {
                            // keep a pointer to it
                            lData->iCtrl = lWindow;
                            // and show the window
                            lWindow->Show(true);

                            if(lData->iFinder)
                                lData->iCtrl->Notify(kEvnLiveOpened,lData->iFinder,true);
                        }
                    }
                    else
                    {
                        wxMessageBox(L"Sorry, the camera couldn't be open.",
                                     L"Ooops ...",
                                     wxOK | wxICON_ERROR,this);
                    }
                }
                else
                    lData->iCtrl->Raise();

                break;
            }
            case ID_LIVE:
            {
                if(!lData->iFinder)
                {
                    if(!lData->iHandle)
                        lData->iHandle = OpenCamera(lData->iData.UniqueId,lData->iOwner);

                    if(lData->iHandle)
                    {
                        // create the info window
                        CFinderWindow* lWindow = new CFinderWindow(*this,lData->iData,lData->iHandle);

                        if(lWindow)
                        {
                            // keep a pointer to it
                            lData->iFinder = lWindow;
                            // and show the window
                            lWindow->Show(true);

                            if(lData->iCtrl)
                                lData->iCtrl->Notify(kEvnLiveOpened,lWindow,true);
                        }
                    }
                    else
                    {
                        wxMessageBox(L"Sorry, the camera couldn't be open.",
                                     L"Ooops ...",
                                     wxOK | wxICON_ERROR,this);
                    }
                }
                else
                    lData->iFinder->Raise();
                
                break;      
            }    
            case ID_SEEK:
            {
                wxTextEntryDialog lDialog(this,L"Please enter the IP address of the camera",L"Seek a camera ...",L"0.0.0.0");

                if(lDialog.ShowModal() == wxID_OK)
                {
                    unsigned long lAddr = inet_addr(lDialog.GetValue().mb_str(wxConvUTF8));
                
                    if(lAddr)
                    {
                        iSeeking = new CSeeker(dSEEKER,GetEventHandler(),lAddr);
                        if(iSeeking)
                            if(!iSeeking->Start())
                            {
                                delete iSeeking;
                                iSeeking = NULL;
                            }
                    }
                    else
                        wxMessageBox(L"You need to enter a valid IP address",
                                     L"Ooops ...",
                                     wxOK | wxICON_ERROR,this);
                }

                break;
            }
            case ID_EXPO:
            {
                bool lClose = false;

                if(!lData->iHandle)
                {
                    lData->iHandle = OpenCamera(lData->iData.UniqueId,lData->iOwner);
                    lClose = true;
                }

                if(lData->iHandle)
                {
		            wxFileDialog lDialog(NULL,wxT("Select an output file"),wxT(""),
                                         wxString(lData->iData.SerialNumber,wxConvUTF8),
                                         wxT("Text files (*.txt)|*.txt"),wxSAVE | wxOVERWRITE_PROMPT);

                    if(lDialog.ShowModal() == wxID_OK)
                    {
     		            wxString lExt  = wxT(".txt");
                        wxString lPath = lDialog.GetPath();

                        if(!lPath.Contains(lExt))
                            lPath = lPath + lExt;

                        if(!ExportCamera(lData->iHandle,lPath))
			                wxMessageBox(wxT("Camera's setup export failed."),wxT("Ooops ..."),wxOK | wxICON_ERROR,this);
                    }

                    if(lClose)
                    {
                        CloseCamera(lData->iHandle);
                        lData->iHandle = NULL;
                    }
                }

                break;
            }
            case ID_EVNT:
            {
                if(!lData->iEvnt)
                {
                    if(!lData->iHandle)
                        lData->iHandle = OpenCamera(lData->iData.UniqueId,lData->iOwner);

                    if(lData->iOwner)
                    {
                        if(lData->iHandle)
                        {                        
                            // create the info window
                            CEvntWindow* lWindow = new CEvntWindow(*this,lData->iData,lData->iHandle);

                            if(lWindow)
                            {
                                // keep a pointer to it
                                lData->iEvnt = lWindow;
                                // and show the window
                                lWindow->Show(true);
                            }
                        }
                        else
                        {
                            wxMessageBox(L"Sorry, the camera couldn't be open.",
                                         L"Ooops ...",
                                         wxOK | wxICON_ERROR,this);
                        }
                    }
                    else
                    {
                        wxMessageBox(L"Sorry, the camera is already open",
                                     L"Ooops ...",
                                     wxOK | wxICON_ERROR,this);                        
                    }
                }
                else
                    lData->iEvnt->Raise();

                break;
            }
            case ID_SRIO:
            {
                if(!lData->iSrio)
                {
                    if(!lData->iHandle)
                        lData->iHandle = OpenCamera(lData->iData.UniqueId,lData->iOwner);

                    if(lData->iOwner)
                    {
                        if(lData->iHandle)
                        {                        
                            // create the info window
                            CSerialWindow* lWindow = new CSerialWindow(*this,lData->iData,lData->iHandle);

                            if(lWindow)
                            {
                                // keep a pointer to it
                                lData->iSrio = lWindow;
                                // and show the window
                                lWindow->Show(true);
                            }
                        }
                        else
                        {
                            wxMessageBox(L"Sorry, the camera couldn't be open.",
                                         L"Ooops ...",
                                         wxOK | wxICON_ERROR,this);
                        }
                    }
                    else
                    {
                        wxMessageBox(L"Sorry, the camera is already open",
                                     L"Ooops ...",
                                     wxOK | wxICON_ERROR,this);                        
                    }
                }
                else
                    lData->iSrio->Raise();

                break;
            }                        
        }

        // refresh the list of window
        RefreshWindowsList();
        // and force the window to be updated
        Update();
    }
    else
    {
        wxMessageBox(L"You must select a camera first.",
                     L"Ooops ...",
                     wxOK | wxICON_ERROR,this);
    }
}