# HG changeset patch # User jeandet # Date 2014-03-23 23:11:52 # Node ID 5e1f92d2bac2f2d47f1eaf27380d99dd573b1803 # Parent 8fdbbdd7a3a47d4563daa67ebfa756aeca9e8914 Added ui file for APB_UART_PLUGIN. diff --git a/APBUARTPLUGIN/APBUARTPLUGIN.cpp b/APBUARTPLUGIN/APBUARTPLUGIN.cpp --- a/APBUARTPLUGIN/APBUARTPLUGIN.cpp +++ b/APBUARTPLUGIN/APBUARTPLUGIN.cpp @@ -22,10 +22,9 @@ #include "APBUARTPLUGIN.h" #include - ApbUartPlugin::ApbUartPlugin(QWidget *parent):socexplorerplugin(parent) { - this->UI = new ApbUartPluginUi(); + this->UI = new APBUART_Plugin_ui(); this->setWidget((QWidget*)this->UI); this->useLoopBack = false; connect(this->UI,SIGNAL(loopbackChkBxStateChanged(int)),this,SLOT(loopbackChangeState(int))); @@ -146,6 +145,7 @@ int ApbUartPlugin::enableLoopback() } unsigned int ctrl_reg= 0x843; parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG); + this->UI->setEnableForLoopBack(false); return 0; } @@ -170,6 +170,7 @@ int ApbUartPlugin::disableLoopback() ctrl_reg = ctrl_reg & (~(1<<11)); parent->Write(&ctrl_reg,1,this->baseAddress()+APB_UART_CONTROL_REG); this->useLoopBack = false; + this->UI->setEnableForLoopBack(true); return 0; } diff --git a/APBUARTPLUGIN/APBUARTPLUGIN.h b/APBUARTPLUGIN/APBUARTPLUGIN.h --- a/APBUARTPLUGIN/APBUARTPLUGIN.h +++ b/APBUARTPLUGIN/APBUARTPLUGIN.h @@ -29,6 +29,7 @@ #include #include #include +#include "apbuart_plugin_ui.h" #define APB_UART_DATA_REG 0x0 #define APB_UART_STATUS_REG 0x4 @@ -58,7 +59,7 @@ public slots: signals: void apbUartTextReceived(QString text); private: - ApbUartPluginUi* UI; + APBUART_Plugin_ui* UI; bool useLoopBack; QTimer loopBackTimer; int enableLoopback(); diff --git a/APBUARTPLUGIN/APBUARTPLUGIN.pro b/APBUARTPLUGIN/APBUARTPLUGIN.pro --- a/APBUARTPLUGIN/APBUARTPLUGIN.pro +++ b/APBUARTPLUGIN/APBUARTPLUGIN.pro @@ -35,14 +35,19 @@ HEADERS += \ APBUARTPLUGIN.h \ apbuartpluginui.h \ apbuartcfg.h \ - apbuartterminal.h + apbuartterminal.h \ + apbuart_plugin_ui.h SOURCES += \ APBUARTPLUGIN.cpp \ apbuartpluginui.cpp \ apbuartcfg.cpp \ - apbuartterminal.cpp + apbuartterminal.cpp \ + apbuart_plugin_ui.cpp + +FORMS += \ + apbuart_plugin_ui.ui diff --git a/APBUARTPLUGIN/apbuart_plugin_ui.cpp b/APBUARTPLUGIN/apbuart_plugin_ui.cpp new file mode 100644 --- /dev/null +++ b/APBUARTPLUGIN/apbuart_plugin_ui.cpp @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ +#include "apbuart_plugin_ui.h" +#include "ui_apbuart_plugin_ui.h" + +APBUART_Plugin_ui::APBUART_Plugin_ui(QWidget *parent) : + QWidget(parent), + ui(new Ui::APBUART_Plugin_ui) +{ + ui->setupUi(this); + connect(this->ui->FIFODebugChkBx,SIGNAL(stateChanged(int)),this,SIGNAL(loopbackChkBxStateChanged(int))); + connect(this,SIGNAL(apbUartTextReceived(QString)),this->ui->UART_TERM,SLOT(append(QString))); +} + +APBUART_Plugin_ui::~APBUART_Plugin_ui() +{ + delete ui; +} + +void APBUART_Plugin_ui::setEnableForLoopBack(bool enable) +{ + this->ui->PortNameLineEdit->setEnabled(enable); + this->ui->ConnectQpb->setEnabled(enable); + this->ui->UartSpeedLineEdit->setEnabled(enable); +} diff --git a/APBUARTPLUGIN/apbuart_plugin_ui.h b/APBUARTPLUGIN/apbuart_plugin_ui.h new file mode 100644 --- /dev/null +++ b/APBUARTPLUGIN/apbuart_plugin_ui.h @@ -0,0 +1,49 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ +#ifndef APBUART_PLUGIN_UI_H +#define APBUART_PLUGIN_UI_H + +#include + +namespace Ui { +class APBUART_Plugin_ui; +} + +class APBUART_Plugin_ui : public QWidget +{ + Q_OBJECT + +public: + explicit APBUART_Plugin_ui(QWidget *parent = 0); + ~APBUART_Plugin_ui(); + +public slots: + void setEnableForLoopBack(bool enable); +signals: + void loopbackChkBxStateChanged( int state ); + void apbUartTextReceived(QString text); + +private: + Ui::APBUART_Plugin_ui *ui; +}; + +#endif // APBUART_PLUGIN_UI_H diff --git a/APBUARTPLUGIN/apbuart_plugin_ui.ui b/APBUARTPLUGIN/apbuart_plugin_ui.ui new file mode 100644 --- /dev/null +++ b/APBUARTPLUGIN/apbuart_plugin_ui.ui @@ -0,0 +1,82 @@ + + + APBUART_Plugin_ui + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + 0 + + + + Configuration + + + + + + + + + Enable FIFO debug mode + + + true + + + + + + + Port Name + + + + + + + Uart Speed + + + + + + + Open Port + + + + + + + + + + + Terminal + + + + + + + + + + + + + +