forked from qt-creator/qt-creator
Bazaar: Follow the Fossil settings setup
Change-Id: If711f8a43a6579c72cad1bc98ef24c3fdd83993b Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -29,13 +29,13 @@ namespace Bazaar::Internal {
|
||||
class BazaarDiffConfig : public VcsBaseEditorConfig
|
||||
{
|
||||
public:
|
||||
BazaarDiffConfig(BazaarSettings &settings, QToolBar *toolBar) :
|
||||
VcsBaseEditorConfig(toolBar)
|
||||
explicit BazaarDiffConfig(QToolBar *toolBar)
|
||||
: VcsBaseEditorConfig(toolBar)
|
||||
{
|
||||
mapSetting(addToggleButton("-w", Tr::tr("Ignore Whitespace")),
|
||||
&settings.diffIgnoreWhiteSpace);
|
||||
&settings().diffIgnoreWhiteSpace);
|
||||
mapSetting(addToggleButton("-B", Tr::tr("Ignore Blank Lines")),
|
||||
&settings.diffIgnoreBlankLines);
|
||||
&settings().diffIgnoreBlankLines);
|
||||
}
|
||||
|
||||
QStringList arguments() const override
|
||||
@@ -54,18 +54,18 @@ public:
|
||||
class BazaarLogConfig : public VcsBaseEditorConfig
|
||||
{
|
||||
public:
|
||||
BazaarLogConfig(BazaarSettings &settings, QToolBar *toolBar) :
|
||||
VcsBaseEditorConfig(toolBar)
|
||||
BazaarLogConfig(QToolBar *toolBar)
|
||||
: VcsBaseEditorConfig(toolBar)
|
||||
{
|
||||
mapSetting(addToggleButton("--verbose", Tr::tr("Verbose"),
|
||||
Tr::tr("Show files changed in each revision.")),
|
||||
&settings.logVerbose);
|
||||
&settings().logVerbose);
|
||||
mapSetting(addToggleButton("--forward", Tr::tr("Forward"),
|
||||
Tr::tr("Show from oldest to newest.")),
|
||||
&settings.logForward);
|
||||
&settings().logForward);
|
||||
mapSetting(addToggleButton("--include-merges", Tr::tr("Include Merges"),
|
||||
Tr::tr("Show merged revisions.")),
|
||||
&settings.logIncludeMerges);
|
||||
&settings().logIncludeMerges);
|
||||
|
||||
const QList<ChoiceItem> logChoices = {
|
||||
{Tr::tr("Detailed"), "long"},
|
||||
@@ -74,18 +74,14 @@ public:
|
||||
{Tr::tr("GNU Change Log"), "gnu-changelog"}
|
||||
};
|
||||
mapSetting(addChoices(Tr::tr("Format"), { "--log-format=%1" }, logChoices),
|
||||
&settings.logFormat);
|
||||
&settings().logFormat);
|
||||
}
|
||||
};
|
||||
|
||||
BazaarClient::BazaarClient(BazaarSettings *settings) : VcsBaseClient(settings)
|
||||
BazaarClient::BazaarClient() : VcsBaseClient(&Internal::settings())
|
||||
{
|
||||
setDiffConfigCreator([settings](QToolBar *toolBar) {
|
||||
return new BazaarDiffConfig(*settings, toolBar);
|
||||
});
|
||||
setLogConfigCreator([settings](QToolBar *toolBar) {
|
||||
return new BazaarLogConfig(*settings, toolBar);
|
||||
});
|
||||
setDiffConfigCreator([](QToolBar *toolBar) { return new BazaarDiffConfig(toolBar); });
|
||||
setLogConfigCreator([](QToolBar *toolBar) { return new BazaarLogConfig(toolBar); });
|
||||
}
|
||||
|
||||
BranchInfo BazaarClient::synchronousBranchQuery(const FilePath &repositoryRoot) const
|
||||
|
@@ -9,12 +9,10 @@
|
||||
|
||||
namespace Bazaar::Internal {
|
||||
|
||||
class BazaarSettings;
|
||||
|
||||
class BazaarClient : public VcsBase::VcsBaseClient
|
||||
{
|
||||
public:
|
||||
explicit BazaarClient(BazaarSettings *settings);
|
||||
BazaarClient();
|
||||
|
||||
BranchInfo synchronousBranchQuery(const Utils::FilePath &repositoryRoot) const;
|
||||
bool synchronousUncommit(const Utils::FilePath &workingDir,
|
||||
|
@@ -215,9 +215,8 @@ public:
|
||||
void createRepositoryActions(const Core::Context &context);
|
||||
|
||||
// Variables
|
||||
BazaarSettings m_settings;
|
||||
BazaarClient m_client{&m_settings};
|
||||
BazaarSettingsPage m_settingPage{&m_settings};
|
||||
BazaarClient m_client;
|
||||
BazaarSettingsPage m_settingPage;
|
||||
|
||||
VcsSubmitEditorFactory m_submitEditorFactory {
|
||||
submitEditorParameters,
|
||||
@@ -372,7 +371,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
|
||||
toolsMenu->addMenu(m_bazaarContainer);
|
||||
m_menuAction = m_bazaarContainer->menu()->menuAction();
|
||||
|
||||
connect(&m_settings, &AspectContainer::applied, this, &IVersionControl::configurationChanged);
|
||||
connect(&settings(), &AspectContainer::applied, this, &IVersionControl::configurationChanged);
|
||||
}
|
||||
|
||||
void BazaarPluginPrivate::createFileActions(const Context &context)
|
||||
@@ -523,7 +522,7 @@ void BazaarPluginPrivate::logRepository()
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
QStringList extraOptions;
|
||||
extraOptions += "--limit=" + QString::number(m_settings.logCount());
|
||||
extraOptions += "--limit=" + QString::number(settings().logCount());
|
||||
m_client.log(state.topLevel(), QStringList(), extraOptions);
|
||||
}
|
||||
|
||||
@@ -705,8 +704,8 @@ void BazaarPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusItem
|
||||
|
||||
const BranchInfo branch = m_client.synchronousBranchQuery(m_submitRepository);
|
||||
commitEditor->setFields(m_submitRepository, branch,
|
||||
m_settings.userName.value(),
|
||||
m_settings.userEmail.value(), status);
|
||||
settings().userName(),
|
||||
settings().userEmail(), status);
|
||||
}
|
||||
|
||||
void BazaarPluginPrivate::diffFromEditorSelected(const QStringList &files)
|
||||
@@ -872,7 +871,7 @@ bool BazaarPluginPrivate::managesFile(const FilePath &workingDirectory, const QS
|
||||
|
||||
bool BazaarPluginPrivate::isConfigured() const
|
||||
{
|
||||
const FilePath binary = m_settings.binaryPath.filePath();
|
||||
const FilePath binary = settings().binaryPath.filePath();
|
||||
return !binary.isEmpty() && binary.isExecutableFile();
|
||||
}
|
||||
|
||||
|
@@ -70,15 +70,15 @@ BazaarSettings::BazaarSettings()
|
||||
|
||||
// BazaarSettingsPage
|
||||
|
||||
BazaarSettingsPage::BazaarSettingsPage(BazaarSettings *settings)
|
||||
BazaarSettingsPage::BazaarSettingsPage()
|
||||
{
|
||||
setId(VcsBase::Constants::VCS_ID_BAZAAR);
|
||||
setDisplayName(Tr::tr("Bazaar"));
|
||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||
setSettings(settings);
|
||||
setSettings(&settings());
|
||||
|
||||
setLayouter([settings](QWidget *widget) {
|
||||
BazaarSettings &s = *settings;
|
||||
setLayouter([](QWidget *widget) {
|
||||
BazaarSettings &s = settings();
|
||||
using namespace Layouting;
|
||||
|
||||
Column {
|
||||
@@ -108,4 +108,10 @@ BazaarSettingsPage::BazaarSettingsPage(BazaarSettings *settings)
|
||||
});
|
||||
}
|
||||
|
||||
BazaarSettings &settings()
|
||||
{
|
||||
static BazaarSettings theSettings;
|
||||
return theSettings;
|
||||
}
|
||||
|
||||
} // Bazaar::Internal
|
||||
|
@@ -22,10 +22,12 @@ public:
|
||||
Utils::StringAspect logFormat;
|
||||
};
|
||||
|
||||
BazaarSettings &settings();
|
||||
|
||||
class BazaarSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
explicit BazaarSettingsPage(BazaarSettings *settings);
|
||||
BazaarSettingsPage();
|
||||
};
|
||||
|
||||
} // Bazaar::Internal
|
||||
|
Reference in New Issue
Block a user