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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [gui_plugin/] [CpuWidgets/] [MemViewWidget.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      Memory editor form.
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
 
14
#include <QtWidgets/QMdiArea>
15
#include <QtWidgets/QMdiSubWindow>
16
#include <QtWidgets/QGridLayout>
17
#include <QtWidgets/QAction>
18
#include <QtCore/QEvent>
19
 
20
namespace debugger {
21
 
22
class MemViewWidget : public QWidget {
23
    Q_OBJECT
24
public:
25
    MemViewWidget(IGui *igui, QWidget *parent, uint64_t addr, uint64_t sz);
26
 
27
signals:
28
    void signalUpdateByTimer();
29
 
30
private slots:
31
    void slotUpdateByTimer();
32
 
33
private:
34
    AttributeType listMem_;
35
    QGridLayout *gridLayout;
36
 
37
    IGui *igui_;
38
};
39
 
40
class MemQMdiSubWindow : public QMdiSubWindow {
41
    Q_OBJECT
42
public:
43
    MemQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent,
44
                    uint64_t addr, uint64_t sz, QAction *act = 0)
45
        : QMdiSubWindow(parent) {
46
        setAttribute(Qt::WA_DeleteOnClose);
47
        action_ = act;
48
        area_ = area;
49
 
50
        setWindowTitle(tr("Memory"));
51
        QWidget *pnew = new MemViewWidget(igui, this, addr, sz);
52
        setWindowIcon(QIcon(tr(":/images/mem_96x96.png")));
53
        if (act) {
54
            act->setChecked(true);
55
            connect(parent, SIGNAL(signalUpdateByTimer()),
56
                    pnew, SLOT(slotUpdateByTimer()));
57
        }
58
        setWidget(pnew);
59
        area_->addSubWindow(this);
60
        show();
61
    }
62
 
63
 
64
protected:
65
    void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE {
66
        if (action_) {
67
            action_->setChecked(false);
68
        }
69
        area_->removeSubWindow(this);
70
        event_->accept();
71
    }
72
private:
73
    QAction *action_;
74
    QMdiArea *area_;
75
};
76
 
77
 
78
}  // namespace debugger

powered by: WebSVN 2.1.0

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