forked from qt-creator/qt-creator
Git: Make Gerrit settings handling more similar to others
Use a singleton for the main settings, don't pass it around as shared pointer. Change-Id: I5c32679452ad631998a688afc9a6e2b154bf3a5d Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -153,13 +153,11 @@ void FetchContext::checkout()
|
||||
}
|
||||
|
||||
GerritPlugin::GerritPlugin()
|
||||
: m_parameters(new GerritParameters)
|
||||
, m_server(new GerritServer)
|
||||
: m_server(new GerritServer)
|
||||
{
|
||||
m_parameters->fromSettings(ICore::settings());
|
||||
gerritSettings().fromSettings();
|
||||
|
||||
m_gerritOptionsPage = new GerritOptionsPage(m_parameters,
|
||||
[this] {
|
||||
m_gerritOptionsPage = new GerritOptionsPage([this] {
|
||||
if (m_dialog)
|
||||
m_dialog->scheduleUpdateRemotes();
|
||||
});
|
||||
@@ -206,7 +204,7 @@ void GerritPlugin::addToLocator(CommandLocator *locator)
|
||||
void GerritPlugin::push(const FilePath &topLevel)
|
||||
{
|
||||
// QScopedPointer is required to delete the dialog when leaving the function
|
||||
GerritPushDialog dialog(topLevel, m_reviewers, m_parameters, ICore::dialogParent());
|
||||
GerritPushDialog dialog(topLevel, m_reviewers, ICore::dialogParent());
|
||||
|
||||
const QString initErrorMessage = dialog.initErrorMessage();
|
||||
if (!initErrorMessage.isEmpty()) {
|
||||
@@ -231,13 +229,13 @@ static FilePath currentRepository()
|
||||
void GerritPlugin::openView()
|
||||
{
|
||||
if (m_dialog.isNull()) {
|
||||
while (!m_parameters->isValid()) {
|
||||
while (!gerritSettings().isValid()) {
|
||||
QMessageBox::warning(Core::ICore::dialogParent(), Git::Tr::tr("Error"),
|
||||
Git::Tr::tr("Invalid Gerrit configuration. Host, user and ssh binary are mandatory."));
|
||||
if (!ICore::showOptionsDialog("Gerrit"))
|
||||
return;
|
||||
}
|
||||
GerritDialog *gd = new GerritDialog(m_parameters, m_server, currentRepository(), ICore::dialogParent());
|
||||
GerritDialog *gd = new GerritDialog(m_server, currentRepository(), ICore::dialogParent());
|
||||
gd->setModal(false);
|
||||
ICore::registerWindow(gd, Context("Git.Gerrit"));
|
||||
connect(gd, &GerritDialog::fetchDisplay, this,
|
||||
@@ -287,7 +285,7 @@ void GerritPlugin::fetch(const std::shared_ptr<GerritChange> &change, int mode)
|
||||
|
||||
FilePath repository;
|
||||
bool verifiedRepository = false;
|
||||
if (m_dialog && m_parameters && m_dialog->repositoryPath().exists())
|
||||
if (m_dialog && m_dialog->repositoryPath().exists())
|
||||
repository = m_dialog->repositoryPath();
|
||||
|
||||
if (!repository.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user