aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/baremetal/debugservers/uvsc/uvtargetdriverselection.h
blob: fdd62a8354a07d040a97c158b5d15a4c954e9c22 (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
// 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 <utils/basetreeview.h>
#include <utils/treemodel.h>

QT_BEGIN_NAMESPACE
class QComboBox;
QT_END_NAMESPACE

namespace BareMetal {
namespace Internal {
namespace Uv {

// DriverSelection

class DriverSelection final
{
public:
    QString name;
    QString dll;
    QStringList cpuDlls;
    int index = 0;
    int cpuDllIndex = 0;

    QVariantMap toMap() const;
    void fromMap(const QVariantMap &map);

    bool operator==(const DriverSelection &other) const;
};

// DriverSelectionCpuDllModel

class DriverSelectionCpuDllItem;
class DriverSelectionCpuDllModel final
        : public Utils::TreeModel<Utils::TreeItem, DriverSelectionCpuDllItem>
{
    Q_OBJECT

public:
    explicit DriverSelectionCpuDllModel(DriverSelection &selection, QObject *parent = nullptr);
    void refresh();

private:
    DriverSelection &m_selection;
};

// DriverSelectionCpuDllView

class DriverSelectionCpuDllView final : public QWidget
{
    Q_OBJECT

public:
    explicit DriverSelectionCpuDllView(DriverSelection &selection, QWidget *parent = nullptr);
    void setCpuDll(int index);
    void refresh();

signals:
    void dllChanged(int index = -1);

private:
    QComboBox *m_comboBox = nullptr;
};

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

Q_DECLARE_METATYPE(BareMetal::Internal::Uv::DriverSelection)