aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/gitlab/gitlabdialog.h
blob: 9268a7c61aebbb622c2de4280da8ed84f94a12f4 (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
// 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 "queryrunner.h"
#include "resultparser.h"

#include <utils/filepath.h>
#include <utils/id.h>

#include <QDialog>

QT_BEGIN_NAMESPACE
class QAbstractItemModel;
class QComboBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QToolButton;
class QTreeView;
QT_END_NAMESPACE

namespace GitLab {

class GitLabParameters;
class GitLabDialog : public QDialog
{
    Q_OBJECT
public:
    explicit GitLabDialog(QWidget *parent = nullptr);

    void updateRemotes();

protected:
    void keyPressEvent(QKeyEvent *event) override;

private:
    void resetTreeView(QTreeView *treeView, QAbstractItemModel *model);
    void requestMainViewUpdate();
    void updatePageButtons();

    void queryFirstPage();
    void queryPreviousPage();
    void queryNextPage();
    void queryLastPage();
    void querySearch();
    void continuePageUpdate();

    void handleUser(const User &user);
    void handleProjects(const Projects &projects);
    void fetchProjects();

    void cloneSelected();

    QPushButton *m_clonePB = nullptr;
    Utils::Id m_currentServerId;
    Query m_lastTreeViewQuery;
    PageInformation m_lastPageInformation;
    int m_currentUserId = -1;

    QLabel *m_mainLabel;
    QLabel *m_detailsLabel;
    QComboBox *m_remoteComboBox;
    QLabel *m_treeViewTitle;
    QLineEdit *m_searchLineEdit;
    QTreeView *m_treeView;
    QToolButton *m_firstToolButton;
    QToolButton *m_previousToolButton;
    QLabel *m_currentPageLabel;
    QToolButton *m_nextToolButton;
    QToolButton *m_lastToolButton;
};

} // namespace GitLab