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