OpenCores
URL https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [gui_plugin/] [ControlWidget/] [PnpWidget.h] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sergeykhbr
/**
2
 * @file
3
 * @copyright  Copyright 2016 GNSS Sensor Ltd. All right reserved.
4
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
5
 * @brief      Plig'n'play information representation window.
6
 */
7
 
8
#pragma once
9
 
10
#include "api_core.h"   // MUST BE BEFORE QtWidgets.h or any other Qt header.
11
#include "attribute.h"
12
#include "igui.h"
13
#include "coreservices/isocinfo.h"
14
 
15
#include <QtWidgets/QMdiArea>
16
#include <QtWidgets/QMdiSubWindow>
17
#include <QtWidgets/QGridLayout>
18
#include <QtWidgets/QAction>
19
#include <QtWidgets/QLabel>
20
#include <QtCore/QEvent>
21
#include <QtGui/qevent.h>
22
 
23
namespace debugger {
24
 
25
class PnpWidget : public QWidget,
26
                  public IGuiCmdHandler {
27
    Q_OBJECT
28
public:
29
    PnpWidget(IGui *igui, QWidget *parent);
30
    virtual ~PnpWidget();
31
 
32
    /** IGuiCmdHandler */
33
    virtual void handleResponse(AttributeType *req, AttributeType *resp);
34
 
35
signals:
36
    void signalUpdate();
37
 
38
private slots:
39
    void slotUpdate();
40
 
41
protected:
42
    virtual void showEvent(QShowEvent *event_);
43
    QLabel *getLabel(int id) {
44
        return static_cast<QLabel *>(mainLayout_->itemAt(id)->widget());
45
    }
46
 
47
private:
48
    QWidget *parent_;
49
    IGui *igui_;
50
    QGridLayout *mainLayout_;
51
 
52
    AttributeType lstSlaves_;
53
    enum ETargets {SIMULATION, ML605, KC705, TARGET_Unknown, TARGETS_total};
54
    QImage imgTarget_[TARGETS_total];
55
 
56
    PnpMapType pnp_;
57
    union DescriptorTableType {
58
        union DescriptorItemType {
59
            MasterConfigType mst;
60
            SlaveConfigType slv;
61
        } *item;
62
        uint8_t *buf;
63
    } iter_;
64
};
65
 
66
class PnpQMdiSubWindow : public QMdiSubWindow {
67
    Q_OBJECT
68
public:
69
    PnpQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent,
70
                      QAction *act)
71
        : QMdiSubWindow(parent) {
72
        setAttribute(Qt::WA_DeleteOnClose);
73
        action_ = act;
74
        area_ = area;
75
 
76
        setWindowTitle(tr("Plug'n'Play info"));
77
        setWindowIcon(QIcon(tr(":/images/board_96x96.png")));
78
        QWidget *pnew = new PnpWidget(igui, this);
79
        act->setChecked(true);
80
        setWidget(pnew);
81
        area_->addSubWindow(this);
82
        show();
83
    }
84
 
85
protected:
86
    void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE {
87
        action_->setChecked(false);
88
        area_->removeSubWindow(this);
89
        event_->accept();
90
    }
91
private:
92
    QAction *action_;
93
    QMdiArea *area_;
94
};
95
 
96
}  // namespace debugger

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.