forked from qt-creator/qt-creator
Fossil: Inline configuredialog.ui
Change-Id: I74e7372ef4839788f4cf9bf0595c9f0a41c0a604 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -2,13 +2,16 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "configuredialog.h"
|
||||
#include "ui_configuredialog.h"
|
||||
|
||||
#include "fossilsettings.h"
|
||||
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QCheckBox>
|
||||
#include <QDir>
|
||||
#include <QLineEdit>
|
||||
|
||||
namespace Fossil {
|
||||
namespace Internal {
|
||||
@@ -17,30 +20,68 @@ class ConfigureDialogPrivate {
|
||||
public:
|
||||
RepositorySettings settings() const
|
||||
{
|
||||
return {m_ui.userLineEdit->text().trimmed(),
|
||||
m_ui.sslIdentityFilePathChooser->filePath().toString(),
|
||||
m_ui.disableAutosyncCheckBox->isChecked()
|
||||
return {m_userLineEdit->text().trimmed(),
|
||||
m_sslIdentityFilePathChooser->filePath().toString(),
|
||||
m_disableAutosyncCheckBox->isChecked()
|
||||
? RepositorySettings::AutosyncOff : RepositorySettings::AutosyncOn};
|
||||
}
|
||||
|
||||
void updateUi() {
|
||||
m_ui.userLineEdit->setText(m_settings.user.trimmed());
|
||||
m_ui.userLineEdit->selectAll();
|
||||
m_ui.sslIdentityFilePathChooser->setPath(QDir::toNativeSeparators(m_settings.sslIdentityFile));
|
||||
m_ui.disableAutosyncCheckBox->setChecked(m_settings.autosync == RepositorySettings::AutosyncOff);
|
||||
m_userLineEdit->setText(m_settings.user.trimmed());
|
||||
m_userLineEdit->selectAll();
|
||||
m_sslIdentityFilePathChooser->setPath(QDir::toNativeSeparators(m_settings.sslIdentityFile));
|
||||
m_disableAutosyncCheckBox->setChecked(m_settings.autosync == RepositorySettings::AutosyncOff);
|
||||
}
|
||||
|
||||
Ui::ConfigureDialog m_ui;
|
||||
QLineEdit *m_userLineEdit;
|
||||
Utils::PathChooser *m_sslIdentityFilePathChooser;
|
||||
QCheckBox *m_disableAutosyncCheckBox;
|
||||
|
||||
RepositorySettings m_settings;
|
||||
};
|
||||
|
||||
ConfigureDialog::ConfigureDialog(QWidget *parent) : QDialog(parent),
|
||||
d(new ConfigureDialogPrivate)
|
||||
{
|
||||
d->m_ui.setupUi(this);
|
||||
d->m_ui.sslIdentityFilePathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
d->m_ui.sslIdentityFilePathChooser->setPromptDialogTitle(tr("SSL/TLS Identity Key"));
|
||||
setWindowTitle(tr("Configure Repository"));
|
||||
resize(600, 0);
|
||||
|
||||
d->m_userLineEdit = new QLineEdit;
|
||||
d->m_userLineEdit->setToolTip(
|
||||
tr("Existing user to become an author of changes made to the repository."));
|
||||
|
||||
d->m_sslIdentityFilePathChooser = new Utils::PathChooser;
|
||||
d->m_sslIdentityFilePathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
d->m_sslIdentityFilePathChooser->setPromptDialogTitle(tr("SSL/TLS Identity Key"));
|
||||
d->m_sslIdentityFilePathChooser->setToolTip(
|
||||
tr("SSL/TLS client identity key to use if requested by the server."));
|
||||
|
||||
d->m_disableAutosyncCheckBox = new QCheckBox(tr("Disable auto-sync"));
|
||||
d->m_disableAutosyncCheckBox->setToolTip(
|
||||
tr("Disable automatic pull prior to commit or update and automatic push "
|
||||
"after commit or tag or branch creation."));
|
||||
|
||||
auto buttonBox = new QDialogButtonBox;
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
|
||||
using namespace Utils::Layouting;
|
||||
Column {
|
||||
Group {
|
||||
title(tr("Repository User")),
|
||||
Form { tr("User:"), d->m_userLineEdit, },
|
||||
},
|
||||
Group {
|
||||
title(tr("Repository Settings")),
|
||||
Form {
|
||||
tr("SSL/TLS identity:"), d->m_sslIdentityFilePathChooser, br,
|
||||
d->m_disableAutosyncCheckBox,
|
||||
},
|
||||
},
|
||||
buttonBox,
|
||||
}.attachTo(this);
|
||||
|
||||
d->updateUi();
|
||||
}
|
||||
|
||||
@@ -60,17 +101,5 @@ void ConfigureDialog::setSettings(const RepositorySettings &settings)
|
||||
d->updateUi();
|
||||
}
|
||||
|
||||
void ConfigureDialog::changeEvent(QEvent *e)
|
||||
{
|
||||
QDialog::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
d->m_ui.retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Fossil
|
||||
|
||||
Reference in New Issue
Block a user