Exemplo n.º 1
0
void
SVNInfoLog::HandleContextMenu
	(
	const JIndex index
	)
{
	JString rev;
	if (!GetBaseRevision(&rev))
		{
		return;
		}

	if (index == kDiffEditedSelectedFilesCtxCmd)
		{
		CompareEdited(rev);
		}
	else if (index == kDiffCurrentSelectedFilesCtxCmd)
		{
		CompareCurrent(rev);
		}
	else if (index == kDiffPrevSelectedFilesCtxCmd)
		{
		ComparePrev(rev);
		}

	else if (index == kCommitDetailsCtxCmd)
		{
		(GetDirector())->ShowInfoLog(itsFullName, rev);
		}

	else if (index == kBrowseRepoRevisionCtxCmd)
		{
		(GetDirector())->BrowseRepo(rev);
		}
}
void
SVNListBase::RefreshContent()
{
	if (itsProcess != NULL)
		{
		JProcess* p = itsProcess;
		itsProcess  = NULL;

		p->Kill();
		delete p;

		DeleteLinks();
		}
	else
		{
		itsSavedSelection->CleanOut();
		JTableSelection& s = GetTableSelection();
		JTableSelectionIterator iter(&s);
		JPoint cell;
		while (iter.Next(&cell))
			{
			const JString* line = itsLineList->NthElement(cell.y);
			itsSavedSelection->InsertSorted(new JString(ExtractRelativePath(*line)));
			}
		}

	itsDisplayState = SaveDisplayState();
	itsLineList->CleanOut();

	int outFD, errFD;
	JError err = JNoError();
	if ((GetDirector())->HasPath())
		{
		err = JProcess::Create(&itsProcess, GetPath(), itsCmd,
							   kJIgnoreConnection, NULL,
							   kJCreatePipe, &outFD,
							   kJCreatePipe, &errFD);
		}
	else	// working with URL
		{
		err = JProcess::Create(&itsProcess, itsCmd,
							   kJIgnoreConnection, NULL,
							   kJCreatePipe, &outFD,
							   kJCreatePipe, &errFD);
		}

	if (err.OK())
		{
		itsProcess->ShouldDeleteWhenFinished();
		ListenTo(itsProcess);
		(GetDirector())->RegisterActionProcess(this, itsProcess, itsRefreshRepoFlag,
											   itsRefreshStatusFlag, itsReloadOpenFilesFlag);

		SetConnection(outFD, errFD);
		}
	else
		{
		err.ReportIfError();
		}
}
void
GDBPlot2DCommand::UpdateRange
	(
	const JIndex	curveIndex,
	const JInteger	min,
	const JInteger	max
	)
{
	CMPlot2DCommand::UpdateRange(curveIndex, min, max);

	JString cmd = "set print pretty off\nset print array off\n"
				  "set print repeats 0\nset width 0\n";

	for (JInteger i=min; i<=max; i++)
		{
		cmd += "print ";
		cmd += GetDirector()->GetXExpression(curveIndex, i);
		cmd.AppendCharacter('\n');

		cmd += "print ";
		cmd += GetDirector()->GetYExpression(curveIndex, i);
		cmd.AppendCharacter('\n');
		}

	SetCommand(cmd);
}
JBoolean
SVNPropertiesList::RemoveNextProperty()
{
	if (!itsRemovePropertyCmdList->IsEmpty())
		{
		const JString cmd = *(itsRemovePropertyCmdList->FirstElement());
		itsRemovePropertyCmdList->DeleteElement(1);

		JSimpleProcess* p;
		const JError err = JSimpleProcess::Create(&p, cmd, kJTrue);
		if (err.OK())
			{
			itsProcessList->Append(p);
			ListenTo(p);
			return kJTrue;
			}
		else
			{
			err.ReportIfError();
			return kJFalse;
			}
		}
	else
		{
		if ((GetDirector())->OKToStartActionProcess())
			{
			RefreshContent();
			}

		(GetDirector())->ScheduleStatusRefresh();
		return kJTrue;
		}
}
Exemplo n.º 5
0
void
LLDBGetRegisters::HandleSuccess
	(
	const JString& data
	)
{
	LLDBLink* link = dynamic_cast<LLDBLink*>(CMGetLink());
	if (link == NULL)
		{
		return;
		}

	lldb::SBCommandInterpreter interp = link->GetDebugger()->GetCommandInterpreter();
	if (!interp.IsValid())
		{
		return;
		}

	lldb::SBCommandReturnObject result;
	interp.HandleCommand("register read", result);

	// https://llvm.org/bugs/show_bug.cgi?id=26421
	if (result.IsValid() && result.Succeeded() /* && result.HasResult() */)
		{
		(GetDirector())->Update(result.GetOutput());
		}
}
void
SVNListBase::HandleContextMenu
	(
	const JIndex index
	)
{
	if (index == kDiffEditedSelectedFilesCtxCmd)
		{
		JString rev;
		if (GetBaseRevision(&rev))
			{
			CompareEdited(rev);
			}
		}
	else if (index == kDiffCurrentSelectedFilesCtxCmd)
		{
		JString rev;
		GetBaseRevision(&rev);
		CompareCurrent(rev);
		}
	else if (index == kDiffPrevSelectedFilesCtxCmd)
		{
		JString rev;
		GetBaseRevision(&rev);
		ComparePrev(rev);
		}

	else if (index == kInfoLogSelectedFilesCtxCmd)
		{
		(GetDirector())->ShowInfoLog(this);
		}
	else if (index == kPropSelectedFilesCtxCmd)
		{
		(GetDirector())->ShowProperties(this);
		}

	else if (index == kIgnoreSelectionCtxCmd)
		{
		Ignore();
		}

	else if (index == kShowSelectedFilesCtxCmd)
		{
		ShowFiles();
		}
}
JBoolean
SVNPropertiesList::CreateProperty()
{
	assert( itsCreatePropertyDialog == NULL );

	itsCreatePropertyDialog =
		new JXGetStringDialog(
			GetDirector(), JGetString(kCreatePropertyWindowTitleID),
			JGetString(kCreatePropertyPromptID), "");
	assert( itsCreatePropertyDialog != NULL );
	ListenTo(itsCreatePropertyDialog);
	itsCreatePropertyDialog->BeginDialog();
	return kJTrue;
}
//=========================================================
// Ha muerto un NPC que he creado.
//=========================================================
void CDirectorSpawn::DeathNotice(CBaseEntity *pVictim)
{
	ChildsAlive--;
	ChildsKilled++;

	CDirector *pDirector = GetDirector();

	if ( pDirector )
	{
		// ¡Han matado a un NPC!
		if ( pVictim->GetEntityName() == MAKE_STRING(CHILD_NAME) )
			pDirector->ChildKilled(pVictim);
			
		// ¡Han matado a un Jefe!
		if ( pVictim->GetEntityName() == MAKE_STRING(BOSS_NAME) )
			pDirector->MBossKilled(pVictim);
	}

	OnChildDead.FireOutput(pVictim, this);
}
void
CMLineAddressTable::GetBreakpoints
	(
	JPtrArray<CMBreakpoint>* list
	)
{
	itsVisualBPIndexList->RemoveAll();

	const JString* fnName;
	if (!GetDirector()->GetFunctionName(&fnName))
		{
		list->CleanOut();
		return;
		}

	CMLocation loc;
	loc.SetFunctionName(*fnName);
	if (!GetLink()->GetBreakpointManager()->GetBreakpoints(loc, list))
		{
		return;
		}
	list->Sort();

	const JSize count = list->GetElementCount();
	JString target;
	for (JIndex i=1; i<=count; i++)
		{
		const CMBreakpoint* bp = list->NthElement(i);

		target = GetLineTextFromAddress(bp->GetAddress());

		JBoolean found;
		const JIndex j = itsLineTextList->SearchSorted1(&target, JOrderedSetT::kAnyMatch, &found);
		itsVisualBPIndexList->AppendElement(j);
		}
}
Exemplo n.º 10
0
void VideoMetadata::toMap(MetadataMap &metadataMap)
{
    if (this == NULL)
        return;

    QString coverfile;
    if (IsHostSet()
        && !GetCoverFile().startsWith("/")
        && !GetCoverFile().isEmpty()
        && !IsDefaultCoverFile(GetCoverFile()))
    {
        coverfile = generate_file_url("Coverart", GetHost(),
                GetCoverFile());
    }
    else
    {
        coverfile = GetCoverFile();
    }

    metadataMap["coverfile"] = coverfile;

    QString screenshotfile;
    if (IsHostSet() && !GetScreenshot().startsWith("/")
        && !GetScreenshot().isEmpty())
    {
        screenshotfile = generate_file_url("Screenshots",
                GetHost(), GetScreenshot());
    }
    else
    {
        screenshotfile = GetScreenshot();
    }

    metadataMap["screenshotfile"] = screenshotfile;

    QString bannerfile;
    if (IsHostSet() && !GetBanner().startsWith("/")
        && !GetBanner().isEmpty())
    {
        bannerfile = generate_file_url("Banners", GetHost(),
                GetBanner());
    }
    else
    {
        bannerfile = GetBanner();
    }

    metadataMap["bannerfile"] = bannerfile;

    QString fanartfile;
    if (IsHostSet() && !GetFanart().startsWith("/")
        && !GetFanart().isEmpty())
    {
        fanartfile = generate_file_url("Fanart", GetHost(),
                GetFanart());
    }
    else
    {
        fanartfile = GetFanart();
    }

    metadataMap["fanartfile"] = fanartfile;

    metadataMap["filename"] = GetFilename();
    metadataMap["title"] = GetTitle();
    metadataMap["subtitle"] = GetSubtitle();
    metadataMap["tagline"] = GetTagline();
    metadataMap["director"] = GetDirector();
    metadataMap["studio"] = GetStudio();
    metadataMap["description"] = GetPlot();
    metadataMap["genres"] = GetDisplayGenres(*this);
    metadataMap["countries"] = GetDisplayCountries(*this);
    metadataMap["cast"] = GetDisplayCast(*this).join(", ");
    metadataMap["rating"] = GetDisplayRating(GetRating());
    metadataMap["length"] = GetDisplayLength(GetLength());
    metadataMap["year"] = GetDisplayYear(GetYear());

    metadataMap["releasedate"] = MythDateToString(GetReleaseDate(), kDateFull);

    metadataMap["userrating"] = GetDisplayUserRating(GetUserRating());
    metadataMap["season"] = GetDisplaySeasonEpisode(GetSeason(), 1);
    metadataMap["episode"] = GetDisplaySeasonEpisode(GetEpisode(), 1);

    if (GetSeason() > 0 || GetEpisode() > 0)
    {
        metadataMap["s##e##"] = QString("s%1e%2").arg(GetDisplaySeasonEpisode
                                             (GetSeason(), 2))
                        .arg(GetDisplaySeasonEpisode(GetEpisode(), 2));
        metadataMap["##x##"] = QString("%1x%2").arg(GetDisplaySeasonEpisode
                                             (GetSeason(), 1))
                        .arg(GetDisplaySeasonEpisode(GetEpisode(), 2));
    }
    else
        metadataMap["s##e##"] = metadataMap["##x##"] = QString();

    metadataMap["trailerstate"] = TrailerToState(GetTrailer());
    metadataMap["userratingstate"] =
            QString::number((int)(GetUserRating()));
    metadataMap["watchedstate"] = WatchedToState(GetWatched());

    metadataMap["videolevel"] = ParentalLevelToState(GetShowLevel());

    metadataMap["insertdate"] = MythDateToString(GetInsertdate(), kDateFull);
    metadataMap["inetref"] = GetInetRef();
    metadataMap["homepage"] = GetHomepage();
    metadataMap["child_id"] = QString::number(GetChildID());
    metadataMap["browseable"] = GetDisplayBrowse(GetBrowse());
    metadataMap["watched"] = GetDisplayWatched(GetWatched());
    metadataMap["processed"] = GetDisplayProcessed(GetProcessed());
    metadataMap["category"] = GetCategory();
}
Exemplo n.º 11
0
void
LLDBGetAssembly::HandleSuccess
	(
	const JString& cmdData
	)
{
	LLDBLink* link = dynamic_cast<LLDBLink*>(CMGetLink());
	if (link == NULL)
		{
		return;
		}

	lldb::SBCommandInterpreter interp = link->GetDebugger()->GetCommandInterpreter();
	if (!interp.IsValid())
		{
		return;
		}

	const CMLocation& loc = (GetDirector())->GetDisassemblyLocation();

	const JString cmd = "disassemble -n " + JPrepArgForExec(loc.GetFunctionName());
	lldb::SBCommandReturnObject result;
	interp.HandleCommand(cmd, result);

	JPtrArray<JString> addrList(JPtrArrayT::kDeleteAll);
	JString instText;

	if (result.IsValid() && result.Succeeded() && result.HasResult())
		{
		std::istringstream input(result.GetOutput());
		JString line, s;
		JSize maxOffsetLength = 0;
		while (!input.eof() && !input.fail())
			{
			line = JReadLine(input);

			JIndex i;
			if (line.LocateSubstring(":", &i) && i < line.GetLength())
				{
				s = line.GetSubstring(1, i-1);
				if (s.BeginsWith("->") && s.GetLength() > 2)
					{
					s = s.GetSubstring(3, s.GetLength());
					}
				s.TrimWhitespace();
				addrList.Append(s);

				JIndexRange r;
				if (offsetPattern.Match(s, &r))
					{
					maxOffsetLength = JMax(maxOffsetLength, r.GetLength());
					}

				if (!instText.IsEmpty())
					{
					instText.AppendCharacter('\n');
					}
				s = line.GetSubstring(i+1, line.GetLength());
				s.TrimWhitespace();
				instText.Append(s);
				}
			}

		const JSize count = addrList.GetElementCount();
		for (JIndex i=1; i<count; i++)
			{
			JString* s = addrList.NthElement(i);
			JIndexRange r;
			if (offsetPattern.Match(*s, &r))
				{
				const JSize pad = maxOffsetLength - r.GetLength();
				for (JIndex j=0; j<pad; j++)
					{
					s->InsertCharacter('0', r.first+2);
					}
				}
			}
		}

	(GetDirector())->DisplayDisassembly(&addrList, instText);
}
//=========================================================
// Verifica las condiciones y devuelve si es
// conveniente/posible crear un NPC en las coordenadas.
//=========================================================
bool CDirectorSpawn::CanMakeNPC(CAI_BaseNPC *pNPC, Vector *pResult)
{
	// Desactivado
	// Esta entidad no funciona en Multiplayer.
	if ( Disabled )
	{
		UTIL_RemoveImmediate(pNPC);
		return false;
	}

	Vector origin;
	ConVarRef director_force_spawn_outview("director_force_spawn_outview");
	
	// Verificamos si es posible crear el NPC en el radio especificado.
	if ( !CAI_BaseNPC::FindSpotForNPCInRadius(&origin, GetAbsOrigin(), pNPC, SpawnRadius, director_force_spawn_outview.GetBool()) )
	{
		if ( !CAI_BaseNPC::FindSpotForNPCInRadius(&origin, GetAbsOrigin(), pNPC, SpawnRadius, false) )
		{
			DevWarning("[DIRECTOR SPAWN] No se encontro un lugar valido para crear un NPC. \r\n");

			UTIL_RemoveImmediate(pNPC);
			return false;
		}
	}

	// Crear en la misma altura que el spawn (Y así evitamos que se cree por debajo del suelo)
	origin.z = GetAbsOrigin().z;

	// Si esta activado la opción de forzar la creación fuera de la visibilidad del usuario.
	// Hay que asegurarnos de que el usuario no esta viendo el lugar de creación...
	if ( director_force_spawn_outview.GetBool() )
	{
		CDirector *pDirector = GetDirector();

		if ( !pDirector )
			return false;

		// En Climax con que no lo vea directamente es suficiente...
		//if ( pDirector->GetStatus() == CLIMAX )
		//{
			if ( UTIL_IsPlayersVisible(origin) )
			{
				DevWarning("[DIRECTOR SPAWN] El lugar de creacion estaba en el campo de vision. \r\n");
				UTIL_RemoveImmediate(pNPC);

				return false;
			}
		//}

		// En cualquier otro modo no debe ser visible ni estar en el cono de visibilidad del jugador.
		/*else
		{
			if ( UTIL_IsPlayersVisibleCone(origin) )
			{
				Warning("[DIRECTOR SPAWN] El lugar de creacion estaba en el campo de vision. \r\n");
				UTIL_RemoveImmediate(pNPC);

				return false;
			}
		}*/
	}

	*pResult = origin;
	return true;
}