VcsBase: Proliferate use of FilePath

... and update user code.

Change-Id: I52c08e9e07238536d31fc72f97312ac582a1e32f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2023-01-20 10:35:45 +01:00
parent 7dd2fe689d
commit 013ad1345e
30 changed files with 175 additions and 188 deletions

View File

@@ -267,7 +267,7 @@ public:
typedef QHash<FilePath, DirectoryCacheEntry> ManagedDirectoryCache;
IEditor *showOutputInEditor(const QString &title, const QString &output,
Id id, const QString &source,
Id id, const FilePath &source,
QTextCodec *codec = nullptr);
// args are passed as command line arguments
@@ -604,13 +604,13 @@ void PerforcePluginPrivate::revertCurrentFile()
if (doNotRevert)
return;
FileChangeBlocker fcb(FilePath::fromString(state.currentFile()));
FileChangeBlocker fcb(state.currentFile());
args.clear();
args << QLatin1String("revert") << state.relativeCurrentFile();
PerforceResponse result2 = runP4Cmd(state.currentFileTopLevel(), args,
CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow);
if (!result2.error)
emit filesChanged(QStringList(state.currentFile()));
emit filesChanged(QStringList(state.currentFile().toString()));
}
void PerforcePluginPrivate::diffCurrentFile()
@@ -834,7 +834,7 @@ void PerforcePluginPrivate::annotate(const FilePath &workingDir,
const QStringList files = QStringList(fileName);
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, files);
const QString id = VcsBaseEditor::getTitleId(workingDir, files, changeList);
const QString source = VcsBaseEditor::getSource(workingDir, files);
const FilePath source = VcsBaseEditor::getSource(workingDir, files);
QStringList args;
args << QLatin1String("annotate") << QLatin1String("-cqi");
if (changeList.isEmpty())
@@ -897,7 +897,7 @@ void PerforcePluginPrivate::filelog(const FilePath &workingDir, const QString &f
CommandToWindow|StdErrToWindow|ErrorToWindow,
{}, {}, codec);
if (!result.error) {
const QString source = VcsBaseEditor::getSource(workingDir, fileName);
const FilePath source = VcsBaseEditor::getSource(workingDir, fileName);
IEditor *editor = showOutputInEditor(Tr::tr("p4 filelog %1").arg(id), result.stdOut,
logEditorParameters.id, source, codec);
if (enableAnnotationContextMenu)
@@ -919,7 +919,7 @@ void PerforcePluginPrivate::changelists(const FilePath &workingDir, const QStrin
CommandToWindow|StdErrToWindow|ErrorToWindow,
{}, {}, codec);
if (!result.error) {
const QString source = VcsBaseEditor::getSource(workingDir, fileName);
const FilePath source = VcsBaseEditor::getSource(workingDir, fileName);
IEditor *editor = showOutputInEditor(Tr::tr("p4 changelists %1").arg(id), result.stdOut,
logEditorParameters.id, source, codec);
VcsBaseEditor::gotoLineOfEditor(editor, 1);
@@ -1380,7 +1380,7 @@ PerforceResponse PerforcePluginPrivate::runP4Cmd(const FilePath &workingDir,
IEditor *PerforcePluginPrivate::showOutputInEditor(const QString &title,
const QString &output,
Utils::Id id,
const QString &source,
const FilePath &source,
QTextCodec *codec)
{
QString s = title;
@@ -1502,13 +1502,13 @@ void PerforcePluginPrivate::p4Diff(const PerforceDiffParameters &p)
void PerforcePluginPrivate::vcsDescribe(const FilePath &source, const QString &n)
{
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(nullptr)
: VcsBaseEditor::getCodec(source.toString());
: VcsBaseEditor::getCodec(source);
QStringList args;
args << QLatin1String("describe") << QLatin1String("-du") << n;
const PerforceResponse result = runP4Cmd(m_settings.topLevel(), args, CommandToWindow|StdErrToWindow|ErrorToWindow,
{}, {}, codec);
if (!result.error)
showOutputInEditor(Tr::tr("p4 describe %1").arg(n), result.stdOut, diffEditorParameters.id, source.toString(), codec);
showOutputInEditor(Tr::tr("p4 describe %1").arg(n), result.stdOut, diffEditorParameters.id, source, codec);
}
void PerforcePluginPrivate::cleanCommitMessageFile()