blob: b5f2b266ecac927687a90820505c5706097740f9 (
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
80
81
82
83
84
85
86
87
88
89
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include "gitlabparameters.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <utils/aspects.h>
#include <QPointer>
QT_BEGIN_NAMESPACE
class QComboBox;
class QPushButton;
QT_END_NAMESPACE
namespace GitLab {
namespace Constants {
const char GITLAB_SETTINGS[] = "GitLab";
} // namespace Constants
class GitLabServerWidget : public QWidget
{
public:
enum Mode { Display, Edit };
explicit GitLabServerWidget(Mode m, QWidget *parent = nullptr);
GitLabServer gitLabServer() const;
void setGitLabServer(const GitLabServer &server);
bool isValid() const;
private:
Mode m_mode = Display;
Utils::Id m_id;
Utils::StringAspect m_host;
Utils::StringAspect m_description;
Utils::StringAspect m_token;
Utils::IntegerAspect m_port;
Utils::BoolAspect m_secure;
};
class GitLabOptionsWidget : public QWidget
{
Q_OBJECT
public:
explicit GitLabOptionsWidget(QWidget *parent = nullptr);
GitLabParameters parameters() const;
void setParameters(const GitLabParameters ¶ms);
private:
void showEditServerDialog();
void showAddServerDialog();
void removeCurrentTriggered();
void addServer(const GitLabServer &newServer);
void modifyCurrentServer(const GitLabServer &newServer);
void updateButtonsState();
GitLabServerWidget *m_gitLabServerWidget = nullptr;
QPushButton *m_edit = nullptr;
QPushButton *m_remove = nullptr;
QPushButton *m_add = nullptr;
QComboBox *m_defaultGitLabServer = nullptr;
Utils::StringAspect m_curl;
};
class GitLabOptionsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
explicit GitLabOptionsPage(GitLabParameters *p, QObject *parent = nullptr);
QWidget *widget() final;
void apply() final;
void finish() final;
signals:
void settingsChanged();
private:
void addServer();
GitLabParameters *m_parameters;
QPointer<GitLabOptionsWidget> m_widget;
};
} // namespace GitLab
|