Commit 9ceca7fe authored by Nate Weibley's avatar Nate Weibley

Move messages into preferences panel and refactor into AppMessages control

parent e0a68ab0
...@@ -282,6 +282,7 @@ HEADERS += \ ...@@ -282,6 +282,7 @@ HEADERS += \
src/QGCQuickWidget.h \ src/QGCQuickWidget.h \
src/QGCTemporaryFile.h \ src/QGCTemporaryFile.h \
src/QGCToolbox.h \ src/QGCToolbox.h \
src/QmlControls/AppMessages.h \
src/QmlControls/CoordinateVector.h \ src/QmlControls/CoordinateVector.h \
src/QmlControls/MavlinkQmlSingleton.h \ src/QmlControls/MavlinkQmlSingleton.h \
src/QmlControls/ParameterEditorController.h \ src/QmlControls/ParameterEditorController.h \
...@@ -297,7 +298,7 @@ HEADERS += \ ...@@ -297,7 +298,7 @@ HEADERS += \
src/AutoPilotPlugins/APM/APMAirframeLoader.h \ src/AutoPilotPlugins/APM/APMAirframeLoader.h \
src/QmlControls/QGCImageProvider.h \ src/QmlControls/QGCImageProvider.h \
src/AutoPilotPlugins/APM/APMRemoteParamsDownloader.h \ src/AutoPilotPlugins/APM/APMRemoteParamsDownloader.h \
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h \
DebugBuild { DebugBuild {
HEADERS += \ HEADERS += \
...@@ -370,7 +371,6 @@ HEADERS += \ ...@@ -370,7 +371,6 @@ HEADERS += \
src/ViewWidgets/LogDownload.h \ src/ViewWidgets/LogDownload.h \
src/ViewWidgets/LogDownloadController.h \ src/ViewWidgets/LogDownloadController.h \
src/ViewWidgets/ViewWidgetController.h \ src/ViewWidgets/ViewWidgetController.h \
src/ViewWidgets/AppMessagesDialog.h
} }
iOSBuild { iOSBuild {
...@@ -424,6 +424,7 @@ SOURCES += \ ...@@ -424,6 +424,7 @@ SOURCES += \
src/QGCTemporaryFile.cc \ src/QGCTemporaryFile.cc \
src/QGCToolbox.cc \ src/QGCToolbox.cc \
src/QGCGeo.cc \ src/QGCGeo.cc \
src/QmlControls/AppMessages.cc \
src/QmlControls/CoordinateVector.cc \ src/QmlControls/CoordinateVector.cc \
src/QmlControls/ParameterEditorController.cc \ src/QmlControls/ParameterEditorController.cc \
src/QmlControls/ScreenToolsController.cc \ src/QmlControls/ScreenToolsController.cc \
...@@ -437,7 +438,7 @@ SOURCES += \ ...@@ -437,7 +438,7 @@ SOURCES += \
src/AutoPilotPlugins/APM/APMAirframeLoader.cc \ src/AutoPilotPlugins/APM/APMAirframeLoader.cc \
src/QmlControls/QGCImageProvider.cc \ src/QmlControls/QGCImageProvider.cc \
src/AutoPilotPlugins/APM/APMRemoteParamsDownloader.cc \ src/AutoPilotPlugins/APM/APMRemoteParamsDownloader.cc \
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc \
DebugBuild { DebugBuild {
SOURCES += \ SOURCES += \
...@@ -502,8 +503,7 @@ SOURCES += \ ...@@ -502,8 +503,7 @@ SOURCES += \
src/ViewWidgets/CustomCommandWidgetController.cc \ src/ViewWidgets/CustomCommandWidgetController.cc \
src/ViewWidgets/LogDownload.cc \ src/ViewWidgets/LogDownload.cc \
src/ViewWidgets/LogDownloadController.cc \ src/ViewWidgets/LogDownloadController.cc \
src/ViewWidgets/ViewWidgetController.cc \ src/ViewWidgets/ViewWidgetController.cc
src/ViewWidgets/AppMessagesDialog.cc
} }
# #
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
<file alias="APMAirframeComponentSummary.qml">src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml</file> <file alias="APMAirframeComponentSummary.qml">src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml</file>
<file alias="CustomCommandWidget.qml">src/ViewWidgets/CustomCommandWidget.qml</file> <file alias="CustomCommandWidget.qml">src/ViewWidgets/CustomCommandWidget.qml</file>
<file alias="LogDownload.qml">src/ViewWidgets/LogDownload.qml</file> <file alias="LogDownload.qml">src/ViewWidgets/LogDownload.qml</file>
<file alias="AppMessagesDialog.qml">src/ViewWidgets/AppMessagesDialog.qml</file>
<file alias="FirmwareUpgrade.qml">src/VehicleSetup/FirmwareUpgrade.qml</file> <file alias="FirmwareUpgrade.qml">src/VehicleSetup/FirmwareUpgrade.qml</file>
<file alias="FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file> <file alias="FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<file alias="PX4FlightModes.qml">src/AutoPilotPlugins/PX4/PX4FlightModes.qml</file> <file alias="PX4FlightModes.qml">src/AutoPilotPlugins/PX4/PX4FlightModes.qml</file>
...@@ -86,6 +85,7 @@ ...@@ -86,6 +85,7 @@
<file alias="QGroundControl/Controls/SubMenuButton.qml">src/QmlControls/SubMenuButton.qml</file> <file alias="QGroundControl/Controls/SubMenuButton.qml">src/QmlControls/SubMenuButton.qml</file>
<file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file> <file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
<file alias="QGroundControl/Controls/VehicleSummaryRow.qml">src/QmlControls/VehicleSummaryRow.qml</file> <file alias="QGroundControl/Controls/VehicleSummaryRow.qml">src/QmlControls/VehicleSummaryRow.qml</file>
<file alias="QGroundControl/Controls/AppMessages.qml">src/QmlControls/AppMessages.qml</file>
<file alias="QGroundControl/Controls/ViewWidget.qml">src/ViewWidgets/ViewWidget.qml</file> <file alias="QGroundControl/Controls/ViewWidget.qml">src/ViewWidgets/ViewWidget.qml</file>
<file alias="SimpleItemEditor.qml">src/MissionEditor/SimpleItemEditor.qml</file> <file alias="SimpleItemEditor.qml">src/MissionEditor/SimpleItemEditor.qml</file>
......
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
#include "LogDownloadController.h" #include "LogDownloadController.h"
#include "PX4AirframeLoader.h" #include "PX4AirframeLoader.h"
#include "ValuesWidgetController.h" #include "ValuesWidgetController.h"
#include "AppMessages.h"
#ifndef __ios__ #ifndef __ios__
#include "SerialLink.h" #include "SerialLink.h"
...@@ -484,6 +485,7 @@ bool QGCApplication::_initForNormalAppBoot(void) ...@@ -484,6 +485,7 @@ bool QGCApplication::_initForNormalAppBoot(void)
_qmlAppEngine = new QQmlApplicationEngine(this); _qmlAppEngine = new QQmlApplicationEngine(this);
_qmlAppEngine->addImportPath("qrc:/qml"); _qmlAppEngine->addImportPath("qrc:/qml");
_qmlAppEngine->rootContext()->setContextProperty("joystickManager", toolbox()->joystickManager()); _qmlAppEngine->rootContext()->setContextProperty("joystickManager", toolbox()->joystickManager());
_qmlAppEngine->rootContext()->setContextProperty("debugMessageModel", &AppMessages::getModel());
_qmlAppEngine->load(QUrl(QStringLiteral("qrc:/qml/MainWindowNative.qml"))); _qmlAppEngine->load(QUrl(QStringLiteral("qrc:/qml/MainWindowNative.qml")));
#else #else
// Start the user interface // Start the user interface
......
...@@ -21,7 +21,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -21,7 +21,7 @@ This file is part of the QGROUNDCONTROL project
======================================================================*/ ======================================================================*/
#include "AppMessagesDialog.h" #include "AppMessages.h"
#include <QStringListModel> #include <QStringListModel>
#include <iostream> #include <iostream>
...@@ -46,18 +46,12 @@ static void msgHandler(QtMsgType type, const QMessageLogContext &context, const ...@@ -46,18 +46,12 @@ static void msgHandler(QtMsgType type, const QMessageLogContext &context, const
if( type == QtFatalMsg ) abort(); if( type == QtFatalMsg ) abort();
} }
void AppMessages::installHandler()
AppMessagesDialog::AppMessagesDialog(const QString &title, QAction *action, QWidget *parent) :
QGCQmlWidgetHolder(title, action, parent)
{ {
resize(800, 600); old_handler = qInstallMessageHandler(msgHandler);
setContextPropertyObject("debugMessageModel", &debug_strings);
setSource(QUrl::fromUserInput("qrc:/qml/AppMessagesDialog.qml"));
loadSettings();
} }
void AppMessagesDialog::installHandler() QStringListModel& AppMessages::getModel()
{ {
old_handler = qInstallMessageHandler(msgHandler); return debug_strings;
} }
...@@ -23,15 +23,11 @@ This file is part of the QGROUNDCONTROL project ...@@ -23,15 +23,11 @@ This file is part of the QGROUNDCONTROL project
#pragma once #pragma once
#include "QGCQmlWidgetHolder.h"
class QStringListModel; class QStringListModel;
class AppMessagesDialog : public QGCQmlWidgetHolder class AppMessages
{ {
Q_OBJECT
public: public:
AppMessagesDialog(const QString& title, QAction* action, QWidget *parent = 0);
static void installHandler(); static void installHandler();
static QStringListModel& getModel();
}; };
Module QGroundControl.Controls Module QGroundControl.Controls
AppMessages 1.0 AppMessages.qml
ClickableColor 1.0 ClickableColor.qml ClickableColor 1.0 ClickableColor.qml
DropButton 1.0 DropButton.qml DropButton 1.0 DropButton.qml
ExclusiveGroupItem 1.0 ExclusiveGroupItem.qml ExclusiveGroupItem 1.0 ExclusiveGroupItem.qml
......
...@@ -42,7 +42,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -42,7 +42,7 @@ This file is part of the QGROUNDCONTROL project
#ifndef __mobile__ #ifndef __mobile__
#include "QGCSerialPortInfo.h" #include "QGCSerialPortInfo.h"
#include "AppMessagesDialog.h" #include "AppMessages.h"
#endif #endif
#ifdef QT_DEBUG #ifdef QT_DEBUG
...@@ -117,7 +117,7 @@ int main(int argc, char *argv[]) ...@@ -117,7 +117,7 @@ int main(int argc, char *argv[])
#ifndef __mobile__ #ifndef __mobile__
// install the message handler // install the message handler
AppMessagesDialog::installHandler(); AppMessages::installHandler();
//-- Test for another instance already running. If that's the case, we simply exit. //-- Test for another instance already running. If that's the case, we simply exit.
QHostAddress host("127.0.0.1"); QHostAddress host("127.0.0.1");
......
...@@ -66,7 +66,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -66,7 +66,7 @@ This file is part of the QGROUNDCONTROL project
#include "UASInfoWidget.h" #include "UASInfoWidget.h"
#include "HILDockWidget.h" #include "HILDockWidget.h"
#include "LogDownload.h" #include "LogDownload.h"
#include "AppMessagesDialog.h" #include "AppMessages.h"
#endif #endif
#ifndef __ios__ #ifndef __ios__
...@@ -89,8 +89,7 @@ enum DockWidgetTypes { ...@@ -89,8 +89,7 @@ enum DockWidgetTypes {
INFO_VIEW, INFO_VIEW,
HIL_CONFIG, HIL_CONFIG,
ANALYZE, ANALYZE,
LOG_DOWNLOAD, LOG_DOWNLOAD
DEBUG_MESSAGES
}; };
static const char *rgDockWidgetNames[] = { static const char *rgDockWidgetNames[] = {
...@@ -101,8 +100,7 @@ static const char *rgDockWidgetNames[] = { ...@@ -101,8 +100,7 @@ static const char *rgDockWidgetNames[] = {
"Info View", "Info View",
"HIL Config", "HIL Config",
"Analyze", "Analyze",
"Log Download", "Log Download"
"Debug Messages"
}; };
#define ARRAY_SIZE(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0])) #define ARRAY_SIZE(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
...@@ -167,6 +165,7 @@ MainWindow::MainWindow() ...@@ -167,6 +165,7 @@ MainWindow::MainWindow()
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
_mainQmlWidgetHolder->setContextPropertyObject("controller", this); _mainQmlWidgetHolder->setContextPropertyObject("controller", this);
_mainQmlWidgetHolder->setContextPropertyObject("debugMessageModel", &AppMessages::getModel());
_mainQmlWidgetHolder->setSource(QUrl::fromUserInput("qrc:qml/MainWindowHybrid.qml")); _mainQmlWidgetHolder->setSource(QUrl::fromUserInput("qrc:qml/MainWindowHybrid.qml"));
// Image provider // Image provider
...@@ -355,9 +354,6 @@ bool MainWindow::_createInnerDockWidget(const QString& widgetName) ...@@ -355,9 +354,6 @@ bool MainWindow::_createInnerDockWidget(const QString& widgetName)
case LOG_DOWNLOAD: case LOG_DOWNLOAD:
widget = new LogDownload(widgetName, action, this); widget = new LogDownload(widgetName, action, this);
break; break;
case DEBUG_MESSAGES:
widget = new AppMessagesDialog(widgetName, action, this);
break;
case STATUS_DETAILS: case STATUS_DETAILS:
widget = new UASInfoWidget(widgetName, action, this); widget = new UASInfoWidget(widgetName, action, this);
break; break;
......
...@@ -213,6 +213,19 @@ Item { ...@@ -213,6 +213,19 @@ Item {
} }
} }
QGCButton {
anchors.left: parent.left
anchors.right: parent.right
text: "Console"
exclusiveGroup: panelActionGroup
onClicked: {
if(__rightPanel.source != "QGroundControl/Controls/AppMessages.qml") {
__rightPanel.source = "QGroundControl/Controls/AppMessages.qml"
}
checked = true
}
}
QGCButton { QGCButton {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
......
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