blob: 2ea05c70158fea36c5342d7935906ed0ada68508 (
plain)
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
|
// Copyright (C) 2017 Orgad Shaneh <orgads@gmail.com>.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include <utils/filepath.h>
namespace Gerrit {
namespace Internal {
class GerritParameters;
class GerritUser
{
public:
bool isSameAs(const GerritUser &other) const;
QString userName;
QString fullName;
QString email;
};
class GerritServer
{
public:
enum { defaultPort = 29418 };
enum HostType
{
Http,
Https,
Ssh
};
enum UrlType
{
DefaultUrl,
UrlWithHttpUser,
RestUrl
};
enum StoredHostValidity
{
Invalid,
NotGerrit,
Valid
};
GerritServer();
GerritServer(const QString &host, unsigned short port, const QString &userName, HostType type);
bool operator==(const GerritServer &other) const;
static QString defaultHost();
QString hostArgument() const;
QString url(UrlType urlType = DefaultUrl) const;
bool fillFromRemote(const QString &remote, const GerritParameters ¶meters, bool forceReload);
int testConnection();
QStringList curlArguments() const;
QString host;
GerritUser user;
QString rootPath; // for http
QString version;
unsigned short port = 0;
HostType type = Ssh;
bool authenticated = true;
bool validateCert = true;
private:
Utils::FilePath curlBinary;
StoredHostValidity loadSettings();
void saveSettings(StoredHostValidity validity) const;
bool setupAuthentication();
bool ascendPath();
bool resolveRoot();
bool resolveVersion(const GerritParameters &p, bool forceReload);
};
} // namespace Internal
} // namespace Gerrit
|