mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 08:34:42 +08:00
Compare commits
2 Commits
286909ff64
...
4372903323
| Author | SHA1 | Date | |
|---|---|---|---|
| 4372903323 | |||
| a1229cf5d6 |
@@ -9,10 +9,11 @@
|
|||||||
**********************************************************************************************************************/
|
**********************************************************************************************************************/
|
||||||
SeerOpenOCDWidget::SeerOpenOCDWidget (QWidget* parent) : SeerLogWidget(parent) {
|
SeerOpenOCDWidget::SeerOpenOCDWidget (QWidget* parent) : SeerLogWidget(parent) {
|
||||||
Q_UNUSED(parent);
|
Q_UNUSED(parent);
|
||||||
_openocdProcess = nullptr;
|
_openocdProcess = nullptr;
|
||||||
_gdbLiveWatchProcess = nullptr;
|
_gdbLiveWatchProcess = nullptr;
|
||||||
_openocdLogsTabWidget = nullptr;
|
_openocdLogsTabWidget = nullptr;
|
||||||
_telnetSocket = nullptr;
|
_openocdLogsTabWidgetParent = nullptr;
|
||||||
|
_telnetSocket = nullptr;
|
||||||
_liveWatchTimer = new QTimer(this);
|
_liveWatchTimer = new QTimer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,8 +73,15 @@ void SeerOpenOCDWidget::terminate ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_openocdLogsTabWidget) {
|
if (_openocdLogsTabWidget) {
|
||||||
|
if (_openocdLogsTabWidgetParent) {
|
||||||
|
int index = _openocdLogsTabWidgetParent->indexOf(_openocdLogsTabWidget);
|
||||||
|
if (index != -1) {
|
||||||
|
_openocdLogsTabWidgetParent->removeTab(index); // Relinquishes Qt's ownership of the widget.
|
||||||
|
}
|
||||||
|
}
|
||||||
delete _openocdLogsTabWidget;
|
delete _openocdLogsTabWidget;
|
||||||
_openocdLogsTabWidget = nullptr;
|
_openocdLogsTabWidget = nullptr;
|
||||||
|
_openocdLogsTabWidgetParent = nullptr;
|
||||||
}
|
}
|
||||||
terminateGdbLiveWatch();
|
terminateGdbLiveWatch();
|
||||||
}
|
}
|
||||||
@@ -253,6 +261,7 @@ void SeerOpenOCDWidget::createOpenOCDConsole (QDetachTabWidget* parent)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_openocdLogsTabWidget = new SeerLogWidget();
|
_openocdLogsTabWidget = new SeerLogWidget();
|
||||||
|
_openocdLogsTabWidgetParent = parent;
|
||||||
parent->addTab(_openocdLogsTabWidget, "OpenOCD output");
|
parent->addTab(_openocdLogsTabWidget, "OpenOCD output");
|
||||||
_openocdLogsTabWidget->setPlaceholderText("[OpenOCD output]");
|
_openocdLogsTabWidget->setPlaceholderText("[OpenOCD output]");
|
||||||
_openocdLogsTabWidget->setLogEnabled(true);
|
_openocdLogsTabWidget->setLogEnabled(true);
|
||||||
@@ -265,7 +274,9 @@ SeerLogWidget* SeerOpenOCDWidget::openocdConsole()
|
|||||||
|
|
||||||
void SeerOpenOCDWidget::setConsoleVisible (bool flag)
|
void SeerOpenOCDWidget::setConsoleVisible (bool flag)
|
||||||
{
|
{
|
||||||
_openocdLogsTabWidget->setVisible(flag);
|
if (_openocdLogsTabWidget) {
|
||||||
|
_openocdLogsTabWidget->setVisible(flag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************
|
/***********************************************************************************************************************
|
||||||
@@ -274,7 +285,9 @@ void SeerOpenOCDWidget::setConsoleVisible (bool flag)
|
|||||||
void SeerOpenOCDWidget::handleReadOutput ()
|
void SeerOpenOCDWidget::handleReadOutput ()
|
||||||
{
|
{
|
||||||
QString Text = QString::fromLocal8Bit(_openocdProcess->readAllStandardOutput());
|
QString Text = QString::fromLocal8Bit(_openocdProcess->readAllStandardOutput());
|
||||||
_openocdLogsTabWidget->handleText(Text);
|
if (_openocdLogsTabWidget) {
|
||||||
|
_openocdLogsTabWidget->handleText(Text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SeerOpenOCDWidget::handleReadError ()
|
void SeerOpenOCDWidget::handleReadError ()
|
||||||
@@ -291,5 +304,7 @@ void SeerOpenOCDWidget::handleReadError ()
|
|||||||
emit openocdStartFailed();
|
emit openocdStartFailed();
|
||||||
QMessageBox::warning(this, "Seer", "OpenOCD failed to start. \nCheck openOCD output for details.", QMessageBox::Ok);
|
QMessageBox::warning(this, "Seer", "OpenOCD failed to start. \nCheck openOCD output for details.", QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
_openocdLogsTabWidget->handleText(Text);
|
if (_openocdLogsTabWidget) {
|
||||||
|
_openocdLogsTabWidget->handleText(Text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <QtWidgets/QWidget>
|
#include <QtWidgets/QWidget>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QPointer>
|
||||||
#include "QDetachTabWidget.h"
|
#include "QDetachTabWidget.h"
|
||||||
#include "SeerLogWidget.h"
|
#include "SeerLogWidget.h"
|
||||||
/***********************************************************************************************************************
|
/***********************************************************************************************************************
|
||||||
@@ -50,7 +51,8 @@ class SeerOpenOCDWidget: public SeerLogWidget{
|
|||||||
QProcess* _openocdProcess;
|
QProcess* _openocdProcess;
|
||||||
QProcess* _gdbLiveWatchProcess;
|
QProcess* _gdbLiveWatchProcess;
|
||||||
QTcpSocket* _telnetSocket;
|
QTcpSocket* _telnetSocket;
|
||||||
SeerLogWidget* _openocdLogsTabWidget;
|
QPointer<SeerLogWidget> _openocdLogsTabWidget;
|
||||||
|
QPointer<QDetachTabWidget> _openocdLogsTabWidgetParent;
|
||||||
QString _telnetPort;
|
QString _telnetPort;
|
||||||
QTemporaryDir _tempDir;
|
QTemporaryDir _tempDir;
|
||||||
QTimer* _liveWatchTimer;
|
QTimer* _liveWatchTimer;
|
||||||
|
|||||||
Reference in New Issue
Block a user