aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/baremetal/debugservers/uvsc/uvtargetdeviceviewer.h
blob: 00b53fdf23247df62c263fc6c1cd7eb84f440904 (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Copyright (C) 2020 Denis Shienkov <denis.shienkov@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 "uvtargetdeviceselection.h"

#include <utils/detailsbutton.h>
#include <utils/detailswidget.h>
#include <utils/fileutils.h>

#include <QDialog>

QT_BEGIN_NAMESPACE
class QLineEdit;
class QPlainTextEdit;
QT_END_NAMESPACE

namespace Utils { class PathChooser; }

namespace BareMetal {
namespace Internal {
namespace Uv {

class DeviceSelectionModel;
class DeviceSelectionView;
class DeviceSelectionMemoryView;
class DeviceSelectionAlgorithmView;

// DeviceSelector

class DeviceSelector final : public Utils::DetailsWidget
{
    Q_OBJECT

public:
    explicit DeviceSelector(QWidget *parent = nullptr);

    void setToolsIniFile(const Utils::FilePath &toolsIniFile);
    Utils::FilePath toolsIniFile() const;

    void setSelection(const DeviceSelection &selection);
    DeviceSelection selection() const;

signals:
    void selectionChanged();

private:
    Utils::FilePath m_toolsIniFile;
    DeviceSelection m_selection;
};

// DeviceSelectorToolPanel

class DeviceSelectorToolPanel final : public Utils::FadingPanel
{
    Q_OBJECT

public:
    explicit DeviceSelectorToolPanel(QWidget *parent = nullptr);

signals:
    void clicked();

private:
    void fadeTo(qreal value) final;
    void setOpacity(qreal value) final;
};

// DeviceSelectorDetailsPanel

class DeviceSelectorDetailsPanel final : public QWidget
{
    Q_OBJECT

public:
    explicit DeviceSelectorDetailsPanel(DeviceSelection &selection, QWidget *parent = nullptr);
    void refresh();

signals:
    void selectionChanged();

private:
    DeviceSelection &m_selection;
    QLineEdit *m_vendorEdit = nullptr;
    QLineEdit *m_packageEdit = nullptr;
    QPlainTextEdit *m_descEdit = nullptr;
    DeviceSelectionMemoryView *m_memoryView = nullptr;
    DeviceSelectionAlgorithmView *m_algorithmView = nullptr;
    Utils::PathChooser *m_peripheralDescriptionFileChooser = nullptr;
};

// DeviceSelectionDialog

class DeviceSelectionDialog final : public QDialog
{
    Q_OBJECT

public:
    explicit DeviceSelectionDialog(const Utils::FilePath &toolsIniFile, QWidget *parent = nullptr);
    DeviceSelection selection() const;

private:
    void setSelection(const DeviceSelection &selection);

    DeviceSelection m_selection;
    DeviceSelectionModel *m_model = nullptr;
    DeviceSelectionView *m_view = nullptr;
};

} // namespace Uv
} // namespace Internal
} // namespace BareMetal