forked from qt-creator/qt-creator
Bazaar: Aspectify settings
Change-Id: I0354698cf3473dd096e57481a945f0f59afc75b3 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -11,7 +11,6 @@ add_qtc_plugin(Bazaar
|
|||||||
branchinfo.cpp branchinfo.h
|
branchinfo.cpp branchinfo.h
|
||||||
commiteditor.cpp commiteditor.h
|
commiteditor.cpp commiteditor.h
|
||||||
constants.h
|
constants.h
|
||||||
optionspage.cpp optionspage.h optionspage.ui
|
|
||||||
pullorpushdialog.cpp pullorpushdialog.h pullorpushdialog.ui
|
pullorpushdialog.cpp pullorpushdialog.h pullorpushdialog.ui
|
||||||
revertdialog.ui
|
revertdialog.ui
|
||||||
uncommitdialog.ui
|
uncommitdialog.ui
|
||||||
|
@@ -2,7 +2,6 @@ include(../../qtcreatorplugin.pri)
|
|||||||
SOURCES += \
|
SOURCES += \
|
||||||
bazaarclient.cpp \
|
bazaarclient.cpp \
|
||||||
bazaarplugin.cpp \
|
bazaarplugin.cpp \
|
||||||
optionspage.cpp \
|
|
||||||
bazaarsettings.cpp \
|
bazaarsettings.cpp \
|
||||||
commiteditor.cpp \
|
commiteditor.cpp \
|
||||||
bazaarcommitwidget.cpp \
|
bazaarcommitwidget.cpp \
|
||||||
@@ -15,7 +14,6 @@ HEADERS += \
|
|||||||
bazaarclient.h \
|
bazaarclient.h \
|
||||||
constants.h \
|
constants.h \
|
||||||
bazaarplugin.h \
|
bazaarplugin.h \
|
||||||
optionspage.h \
|
|
||||||
bazaarsettings.h \
|
bazaarsettings.h \
|
||||||
commiteditor.h \
|
commiteditor.h \
|
||||||
bazaarcommitwidget.h \
|
bazaarcommitwidget.h \
|
||||||
@@ -25,7 +23,6 @@ HEADERS += \
|
|||||||
branchinfo.h
|
branchinfo.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
optionspage.ui \
|
|
||||||
revertdialog.ui \
|
revertdialog.ui \
|
||||||
bazaarcommitpanel.ui \
|
bazaarcommitpanel.ui \
|
||||||
pullorpushdialog.ui \
|
pullorpushdialog.ui \
|
||||||
|
@@ -29,9 +29,6 @@ QtcPlugin {
|
|||||||
"commiteditor.cpp",
|
"commiteditor.cpp",
|
||||||
"commiteditor.h",
|
"commiteditor.h",
|
||||||
"constants.h",
|
"constants.h",
|
||||||
"optionspage.cpp",
|
|
||||||
"optionspage.h",
|
|
||||||
"optionspage.ui",
|
|
||||||
"pullorpushdialog.cpp",
|
"pullorpushdialog.cpp",
|
||||||
"pullorpushdialog.h",
|
"pullorpushdialog.h",
|
||||||
"pullorpushdialog.ui",
|
"pullorpushdialog.ui",
|
||||||
|
@@ -49,13 +49,13 @@ class BazaarDiffConfig : public VcsBaseEditorConfig
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
BazaarDiffConfig(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
BazaarDiffConfig(BazaarSettings &settings, QToolBar *toolBar) :
|
||||||
VcsBaseEditorConfig(toolBar)
|
VcsBaseEditorConfig(toolBar)
|
||||||
{
|
{
|
||||||
mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace")),
|
mapSetting(addToggleButton("-w", tr("Ignore Whitespace")),
|
||||||
settings.boolPointer(BazaarSettings::diffIgnoreWhiteSpaceKey));
|
&settings.diffIgnoreWhiteSpace);
|
||||||
mapSetting(addToggleButton(QLatin1String("-B"), tr("Ignore Blank Lines")),
|
mapSetting(addToggleButton("-B", tr("Ignore Blank Lines")),
|
||||||
settings.boolPointer(BazaarSettings::diffIgnoreBlankLinesKey));
|
&settings.diffIgnoreBlankLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList arguments() const override
|
QStringList arguments() const override
|
||||||
@@ -64,8 +64,7 @@ public:
|
|||||||
// Bazaar wants "--diff-options=-w -B.."
|
// Bazaar wants "--diff-options=-w -B.."
|
||||||
const QStringList formatArguments = VcsBaseEditorConfig::arguments();
|
const QStringList formatArguments = VcsBaseEditorConfig::arguments();
|
||||||
if (!formatArguments.isEmpty()) {
|
if (!formatArguments.isEmpty()) {
|
||||||
const QString a = QLatin1String("--diff-options=")
|
const QString a = "--diff-options=" + formatArguments.join(' ');
|
||||||
+ formatArguments.join(QString(QLatin1Char(' ')));
|
|
||||||
args.append(a);
|
args.append(a);
|
||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
@@ -76,31 +75,31 @@ class BazaarLogConfig : public VcsBaseEditorConfig
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
BazaarLogConfig(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
BazaarLogConfig(BazaarSettings &settings, QToolBar *toolBar) :
|
||||||
VcsBaseEditorConfig(toolBar)
|
VcsBaseEditorConfig(toolBar)
|
||||||
{
|
{
|
||||||
mapSetting(addToggleButton(QLatin1String("--verbose"), tr("Verbose"),
|
mapSetting(addToggleButton("--verbose", tr("Verbose"),
|
||||||
tr("Show files changed in each revision.")),
|
tr("Show files changed in each revision.")),
|
||||||
settings.boolPointer(BazaarSettings::logVerboseKey));
|
&settings.logVerbose);
|
||||||
mapSetting(addToggleButton(QLatin1String("--forward"), tr("Forward"),
|
mapSetting(addToggleButton("--forward", tr("Forward"),
|
||||||
tr("Show from oldest to newest.")),
|
tr("Show from oldest to newest.")),
|
||||||
settings.boolPointer(BazaarSettings::logForwardKey));
|
&settings.logForward);
|
||||||
mapSetting(addToggleButton(QLatin1String("--include-merges"), tr("Include Merges"),
|
mapSetting(addToggleButton("--include-merges", tr("Include Merges"),
|
||||||
tr("Show merged revisions.")),
|
tr("Show merged revisions.")),
|
||||||
settings.boolPointer(BazaarSettings::logIncludeMergesKey));
|
&settings.logIncludeMerges);
|
||||||
|
|
||||||
const QList<ChoiceItem> logChoices = {
|
const QList<ChoiceItem> logChoices = {
|
||||||
ChoiceItem(tr("Detailed"), QLatin1String("long")),
|
{tr("Detailed"), "long"},
|
||||||
ChoiceItem(tr("Moderately Short"), QLatin1String("short")),
|
{tr("Moderately Short"), "short"},
|
||||||
ChoiceItem(tr("One Line"), QLatin1String("line")),
|
{tr("One Line"), "line"},
|
||||||
ChoiceItem(tr("GNU Change Log"), QLatin1String("gnu-changelog"))
|
{tr("GNU Change Log"), "gnu-changelog"}
|
||||||
};
|
};
|
||||||
mapSetting(addChoices(tr("Format"), { "--log-format=%1" }, logChoices),
|
mapSetting(addChoices(tr("Format"), { "--log-format=%1" }, logChoices),
|
||||||
settings.stringPointer(BazaarSettings::logFormatKey));
|
&settings.logFormat);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
BazaarClient::BazaarClient(BazaarSettings *settings) : VcsBaseClient(settings)
|
BazaarClient::BazaarClient(BazaarSettings *settings) : VcsBaseClient(nullptr, settings)
|
||||||
{
|
{
|
||||||
setDiffConfigCreator([settings](QToolBar *toolBar) {
|
setDiffConfigCreator([settings](QToolBar *toolBar) {
|
||||||
return new BazaarDiffConfig(*settings, toolBar);
|
return new BazaarDiffConfig(*settings, toolBar);
|
||||||
|
@@ -31,7 +31,6 @@
|
|||||||
#include "bazaarsettings.h"
|
#include "bazaarsettings.h"
|
||||||
#include "commiteditor.h"
|
#include "commiteditor.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "optionspage.h"
|
|
||||||
#include "pullorpushdialog.h"
|
#include "pullorpushdialog.h"
|
||||||
|
|
||||||
#include "ui_revertdialog.h"
|
#include "ui_revertdialog.h"
|
||||||
@@ -490,7 +489,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 += QLatin1String("--limit=") + QString::number(m_settings.intValue(BazaarSettings::logCountKey));
|
extraOptions += "--limit=" + QString::number(m_settings.logCount.value());
|
||||||
m_client.log(state.topLevel(), QStringList(), extraOptions);
|
m_client.log(state.topLevel(), QStringList(), extraOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -677,8 +676,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.stringValue(BazaarSettings::userNameKey),
|
m_settings.userName.value(),
|
||||||
m_settings.stringValue(BazaarSettings::userEmailKey), status);
|
m_settings.userEmail.value(), status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BazaarPluginPrivate::diffFromEditorSelected(const QStringList &files)
|
void BazaarPluginPrivate::diffFromEditorSelected(const QStringList &files)
|
||||||
@@ -865,7 +864,7 @@ bool BazaarPluginPrivate::managesFile(const QString &workingDirectory, const QSt
|
|||||||
|
|
||||||
bool BazaarPluginPrivate::isConfigured() const
|
bool BazaarPluginPrivate::isConfigured() const
|
||||||
{
|
{
|
||||||
const Utils::FilePath binary = m_settings.binaryPath();
|
const FilePath binary = m_settings.binaryPath.filePath();
|
||||||
if (binary.isEmpty())
|
if (binary.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
QFileInfo fi = binary.toFileInfo();
|
QFileInfo fi = binary.toFileInfo();
|
||||||
|
@@ -24,36 +24,145 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "bazaarsettings.h"
|
#include "bazaarsettings.h"
|
||||||
|
|
||||||
|
#include "bazaarclient.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
|
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
|
#include <utils/layoutbuilder.h>
|
||||||
|
|
||||||
|
#include <vcsbase/vcsbaseconstants.h>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Bazaar {
|
namespace Bazaar {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const QLatin1String BazaarSettings::diffIgnoreWhiteSpaceKey("diffIgnoreWhiteSpace");
|
|
||||||
const QLatin1String BazaarSettings::diffIgnoreBlankLinesKey("diffIgnoreBlankLines");
|
|
||||||
const QLatin1String BazaarSettings::logVerboseKey("logVerbose");
|
|
||||||
const QLatin1String BazaarSettings::logForwardKey("logForward");
|
|
||||||
const QLatin1String BazaarSettings::logIncludeMergesKey("logIncludeMerges");
|
|
||||||
const QLatin1String BazaarSettings::logFormatKey("logFormat");
|
|
||||||
|
|
||||||
BazaarSettings::BazaarSettings()
|
BazaarSettings::BazaarSettings()
|
||||||
{
|
{
|
||||||
setSettingsGroup(QLatin1String(Constants::BAZAAR));
|
setSettingsGroup(Constants::BAZAAR);
|
||||||
// Override default binary path
|
setAutoApply(false);
|
||||||
declareKey(binaryPathKey, QLatin1String(Constants::BAZAARDEFAULT));
|
|
||||||
declareKey(diffIgnoreWhiteSpaceKey, false);
|
registerAspect(&binaryPath);
|
||||||
declareKey(diffIgnoreBlankLinesKey, false);
|
binaryPath.setDisplayStyle(StringAspect::PathChooserDisplay);
|
||||||
declareKey(logVerboseKey, false);
|
binaryPath.setExpectedKind(PathChooser::ExistingCommand);
|
||||||
declareKey(logForwardKey, false);
|
binaryPath.setDefaultValue(Constants::BAZAARDEFAULT);
|
||||||
declareKey(logIncludeMergesKey, false);
|
binaryPath.setDisplayName(tr("Bazaar Command"));
|
||||||
declareKey(logFormatKey, QLatin1String("long"));
|
binaryPath.setHistoryCompleter("Bazaar.Command.History");
|
||||||
|
binaryPath.setLabelText(tr("Command:"));
|
||||||
|
|
||||||
|
registerAspect(&diffIgnoreWhiteSpace);
|
||||||
|
diffIgnoreWhiteSpace.setSettingsKey("diffIgnoreWhiteSpace");
|
||||||
|
|
||||||
|
registerAspect(&diffIgnoreBlankLines);
|
||||||
|
diffIgnoreBlankLines.setSettingsKey("diffIgnoreBlankLines");
|
||||||
|
|
||||||
|
registerAspect(&logVerbose);
|
||||||
|
logVerbose.setSettingsKey("logVerbose");
|
||||||
|
|
||||||
|
registerAspect(&logFormat);
|
||||||
|
logForward.setSettingsKey("logForward");
|
||||||
|
|
||||||
|
registerAspect(&logIncludeMerges);
|
||||||
|
logIncludeMerges.setSettingsKey("logIncludeMerges");
|
||||||
|
|
||||||
|
registerAspect(&logFormat);
|
||||||
|
logFormat.setDisplayStyle(StringAspect::LineEditDisplay);
|
||||||
|
logFormat.setSettingsKey("logFormat");
|
||||||
|
logFormat.setDefaultValue("long");
|
||||||
|
|
||||||
|
registerAspect(&userName);
|
||||||
|
userName.setDisplayStyle(StringAspect::LineEditDisplay);
|
||||||
|
userName.setLabelText(tr("Default username:"));
|
||||||
|
userName.setToolTip(tr("Username to use by default on commit."));
|
||||||
|
|
||||||
|
registerAspect(&userEmail);
|
||||||
|
userEmail.setDisplayStyle(StringAspect::LineEditDisplay);
|
||||||
|
userEmail.setLabelText(tr("Default email:"));
|
||||||
|
userEmail.setToolTip(tr("Email to use by default on commit."));
|
||||||
|
|
||||||
|
registerAspect(&logCount);
|
||||||
|
logCount.setLabelText(tr("Log count:"));
|
||||||
|
logCount.setToolTip(tr("The number of recent commit logs to show. Choose 0 to see all entries."));
|
||||||
|
|
||||||
|
registerAspect(&logCount);
|
||||||
|
timeout.setLabelText(tr("Timeout:"));
|
||||||
|
timeout.setSuffix(tr("s"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BazaarSettings::sameUserId(const BazaarSettings &other) const
|
bool BazaarSettings::sameUserId(const BazaarSettings &other) const
|
||||||
{
|
{
|
||||||
return stringValue(userNameKey) == other.stringValue(userNameKey)
|
return userName.value() == other.userName.value()
|
||||||
&& stringValue(userEmailKey) == other.stringValue(userEmailKey);
|
&& userEmail.value() == other.userEmail.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
// OptionsPage
|
||||||
} // namespace Bazaar
|
|
||||||
|
class OptionsPageWidget final : public Core::IOptionsPageWidget
|
||||||
|
{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(Bazaar::Internal::OptionsPageWidget)
|
||||||
|
|
||||||
|
public:
|
||||||
|
OptionsPageWidget(const std::function<void()> &onApply, BazaarSettings *settings);
|
||||||
|
|
||||||
|
void apply() final;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::function<void()> m_onApply;
|
||||||
|
BazaarSettings *m_settings;
|
||||||
|
};
|
||||||
|
|
||||||
|
void OptionsPageWidget::apply()
|
||||||
|
{
|
||||||
|
if (!m_settings->isDirty())
|
||||||
|
return;
|
||||||
|
m_settings->apply();
|
||||||
|
m_onApply();
|
||||||
|
}
|
||||||
|
|
||||||
|
OptionsPageWidget::OptionsPageWidget(const std::function<void(void)> &onApply, BazaarSettings *settings)
|
||||||
|
: m_onApply(onApply), m_settings(settings)
|
||||||
|
{
|
||||||
|
BazaarSettings &s = *m_settings;
|
||||||
|
|
||||||
|
using namespace Layouting;
|
||||||
|
const Break nl;
|
||||||
|
|
||||||
|
Column {
|
||||||
|
Group {
|
||||||
|
Title(tr("Configuration")),
|
||||||
|
Row { s.binaryPath }
|
||||||
|
},
|
||||||
|
|
||||||
|
Group {
|
||||||
|
Title(tr("User")),
|
||||||
|
Form {
|
||||||
|
s.userName, nl,
|
||||||
|
s.userEmail
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
Group {
|
||||||
|
Title(tr("Miscellaneous")),
|
||||||
|
Row {
|
||||||
|
s.logCount,
|
||||||
|
s.timeout,
|
||||||
|
Stretch()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Stretch()
|
||||||
|
|
||||||
|
}.attachTo(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
OptionsPage::OptionsPage(const std::function<void(void)> &onApply, BazaarSettings *settings)
|
||||||
|
{
|
||||||
|
setId(VcsBase::Constants::VCS_ID_BAZAAR);
|
||||||
|
setDisplayName(OptionsPageWidget::tr("Bazaar"));
|
||||||
|
setWidgetCreator([onApply, settings] { return new OptionsPageWidget(onApply, settings); });
|
||||||
|
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // Internal
|
||||||
|
} // Bazaar
|
||||||
|
@@ -25,24 +25,34 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
|
#include <utils/aspects.h>
|
||||||
|
|
||||||
#include <vcsbase/vcsbaseclientsettings.h>
|
#include <vcsbase/vcsbaseclientsettings.h>
|
||||||
|
|
||||||
namespace Bazaar {
|
namespace Bazaar {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BazaarSettings : public VcsBase::VcsBaseClientSettings
|
class BazaarSettings : public VcsBase::VcsBaseSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const QLatin1String diffIgnoreWhiteSpaceKey;
|
Utils::BoolAspect diffIgnoreWhiteSpace;
|
||||||
static const QLatin1String diffIgnoreBlankLinesKey;
|
Utils::BoolAspect diffIgnoreBlankLines;
|
||||||
static const QLatin1String logVerboseKey;
|
Utils::BoolAspect logVerbose;
|
||||||
static const QLatin1String logForwardKey;
|
Utils::BoolAspect logForward;
|
||||||
static const QLatin1String logIncludeMergesKey;
|
Utils::BoolAspect logIncludeMerges;
|
||||||
static const QLatin1String logFormatKey;
|
Utils::StringAspect logFormat;
|
||||||
|
|
||||||
BazaarSettings();
|
BazaarSettings();
|
||||||
bool sameUserId(const BazaarSettings &other) const;
|
bool sameUserId(const BazaarSettings &other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class OptionsPage final : public Core::IOptionsPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OptionsPage(const std::function<void()> &onApply, BazaarSettings *settings);
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Bazaar
|
} // namespace Bazaar
|
||||||
|
@@ -1,95 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 Hugues Delorme
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "optionspage.h"
|
|
||||||
#include "bazaarclient.h"
|
|
||||||
#include "bazaarsettings.h"
|
|
||||||
#include "bazaarplugin.h"
|
|
||||||
#include "ui_optionspage.h"
|
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
#include <vcsbase/vcsbaseconstants.h>
|
|
||||||
|
|
||||||
using namespace VcsBase;
|
|
||||||
|
|
||||||
namespace Bazaar {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class OptionsPageWidget final : public Core::IOptionsPageWidget
|
|
||||||
{
|
|
||||||
Q_DECLARE_TR_FUNCTIONS(Bazaar::Internal::OptionsPageWidget)
|
|
||||||
|
|
||||||
public:
|
|
||||||
OptionsPageWidget(const std::function<void()> &onApply, BazaarSettings *settings);
|
|
||||||
|
|
||||||
void apply() final;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::OptionsPage m_ui;
|
|
||||||
const std::function<void()> m_onApply;
|
|
||||||
BazaarSettings *m_settings;
|
|
||||||
};
|
|
||||||
|
|
||||||
void OptionsPageWidget::apply()
|
|
||||||
{
|
|
||||||
BazaarSettings s = *m_settings;
|
|
||||||
s.setValue(BazaarSettings::binaryPathKey, m_ui.commandChooser->rawPath());
|
|
||||||
s.setValue(BazaarSettings::userNameKey, m_ui.defaultUsernameLineEdit->text().trimmed());
|
|
||||||
s.setValue(BazaarSettings::userEmailKey, m_ui.defaultEmailLineEdit->text().trimmed());
|
|
||||||
s.setValue(BazaarSettings::logCountKey, m_ui.logEntriesCount->value());
|
|
||||||
s.setValue(BazaarSettings::timeoutKey, m_ui.timeout->value());
|
|
||||||
|
|
||||||
if (*m_settings == s)
|
|
||||||
return;
|
|
||||||
|
|
||||||
*m_settings = s;
|
|
||||||
m_onApply();
|
|
||||||
}
|
|
||||||
|
|
||||||
OptionsPageWidget::OptionsPageWidget(const std::function<void(void)> &onApply, BazaarSettings *settings)
|
|
||||||
: m_onApply(onApply), m_settings(settings)
|
|
||||||
{
|
|
||||||
m_ui.setupUi(this);
|
|
||||||
m_ui.commandChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
|
||||||
m_ui.commandChooser->setPromptDialogTitle(tr("Bazaar Command"));
|
|
||||||
m_ui.commandChooser->setHistoryCompleter(QLatin1String("Bazaar.Command.History"));
|
|
||||||
|
|
||||||
m_ui.commandChooser->setPath(m_settings->stringValue(BazaarSettings::binaryPathKey));
|
|
||||||
m_ui.defaultUsernameLineEdit->setText(m_settings->stringValue(BazaarSettings::userNameKey));
|
|
||||||
m_ui.defaultEmailLineEdit->setText(m_settings->stringValue(BazaarSettings::userEmailKey));
|
|
||||||
m_ui.logEntriesCount->setValue(m_settings->intValue(BazaarSettings::logCountKey));
|
|
||||||
m_ui.timeout->setValue(m_settings->intValue(BazaarSettings::timeoutKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
OptionsPage::OptionsPage(const std::function<void(void)> &onApply, BazaarSettings *settings)
|
|
||||||
{
|
|
||||||
setId(VcsBase::Constants::VCS_ID_BAZAAR);
|
|
||||||
setDisplayName(OptionsPageWidget::tr("Bazaar"));
|
|
||||||
setWidgetCreator([onApply, settings] { return new OptionsPageWidget(onApply, settings); });
|
|
||||||
setCategory(Constants::VCS_SETTINGS_CATEGORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // Internal
|
|
||||||
} // Bazaar
|
|
@@ -1,42 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 Hugues Delorme
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
|
||||||
|
|
||||||
namespace Bazaar {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class BazaarSettings;
|
|
||||||
|
|
||||||
class OptionsPage final : public Core::IOptionsPage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
OptionsPage(const std::function<void()> &onApply, BazaarSettings *settings);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Bazaar
|
|
@@ -1,176 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>Bazaar::Internal::OptionsPage</class>
|
|
||||||
<widget class="QWidget" name="Bazaar::Internal::OptionsPage">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>649</width>
|
|
||||||
<height>268</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="configGroupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>Configuration</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout_3">
|
|
||||||
<property name="fieldGrowthPolicy">
|
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="commandLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Command:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="Utils::PathChooser" name="commandChooser" native="true"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="userGroupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>User</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<property name="fieldGrowthPolicy">
|
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="defaultUsernameLabel">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Username to use by default on commit.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Default username:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="defaultUsernameLineEdit">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Username to use by default on commit.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="defaultEmailLabel">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Email to use by default on commit.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Default email:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="defaultEmailLineEdit">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Email to use by default on commit.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="miscGroupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>Miscellaneous</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="showLogEntriesLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Log count:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QSpinBox" name="logEntriesCount">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>The number of recent commit logs to show. Choose 0 to see all entries.</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>1000</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>1000</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QLabel" name="timeoutSecondsLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Timeout:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
|
||||||
<widget class="QSpinBox" name="timeout">
|
|
||||||
<property name="suffix">
|
|
||||||
<string>s</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>360</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>30</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="4">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>213</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>Utils::PathChooser</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header location="global">utils/pathchooser.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
<slots>
|
|
||||||
<signal>editingFinished()</signal>
|
|
||||||
<signal>browsingFinished()</signal>
|
|
||||||
</slots>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
Reference in New Issue
Block a user