##// END OF EJS Templates
Added ui file for APB_UART_PLUGIN.
jeandet -
r26:5e1f92d2bac2 default
parent child
Show More
@@ -0,0 +1,44
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 ----------------------------------------------------------------------------*/
22 #include "apbuart_plugin_ui.h"
23 #include "ui_apbuart_plugin_ui.h"
24
25 APBUART_Plugin_ui::APBUART_Plugin_ui(QWidget *parent) :
26 QWidget(parent),
27 ui(new Ui::APBUART_Plugin_ui)
28 {
29 ui->setupUi(this);
30 connect(this->ui->FIFODebugChkBx,SIGNAL(stateChanged(int)),this,SIGNAL(loopbackChkBxStateChanged(int)));
31 connect(this,SIGNAL(apbUartTextReceived(QString)),this->ui->UART_TERM,SLOT(append(QString)));
32 }
33
34 APBUART_Plugin_ui::~APBUART_Plugin_ui()
35 {
36 delete ui;
37 }
38
39 void APBUART_Plugin_ui::setEnableForLoopBack(bool enable)
40 {
41 this->ui->PortNameLineEdit->setEnabled(enable);
42 this->ui->ConnectQpb->setEnabled(enable);
43 this->ui->UartSpeedLineEdit->setEnabled(enable);
44 }
@@ -0,0 +1,49
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 ----------------------------------------------------------------------------*/
22 #ifndef APBUART_PLUGIN_UI_H
23 #define APBUART_PLUGIN_UI_H
24
25 #include <QWidget>
26
27 namespace Ui {
28 class APBUART_Plugin_ui;
29 }
30
31 class APBUART_Plugin_ui : public QWidget
32 {
33 Q_OBJECT
34
35 public:
36 explicit APBUART_Plugin_ui(QWidget *parent = 0);
37 ~APBUART_Plugin_ui();
38
39 public slots:
40 void setEnableForLoopBack(bool enable);
41 signals:
42 void loopbackChkBxStateChanged( int state );
43 void apbUartTextReceived(QString text);
44
45 private:
46 Ui::APBUART_Plugin_ui *ui;
47 };
48
49 #endif // APBUART_PLUGIN_UI_H
@@ -0,0 +1,82
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
3 <class>APBUART_Plugin_ui</class>
4 <widget class="QWidget" name="APBUART_Plugin_ui">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>400</width>
10 <height>300</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Form</string>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout">
17 <item>
18 <widget class="QTabWidget" name="TabWidget">
19 <property name="currentIndex">
20 <number>0</number>
21 </property>
22 <widget class="QWidget" name="Config">
23 <attribute name="title">
24 <string>Configuration</string>
25 </attribute>
26 <layout class="QGridLayout" name="gridLayout">
27 <item row="1" column="1">
28 <widget class="QLineEdit" name="PortNameLineEdit"/>
29 </item>
30 <item row="0" column="0" colspan="2">
31 <widget class="QCheckBox" name="FIFODebugChkBx">
32 <property name="text">
33 <string>Enable FIFO debug mode</string>
34 </property>
35 <property name="checked">
36 <bool>true</bool>
37 </property>
38 </widget>
39 </item>
40 <item row="1" column="0">
41 <widget class="QLabel" name="PortNameLbl">
42 <property name="text">
43 <string>Port Name</string>
44 </property>
45 </widget>
46 </item>
47 <item row="3" column="0">
48 <widget class="QLabel" name="UartSpeedLbl">
49 <property name="text">
50 <string>Uart Speed</string>
51 </property>
52 </widget>
53 </item>
54 <item row="4" column="1">
55 <widget class="QPushButton" name="ConnectQpb">
56 <property name="text">
57 <string>Open Port</string>
58 </property>
59 </widget>
60 </item>
61 <item row="3" column="1">
62 <widget class="QLineEdit" name="UartSpeedLineEdit"/>
63 </item>
64 </layout>
65 </widget>
66 <widget class="QWidget" name="Terminal">
67 <attribute name="title">
68 <string>Terminal</string>
69 </attribute>
70 <layout class="QVBoxLayout" name="verticalLayout_2">
71 <item>
72 <widget class="QTextEdit" name="UART_TERM"/>
73 </item>
74 </layout>
75 </widget>
76 </widget>
77 </item>
78 </layout>
79 </widget>
80 <resources/>
81 <connections/>
82 </ui>
@@ -22,10 +22,9
22 #include "APBUARTPLUGIN.h"
22 #include "APBUARTPLUGIN.h"
23 #include <socexplorerengine.h>
23 #include <socexplorerengine.h>
24
24
25
26 ApbUartPlugin::ApbUartPlugin(QWidget *parent):socexplorerplugin(parent)
25 ApbUartPlugin::ApbUartPlugin(QWidget *parent):socexplorerplugin(parent)
27 {
26 {
28 this->UI = new ApbUartPluginUi();
27 this->UI = new APBUART_Plugin_ui();
29 this->setWidget((QWidget*)this->UI);
28 this->setWidget((QWidget*)this->UI);
30 this->useLoopBack = false;
29 this->useLoopBack = false;
31 connect(this->UI,SIGNAL(loopbackChkBxStateChanged(int)),this,SLOT(loopbackChangeState(int)));
30 connect(this->UI,SIGNAL(loopbackChkBxStateChanged(int)),this,SLOT(loopbackChangeState(int)));
@@ -146,6 +145,7 int ApbUartPlugin::enableLoopback()
146 }
145 }
147 unsigned int ctrl_reg= 0x843;
146 unsigned int ctrl_reg= 0x843;
148 parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG);
147 parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG);
148 this->UI->setEnableForLoopBack(false);
149 return 0;
149 return 0;
150 }
150 }
151
151
@@ -170,6 +170,7 int ApbUartPlugin::disableLoopback()
170 ctrl_reg = ctrl_reg & (~(1<<11));
170 ctrl_reg = ctrl_reg & (~(1<<11));
171 parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG);
171 parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG);
172 this->useLoopBack = false;
172 this->useLoopBack = false;
173 this->UI->setEnableForLoopBack(true);
173 return 0;
174 return 0;
174 }
175 }
175
176
@@ -29,6 +29,7
29 #include <socexplorerplugin.h>
29 #include <socexplorerplugin.h>
30 #include <apbuartpluginui.h>
30 #include <apbuartpluginui.h>
31 #include <QTimer>
31 #include <QTimer>
32 #include "apbuart_plugin_ui.h"
32
33
33 #define APB_UART_DATA_REG 0x0
34 #define APB_UART_DATA_REG 0x0
34 #define APB_UART_STATUS_REG 0x4
35 #define APB_UART_STATUS_REG 0x4
@@ -58,7 +59,7 public slots:
58 signals:
59 signals:
59 void apbUartTextReceived(QString text);
60 void apbUartTextReceived(QString text);
60 private:
61 private:
61 ApbUartPluginUi* UI;
62 APBUART_Plugin_ui* UI;
62 bool useLoopBack;
63 bool useLoopBack;
63 QTimer loopBackTimer;
64 QTimer loopBackTimer;
64 int enableLoopback();
65 int enableLoopback();
@@ -35,14 +35,19 HEADERS += \
35 APBUARTPLUGIN.h \
35 APBUARTPLUGIN.h \
36 apbuartpluginui.h \
36 apbuartpluginui.h \
37 apbuartcfg.h \
37 apbuartcfg.h \
38 apbuartterminal.h
38 apbuartterminal.h \
39 apbuart_plugin_ui.h
39
40
40
41
41 SOURCES += \
42 SOURCES += \
42 APBUARTPLUGIN.cpp \
43 APBUARTPLUGIN.cpp \
43 apbuartpluginui.cpp \
44 apbuartpluginui.cpp \
44 apbuartcfg.cpp \
45 apbuartcfg.cpp \
45 apbuartterminal.cpp
46 apbuartterminal.cpp \
47 apbuart_plugin_ui.cpp
48
49 FORMS += \
50 apbuart_plugin_ui.ui
46
51
47
52
48
53
General Comments 0
You need to be logged in to leave comments. Login now