aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/axivion/axivionprojectsettings.h
blob: d5bc1fd2e62ffac0fb640b04c06f4306e8c8d330 (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
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include "axivionsettings.h"

#include <projectexplorer/projectsettingswidget.h>

#include <QObject>

QT_BEGIN_NAMESPACE
class QLabel;
class QPushButton;
class QTreeWidget;
QT_END_NAMESPACE

namespace ProjectExplorer { class Project; }

namespace Utils { class InfoLabel; }

namespace Axivion::Internal {

class DashboardInfo;

class AxivionProjectSettings : public QObject
{
public:
    explicit AxivionProjectSettings(ProjectExplorer::Project *project);

    void setDashboardProjectName(const QString &name) { m_dashboardProjectName = name; }
    QString dashboardProjectName() const { return m_dashboardProjectName; }

private:
    void load();
    void save();

    ProjectExplorer::Project *m_project = nullptr;
    QString m_dashboardProjectName;
};

class AxivionProjectSettingsWidget : public ProjectExplorer::ProjectSettingsWidget
{
public:
    explicit AxivionProjectSettingsWidget(ProjectExplorer::Project *project,
                                          QWidget *parent = nullptr);

private:
    void fetchProjects();
    void onDashboardInfoReceived(const DashboardInfo &info);
    void onSettingsChanged();
    void linkProject();
    void unlinkProject();
    void updateUi();
    void updateEnabledStates();

    AxivionProjectSettings *m_projectSettings = nullptr;
    AxivionSettings *m_globalSettings;
    QLabel *m_linkedProject = nullptr;
    QTreeWidget *m_dashboardProjects = nullptr;
    QPushButton *m_fetchProjects = nullptr;
    QPushButton *m_link = nullptr;
    QPushButton *m_unlink = nullptr;
    Utils::InfoLabel *m_infoLabel = nullptr;
};

} // Axivion::Internal