diff options
| author | hjk <[email protected]> | 2021-07-30 16:46:27 +0200 |
|---|---|---|
| committer | hjk <[email protected]> | 2021-08-02 14:40:33 +0000 |
| commit | ff57cb548d2c528a42fa2870b2486cddc08acfb7 (patch) | |
| tree | 0c7f371818d436d79cd3d65fac1c98de4d2391bf /src/plugins/mercurial/mercurialplugin.cpp | |
| parent | 17f907da9bd73d9b1515cbdd269c93f0061b7071 (diff) | |
Vcs: Use more FilePath for file paths
Change-Id: I855cde65d034a9647972a7fddf1e8266d7ccfa88
Reviewed-by: Orgad Shaneh <[email protected]>
Diffstat (limited to 'src/plugins/mercurial/mercurialplugin.cpp')
| -rw-r--r-- | src/plugins/mercurial/mercurialplugin.cpp | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp index f1ca7dfb64e..12b8cb6a186 100644 --- a/src/plugins/mercurial/mercurialplugin.cpp +++ b/src/plugins/mercurial/mercurialplugin.cpp @@ -215,7 +215,7 @@ private: QAction *m_createRepositoryAction = nullptr; QAction *m_menuAction = nullptr; - QString m_submitRepository; + FilePath m_submitRepository; bool m_submitActionTriggered = false; @@ -657,12 +657,11 @@ void MercurialPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusI this, &MercurialPluginPrivate::diffFromEditorSelected); commitEditor->setCheckScriptWorkingDirectory(m_submitRepository); - const QString msg = tr("Commit changes for \"%1\"."). - arg(QDir::toNativeSeparators(m_submitRepository)); + const QString msg = tr("Commit changes for \"%1\".").arg(m_submitRepository.toUserOutput()); commitEditor->document()->setPreferredDisplayName(msg); - const QString branch = vcsTopic(FilePath::fromString(m_submitRepository)); - commitEditor->setFields(QFileInfo(m_submitRepository), branch, + const QString branch = vcsTopic(m_submitRepository); + commitEditor->setFields(QFileInfo(m_submitRepository.toString()), branch, m_settings.userName.value(), m_settings.userEmail.value(), status); } @@ -762,7 +761,7 @@ bool MercurialPluginPrivate::managesDirectory(const FilePath &filePath, FilePath bool MercurialPluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const { - return m_client.managesFile(workingDirectory.toString(), fileName); + return m_client.managesFile(workingDirectory, fileName); } bool MercurialPluginPrivate::isConfigured() const @@ -800,23 +799,21 @@ bool MercurialPluginPrivate::vcsOpen(const FilePath &filePath) bool MercurialPluginPrivate::vcsAdd(const FilePath &filePath) { - const QFileInfo fi = filePath.toFileInfo(); - return m_client.synchronousAdd(fi.absolutePath(), fi.fileName()); + return m_client.synchronousAdd(filePath.parentDir(), filePath.fileName()); } bool MercurialPluginPrivate::vcsDelete(const FilePath &filePath) { - const QFileInfo fi = filePath.toFileInfo(); - return m_client.synchronousRemove(fi.absolutePath(), fi.fileName()); + return m_client.synchronousRemove(filePath.parentDir(), filePath.fileName()); } bool MercurialPluginPrivate::vcsMove(const FilePath &from, const FilePath &to) { const QFileInfo fromInfo = from.toFileInfo(); const QFileInfo toInfo = to.toFileInfo(); - return m_client.synchronousMove(fromInfo.absolutePath(), - fromInfo.absoluteFilePath(), - toInfo.absoluteFilePath()); + return m_client.synchronousMove(from.parentDir(), + fromInfo.absoluteFilePath(), + toInfo.absoluteFilePath()); } bool MercurialPluginPrivate::vcsCreateRepository(const FilePath &directory) @@ -826,8 +823,7 @@ bool MercurialPluginPrivate::vcsCreateRepository(const FilePath &directory) void MercurialPluginPrivate::vcsAnnotate(const FilePath &filePath, int line) { - const QFileInfo fi = filePath.toFileInfo(); - m_client.annotate(fi.absolutePath(), fi.fileName(), QString(), line); + m_client.annotate(filePath.parentDir(), filePath.fileName(), QString(), line); } Core::ShellCommand *MercurialPluginPrivate::createInitialCheckoutCommand(const QString &url, @@ -837,8 +833,7 @@ Core::ShellCommand *MercurialPluginPrivate::createInitialCheckoutCommand(const Q { QStringList args; args << QLatin1String("clone") << extraArgs << url << localName; - auto command = new VcsBase::VcsCommand(baseDirectory.toString(), - m_client.processEnvironment()); + auto command = new VcsBase::VcsCommand(baseDirectory, m_client.processEnvironment()); command->addJob({m_settings.binaryPath.filePath(), args}, -1); return command; } @@ -851,14 +846,14 @@ bool MercurialPluginPrivate::sccManaged(const QString &filename) if (!managed || topLevel.isEmpty()) return false; const QDir topLevelDir(topLevel.toString()); - return m_client.manifestSync(topLevel.toString(), topLevelDir.relativeFilePath(filename)); + return m_client.manifestSync(topLevel, topLevelDir.relativeFilePath(filename)); } void MercurialPluginPrivate::changed(const QVariant &v) { switch (v.type()) { case QVariant::String: - emit repositoryChanged(v.toString()); + emit repositoryChanged(FilePath::fromVariant(v)); break; case QVariant::StringList: emit filesChanged(v.toStringList()); |
