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