From c952f7b56b9c1ad745ad5f1dbad794c9a29eaa91 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Mon, 8 Dec 2014 20:55:19 -0800 Subject: [PATCH] Remove unnecessary QGCStatusBar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The derived class wasn’t really adding any capabilties --- qgroundcontrol.pro | 2 -- src/ui/MainWindow.cc | 8 ++---- src/ui/MainWindow.h | 1 - src/ui/QGCStatusBar.cc | 78 -------------------------------------------------- src/ui/QGCStatusBar.h | 59 -------------------------------------- src/ui/QGCToolBar.h | 2 -- 6 files changed, 3 insertions(+), 147 deletions(-) delete mode 100644 src/ui/QGCStatusBar.cc delete mode 100644 src/ui/QGCStatusBar.h diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 7d3cab5..769d9b9 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -413,7 +413,6 @@ HEADERS += \ src/ui/map/QGCMapToolBar.h \ src/QGCGeo.h \ src/ui/QGCToolBar.h \ - src/ui/QGCStatusBar.h \ src/ui/QGCMAVLinkInspector.h \ src/ui/MAVLinkDecoder.h \ src/ui/WaypointViewOnlyView.h \ @@ -556,7 +555,6 @@ SOURCES += \ src/ui/map/QGCMapTool.cc \ src/ui/map/QGCMapToolBar.cc \ src/ui/QGCToolBar.cc \ - src/ui/QGCStatusBar.cc \ src/ui/QGCMAVLinkInspector.cc \ src/ui/MAVLinkDecoder.cc \ src/ui/WaypointViewOnlyView.cc \ diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index d43ec07..9be4126 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -57,7 +57,6 @@ This file is part of the QGROUNDCONTROL project #include "MAVLinkDecoder.h" #include "QGCMAVLinkMessageSender.h" #include "QGCRGBDView.h" -#include "QGCStatusBar.h" #include "UASQuickView.h" #include "QGCDataPlot2D.h" #include "Linecharts.h" @@ -225,8 +224,7 @@ MainWindow::MainWindow(QSplashScreen* splashScreen, enum MainWindow::CUSTOM_MODE advancedActions << ui.actionSimulationView; toolBar->setPerspectiveChangeAdvancedActions(advancedActions); - customStatusBar = new QGCStatusBar(this); - setStatusBar(customStatusBar); + setStatusBar(new QStatusBar(this)); statusBar()->setSizeGripEnabled(true); emit initStatusChanged(tr("Building common widgets."), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); @@ -503,8 +501,8 @@ void MainWindow::buildCommonWidgets() this, SIGNAL(valueChanged(int,QString,QString,QVariant,quint64))); // Log player - logPlayer = new QGCMAVLinkLogPlayer(mavlink, customStatusBar); - customStatusBar->setLogPlayer(logPlayer); + logPlayer = new QGCMAVLinkLogPlayer(mavlink, statusBar()); + statusBar()->addPermanentWidget(logPlayer); // Initialize all of the views, if they haven't been already, and add their central widgets if (!plannerView) diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 0933431..df2a129 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -416,7 +416,6 @@ protected: QPointer hudDockWidget; QPointer toolBar; - QPointer customStatusBar; QPointer mavlinkInspectorWidget; QPointer mavlinkDecoder; diff --git a/src/ui/QGCStatusBar.cc b/src/ui/QGCStatusBar.cc deleted file mode 100644 index 4e964ff..0000000 --- a/src/ui/QGCStatusBar.cc +++ /dev/null @@ -1,78 +0,0 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009 - 2013 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL 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 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see . - -======================================================================*/ - -#include -#include -#include -#include - -#include "QGCStatusBar.h" -#include "UASManager.h" -#include "MainWindow.h" -#include "QGCApplication.h" - -QGCStatusBar::QGCStatusBar(QWidget *parent) : - QStatusBar(parent), - player(NULL), - changed(true), - lastLogDirectory(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)) -{ - setObjectName("QGC_STATUSBAR"); - loadSettings(); -} - -void QGCStatusBar::paintEvent(QPaintEvent * event) -{ - Q_UNUSED(event); - QPainter p(this); - QStyleOption opt; - opt.initFrom(this); - style()->drawPrimitive(QStyle::PE_PanelStatusBar, &opt, &p, this); -} - -void QGCStatusBar::setLogPlayer(QGCMAVLinkLogPlayer* player) -{ - this->player = player; - addPermanentWidget(player); -} - -void QGCStatusBar::loadSettings() -{ - QSettings settings; - settings.beginGroup("QGC_MAVLINKLOGPLAYER"); - lastLogDirectory = settings.value("LAST_LOG_DIRECTORY", lastLogDirectory).toString(); - settings.endGroup(); -} - -void QGCStatusBar::storeSettings() -{ - QSettings settings; - settings.beginGroup("QGC_MAVLINKLOGPLAYER"); - settings.setValue("LAST_LOG_DIRECTORY", lastLogDirectory); - settings.endGroup(); -} - -QGCStatusBar::~QGCStatusBar() -{ - storeSettings(); -} diff --git a/src/ui/QGCStatusBar.h b/src/ui/QGCStatusBar.h deleted file mode 100644 index 2087424..0000000 --- a/src/ui/QGCStatusBar.h +++ /dev/null @@ -1,59 +0,0 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009 - 2013 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL 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 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see . - -======================================================================*/ - -#ifndef QGCSTATUSBAR_H -#define QGCSTATUSBAR_H - -#include -#include -#include -#include -#include -#include -#include "UASInterface.h" -#include "QGCMAVLinkLogPlayer.h" - -class QGCStatusBar : public QStatusBar -{ - Q_OBJECT - -public: - explicit QGCStatusBar(QWidget* parent = 0); - void addPerspectiveChangeAction(QAction* action); - ~QGCStatusBar(); - -public slots: - /** @brief Set log playing component */ - void setLogPlayer(QGCMAVLinkLogPlayer* player); - virtual void paintEvent(QPaintEvent * event); - -protected: - void storeSettings(); - void loadSettings(); - - QGCMAVLinkLogPlayer* player; - bool changed; - QString lastLogDirectory; -}; - -#endif // QGCSTATUSBAR_H diff --git a/src/ui/QGCToolBar.h b/src/ui/QGCToolBar.h index 7482c4a..e4d0483 100644 --- a/src/ui/QGCToolBar.h +++ b/src/ui/QGCToolBar.h @@ -33,7 +33,6 @@ This file is part of the QGROUNDCONTROL project #include #include #include "UASInterface.h" -#include "QGCMAVLinkLogPlayer.h" #include "SerialLink.h" class QGCToolBar : public QToolBar @@ -124,7 +123,6 @@ protected: QProgressBar* toolBarBatteryBar; QLabel* toolBarBatteryVoltageLabel; - QGCMAVLinkLogPlayer* player; QComboBox *portComboBox; QComboBox *baudcomboBox; QTimer portBoxTimer;