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 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 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
private:
31
    UartEditor *editor_;
32
};
33
 
34
class UartQMdiSubWindow : public QMdiSubWindow {
35
    Q_OBJECT
36
public:
37
    UartQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent,
38
                      QAction *act = 0)
39
        : QMdiSubWindow(parent) {
40
        setAttribute(Qt::WA_DeleteOnClose);
41
        action_ = act;
42
        area_ = area;
43
 
44
        setWindowTitle(tr("uart0"));
45
        setMinimumWidth(parent->size().width() / 2);
46
        QWidget *pnew = new UartWidget(igui, this);
47
        setWindowIcon(QIcon(tr(":/images/serial_96x96.png")));
48
        if (act) {
49
            act->setChecked(true);
50
        }
51
        setWidget(pnew);
52
        area_->addSubWindow(this);
53
        show();
54
    }
55
 
56
protected:
57
    void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE {
58
        if (action_) {
59
            action_->setChecked(false);
60
        }
61
        area_->removeSubWindow(this);
62
        event_->accept();
63
    }
64
private:
65
    QAction *action_;
66
    QMdiArea *area_;
67
};
68
 
69
}  // namespace debugger

powered by: WebSVN 2.1.0

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