Ejemplo n.º 1
0
void State_selectPart::updateStats()
{
    partConsole->clear();
    partConsole->setDefaultForeground(TCODColor::white);
    if (parttype == 'c')
        getProfile(refToFleet.captain.cannonInventory[selector], 1);
    if (parttype == 's')
        getProfile(refToFleet.captain.sailInventory[selector], 1);
    if (parttype == 'a')
        getProfile(refToFleet.captain.armorInventory[selector], 1);

    partConsole->setDefaultForeground(MabinogiBrown);
    partConsole->printFrame(0, 0, console->getWidth(), console->getHeight(), false);
}
Ejemplo n.º 2
0
void dynpm(GtkWidget *widget, gpointer data){
    char **cards = getCards((char*) DEFAULT_DRM_DIR);
    if (cards == NULL) {
        g_printerr("Card list is empty.\n");
        return;
    }

    int idx = 0;
    while (cards[idx] != NULL) {
        g_print("Found card: %s\n", cards[idx]);

        if (canModifyPM()) {
            g_print("Setting dynpm\n");
            setMethod(cards[idx], DYNPM);
            g_print("method = %d\n", getMethod(cards[idx]));
            if (getMethod(cards[idx]) != METHOD_UNKNOWN) {
                g_print("profile = %d\n", getProfile(cards[idx]));
            }
        } else {
            g_print("Insufficient permission to modify PM method\n");
        }
        idx++;
    }
    freeCards(cards);
}
Ejemplo n.º 3
0
EditPersonalInfosWidget::EditPersonalInfosWidget(QWidget* parent,const LinQedInClient* cl):EditInfosWidget(parent,
                                                                                                    tr("Modifica informazioni personali"),
                                                                                                    cl),
    infos(getProfile().getPersonalInformations()){
    setAttribute(Qt::WA_DeleteOnClose,true);
    formWidget=new QWidget;
    infosLayout=new QFormLayout;
    name=new QLineEdit; surname=new QLineEdit; birthplace=new QLineEdit; birthState=new QLineEdit;
    connect(name,SIGNAL(returnPressed()),this,SLOT(saveRequest()));
    connect(surname,SIGNAL(returnPressed()),this,SLOT(saveRequest()));
    connect(birthplace,SIGNAL(returnPressed()),this,SLOT(saveRequest()));
    connect(birthState,SIGNAL(returnPressed()),this,SLOT(saveRequest()));
    infosLayout->addRow(tr("Nome: "),name); infosLayout->setAlignment(name,Qt::AlignCenter);
    infosLayout->addRow(tr("Cognome: "),surname); infosLayout->setAlignment(surname,Qt::AlignCenter);
    infosLayout->addRow(tr("Luogo di Nascita: "),birthplace); infosLayout->setAlignment(birthplace,Qt::AlignCenter);
    infosLayout->addRow(tr("Paese di Nascita: "),birthState); infosLayout->setAlignment(birthState,Qt::AlignCenter);
    initRadioButtons();
    infosLayout->addRow(tr("Sesso: "),genderBox); infosLayout->setAlignment(genderBox,Qt::AlignCenter);
    calendar=new QCalendarWidget;
    calendar->setGridVisible(true);
    calendar->setMinimumDate(QDate(1950,1,1));
    calendar->setMaximumDate(QDate::currentDate().addYears(-16)); //dai 16 anni in su
    calendar->setVerticalHeaderFormat(QCalendarWidget::NoVerticalHeader);
    infosLayout->addRow(tr("Data di Nascita"),calendar);
    formWidget->setObjectName("form");
    formWidget->setStyleSheet("#form{"+GUIStyle::borderStyle()+"}");
    formWidget->setContentsMargins(10,10,10,10);
    formWidget->setLayout(infosLayout);
    addWidgetToMainLayout(formWidget,Qt::AlignCenter);
    initButtons();

    writeDefaultValues();
}//EditPersonalInfosWidget
Ejemplo n.º 4
0
//##ModelId=4C32C8AB0148
void fluid::glExtension::btGLShaderModel_4_0::createGeometryShader(const char* path, const char* entry,btGLBufferBundle *bundle)
{
	if(hasGeometry)
		cgDestroyProgram(geometryShader);

	if(path == NULL)
		hasGeometry=false;

	geometryShader=cgCreateProgramFromFile(context,CG_SOURCE,path,getProfile(CG_GL_GEOMETRY),entry,NULL);

	if(bundle != NULL)
	{
		//search for bindable uniform
		GLint max;
		glGetIntegerv(GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT,&max);
		char uniformBufferName[256];
		for(int i=0;i < max;i++)
		{
			sprintf_s(uniformBufferName,256,"geometry_bindable_uniform_%d",i);
			if(bundle->existsName(uniformBufferName))
			{
				CGbuffer buf=bundle->getBindableUniformBufferIdForName(uniformBufferName);
				cgSetProgramBuffer(geometryShader,i,buf);
			}
		}
	}

	cgGLLoadProgram(geometryShader);
	hasGeometry=true;
}
Ejemplo n.º 5
0
void EditStudiesInfosWidget::saveRequest(){
    Studies s(getInformationText(highSchool),getInformationText(qualification));
    bool stopped=false;
    int r=0;
    for(;r<model->rowCount() && !stopped;r++){
        stopped=(model->item(r,university)->text()=="" || model->item(r,course)->text()=="" || model->item(r,situation)->text()=="");
        ((model->item(r,3)->text().contains(" e lode"))?
                s.addDegree(Degree(model->item(r,university)->text(),
                                   model->item(r,course)->text(),
                                   model->item(r,situation)->text().mid(0,model->item(r,situation)->text().size()-7).toInt(),
                                   true)):
                s.addDegree(Degree(model->item(r,university)->text(),
                                   model->item(r,course)->text(),
                                   ((model->item(r,situation)->text()=="In corso")?0:
                                                                             model->item(r,situation)->text().toInt())
                                  )));
    }//for
    if(stopped){
        noDegree->setText("Informazioni mancanti nell'inserimento di una laurea.");
        noDegree->setVisible(true);
    }//if
    else if(r==0) cancel();
    else{
        Profile prof=getProfile();
        prof.updateInformationsBySectionName(Studies::getIDString(),s);
        emit save(prof);
    }//else
}//saveRequest
Ejemplo n.º 6
0
EditStudiesInfosWidget::EditStudiesInfosWidget(const LinQedInClient* cl,QWidget* parent):EditInfosWidget(parent,
                                                                                                    tr("Modifica informazioni di studio"),
                                                                                                    cl){
    setAttribute(Qt::WA_DeleteOnClose);
    try{
        infos=dynamic_cast<const Studies*>(&getProfile().getInformationsBySectionName(Studies::getIDString()));
    }catch(const NoInfoException&){infos=0;}
    formWidget=new QFrame;
    form=new QFormLayout;
    highSchool=new QLineEdit; qualification=new QLineEdit;
    connect(highSchool,SIGNAL(returnPressed()),this,SLOT(saveRequest()));
    connect(qualification,SIGNAL(returnPressed()),this,SLOT(saveRequest()));
    form->addRow(tr("Scuola Superiore: "),highSchool); form->setAlignment(highSchool,Qt::AlignCenter);
    form->addRow(tr("Qualificazione Professionale: "),qualification); form->setAlignment(qualification,Qt::AlignCenter);
    initDegrees();

    noDegree=new QLabel(noDegreeS);
    noDegree->setStyleSheet(GUIStyle::errorLabelStyle());
    form->addWidget(noDegree); form->setAlignment(noDegree,Qt::AlignCenter);

    addDegree=new QPushButton(tr("Aggiungi Laurea"));
    addDegree->setCursor(QCursor(Qt::PointingHandCursor));
    form->addWidget(addDegree); form->setAlignment(addDegree,Qt::AlignCenter);
    connect(addDegree,SIGNAL(clicked()),this,SLOT(addRow()));

    formWidget->setLayout(form);
    addWidgetToMainLayout(formWidget,Qt::AlignCenter);
    initButtons();
    formWidget->setObjectName("form");
    formWidget->setStyleSheet("#form{"+GUIStyle::borderStyle()+"padding-left:10px;padding-top:10px;}");
    writeDefaultValues();
}//EditStudiesInfosWidget
    //---------------------------------------------------------------
    void BaseExtraTechnique::addExtraTechniqueChildParameter ( 
        const String& profileName,
        const String& childName,
        const String& paramName,
        const String &value, 
        const String &paramSid )
    {
        // Get the current Profile from the map or create a new one.
        Profile& profile = getProfile ( profileName );

        // Get the list of child elements of the current profile
        ChildElementsMap& childElements = profile.mChildElements;

        // Get the current childElement from the map or create a new one.
        Parameters& childParameters = getChildParameters ( childElements, childName );

        // Create the value
        ParamData paramValue;
        paramValue.sid = paramSid;
        paramValue.stringValue = value;
        paramValue.paramType = STRING;

        // Add the given parameter into the parameter list of the child element
        childParameters.insert ( Parameter ( paramName, paramValue ) );
    }
Ejemplo n.º 8
0
void vfs::CProfileStack::pushProfile(CVirtualProfile* pProfile)
{
	if(!getProfile(pProfile->cName))
	{
		if(pProfile->cWritable)
		{
			m_profiles.push_front(pProfile);
		}
		else
		{
			t_profiles::iterator pit = m_profiles.begin();
			while(pit != m_profiles.end() && (*pit)->cWritable)
			{
				pit++;
			}
			//if(pit != m_profiles.end())
			{
				m_profiles.insert(pit,pProfile);
			}
			//else
			//{
			//	m_profiles.push_front(pProfile);
			//}
		}
		return;
	}
	VFS_THROW(L"A profile with this name already exists");
}
Ejemplo n.º 9
0
Boolean DVVideoStreamFramer::getFrameParameters(unsigned& frameSize, double& frameDuration) {
  if (fOurProfile == NULL) getProfile();
  if (fOurProfile == NULL) return False;

  frameSize = ((DVVideoProfile const*)fOurProfile)->dvFrameSize;
  frameDuration = ((DVVideoProfile const*)fOurProfile)->frameDuration;
  return True;
}
Ejemplo n.º 10
0
void SFXSound::onRemove()
{
   SFXProfile* profile = getProfile();
   if( profile != NULL )
      profile->getChangedSignal().remove( this, &SFXSound::_onProfileChanged );
      
   Parent::onRemove();
}
Ejemplo n.º 11
0
int LoadDatabaseModule(void)
{
	TCHAR szProfile[MAX_PATH];
	PathToAbsoluteT(_T("."), szProfile);
	_tchdir(szProfile);
	szProfile[0] = 0;

	LoadDatabaseServices();

	// find out which profile to load
	if (!getProfile(szProfile, SIZEOF(szProfile)))
		return 1;

	EnsureCheckerLoaded(false); // unload dbchecker

	if (arDbPlugins.getCount() == 0) {
		TCHAR buf[256];
		TCHAR* p = _tcsrchr(szProfile, '\\');
		mir_sntprintf(buf, SIZEOF(buf), TranslateT("Miranda is unable to open '%s' because you do not have any profile plugins installed.\nYou need to install dbx_mmap.dll"), p ? ++p : szProfile);
		MessageBox(0, buf, TranslateT("No profile support installed!"), MB_OK | MB_ICONERROR);
	}

	// find a driver to support the given profile
	bool retry;
	int rc;
	do {
		retry = false;
		if ( _taccess(szProfile, 0) && shouldAutoCreate(szProfile))
			rc = tryCreateDatabase(szProfile);
		else
			rc = tryOpenDatabase(szProfile);

		if (rc > 0) {
			// if there were drivers but they all failed cos the file is locked, try and find the miranda which locked it
			if (fileExist(szProfile)) {
				// file isn't locked, just no driver could open it.
				TCHAR buf[256];
				TCHAR* p = _tcsrchr(szProfile, '\\');
				mir_sntprintf(buf, SIZEOF(buf), TranslateT("Miranda was unable to open '%s', it's in an unknown format.\nThis profile might also be damaged, please run DbChecker which should be installed."), p ? ++p : szProfile);
				MessageBox(0, buf, TranslateT("Miranda can't understand that profile"), MB_OK | MB_ICONERROR);
			}
			else if (!FindMirandaForProfile(szProfile)) {
				TCHAR buf[256];
				TCHAR* p = _tcsrchr(szProfile, '\\');
				mir_sntprintf(buf, SIZEOF(buf), TranslateT("Miranda was unable to open '%s'\nIt's inaccessible or used by other application or Miranda instance"), p ? ++p : szProfile);
				retry = MessageBox(0, buf, TranslateT("Miranda can't open that profile"), MB_RETRYCANCEL | MB_ICONERROR) == IDRETRY;
			}
		}
	}
		while (retry);

	if (rc == ERROR_SUCCESS) {
		InitIni();
		return 0;
	}

	return rc;
}
Ejemplo n.º 12
0
//----------------------------------------//
// Main
//----------------------------------------//
void CompareVP()
{

  // Specify the the files
  const int nFiles = 2;
  TFile* files[nFiles];
  files[0] = new TFile("rootfiles/beam40MeV_100000Prim.root");
  files[1] = new TFile("rootfiles/beam100e3MeV_40Prim.root");
  
  // Specify the plot names for legend
  TString fnames[nFiles];
  fnames[0] = "E_{e-}^{prim}=40 MeV, x10^{4}";
  fnames[1] = "E_{e-}^{prim}=100 GeV, x40";

  // Colors
  int colors[] = {kBlue, kRed};
  int markers[] = {20, 25};

  // Specify the hist name and the labels
  TString pname  = "VP_avg";
  TString xtitle = "time [ns]";
  TString ytitle = "|RA(#theta_{C},t)| [Vs]";

  // Make Canvas
  TCanvas* c = makeCanvas("c");
  c->SetLogy();

  // Make legend
  TLegend* leg = makeLegend(0.15,0.3,0.8,0.9);
  
  // Specify the minimum and maximum for x-range
  float xmin = -1; // ns
  float xmax = 1;  // ns

  // Loop over and plot profiles
  TProfile* profs[nFiles];
  float maximum = -999;
  for(int f=0; f<nFiles; ++f){
    profs[f] = getProfile(files[f],pname,xtitle,ytitle,colors[f],markers[f]);
    leg->AddEntry(profs[f], fnames[f].Data(), "lep");
    if( maximum < profs[f]->GetMaximum() )
      maximum = profs[f]->GetMaximum();
    profs[f]->GetXaxis()->SetRange( profs[f]->GetXaxis()->FindBin(xmin),
				    profs[f]->GetXaxis()->FindBin(xmax));
  }

  // Set maximum and draw
  profs[0]->SetMaximum(maximum*10);
  profs[0]->Draw();
  for(int f=1; f<nFiles; ++f)
    profs[f]->Draw("same");
  leg->Draw("same");
  
  c->SaveAs((savedir+"EnergyNParticleComp.png").Data());
  
  
}
Ejemplo n.º 13
0
/**
 * 
 * @param widget
 * @param data
 */
static void
print_hello(GtkWidget *widget,
        gpointer data) {
    
    char **cards = getCards((char*) DEFAULT_DRM_DIR);
    if (cards == NULL) {
        g_printerr("Card list is empty.\n");
        return;
    }

    int idx = 0;
    while (cards[idx] != NULL) {
        g_print("Found card: %s\n", cards[idx]);

        g_print("method = %d\n", getMethod(cards[idx]));
        if (getMethod(cards[idx]) != METHOD_UNKNOWN) {
            g_print("profile = %d\n", getProfile(cards[idx]));
        }

        if (canModifyPM()) {
            g_print("Setting dynpm\n");
            setMethod(cards[idx], DYNPM);
            g_print("method = %d\n", getMethod(cards[idx]));
            if (getMethod(cards[idx]) != METHOD_UNKNOWN) {
                g_print("profile = %d\n", getProfile(cards[idx]));
            }

            g_print("Setting low profile\n");
            setMethod(cards[idx], PROFILE);
            setProfile(cards[idx], LOW);
            g_print("method = %d\n", getMethod(cards[idx]));
            if (getMethod(cards[idx]) != METHOD_UNKNOWN) {
                g_print("profile = %d\n", getProfile(cards[idx]));
            }
        }

        g_print("Current temperature: %d\n", getTemperature(cards[idx]));

        idx++;
    }
    freeCards(cards);

}
    //---------------------------------------------------------------
    void BaseExtraTechnique::addExtraTechniqueTextblock ( 
        const String& profileName, 
        const String& text )
    {
        // Get the current Profile from the map or create a new one.
        Profile& profile = getProfile ( profileName );

        // Set the textblock.
        profile.mText = text;
    }
Ejemplo n.º 15
0
void EditPersonalInfosWidget::saveRequest(){
    Personal p((name->text()=="")?name->placeholderText():name->text(),
               (surname->text()=="")?surname->placeholderText():surname->text(),
               getInformationText(birthplace),
               getInformationText(birthState),
               calendar->selectedDate(),
               (male->isChecked())?Personal::M:Personal::F);
    Profile prof=getProfile();
    prof.updateInformationsBySectionName(Personal::getIDString(),p);
    emit save(prof);
}//saveRequest
Ejemplo n.º 16
0
int LoadDatabaseModule(void)
{
	TCHAR szProfile[MAX_PATH];
	pathToAbsoluteT(_T("."), szProfile, NULL);
	_tchdir(szProfile);
	szProfile[0] = 0;

	// load the older basic services of the db
	InitUtils();

	// find out which profile to load
	if ( !getProfile( szProfile, SIZEOF( szProfile )))
		return 1;

	PLUGIN_DB_ENUM dbe;
	dbe.cbSize = sizeof(PLUGIN_DB_ENUM);
	dbe.lParam = (LPARAM)szProfile;

	if ( _taccess(szProfile, 0) && shouldAutoCreate( szProfile ))
		dbe.pfnEnumCallback=( int(*) (const char*,void*,LPARAM) )FindDbPluginAutoCreate;
	else
		dbe.pfnEnumCallback=( int(*) (const char*,void*,LPARAM) )FindDbPluginForProfile;

	// find a driver to support the given profile
	int rc = CallService(MS_PLUGINS_ENUMDBPLUGINS, 0, (LPARAM)&dbe);
	switch ( rc ) {
	case -1: {
		// no plugins at all
		TCHAR buf[256];
		TCHAR* p = _tcsrchr(szProfile,'\\');
		mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda is unable to open '%s' because you do not have any profile plugins installed.\nYou need to install dbx_3x.dll or equivalent."), p ? ++p : szProfile );
		MessageBox(0,buf,TranslateT("No profile support installed!"),MB_OK | MB_ICONERROR);
		break;
	}
	case 1:
		// if there were drivers but they all failed cos the file is locked, try and find the miranda which locked it
		if (fileExist(szProfile)) {
			// file isn't locked, just no driver could open it.
			TCHAR buf[256];
			TCHAR* p = _tcsrchr(szProfile,'\\');
			mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda was unable to open '%s', it's in an unknown format.\nThis profile might also be damaged, please run DB-tool which should be installed."), p ? ++p : szProfile);
			MessageBox(0,buf,TranslateT("Miranda can't understand that profile"),MB_OK | MB_ICONERROR);
		}
		else if (!FindMirandaForProfile(szProfile)) {
			TCHAR buf[256];
			TCHAR* p = _tcsrchr(szProfile,'\\');
			mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda was unable to open '%s'\nIt's inaccessible or used by other application or Miranda instance"), p ? ++p : szProfile);
			MessageBox(0,buf,TranslateT("Miranda can't open that profile"),MB_OK | MB_ICONERROR);
		}
		break;
	}
	return (rc != 0);
}
Ejemplo n.º 17
0
QString Sample::makeToolTipText(const bool withDatasetName) {
    QStringList ret;

    if (withDatasetName) {
        ret << QObject::tr("Sample");
    }

    ret << QObject::tr("Id: %1").arg(getId())
            << QObject::tr("Name: %1").arg(getName())
            << QObject::tr("Description: %1").arg(getDescription());

    if (hasProfile()) {
        ret << QObject::tr("Profile: %1").arg(getProfile()->getName());
    }
    
    return ret.join("\n");
}
Ejemplo n.º 18
0
void SFXSound::_reloadBuffer()
{
   SFXProfile* profile = getProfile();
   if( profile != NULL && _releaseVoice() )
   {
      SFXBuffer* buffer = profile->getBuffer();
      if( !buffer )
      {
         Con::errorf( "SFXSound::_reloadBuffer() - Could not create device buffer!" );
         return;
      }
      
      _setBuffer( buffer );
      
      if( getLastStatus() == SFXStatusPlaying )
         SFX->_assignVoice( this );
   }
}
    //---------------------------------------------------------------
    void BaseExtraTechnique::addExtraTechniqueParameter ( 
        const String& profileName,
        const String& paramName,
        const String& value, 
        const String &paramSid )
    {
        // Get the current Profile from the map or create a new one.
        Profile& profile = getProfile ( profileName );

        // Create the value
        ParamData paramValue;
        paramValue.sid = paramSid;
        paramValue.stringValue = value;
        paramValue.paramType = STRING;

        // Insert the value into the parameters map of the current profile.
        profile.mParameters.insert ( Parameter ( paramName, paramValue ) );
    }
Ejemplo n.º 20
0
 std::string ABST::toPrettyString(uint32_t indent) {
   std::stringstream r;
   r << std::string(indent, ' ') << "[abst] Bootstrap Info (" << boxedSize() << ")" << std::endl;
   r << std::string(indent + 1, ' ') << "Version " << (int)getVersion() << std::endl;
   r << std::string(indent + 1, ' ') << "BootstrapinfoVersion " << getBootstrapinfoVersion() << std::endl;
   r << std::string(indent + 1, ' ') << "Profile " << (int)getProfile() << std::endl;
   if (getLive()) {
     r << std::string(indent + 1, ' ') << "Live" << std::endl;
   } else {
     r << std::string(indent + 1, ' ') << "Recorded" << std::endl;
   }
   if (getUpdate()) {
     r << std::string(indent + 1, ' ') << "Update" << std::endl;
   } else {
     r << std::string(indent + 1, ' ') << "Replacement or new table" << std::endl;
   }
   r << std::string(indent + 1, ' ') << "Timescale " << getTimeScale() << std::endl;
   r << std::string(indent + 1, ' ') << "CurrMediaTime " << getCurrentMediaTime() << std::endl;
   r << std::string(indent + 1, ' ') << "SmpteTimeCodeOffset " << getSmpteTimeCodeOffset() << std::endl;
   r << std::string(indent + 1, ' ') << "MovieIdentifier " << getMovieIdentifier() << std::endl;
   r << std::string(indent + 1, ' ') << "ServerEntryTable (" << getServerEntryCount() << ")" << std::endl;
   for (unsigned int i = 0; i < getServerEntryCount(); i++) {
     r << std::string(indent + 2, ' ') << i << ": " << getServerEntry(i) << std::endl;
   }
   r << std::string(indent + 1, ' ') << "QualityEntryTable (" << getQualityEntryCount() << ")" << std::endl;
   for (unsigned int i = 0; i < getQualityEntryCount(); i++) {
     r << std::string(indent + 2, ' ') << i << ": " << getQualityEntry(i) << std::endl;
   }
   r << std::string(indent + 1, ' ') << "DrmData " << getDrmData() << std::endl;
   r << std::string(indent + 1, ' ') << "MetaData " << getMetaData() << std::endl;
   r << std::string(indent + 1, ' ') << "SegmentRunTableEntries (" << getSegmentRunTableCount() << ")" << std::endl;
   for (uint32_t i = 0; i < getSegmentRunTableCount(); i++) {
     r << ((Box)getSegmentRunTable(i)).toPrettyString(indent + 2);
   }
   r << std::string(indent + 1, ' ') + "FragmentRunTableEntries (" << getFragmentRunTableCount() << ")" << std::endl;
   for (uint32_t i = 0; i < getFragmentRunTableCount(); i++) {
     r << ((Box)getFragmentRunTable(i)).toPrettyString(indent + 2);
   }
   return r.str();
 }
    //---------------------------------------------------------------
    void BaseExtraTechnique::addExtraTechniqueChildParameter ( 
        const String& profileName,
        const String& childName,
        const String& paramName,
        double matrix[][4], 
        const String &paramSid )
    {
        // Get the current Profile from the map or create a new one.
        Profile& profile = getProfile ( profileName );

        // Get the current childElement from the map or create a new one.
        Parameters& childParameters = getChildParameters ( profile.mChildElements, childName );

        // Create the value
        ParamData paramValue;
        paramValue.sid = paramSid;
        paramValue.matrix = matrix;
        paramValue.paramType = MATRIX;

        // Add the given parameter into the parameter list of the child element
        childParameters.insert ( Parameter ( paramName, paramValue ) );
    }
Ejemplo n.º 22
0
//----------------------------------------//
// Plot Two histograms
//----------------------------------------//
void plot(TFile* f_mix, TFile* f_g4, TString append)
{

  // Make Canvas
  TCanvas* c = makeCanvas("c");
  c->SetLogy();

  // Make Legend
  TLegend* leg = makeLegend(0.7,0.9,0.75,0.92);
  leg->SetTextSize(0.05);

  // Some plot particles
  TString xtitle = "Shower Depth [cm]";
  TString ytitle = "<N(e^{-}-e^{+})>";

  // Get profile from g4 results
  //TProfile* p_g4 = getProfile(f_g4,"NPartSum",xtitle,ytitle,kBlack,20);
  TProfile* p_g4 = getProfile(f_g4,"NPartDiff",xtitle,ytitle,kBlack,20);
  p_g4->SetMarkerSize(0.75);

  // Get profile from mixed file
  int nbins = p_g4->GetNbinsX();
  float xmin = p_g4->GetXaxis()->GetXmin();
  float xmax = p_g4->GetXaxis()->GetXmax();
  TProfile* p_mix = getMixProfile(f_mix,nbins,xmin,xmax,kBlue,25);

  // Add to legend
  leg->AddEntry(p_g4,"G4", "lep");
  leg->AddEntry(p_mix,"G4 Mixed", "lep");

  // Draw
  //p_g4->Draw();
  //p_mix->Draw("same");
  //leg->Draw("same");

  // Make ratio plot
  plotRatio(p_mix, p_g4, leg, c, "Mixed/G4", append);

}
EditOccupationsInfosWidget::EditOccupationsInfosWidget(const LinQedInClient* cl,QWidget* parent):EditInfosWidget(parent,
                                                                                                            tr("Modifica esperienze lavorative"),
                                                                                                            cl),
    calendar(0){
    setAttribute(Qt::WA_DeleteOnClose,true);
    try{
        infos=dynamic_cast<const Occupations*>(&getProfile().getInformationsBySectionName(Occupations::getIDString()));
    }catch(const NoInfoException&){infos=0;}
    initJobs();

    noJob=new QLabel(noJobS);
    noJob->setStyleSheet(GUIStyle::errorLabelStyle());
    addWidgetToMainLayout(noJob,Qt::AlignCenter);

    addJob=new QPushButton(tr("Aggiungi Lavoro"));
    addJob->setCursor(QCursor(Qt::PointingHandCursor));
    addWidgetToMainLayout(addJob,Qt::AlignCenter);
    connect(addJob,SIGNAL(clicked()),this,SLOT(addRow()));

    initButtons(true,true,true);
    writeDefaultValues();
}//EditOccupationsInfosWidget
void EditOccupationsInfosWidget::saveRequest(){
    Occupations o;
    bool stopped=false;
    int r=0;
    for(;r<model->rowCount() && !stopped;r++){
        stopped=(model->item(r,company)->text()=="" || model->item(r,employment)->text()=="" || model->item(r,begin)->text()=="Click");
        o.addJob(Job(model->item(r,company)->text(),
                     model->item(r,employment)->text(),
                     QDate::fromString(model->item(r,begin)->text(),"dd/M/yyyy"),
                     (model->item(r,end)->text()=="In corso" || model->item(r,end)->text()<model->item(r,begin)->text())?QDate(0,0,0):
                                        QDate::fromString(model->item(r,4)->text(),"dd/M/yyyy")));
    }//for
    if(stopped){
        noJob->setText("Informazioni mancanti nell'inserimento di un lavoro.");
        noJob->setVisible(true);
    }//if
    else if(r==0) cancel();
    else{
        Profile prof=getProfile();
        prof.updateInformationsBySectionName(Occupations::getIDString(),o);
        emit save(prof);
    }//else
}//saveRequest
Ejemplo n.º 25
0
bool SFXSound::_allocVoice( SFXDevice* device )
{
   // We shouldn't have any existing voice!
   AssertFatal( !mVoice, "SFXSound::_allocVoice() - Already had a voice!" );

   // Must not assign voice to source that isn't playing.
   AssertFatal( getLastStatus() == SFXStatusPlaying,
      "SFXSound::_allocVoice() - Source is not playing!" );

   // The buffer can be lost when the device is reset 
   // or changed, so initialize it if we have to.  If
   // that fails then we cannot create the voice.
   
   if( mBuffer.isNull() )
   {
      SFXProfile* profile = getProfile();
      if( profile != NULL )
      {
         SFXBuffer* buffer = profile->getBuffer();
         if( buffer )
            _setBuffer( buffer );
      }

      if( mBuffer.isNull() )
         return false;
   }

   // Ask the device for a voice based on this buffer.
   mVoice = device->createVoice( is3d(), mBuffer );
   if( !mVoice )
      return false;
            
   // Set initial properties.
   
   mVoice->setVolume( mPreAttenuatedVolume );
   mVoice->setPitch( mEffectivePitch );
   mVoice->setPriority( mEffectivePriority );
   if( mDescription->mRolloffFactor != -1.f )
      mVoice->setRolloffFactor( mDescription->mRolloffFactor );
      
   // Set 3D parameters.
   
   if( is3d() )
   {
      // Scatter the position, if requested.  Do this only once so
      // we don't change position when resuming from virtualized
      // playback.
      
      if( !mTransformScattered )
         _scatterTransform();
      
      // Set the 3D attributes.

      setTransform( mTransform );
      setVelocity( mVelocity );
      _setMinMaxDistance( mMinDistance, mMaxDistance );
      _setCone( mConeInsideAngle, mConeOutsideAngle, mConeOutsideVolume );
   }
   
   // Set reverb, if enabled.

   if( mDescription->mUseReverb )
      mVoice->setReverb( mDescription->mReverb );
   
   // Update the duration... it shouldn't have changed, but
   // its probably better that we're accurate if it did.
   mDuration = mBuffer->getDuration();

   // If virtualized playback has been started, we transfer its position to the
   // voice and stop virtualization.

   const U32 playTime = mPlayTimer.getPosition();
   
   if( playTime > 0 )
   {
      const U32 pos = mBuffer->getFormat().getSampleCount( playTime );
      mVoice->setPosition( pos);
   }

   mVoice->play( isLooping() );
   
   #ifdef DEBUG_SPEW
   Platform::outputDebugString( "[SFXSound] allocated voice for source '%i' (pos=%i, 3d=%i, vol=%f)",
      getId(), playTime, is3d(), mPreAttenuatedVolume );
   #endif
   
   return true;
}
Ejemplo n.º 26
0
//----------------------------------------//
// Plot the peak of a few values
//----------------------------------------//
void plotPeakComp()
{

  // Make Canvas
  TCanvas* c = makeCanvas("c");
  c->SetLogy();
  //c->SetLogx();

  // G4 and ZHS plots
  TString g4pname = "A_AntNum_0_pos_827.371_0_561.656";
  TString zhspname = "VP_avg_55.829616";

  // Specify the G4 plots
  TString g4dir = "efieldroot/";
  vector<TString> g4files;
  g4files.push_back(g4dir+"Output_50Evt_1GeV_1Prim_HardCodedAntenna_R1000m_newV.root");
  g4files.push_back(g4dir+"Output_50Evt_10GeV_1Prim_HardCodedAntenna_R1000m_newV.root");
  g4files.push_back(g4dir+"Output_50Evt_100GeV_1Prim_HardCodedAntenna_R1000m_newV.root");
  g4files.push_back(g4dir+"Output_20Evt_1TeV_1Prim_HardCodedAntenna_R1000m_newV.root");
  //g4files.push_back(g4dir+"Output_20Evt_10TeV_1Prim_HardCodedAntenna_R1000m_newV.root");

  // Specify the G4 plots
  TString zhsdir = "../ZHS_ELSEnergy/rootfiles/";
  vector<TString> zhsfiles;
  zhsfiles.push_back(zhsdir+"beam1e3MeV_1Prim_50NEvt_Angular.root");
  zhsfiles.push_back(zhsdir+"beam10e3MeV_1Prim_50NEvt_Angular.root");
  zhsfiles.push_back(zhsdir+"beam100e3MeV_1Prim_50NEvt_Angular.root");
  zhsfiles.push_back(zhsdir+"beam1e6MeV_1Prim_20NEvt_Angular.root");


  // What energies correspond to file [GeV]
  vector<double> NRG;
  NRG.push_back(1);
  NRG.push_back(10);
  NRG.push_back(100);
  NRG.push_back(1000);
  NRG.push_back(10000);

  // Specify some histogram shiz
  TString xtitle = "log(Energy/GeV)";
  TString ytitle = "Max(A) [Vm/s]";
  TH1F* frame = makeHist("frame",1,-1,5,xtitle,ytitle,kBlack,20);

  // Now loop over files and get points
  int npoints = 0;
  double E[1000];
  double g4_max[1000];
  double zhs_max[1000];
  double maximum = -999;
  for(unsigned int i=0; i<g4files.size(); ++i){

    // Store energy 
    E[i] = log10(NRG.at(i));

    // Get G4 result
    TFile* f_g4 = new TFile(g4files.at(i).Data());
    TProfile* prof = getProfile(f_g4, g4pname,"","",kBlack,20);
    //g4_max[i] = prof->GetMaximum();
    g4_max[i] = getMax(prof);
    if( maximum < g4_max[i] ) maximum = g4_max[i];

    // Get G4 result
    TFile* f_zhs = new TFile(zhsfiles.at(i).Data());
    TProfile* prof = getProfile(f_zhs, zhspname,"","",kBlack,20);
    //zhs_max[i] = prof->GetMaximum() / 1000.;
    //zhs_max[i] = prof->GetMaximum() /1000. ;
    zhs_max[i] = getMax(prof) / 1000.;
    if( maximum < zhs_max[i] ) maximum = zhs_max[i];

    // Increment points
    npoints++;

  }

  // Make TGraph
  TGraph* gr_g4 = new TGraph(npoints, E, g4_max);
  gr_g4->SetLineWidth(1);
  gr_g4->SetMarkerSize(1);
  gr_g4->SetMarkerStyle(20);
  gr_g4->SetLineColor(kBlue);
  gr_g4->SetMarkerColor(kBlue);

  // Make TGraph
  TGraph* gr_zhs = new TGraph(npoints, E, zhs_max);
  gr_zhs->SetLineWidth(1);
  gr_zhs->SetMarkerSize(1);
  gr_zhs->SetMarkerStyle(20);
  gr_zhs->SetLineColor(kRed);
  gr_zhs->SetMarkerColor(kRed);

  // Draw graph
  frame->SetMaximum(5*maximum);
  frame->SetMinimum(1e-5*maximum);
  frame->Draw();
  gr_g4->Draw("samelp");
  gr_zhs->Draw("samelp");

  // Add some legend
  TLegend* leg = makeLegend(0.2,0.4,0.8,0.9);
  leg->AddEntry(gr_g4,"Geant4","lp");  
  leg->AddEntry(gr_zhs,"ZHS","lp");
  leg->Draw("same");

}
Ejemplo n.º 27
0
void Enchantment::applyEnchantment(std::shared_ptr<Object> target)
{
    //Invalid target?
    if( target->isTerminated() || (!target->isAlive() && !_enchantProfile->_target._stay) ) {
		Log::get().warn("%s:%d: invalid target\n", __FILE__, __LINE__);
        requestTerminate();
        return;
    }

    //Already added to a target?
    if(_target.lock()) {
        throw std::logic_error("Enchantment::applyEnchantment() - Already applied\n");
    }

    // do retargeting, if necessary
    // Should it choose an inhand item?
    if (_enchantProfile->retarget) {
        // Left, right, or both are valid
        if (target->getRightHandItem()) {
            // Only right hand is valid
            target = target->getRightHandItem();
        }
        else if (target->getLeftHandItem()) {
            // Pick left hand
            target = target->getLeftHandItem();
        }
        else {
            // No weapons to pick, make it fail
			Log::get().debug("Enchantment::applyEnchantment() - failed because target has no valid items in hand\n");
            requestTerminate();
            return;
        }
    }

    //Set our target, stored as a weak_ptr
    _target = target;

    // Check damage type, 90% damage resistance is enough to resist the enchant
    if (_enchantProfile->required_damagetype < DAMAGE_COUNT) {
        if (target->getDamageReduction(_enchantProfile->required_damagetype) >= 0.90f) {
			Log::get().debug("Enchantment::applyEnchantment() - failed because the target is immune to the enchant.\n");
            requestTerminate();
            return;
        }
    }

    // Check if target has the required damage type we need
    if (_enchantProfile->require_damagetarget_damagetype < DAMAGE_COUNT) {
        if (target->damagetarget_damagetype != _enchantProfile->require_damagetarget_damagetype) {
			Log::get().warn("%s:%d: application of enchantment failed because the target not have the right damagetarget_damagetype.\n", __FILE__, __LINE__);
            requestTerminate();
            return;
        }
    }

    //modify enchant duration with damage resistance (bad resistance actually *increases* duration!)
    if ( _lifeTime > 0 && _enchantProfile->required_damagetype < DAMAGE_COUNT && target ) {
        _lifeTime -= std::ceil(target->getDamageReduction(_enchantProfile->required_damagetype) * _enchantProfile->lifetime);
    }

    // Create an overlay character?
    if (_enchantProfile->spawn_overlay)
    {
        std::shared_ptr<Object> overlay = _currentModule->spawnObject(target->getPosition(), _spawnerProfileID, target->team, 0, target->ori.facing_z, "", ObjectRef::Invalid );
        if (overlay)
        {
            _overlay = overlay;                             //Kill this character on end...
            overlay->ai.setTarget(target->getObjRef());
            overlay->is_overlay  = true;
            overlay->ai.state = _enchantProfile->spawn_overlay; // ??? WHY DO THIS ???

            // Start out with ActionMJ...  Object activated
            int action = overlay->getProfile()->getModel()->getAction(ACTION_MJ);
            if ( !ACTION_IS_TYPE( action, D ) )
            {
                chr_start_anim( overlay.get(), action, false, true );
            }

            // Assume it's transparent...
            overlay->setLight(254);
            overlay->setAlpha(128);
        }
    }

    //Check if this enchant has any set modifiers that conflicts with another enchant
    _modifiers.remove_if([this, &target](const EnchantModifier &modifier) {

        //Only set types can conflict
        if(!Ego::Attribute::isOverrideSetAttribute(modifier._type)) {
            return false;
        }

        //Is there no conflict?
        if(target->getTempAttributes().find(modifier._type) == target->getTempAttributes().end()) {
            return false;
        }

        //Ok there exist a conflict, so now we have to resolve it somehow
        //Does this enchant override other enchants?
        if(getProfile()->_override) {
            bool conflictResolved = false;

            //Find the active enchant that conflicts with us
            for(const std::shared_ptr<Ego::Enchantment> &conflictingEnchant : target->getActiveEnchants()) {
                conflictingEnchant->_modifiers.remove_if([this, &conflictingEnchant, &modifier, &conflictResolved](const EnchantModifier &otherModifier)
                    {
                        //Is this the one?
                        if(modifier._type == otherModifier._type) {
                            conflictResolved = true;

                            //Remove Enchants that conflict with this one?
                            if(getProfile()->remove_overridden) {
                                conflictingEnchant->requestTerminate();
                            }

                            return true;
                        }

                        //Nope, keep looking
                        return false;
                    });

                //Has it been resolved?
                if(conflictResolved) {
                    break;
                }
            }

            //We have higher priority than exiting enchants
            return false;
        }
        else {
            //The existing enchant has higher priority than ours
            return true;
        }
    });

    //Now actually apply the values to the target
    for(const EnchantModifier &modifier : _modifiers)
    {
        //These should never occur
        if(modifier._type == Ego::Attribute::NR_OF_PRIMARY_ATTRIBUTES ||
           modifier._type == Ego::Attribute::NR_OF_ATTRIBUTES) 
        {
            throw std::logic_error("Enchant.cpp - Invalid enchant type: meta-type as modifier");
        }

        //Morph is special and handled differently than others
        if(modifier._type == Ego::Attribute::MORPH) {
            //Store target's original armor
            target->getTempAttributes()[Ego::Attribute::MORPH] = target->skin;

            //Transform the object
            target->polymorphObject(_spawnerProfileID, 0);
        }

        //Is it a set type?
        else if(Ego::Attribute::isOverrideSetAttribute(modifier._type)) {
            target->getTempAttributes()[modifier._type] = modifier._value;
        }

        //It's a cumulative addition
        else {
            target->getTempAttributes()[modifier._type] += modifier._value;            
        }
    }

    //Finally apply boost values to owner as well
    std::shared_ptr<Object> owner = _owner.lock();
    if(owner != nullptr && !owner->isTerminated()) {
        owner->getTempAttributes()[Ego::Attribute::MANA_REGEN] += _ownerManaSustain;
        owner->getTempAttributes()[Ego::Attribute::LIFE_REGEN] += _ownerLifeSustain;
    }

    //Insert this enchantment into the Objects list of active enchants
    target->getActiveEnchants().push_front(shared_from_this());    
}
Ejemplo n.º 28
0
char const* DVVideoStreamFramer::profileName() {
  if (fOurProfile == NULL) getProfile();

  return fOurProfile != NULL ? ((DVVideoProfile const*)fOurProfile)->name : NULL;
}
Ejemplo n.º 29
0
	boost::shared_ptr<LocationNode> DESFireChip::getRootLocationNode()
	{
		boost::shared_ptr<LocationNode> rootNode;
		rootNode.reset(new LocationNode());
		char tmpName[255];

		rootNode->setName("Mifare DESFire");
		rootNode->setHasProperties(true);

		boost::shared_ptr<DESFireLocation> rootLocation = boost::dynamic_pointer_cast<DESFireLocation>(getProfile()->createLocation());
		rootLocation->aid = (unsigned int)-1;
		rootLocation->file = (unsigned int)-1;
		rootNode->setLocation(rootLocation);

		if (getCommands())
		{
			getDESFireCommands()->selectApplication(0);

			// Try authentication.
			try
			{
				getDESFireCommands()->authenticate(0);
			}
			catch(CardException&)
			{

			}

			std::vector<int> aids = getDESFireCommands()->getApplicationIDs();

			for (std::vector<int>::const_iterator aid = aids.begin(); aid != aids.end(); aid++)
			{
				boost::shared_ptr<LocationNode> aidNode;
				aidNode.reset(new LocationNode());
				sprintf(tmpName, "Application ID %u", *aid);
				aidNode->setName(tmpName);

				boost::shared_ptr<DESFireLocation> aidLocation = boost::dynamic_pointer_cast<DESFireLocation>(getProfile()->createLocation());
				aidLocation->aid = *aid;
				aidLocation->file = static_cast<unsigned int>(-1);
				aidNode->setLocation(aidLocation);

				if (getDESFireCommands()->selectApplication(*aid))
				{
					// Try authentication.
					try
					{
						getDESFireCommands()->authenticate(0);
					}
					catch(CardException&)
					{

					}

					try
					{
						std::vector<int> files = getDESFireCommands()->getFileIDs();
					
						for (std::vector<int>::const_iterator file = files.begin(); file != files.end(); ++file)
						{
							boost::shared_ptr<LocationNode> fileNode;
							fileNode.reset(new LocationNode());
							sprintf(tmpName, "File %d", *file);
							fileNode->setName(tmpName);

							boost::shared_ptr<DESFireLocation> location = getApplicationLocation();
							location->aid = *aid;
							location->file = *file;
							location->byte = 0;							

							try
							{
								DESFireCommands::FileSetting settings;
								if (getDESFireCommands()->getFileSettings(*file, settings))
								{
									location->securityLevel = (EncryptionMode)settings.comSett;
									switch (settings.fileType)
									{
									case 0:
										{
											size_t fileSize = 0;
											memcpy(&fileSize, settings.type.dataFile.fileSize, sizeof(settings.type.dataFile.fileSize));
											fileNode->setLength(fileSize);
										}
										break;

									case 1:
										{
											//TODO: Write something here ?
										}
										break;

									case 2:
										{
											size_t recordSize = 0;
											memcpy(&recordSize, settings.type.recordFile.recordSize, sizeof(settings.type.recordFile.recordSize));
											fileNode->setLength(recordSize);
										}
										break;
									}
								}
								else
								{
									location->securityLevel = CM_ENCRYPT;
								}
							}
							catch(std::exception&)
							{
								fileNode->setLength(0);
							}
															
							fileNode->setNeedAuthentication(true);
							fileNode->setHasProperties(true);
							fileNode->setLocation(location);
							fileNode->setParent(aidNode);
							aidNode->getChildrens().push_back(fileNode);
						}
					}
					catch(std::exception&)
					{
					}
				}

				aidNode->setHasProperties(true);
				aidNode->setParent(rootNode);
				rootNode->getChildrens().push_back(aidNode);
			}
		}

		return rootNode;
	}
Ejemplo n.º 30
0
void Enchantment::playEndSound() const
{
    std::shared_ptr<Object> target = _target.lock();
    if(target) {
        const std::shared_ptr<ObjectProfile> &spawnerProfile = ProfileSystem::get().getProfile(_spawnerProfileID);
        AudioSystem::get().playSound(target->getPosition(), spawnerProfile->getSoundID(getProfile()->endsound_index));
    }
}