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