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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [gui_plugin/] [PeriphWidgets/] [UartWidget.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      Serial console emulator.
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/irawlistener.h"
14
#include "coreservices/iserial.h"
15
 
16
#include "UartEditor.h"
17
#include <QtWidgets/QMdiArea>
18
#include <QtWidgets/QMdiSubWindow>
19
#include <QtWidgets/QGridLayout>
20
#include <QtWidgets/QAction>
21
#include <QtCore/QEvent>
22
 
23
namespace debugger {
24
 
25
class UartWidget : public QWidget {
26
    Q_OBJECT
27
public:
28
    UartWidget(IGui *igui, QWidget *parent);
29
 
30
signals:
31
    void signalPostInit(AttributeType *cfg);
32
 
33
private slots:
34
    void slotPostInit(AttributeType *cfg);
35
 
36
private:
37
    UartEditor *editor_;
38
};
39
 
40
class UartQMdiSubWindow : public QMdiSubWindow {
41
    Q_OBJECT
42
public:
43
    UartQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent,
44
                      QAction *act = 0)
45
        : QMdiSubWindow(parent) {
46
        setAttribute(Qt::WA_DeleteOnClose);
47
        action_ = act;
48
        area_ = area;
49
 
50
        setWindowTitle(tr("uart0"));
51
        setMinimumWidth(parent->size().width() / 2);
52
        QWidget *pnew = new UartWidget(igui, this);
53
        setWindowIcon(QIcon(tr(":/images/serial_96x96.png")));
54
        if (act) {
55
            act->setChecked(true);
56
        }
57
        connect(parent, SIGNAL(signalPostInit(AttributeType *)),
58
                pnew, SLOT(slotPostInit(AttributeType *)));
59
        setWidget(pnew);
60
        area_->addSubWindow(this);
61
        show();
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
}  // namespace debugger

powered by: WebSVN 2.1.0

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