Commit f82b33a4 authored by oberion's avatar oberion

Deleting the MainWindow instance after closing application

Fixed some destructor commands
parent 259845de
......@@ -204,8 +204,9 @@ QGCCore::~QGCCore()
{
//mainWindow->storeSettings();
mainWindow->close();
mainWindow->deleteLater();
//mainWindow->deleteLater();
// Delete singletons
delete MainWindow::instance();
delete LinkManager::instance();
delete UASManager::instance();
}
......
......@@ -50,8 +50,8 @@ HDDisplay::HDDisplay(QStringList* plotList, QString title, QWidget *parent) :
acceptUnitList(new QStringList()),
lastPaintTime(0),
columns(3),
valuesChanged(true)/*,
m_ui(new Ui::HDDisplay)*/
valuesChanged(true),
m_ui(NULL)
{
setWindowTitle(title);
//m_ui->setupUi(this);
......@@ -135,7 +135,22 @@ HDDisplay::HDDisplay(QStringList* plotList, QString title, QWidget *parent) :
HDDisplay::~HDDisplay()
{
saveState();
delete m_ui;
if(this->refreshTimer)
{
delete this->refreshTimer;
}
if(this->acceptList)
{
delete this->acceptList;
}
if(this->acceptUnitList)
{
delete this->acceptUnitList;
}
if(this->m_ui)
{
delete m_ui;
}
}
QSize HDDisplay::sizeHint() const
......
......@@ -136,6 +136,11 @@ HSIDisplay::HSIDisplay(QWidget *parent) :
setFocusPolicy(Qt::StrongFocus);
}
HSIDisplay::~HSIDisplay()
{
}
void HSIDisplay::resetMAVState()
{
mavInitialized = false;
......
......@@ -48,7 +48,7 @@ class HSIDisplay : public HDDisplay
Q_OBJECT
public:
HSIDisplay(QWidget *parent = 0);
// ~HSIDisplay();
~HSIDisplay();
public slots:
void setActiveUAS(UASInterface* uas);
......
......@@ -91,7 +91,7 @@ MainWindow::MainWindow(QWidget *parent):
currentStyle(QGC_MAINWINDOW_STYLE_INDOOR),
aboutToCloseFlag(false),
changingViewsFlag(false),
centerStackActionGroup(this),
centerStackActionGroup(new QActionGroup(this)),
styleFileName(QCoreApplication::applicationDirPath() + "/style-indoor.css"),
autoReconnect(false),
lowPowerMode(false)
......@@ -138,7 +138,7 @@ MainWindow::MainWindow(QWidget *parent):
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
// Setup UI state machines
centerStackActionGroup.setExclusive(true);
centerStackActionGroup->setExclusive(true);
centerStack = new QStackedWidget(this);
setCentralWidget(centerStack);
......@@ -246,8 +246,8 @@ MainWindow::~MainWindow()
if (dockWidget)
{
// Remove dock widget from main window
removeDockWidget(dockWidget);
delete dockWidget->widget();
// removeDockWidget(dockWidget);
// delete dockWidget->widget();
delete dockWidget;
}
else
......@@ -417,14 +417,14 @@ void MainWindow::buildCommonWidgets()
parametersDockWidget->setObjectName("PARAMETER_INTERFACE_DOCKWIDGET");
addTool(parametersDockWidget, tr("Calibration and Parameters"), Qt::RightDockWidgetArea);
}
if (!hsiDockWidget) {
hsiDockWidget = new QDockWidget(tr("Horizontal Situation Indicator"), this);
hsiDockWidget->setWidget( new HSIDisplay(this) );
hsiDockWidget->setObjectName("HORIZONTAL_SITUATION_INDICATOR_DOCK_WIDGET");
addTool(hsiDockWidget, tr("Horizontal Situation"), Qt::BottomDockWidgetArea);
}
if (!headDown1DockWidget) {
headDown1DockWidget = new QDockWidget(tr("Flight Display"), this);
HDDisplay* hdDisplay = new HDDisplay(acceptList, "Flight Display", this);
......@@ -442,7 +442,7 @@ void MainWindow::buildCommonWidgets()
headDown2DockWidget->setObjectName("HEAD_DOWN_DISPLAY_2_DOCK_WIDGET");
addTool(headDown2DockWidget, tr("Actuator Status"), Qt::RightDockWidgetArea);
}
if (!rcViewDockWidget) {
rcViewDockWidget = new QDockWidget(tr("Radio Control"), this);
rcViewDockWidget->setWidget( new QGCRemoteControlView(this) );
......@@ -555,7 +555,7 @@ void MainWindow::addCentralWidget(QWidget* widget, const QString& title)
QVariant var;
var.setValue((QWidget*)widget);
tempAction->setData(var);
centerStackActionGroup.addAction(tempAction);
centerStackActionGroup->addAction(tempAction);
connect(tempAction,SIGNAL(triggered()),this, SLOT(showCentralWidget()));
connect(widget, SIGNAL(visibilityChanged(bool)), tempAction, SLOT(setChecked(bool)));
tempAction->setChecked(widget->isVisible());
......
......@@ -303,7 +303,7 @@ protected:
QSettings settings;
QStackedWidget *centerStack;
QActionGroup centerStackActionGroup;
QActionGroup* centerStackActionGroup;
// Center widgets
QPointer<Linecharts> linechartWidget;
......
......@@ -43,8 +43,8 @@ QGCRemoteControlView::QGCRemoteControlView(QWidget *parent) :
uasId(-1),
rssi(0.0f),
updated(false),
channelLayout(new QVBoxLayout())//,
//ui(new Ui::QGCRemoteControlView)
channelLayout(new QVBoxLayout()),
ui(NULL)
{
ui->setupUi(this);
QGridLayout* layout = new QGridLayout(this);
......@@ -71,8 +71,14 @@ QGCRemoteControlView::QGCRemoteControlView(QWidget *parent) :
QGCRemoteControlView::~QGCRemoteControlView()
{
delete ui;
delete channelLayout;
if(this->ui)
{
delete ui;
}
if(this->channelLayout)
{
delete channelLayout;
}
}
void QGCRemoteControlView::setUASId(int id)
......@@ -172,7 +178,7 @@ void QGCRemoteControlView::setRemoteRSSI(float rssiNormalized)
void QGCRemoteControlView::appendChannelWidget(int channelId)
{
// Create new layout
QHBoxLayout* layout = new QHBoxLayout();
QHBoxLayout* layout = new QHBoxLayout(this);
// Add content
layout->addWidget(new QLabel(QString("Channel %1").arg(channelId + 1), this));
QLabel* raw = new QLabel(this);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment