示例#1
0
		void Runner::RunProtected() {
			SPADES_MARK_FUNCTION();
			std::string err;
			try{
				Run();
			}catch(const spades::Exception& ex){
				err = ex.GetShortMessage();
				SPLog("Unhandled exception in SDLRunner:\n%s", ex.what());
			}catch(const std::exception& ex){
				err = ex.what();
				SPLog("Unhandled exception in SDLRunner:\n%s", ex.what());
			}
			if(!err.empty()){
				ErrorDialog dlg;
				dlg.set_modal();
				dlg.result = 0;
				
				// TODO: free this buffer (just leaking)
				Fl_Text_Buffer *buf = new Fl_Text_Buffer;
				buf->append(err.c_str());
				dlg.infoView->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0);
				dlg.infoView->buffer(buf);
				dlg.helpView->value("See SystemMessages.log for more details.");
				dlg.show();
				while(dlg.visible()){
					Fl::wait();
				}
			}
		}
/** Static Write File

  Writes a given set of FilmParameters to a file.  Persists a copy of OMfilmParams as returned
  by the FilmParameters object using the FilmParameters::getParamsCopy() method.

  @param p_file
  File to write to

  @param p_params
  A FilmParameters object pointer containing the parameters to persist to disk

  @param p_showErr
  Whether or not to report errors back to user (default = true)

*/
void FilmFileHandler::writeFile(QString p_file, FilmParameters* p_params, bool p_showErr) {

        // do not try to write to a file with no name
    if( p_file.isEmpty() )
        return;


    QFile filmFile(p_file);
    QString errors;
    bool errorOccur = false;


    if( filmFile.open(QIODevice::WriteOnly) ) {
        QDataStream data( &filmFile );
            // write structure version to file
        data << quint32(OM_FILM_FMT_VER);
            // write film data structure to file
        data << p_params->getParamsCopy();
        filmFile.close();
    }
    else {
        errors.append("ERROR: Could not open file ");
        errors.append(p_file);
        errors.append(": ");
        errors.append( filmFile.error() );
        errorOccur = true;
    }

    if( p_showErr && errorOccur ) {
        ErrorDialog erDlg;
        erDlg.setError(errors);
        erDlg.exec();
    }

}
示例#3
0
void DataAccessConditions::onBtnSaveClicked() {
	try {
		Gtk::MessageDialog dialog("value: " + Utils::intToStrHex(calcAccessBits()));
		dialog.run();
	} catch(const std::runtime_error& e) {
		ErrorDialog error;
		error.show(e.what());
	}
}
示例#4
0
void ShowModelessErrorDialog(wxWindow *parent,
                             const wxString &dlogTitle,
                             const wxString &message,
                             const wxString &helpURL,
                             const bool Close)
{
   ErrorDialog *dlog = new ErrorDialog(parent, dlogTitle, message, helpURL, Close, false);
   dlog->CentreOnParent();
   dlog->Show();
   // ANSWER-ME: Vigilant Sentry flags this method as not deleting dlog, so a mem leak.
   // ANSWER-ME: This is unused. Delete it or are there plans for it?
}
示例#5
0
 bool ErrorDialog::display_errors ()
 {
   std::list<ErrorMsg>::iterator msg = messages.end();
   while (msg != messages.begin()) {
     msg--;
     if (msg->loglevel <= 1) {
       ErrorDialog dialog (msg->text);
       dialog.run();
       break;
     }
   }
   messages.clear();
   return (false);
 }
示例#6
0
bool convertMetaDataToIpl(xn::DepthGenerator* dpg,xn::UserGenerator* ug,XnUserID userID)
{

	bool m_front=true;
	xn::DepthMetaData dmd;
	xn::SceneMetaData smd;
	dpg->GetMetaData(dmd);
	XnStatus tStatus=ug->GetUserPixels(userID, smd);
	if (tStatus!=XN_STATUS_OK)
		return false;
	
	const XnDepthPixel* pDepth = dmd.Data();
	const XnLabel* pUsersLBLs = smd.Data();
	size_t j,i;
	try 
	{
	for ( j= 0; j < m_Height; j++)
	{
		unsigned char* uPtr=(unsigned char*)(uImage->imageData+j*uImage->widthStep);
		unsigned short* dPtr=(unsigned short*)(dImage->imageData+j*dImage->widthStep);
		for(i = 0; i < m_Width; i++)
		{		
			uint fixed_i = i;// fix i if we are mirrored
			if (!m_front)
				fixed_i = m_Width - i;				
			if (userID == pUsersLBLs[j*m_Width + fixed_i])// if we have a candidate, filter out the rest
			{	
				uPtr[fixed_i]=255;
				dPtr[fixed_i]=pDepth[j*m_Width + fixed_i];

				//if	(dPtr[fixed_i]< minD)
				//	minD=dPtr[fixed_i];
				//if	(dPtr[fixed_i]> maxD)
				//	maxD=dPtr[fixed_i];

			}		
		}
	}
	}
	catch (cv::Exception e)
	{
			ErrorDialog dlg;
			dlg.display(e.err + "\ni:" +  Ogre::StringConverter::toString(i) +  "\nj:" +  Ogre::StringConverter::toString(j));
			exit(0);
	}
	return true;
}
//lm: this doesnt really belong here, should be somewhere in core or client probably?
//	we might need to introduce some base object that will handle global state and whatnot..
//	now all windows just spawn eachother, instead of being managed from a central place.
void MainWindow::StartGame(const spades::ServerAddress &host) {
	SPADES_MARK_FUNCTION();
	
	//hide();
	
#if 0
	SDLRunner r(host);
	r.Run();
#else
	std::string err;
	try{
		if(cg_smp){
			SDLAsyncRunner r(host, cg_playerName);
			r.Run();
		}else{
			SDLRunner r(host, cg_playerName);
			r.Run();
		}
	}catch(const spades::Exception& ex){
		err = ex.GetShortMessage();
		SPLog("Unhandled exception in SDLRunner:\n%s", ex.what());
	}catch(const std::exception& ex){
		err = ex.what();
		SPLog("Unhandled exception in SDLRunner:\n%s", ex.what());
	}
	if(!err.empty()){
		ErrorDialog dlg;
		dlg.set_modal();
		dlg.result = 0;
		
		// TODO: free this buffer (just leaking)
		Fl_Text_Buffer *buf = new Fl_Text_Buffer;
		buf->append(err.c_str());
		dlg.infoView->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0);
		dlg.infoView->buffer(buf);
		dlg.helpView->value("See SystemMessages.log for more details.");
		dlg.show();
		while(dlg.visible()){
			Fl::wait();
		}
		if( dlg.result == 1 ){
			//show();
		}
	}
#endif
}
示例#8
0
void ShowAliasMissingDialog(AudacityProject *parent,
                            const wxString &dlogTitle,
                            const wxString &message,
                            const wxString &helpURL,
                            const bool Close)
{
   ErrorDialog *dlog = new AliasedFileMissingDialog(parent, dlogTitle, message, helpURL, Close, false);
   // Don't center because in many cases (effect, export, etc) there will be a progress bar in the center that blocks this.
   // instead put it just above or on the top of the project.
   wxPoint point;
   point.x = 0;

   point.y = parent ? parent->GetPosition().y - 200 : 100;

   if (point.y < 100)
      point.y = 100;
   dlog->SetPosition(point);
   dlog->CentreOnParent(wxHORIZONTAL);

   // This needs to be modeless because user may need to
   // stop playback AND read dialog's instructions.
   dlog->Show();
   // ANSWER-ME: Vigilant Sentry flags this method as not deleting dlog, so a mem leak.
}