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] - Rev 5

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

/**
 * @file
 * @copyright  Copyright 2016 GNSS Sensor Ltd. All right reserved.
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
 * @brief      Memory editor form.
 */
 
#pragma once
 
#include "api_core.h"   // MUST BE BEFORE QtWidgets.h or any other Qt header.
#include "attribute.h"
#include "igui.h"
 
#include <QtWidgets/QMdiArea>
#include <QtWidgets/QMdiSubWindow>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QAction>
#include <QtCore/QEvent>
 
namespace debugger {
 
class MemViewWidget : public QWidget {
    Q_OBJECT
public:
    MemViewWidget(IGui *igui, QWidget *parent, uint64_t addr, uint64_t sz);
 
signals:
    void signalUpdateByTimer();
 
private slots:
    void slotUpdateByTimer();
 
private:
    AttributeType listMem_;
    QGridLayout *gridLayout;
 
    IGui *igui_;
};
 
class MemQMdiSubWindow : public QMdiSubWindow {
    Q_OBJECT
public:
    MemQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent,
                    uint64_t addr, uint64_t sz, QAction *act = 0)
        : QMdiSubWindow(parent) {
        setAttribute(Qt::WA_DeleteOnClose);
        action_ = act;
        area_ = area;
 
        setWindowTitle(tr("Memory"));
        QWidget *pnew = new MemViewWidget(igui, this, addr, sz);
        setWindowIcon(QIcon(tr(":/images/mem_96x96.png")));
        if (act) {
            act->setChecked(true);
            connect(parent, SIGNAL(signalUpdateByTimer()),
                    pnew, SLOT(slotUpdateByTimer()));
        }
        setWidget(pnew);
        area_->addSubWindow(this);
        show();
    }
 
 
protected:
    void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE {
        if (action_) {
            action_->setChecked(false);
        }
        area_->removeSubWindow(this);
        event_->accept();
    }
private:
    QAction *action_;
    QMdiArea *area_;
};
 
 
}  // namespace debugger
 

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

powered by: WebSVN 2.1.0

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