Vcs: Use FilePath in IVersionControl API

Adapt first level of users.

Change-Id: Ifcd7bff45631ff3b9e26a9e3176daa6cf0cf2e56
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2021-07-29 09:31:09 +02:00
parent 69c6c9f7d5
commit edcedabed9
33 changed files with 391 additions and 379 deletions

View File

@@ -52,7 +52,7 @@ namespace VcsBase {
VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters,
// Force copy, see QTCREATORBUG-13218
const EditorWidgetCreator editorWidgetCreator,
std::function<void(const QString &, const QString &)> describeFunc)
std::function<void (const Utils::FilePath &, const QString &)> describeFunc)
{
setId(parameters->id);
setDisplayName(QCoreApplication::translate("VCS", parameters->displayName));

View File

@@ -40,7 +40,7 @@ class VCSBASE_EXPORT VcsEditorFactory : public TextEditor::TextEditorFactory
public:
VcsEditorFactory(const VcsBaseEditorParameters *parameters,
const EditorWidgetCreator editorWidgetCreator,
std::function<void(const QString &, const QString &)> describeFunc);
std::function<void(const Utils::FilePath &, const QString &)> describeFunc);
};
} // namespace VcsBase

View File

@@ -329,7 +329,8 @@ QString ChangeTextCursorHandler::currentContents() const
void ChangeTextCursorHandler::slotDescribe()
{
emit editorWidget()->describeRequested(editorWidget()->source(), m_currentChange);
emit editorWidget()->describeRequested(FilePath::fromString(editorWidget()->source()),
m_currentChange);
}
void ChangeTextCursorHandler::slotCopyRevision()

View File

@@ -157,7 +157,7 @@ protected:
int lineNumberDigits() const override;
public:
typedef std::function<void(const QString &, const QString &)> DescribeFunc;
typedef std::function<void(const Utils::FilePath &, const QString &)> DescribeFunc;
void finalizeInitialization() override;
// FIXME: Consolidate these into finalizeInitialization
@@ -219,7 +219,7 @@ signals:
// These signals also exist in the opaque editable (IEditor) that is
// handled by the editor manager for convenience. They are emitted
// for LogOutput/AnnotateOutput content types.
void describeRequested(const QString &source, const QString &change);
void describeRequested(const Utils::FilePath &source, const QString &change);
void annotateRevisionRequested(const QString &workingDirectory, const QString &file,
const QString &change, int lineNumber);
void diffChunkApplied(const VcsBase::DiffChunk &dc);

View File

@@ -241,7 +241,7 @@ QString StateListener::windowTitleVcsTopic(const QString &filePath)
QString topLevelPath;
IVersionControl *vc = VcsManager::findVersionControlForDirectory(
searchPath, &topLevelPath);
return (vc && !topLevelPath.isEmpty()) ? vc->vcsTopic(topLevelPath) : QString();
return (vc && !topLevelPath.isEmpty()) ? vc->vcsTopic(FilePath::fromString(topLevelPath)) : QString();
}
static inline QString displayNameOfEditor(const QString &fileName)
@@ -657,7 +657,7 @@ void VcsBasePluginPrivate::createRepository()
return;
} while (true);
// Create
const bool rc = vcsCreateRepository(directory);
const bool rc = vcsCreateRepository(FilePath::fromString(directory));
const QString nativeDir = QDir::toNativeSeparators(directory);
if (rc) {
QMessageBox::information(mw, tr("Repository Created"),

View File

@@ -34,6 +34,8 @@
#include <QTextCursor>
#include <QUrl>
using namespace Utils;
namespace VcsBase {
VcsOutputLineParser::VcsOutputLineParser() :
@@ -73,7 +75,7 @@ bool VcsOutputLineParser::handleVcsLink(const QString &workingDirectory, const Q
return true;
}
if (IVersionControl *vcs = VcsManager::findVersionControlForDirectory(workingDirectory))
return vcs->handleLink(workingDirectory, href);
return vcs->handleLink(FilePath::fromString(workingDirectory), href);
return false;
}
@@ -89,7 +91,7 @@ void VcsOutputLineParser::fillLinkContextMenu(
return;
}
if (Core::IVersionControl *vcs = Core::VcsManager::findVersionControlForDirectory(workingDirectory))
vcs->fillLinkContextMenu(menu, workingDirectory, href);
vcs->fillLinkContextMenu(menu, FilePath::fromString(workingDirectory), href);
}
}

View File

@@ -52,6 +52,7 @@
using namespace Core;
using namespace ProjectExplorer;
using namespace Utils;
namespace VcsBase {
namespace Internal {
@@ -122,7 +123,7 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
QString topLevel;
if (Project *project = ProjectTree::currentProject())
vc = VcsManager::findVersionControlForDirectory(project->projectDirectory().toString(), &topLevel);
return vc ? vc->vcsTopic(topLevel) : QString();
return vc ? vc->vcsTopic(FilePath::fromString(topLevel)) : QString();
});
expander->registerVariable(Constants::VAR_VCS_TOPLEVELPATH,