1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
// Copyright (c) 2018 Artur Shepilko
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "configuredialog.h"
#include "fossilsettings.h"
#include "fossiltr.h"
#include <utils/layoutbuilder.h>
#include <utils/pathchooser.h>
#include <QDialogButtonBox>
#include <QCheckBox>
#include <QDir>
#include <QLineEdit>
namespace Fossil {
namespace Internal {
class ConfigureDialogPrivate {
public:
RepositorySettings settings() const
{
return {m_userLineEdit->text().trimmed(),
m_sslIdentityFilePathChooser->filePath().toString(),
m_disableAutosyncCheckBox->isChecked()
? RepositorySettings::AutosyncOff : RepositorySettings::AutosyncOn};
}
void updateUi() {
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);
}
QLineEdit *m_userLineEdit;
Utils::PathChooser *m_sslIdentityFilePathChooser;
QCheckBox *m_disableAutosyncCheckBox;
RepositorySettings m_settings;
};
ConfigureDialog::ConfigureDialog(QWidget *parent) : QDialog(parent),
d(new ConfigureDialogPrivate)
{
setWindowTitle(Tr::tr("Configure Repository"));
resize(600, 0);
d->m_userLineEdit = new QLineEdit;
d->m_userLineEdit->setToolTip(
Tr::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::tr("SSL/TLS Identity Key"));
d->m_sslIdentityFilePathChooser->setToolTip(
Tr::tr("SSL/TLS client identity key to use if requested by the server."));
d->m_disableAutosyncCheckBox = new QCheckBox(Tr::tr("Disable auto-sync"));
d->m_disableAutosyncCheckBox->setToolTip(
Tr::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 Layouting;
Column {
Group {
title(Tr::tr("Repository User")),
Form { Tr::tr("User:"), d->m_userLineEdit, },
},
Group {
title(Tr::tr("Repository Settings")),
Form {
Tr::tr("SSL/TLS identity:"), d->m_sslIdentityFilePathChooser, br,
d->m_disableAutosyncCheckBox,
},
},
buttonBox,
}.attachTo(this);
d->updateUi();
}
ConfigureDialog::~ConfigureDialog()
{
delete d;
}
const RepositorySettings ConfigureDialog::settings() const
{
return d->settings();
}
void ConfigureDialog::setSettings(const RepositorySettings &settings)
{
d->m_settings = settings;
d->updateUi();
}
} // namespace Internal
} // namespace Fossil
|