forked from qt-creator/qt-creator
Fossil: Use a bit more FilePath{Aspect}
Change-Id: Ie7c995585aafe03428dc5e93b2904b189f0319c0 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -592,7 +592,7 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory,
|
||||
// use the configured default user for admin
|
||||
|
||||
const QString repoName = workingDirectory.fileName().simplified();
|
||||
const QString repoPath = settings().defaultRepoPath.value();
|
||||
const FilePath repoPath = settings().defaultRepoPath();
|
||||
const QString adminUser = settings().userName.value();
|
||||
|
||||
if (repoName.isEmpty() || repoPath.isEmpty())
|
||||
@@ -602,8 +602,7 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory,
|
||||
// @TODO: what about --template options?
|
||||
|
||||
const FilePath fullRepoName = FilePath::fromStringWithExtension(repoName, Constants::FOSSIL_FILE_SUFFIX);
|
||||
const FilePath repoFilePath = FilePath::fromString(repoPath)
|
||||
.pathAppended(fullRepoName.toString());
|
||||
const FilePath repoFilePath = repoPath.pathAppended(fullRepoName.toString());
|
||||
QStringList args(vcsCommandString(CreateRepositoryCommand));
|
||||
if (!adminUser.isEmpty())
|
||||
args << "--admin-user" << adminUser;
|
||||
|
||||
@@ -592,7 +592,7 @@ bool FossilPluginPrivate::pullOrPush(FossilPluginPrivate::SyncMode mode)
|
||||
QTC_ASSERT(state.hasTopLevel(), return false);
|
||||
|
||||
PullOrPushDialog dialog(pullOrPushMode, Core::ICore::dialogParent());
|
||||
dialog.setLocalBaseDirectory(m_client.settings().defaultRepoPath.value());
|
||||
dialog.setLocalBaseDirectory(m_client.settings().defaultRepoPath());
|
||||
const QString defaultURL(m_client.synchronousGetRepositoryURL(state.topLevel()));
|
||||
dialog.setDefaultRemoteLocation(defaultURL);
|
||||
if (dialog.exec() != QDialog::Accepted)
|
||||
@@ -868,24 +868,19 @@ bool FossilPluginPrivate::managesFile(const FilePath &workingDirectory, const QS
|
||||
|
||||
bool FossilPluginPrivate::isConfigured() const
|
||||
{
|
||||
const Utils::FilePath binary = m_client.vcsBinary();
|
||||
const FilePath binary = m_client.vcsBinary();
|
||||
if (binary.isEmpty())
|
||||
return false;
|
||||
|
||||
const QFileInfo fi = binary.toFileInfo();
|
||||
if ( !(fi.exists() && fi.isFile() && fi.isExecutable()) )
|
||||
if (!binary.isExecutableFile())
|
||||
return false;
|
||||
|
||||
// Local repositories default path must be set and exist
|
||||
const QString repoPath = m_client.settings().defaultRepoPath.value();
|
||||
const FilePath repoPath = m_client.settings().defaultRepoPath();
|
||||
if (repoPath.isEmpty())
|
||||
return false;
|
||||
|
||||
const QDir dir(repoPath);
|
||||
if (!dir.exists())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return repoPath.isReadableDir();
|
||||
}
|
||||
|
||||
bool FossilPluginPrivate::supportsOperation(Operation operation) const
|
||||
|
||||
@@ -42,7 +42,6 @@ FossilSettings::FossilSettings()
|
||||
|
||||
registerAspect(&defaultRepoPath);
|
||||
defaultRepoPath.setSettingsKey("defaultRepoPath");
|
||||
defaultRepoPath.setDisplayStyle(StringAspect::PathChooserDisplay);
|
||||
defaultRepoPath.setExpectedKind(PathChooser::Directory);
|
||||
defaultRepoPath.setDisplayName(Tr::tr("Fossil Repositories"));
|
||||
defaultRepoPath.setLabelText(Tr::tr("Default path:"));
|
||||
@@ -55,7 +54,6 @@ FossilSettings::FossilSettings()
|
||||
|
||||
registerAspect(&sslIdentityFile);
|
||||
sslIdentityFile.setSettingsKey("sslIdentityFile");
|
||||
sslIdentityFile.setDisplayStyle(StringAspect::PathChooserDisplay);
|
||||
sslIdentityFile.setExpectedKind(PathChooser::File);
|
||||
sslIdentityFile.setDisplayName(Tr::tr("SSL/TLS Identity Key"));
|
||||
sslIdentityFile.setLabelText(Tr::tr("SSL/TLS identity:"));
|
||||
|
||||
@@ -12,8 +12,8 @@ class FossilSettings : public VcsBase::VcsBaseSettings
|
||||
public:
|
||||
FossilSettings();
|
||||
|
||||
Utils::StringAspect defaultRepoPath;
|
||||
Utils::StringAspect sslIdentityFile;
|
||||
Utils::FilePathAspect defaultRepoPath;
|
||||
Utils::FilePathAspect sslIdentityFile;
|
||||
Utils::BoolAspect diffIgnoreAllWhiteSpace;
|
||||
Utils::BoolAspect diffStripTrailingCR;
|
||||
Utils::BoolAspect annotateShowCommitters;
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
#include <QLineEdit>
|
||||
#include <QRadioButton>
|
||||
|
||||
namespace Fossil {
|
||||
namespace Internal {
|
||||
namespace Fossil::Internal {
|
||||
|
||||
PullOrPushDialog::PullOrPushDialog(Mode mode, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
@@ -106,10 +105,9 @@ void PullOrPushDialog::setDefaultRemoteLocation(const QString &url)
|
||||
m_urlLineEdit->setText(url);
|
||||
}
|
||||
|
||||
void PullOrPushDialog::setLocalBaseDirectory(const QString &dir)
|
||||
void PullOrPushDialog::setLocalBaseDirectory(const Utils::FilePath &dir)
|
||||
{
|
||||
m_localPathChooser->setBaseDirectory(Utils::FilePath::fromString(dir));
|
||||
m_localPathChooser->setBaseDirectory(dir);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Fossil
|
||||
} // Fossil::Internal
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -13,13 +15,10 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace Utils { class PathChooser; }
|
||||
|
||||
namespace Fossil {
|
||||
namespace Internal {
|
||||
namespace Fossil::Internal {
|
||||
|
||||
class PullOrPushDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Mode {
|
||||
PullMode,
|
||||
@@ -33,7 +32,7 @@ public:
|
||||
bool isRememberOptionEnabled() const;
|
||||
bool isPrivateOptionEnabled() const;
|
||||
void setDefaultRemoteLocation(const QString &url);
|
||||
void setLocalBaseDirectory(const QString &dir);
|
||||
void setLocalBaseDirectory(const Utils::FilePath &dir);
|
||||
// Pull-specific options
|
||||
// Push-specific options
|
||||
|
||||
@@ -47,5 +46,4 @@ private:
|
||||
QCheckBox *m_privateCheckBox;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Fossil
|
||||
} // Fossil::Internal
|
||||
|
||||
Reference in New Issue
Block a user