Commit 30573ed0 authored by LM's avatar LM

Merged, made tool widget saving / loading work

parents 0d69f523 25bb4e00
......@@ -19,7 +19,7 @@ tmp
debug
release
qgroundcontrol
mavlinkgen
mavlinkgen-build-desktop
*.wav
qgroundcontrol.xcodeproj/**
doc/html
......
......@@ -381,7 +381,6 @@ set (qgroundcontrolHdrs
src/ui/map/Waypoint2DIcon.h
src/ui/map/MAV2DIcon.h
src/ui/OgreWidget.h
src/ui/mavlink/DomItem.h
src/ui/generated/ObjectDetectionView.h
src/ui/generated/MAVLinkSettingsWidget.h
src/ui/generated/SerialSettings.h
......@@ -427,7 +426,6 @@ set(qgroundcontrolMocSrc
src/comm/AS4Protocol.h
src/comm/MAVLinkSwarmSimulationLink.h
src/comm/ProtocolInterface.h
src/comm/MAVLinkSyntaxHighlighter.h
#src/comm/OpalLink.h
src/comm/MAVLinkProtocol.h
src/comm/SerialLinkInterface.h
......@@ -435,7 +433,6 @@ set(qgroundcontrolMocSrc
src/comm/UDPLink.h
src/comm/LinkManager.h
src/comm/LinkInterface.h
src/comm/MAVLinkXMLParser.h
src/comm/MAVLinkSimulationLink.h
src/comm/SerialSimulationLink.h
src/comm/MAVLinkSimulationWaypointPlanner.h
......@@ -495,7 +492,6 @@ set(qgroundcontrolMocSrc
src/ui/QGCMAVLinkLogPlayer.h
src/ui/QGCUDPLinkConfiguration.h
#src/ui/OpalLinkConfigurationWindow.h
src/ui/mavlink/DomModel.h
src/ui/SlugsHilSim.h
src/ui/WaypointList.h
src/ui/JoystickWidget.h
......@@ -529,8 +525,6 @@ set (qgroundcontrolSrc
src/comm/MAVLinkSimulationMAV.cc
src/comm/MAVLinkSimulationWaypointPlanner.cc
src/comm/MAVLinkSwarmSimulationLink.cc
src/comm/MAVLinkSyntaxHighlighter.cc
src/comm/MAVLinkXMLParser.cc
src/comm/SerialLink.cc
src/comm/SerialSimulationLink.cc
src/comm/UDPLink.cc
......@@ -584,7 +578,6 @@ set (qgroundcontrolSrc
#src/ui/SlugsVideoCamControl.cpp
src/ui/WaypointList.cc
src/ui/WaypointView.cc
src/ui/XMLCommProtocolWidget.cc
src/ui/designer/QGCActionButton.cc
src/ui/designer/QGCParamSlider.cc
src/ui/designer/QGCToolWidget.cc
......@@ -598,8 +591,6 @@ set (qgroundcontrolSrc
src/ui/map/MAV2DIcon.cc
src/ui/map/Waypoint2DIcon.cc
src/ui/map3D/QGCWebPage.cc
src/ui/mavlink/DomItem.cc
src/ui/mavlink/DomModel.cc
src/ui/uas/QGCUnconnectedInfoWidget.cc
src/ui/uas/UASControlWidget.cc
src/ui/uas/UASInfoWidget.cc
......
......@@ -74,12 +74,20 @@ Done.
Windows
=======
Windows XP:
Windows XP/7:
1) Download and install the QT SDK for Windows from http://qt.nokia.com/downloads/.
1) Download and install the QT SDK for Windows from http://qt.nokia.com/downloads/ (Visual Studio 2008 version)
2) Open qgroundcontrol.pro with QT to open the project.
2) Download and install Visual Studio 2008 Express Edition (free)
3) Once the indexing is complete, you may build the project, which will compile and run the debug build.
3) Go to the source folder of QGroundControl with the Qt 4.7.x Command Prompt tool (from the applications menu)
4) Create the Visual Studio project by typing:
qmake -tp vc qgroundcontrol.pro
5) Now start Visual Studio and load the qgroundcontrol.vcproj file
6) Compile and edit in Visual Studio. If you need to add new files, add them to qgroundcontrol.pro and re-run "quake -tp vc qgroundcontrol.pro"
......@@ -86,6 +86,7 @@
<file>images/mapproviders/googleearth.svg</file>
<file>images/contrib/slugs.png</file>
<file>images/style-outdoor.css</file>
<file>images/patterns/lenna.jpg</file>
</qresource>
<qresource prefix="/general">
<file alias="vera.ttf">images/Vera.ttf</file>
......
# }
# Include general settings for MAVGround
# necessary as last include to override any non-acceptable settings
# done by the plugins above
QT += svg xml
TEMPLATE = app
TARGET = mavlinkgen
BASEDIR = .
BUILDDIR = build/mavlinkgen
LANGUAGE = C++
CONFIG += release
CONFIG -= debug
OBJECTS_DIR = $$BUILDDIR/obj
MOC_DIR = $$BUILDDIR/moc
UI_HEADERS_DIR = src/ui/generated
macx:DESTDIR = $$BASEDIR/bin/mac
INCLUDEPATH += . \
src \
src/ui \
src/comm \
include/ui \
src/ui/mavlink \
src/standalone/mavlinkgen
# Input
FORMS += src/ui/XMLCommProtocolWidget.ui
HEADERS += src/standalone/mavlinkgen/MAVLinkGen.h \
src/ui/XMLCommProtocolWidget.h \
src/comm/MAVLinkXMLParser.h \
src/ui/mavlink/DomItem.h \
src/ui/mavlink/DomModel.h \
src/ui/mavlink/QGCMAVLinkTextEdit.h
SOURCES += src/standalone/mavlinkgen/main.cc \
src/standalone/mavlinkgen/MAVLinkGen.cc \
src/ui/XMLCommProtocolWidget.cc \
src/ui/mavlink/DomItem.cc \
src/ui/mavlink/DomModel.cc \
src/comm/MAVLinkXMLParser.cc \
src/ui/mavlink/QGCMAVLinkTextEdit.cc
RESOURCES = mavground.qrc
......@@ -7,15 +7,11 @@ TEMPLATE = app
TARGET = qgcvideo
BASEDIR = .
BUILDDIR = build/qgcvideo
LANGUAGE = C++
CONFIG += release
CONFIG -= debug
OBJECTS_DIR = $$BUILDDIR/obj
MOC_DIR = $$BUILDDIR/moc
UI_HEADERS_DIR = src/ui/generated
macx:DESTDIR = $$BASEDIR/bin/mac
......@@ -29,11 +25,18 @@ INCLUDEPATH += . \
# Input
HEADERS += \
src/comm/UDPLink.h \
src/comm/LinkInterface.h \
src/comm/LinkManager.h \
src/QGC.h \
src/apps/qgcvideo/QGCVideoMainWindow.h \
src/apps/qgcvideo/QGCVideoApp.h \
src/apps/qgcvideo/QGCVideoWidget.h
SOURCES += \
src/comm/UDPLink.cc \
src/comm/LinkManager.cc \
src/QGC.cc \
src/apps/qgcvideo/main.cc \
src/apps/qgcvideo/QGCVideoMainWindow.cc \
src/apps/qgcvideo/QGCVideoApp.cc \
......
......@@ -32,8 +32,9 @@ include(lib/nmea/nmea.pri)
# of open-source software!
# (We're not reusing any part of the OP GCS, just the map library)
# Try to get it from OP mainline, if this fails fall back to internal copies
exists(../openpilot/ground/openpilotgcs/src/libs) {
exists(../openpilot-xxxxxxx/ground/openpilotgcs/src/libs) {
include(../openpilot/ground/openpilotgcs/src/libs/utils/utils_external.pri)
include(../openpilot/ground/openpilotgcs/src/libs/opmapcontrol/opmapcontrol_external.pri)
DEPENDPATH += \
......@@ -57,7 +58,8 @@ DEPENDPATH += \
src/libs/utils \
src/libs/utils/src \
src/libs/opmapcontrol \
src/libs/opmapcontrol/src
src/libs/opmapcontrol/src \
src/libs/opmapcontrol/src/mapwidget
INCLUDEPATH += \
src/libs/utils \
......@@ -82,7 +84,7 @@ BUILDDIR = $$TARGETDIR/build
LANGUAGE = C++
OBJECTS_DIR = $$BUILDDIR/obj
MOC_DIR = $$BUILDDIR/moc
UI_HEADERS_DIR = src/ui/generated
UI_HEADERS_DIR = $$BUILDDIR/ui
MAVLINK_CONF = ""
# If the user config file exists, it will be included.
......@@ -141,11 +143,26 @@ contains(MAVLINK_CONF, ardupilotmega) {
}
# }
# Include general settings for MAVGround
# Include general settings for QGroundControl
# necessary as last include to override any non-acceptable settings
# done by the plugins above
include(qgroundcontrol.pri)
# Include MAVLink generator
DEPENDPATH += \
src/apps/mavlinkgen
INCLUDEPATH += \
src/apps/mavlinkgen \
src/apps/mavlinkgen/ui \
src/apps/mavlinkgen/generator
include(src/apps/mavlinkgen/mavlinkgen.pri)
# Include QWT plotting library
include(src/lib/qwt/qwt.pri)
DEPENDPATH += . \
......@@ -189,7 +206,6 @@ FORMS += src/ui/MainWindow.ui \
src/ui/ObjectDetectionView.ui \
src/ui/JoystickWidget.ui \
src/ui/DebugConsole.ui \
src/ui/XMLCommProtocolWidget.ui \
src/ui/HDDisplay.ui \
src/ui/MAVLinkSettingsWidget.ui \
src/ui/AudioOutputWidget.ui \
......@@ -274,10 +290,6 @@ HEADERS += src/MG.h \
src/input/JoystickInput.h \
src/ui/JoystickWidget.h \
src/ui/DebugConsole.h \
src/ui/XMLCommProtocolWidget.h \
src/ui/mavlink/DomItem.h \
src/ui/mavlink/DomModel.h \
src/comm/MAVLinkXMLParser.h \
src/ui/HDDisplay.h \
src/ui/MAVLinkSettingsWidget.h \
src/ui/AudioOutputWidget.h \
......@@ -289,7 +301,6 @@ HEADERS += src/MG.h \
src/uas/SlugsMAV.h \
src/uas/PxQuadMAV.h \
src/uas/ArduPilotMegaMAV.h \
src/comm/MAVLinkSyntaxHighlighter.h \
src/ui/watchdog/WatchdogControl.h \
src/ui/watchdog/WatchdogProcessView.h \
src/ui/watchdog/WatchdogView.h \
......@@ -335,7 +346,6 @@ HEADERS += src/MG.h \
src/ui/map/QGCMapWidget.h \
src/ui/map/MAV2DIcon.h \
src/ui/map/Waypoint2DIcon.h \
src/ui/mavlink/QGCMAVLinkTextEdit.h \
src/ui/map/QGCMapTool.h \
src/ui/map/QGCMapToolBar.h \
src/libs/qextserialport/qextserialenumerator.h
......@@ -405,10 +415,6 @@ SOURCES += src/main.cc \
src/input/JoystickInput.cc \
src/ui/JoystickWidget.cc \
src/ui/DebugConsole.cc \
src/ui/XMLCommProtocolWidget.cc \
src/ui/mavlink/DomItem.cc \
src/ui/mavlink/DomModel.cc \
src/comm/MAVLinkXMLParser.cc \
src/ui/HDDisplay.cc \
src/ui/MAVLinkSettingsWidget.cc \
src/ui/AudioOutputWidget.cc \
......@@ -420,7 +426,6 @@ SOURCES += src/main.cc \
src/uas/SlugsMAV.cc \
src/uas/PxQuadMAV.cc \
src/uas/ArduPilotMegaMAV.cc \
src/comm/MAVLinkSyntaxHighlighter.cc \
src/ui/watchdog/WatchdogControl.cc \
src/ui/watchdog/WatchdogProcessView.cc \
src/ui/watchdog/WatchdogView.cc \
......@@ -465,7 +470,6 @@ SOURCES += src/main.cc \
src/ui/map/QGCMapWidget.cc \
src/ui/map/MAV2DIcon.cc \
src/ui/map/Waypoint2DIcon.cc \
src/ui/mavlink/QGCMAVLinkTextEdit.cc \
src/ui/map/QGCMapTool.cc \
src/ui/map/QGCMapToolBar.cc
macx|win32-msvc2008::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
......@@ -60,34 +60,29 @@ This file is part of the PIXHAWK project
MAVLinkGen::MAVLinkGen(int &argc, char* argv[]) : QApplication(argc, argv)
{
this->setApplicationName("MAVLink Generator");
this->setApplicationVersion("v. 0.1.0 (Beta)");
this->setOrganizationName(QLatin1String("OpenMAV Association"));
this->setOrganizationDomain("http://qgroundcontrol.org");
this->setApplicationVersion("v. 1.0.0 (Beta)");
this->setOrganizationName(QLatin1String("MAVLink Consortium"));
this->setOrganizationDomain("http://qgroundcontrol.org/mavlink");
QSettings::setDefaultFormat(QSettings::IniFormat);
// Exit main application when last window is closed
connect(this, SIGNAL(lastWindowClosed()), this, SLOT(quit()));
// Set application font
QFontDatabase fontDatabase = QFontDatabase();
const QString fontFileName = ":/general/vera.ttf"; ///< Font file is part of the QRC file and compiled into the app
const QString fontFamilyName = "Bitstream Vera Sans";
if(!QFile::exists(fontFileName)) printf("ERROR! font file: %s DOES NOT EXIST!\n", fontFileName.toStdString().c_str());
fontDatabase.addApplicationFont(fontFileName);
setFont(fontDatabase.font(fontFamilyName, "Roman", 12));
// Create main window
QMainWindow* window = new QMainWindow();
window = new QMainWindow();
window->setCentralWidget(new XMLCommProtocolWidget(window));
window->setWindowTitle(applicationName() + " " + applicationVersion());
window->resize(qMax(950, static_cast<int>(QApplication::desktop()->width()*0.7f)), qMax(600, static_cast<int>(QApplication::desktop()->height()*0.8f)));
window->show();
}
/**
* @brief Destructor for the groundstation. It destroys all loaded instances.
* @brief Destructor
*
**/
MAVLinkGen::~MAVLinkGen()
{
window->hide();
delete window;
}
......@@ -34,6 +34,7 @@ This file is part of the PIXHAWK project
#define MAVLINKGEN_H
#include <QApplication>
#include <QMainWindow>
/**
* @brief The main application and management class.
......@@ -51,6 +52,7 @@ public:
~MAVLinkGen();
protected:
QMainWindow* window;
private:
};
......
Code Generator for the MAVLink Micro Air Vehicle Message Marshalling Library
This is a code generator for the library for lightweight communication between
Micro Air Vehicles and/or ground control stations.
It serializes C-structs for serial channels and can be used with
any type of radio modem.
**********
* NEWS *
**********
MAVLink has been ported to Python and Java. MAVLinkGen will soon support the output of Python and Java code as well.
For help, please visit the mailing list: http://groups.google.com/group/mavlink
MAVLink is licensed under the terms of the Lesser General Public License of the Free Software Foundation (LGPL).
MAVLink's reference implementation is done in the QGroundControl operator control unit. MAVLink is however not tied in any way to QGroundControl nor does it depend on it. Many other groundstations (APM Planner, HK GCS, Copter-GCS) support it and might be better suited for your application than QGC - check them out.
Project:
http://qgroundcontrol.org/mavlink
Files:
http://github.com/pixhawk/mavlinkgen
http://github.com/pixhawk/mavlink
(c) 2009-2011 Lorenz Meier <mail@qgroundcontrol.org>
\ No newline at end of file
#!/bin/sh
cp -r ../../mavlinkgen-build-desktop/mavlinkgen.app .
echo -e '\n\nStarting to create disk image. This may take a while..\n'
macdeployqt mavlinkgen.app -dmg
rm -rf mavlinkgen.app
echo -e '\n\n MAVLinkGen .DMG file is now ready for publishing\n'
Name "QGroundcontrol"
Name "MAVLink Generator"
OutFile "qgroundcontrol-installer-win32.exe"
OutFile "mavlinkgen-installer-win32.exe"
InstallDir $PROGRAMFILES\qgroundcontrol
InstallDir $PROGRAMFILES\mavlinkgen
Page license
Page directory
......@@ -17,19 +17,19 @@ Section ""
SetOutPath $INSTDIR
File ..\release\*.*
WriteUninstaller $INSTDIR\QGroundControl_uninstall.exe
WriteUninstaller $INSTDIR\mavlinkgen_uninstall.exe
SectionEnd
Section "Uninstall"
Delete $INSTDIR\QGroundControl_uninstall.exe
Delete $INSTDIR\mavlinkgen_uninstall.exe
Delete $INSTDIR\*.*
RMDir $INSTDIR
Delete "$SMPROGRAMS\QGroundControl\*.*"
RMDir "$SMPROGRAMS\QGroundControl\"
Delete "$SMPROGRAMS\mavlinkgen\*.*"
RMDir "$SMPROGRAMS\mavlinkgen\"
SectionEnd
Section "create Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\QGroundControl"
CreateShortCut "$SMPROGRAMS\QGroundControl\uninstall.lnk" "$INSTDIR\QGroundControl_uninstall.exe" "" "$INSTDIR\QGroundControl_uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\QGroundControl\QGroundControl.lnk" "$INSTDIR\qgroundcontrol.exe" "" "$INSTDIR\qgroundcontrol.exe" 0
CreateDirectory "$SMPROGRAMS\MAVLink"
CreateShortCut "$SMPROGRAMS\MAVLink\Uninstall.lnk" "$INSTDIR\mavlinkgen_uninstall.exe" "" "$INSTDIR\mavlinkgen_uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\MAVLink\MAVLinkGen.lnk" "$INSTDIR\mavlinkgen.exe" "" "$INSTDIR\mavlinkgen.exe" 0
SectionEnd
\ No newline at end of file
......@@ -103,7 +103,7 @@ bool MAVLinkXMLParser::generate()
// Start main header
QString mainHeader = QString("/** @file\n *\t@brief MAVLink comm protocol.\n *\t@see http://pixhawk.ethz.ch/software/mavlink\n *\t Generated on %1\n */\n#ifndef " + pureFileName.toUpper() + "_H\n#define " + pureFileName.toUpper() + "_H\n\n").arg(date); // The main header includes all messages
QString mainHeader = QString("/** @file\n *\t@brief MAVLink comm protocol.\n *\t@see http://qgroundcontrol.org/mavlink/\n *\t Generated on %1\n */\n#ifndef " + pureFileName.toUpper() + "_H\n#define " + pureFileName.toUpper() + "_H\n\n").arg(date); // The main header includes all messages
// Mark all code as C code
mainHeader += "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n";
mainHeader += "\n#include \"../protocol.h\"\n";
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# Third-party includes.
# if you include this file with the commands below into
# your Qt project, you can enable your application
# to generate MAVLink code easily.
###### EXAMPLE BEGIN
## Include MAVLink generator
#DEPENDPATH += \
# src/apps/mavlinkgen
#
#INCLUDEPATH += \
# src/apps/mavlinkgen
# src/apps/mavlinkgen/ui \
# src/apps/mavlinkgen/generator
#
#include(src/apps/mavlinkgen/mavlinkgen.pri)
###### EXAMPLE END
INCLUDEPATH += .\
ui \
generator
FORMS += ui/XMLCommProtocolWidget.ui
HEADERS += \
ui/XMLCommProtocolWidget.h \
generator/MAVLinkXMLParser.h \
ui/DomItem.h \
ui/DomModel.h \
ui/QGCMAVLinkTextEdit.h
SOURCES += \
ui/XMLCommProtocolWidget.cc \
ui/DomItem.cc \
ui/DomModel.cc \
generator/MAVLinkXMLParser.cc \
ui/QGCMAVLinkTextEdit.cc
RESOURCES += mavlinkgen.qrc
# MAVLink code generator
# generates code in several languages for MAVLink encoding/decoding
QT += svg xml
TEMPLATE = app
TARGET = mavlinkgen
LANGUAGE = C++
# Widget files (can be included in third-party Qt applications)
include(mavlinkgen.pri)
# Standalone files
HEADERS += MAVLinkGen.h
SOURCES += main.cc \
MAVLinkGen.cc
\ No newline at end of file
<RCC>
<qresource prefix="/">
<file>images/categories/applications-system.svg</file>
<file>images/status/folder-open.svg</file>
</qresource>
</RCC>
......@@ -113,11 +113,9 @@ QVariant DomModel::data(const QModelIndex &index, int role) const
//// }
// }
// break;
default:
{
return QVariant();
}
}
// Return empty variant if no case applied
return QVariant();
}
Qt::ItemFlags DomModel::flags(const QModelIndex &index) const
......
......@@ -6,31 +6,29 @@
#include "XMLCommProtocolWidget.h"
#include "ui_XMLCommProtocolWidget.h"
#include "MAVLinkXMLParser.h"
#include "MAVLinkSyntaxHighlighter.h"
#include "QGC.h"
#include <QDebug>
#include <iostream>
XMLCommProtocolWidget::XMLCommProtocolWidget(QWidget *parent) :
QWidget(parent),
m_ui(new Ui::XMLCommProtocolWidget)
model(NULL),
m_ui(new Ui::XMLCommProtocolWidget)
{
m_ui->setupUi(this);
connect(m_ui->selectFileButton, SIGNAL(clicked()), this, SLOT(selectXMLFile()));
connect(m_ui->selectOutputButton, SIGNAL(clicked()), this, SLOT(selectOutputDirectory()));
connect(m_ui->generateButton, SIGNAL(clicked()), this, SLOT(generate()));
connect(m_ui->saveButton, SIGNAL(clicked()), this, SLOT(save()));
// Make sure text background is white
m_ui->xmlTextView->setStyleSheet("QGCMAVLinkTextEdit { background-color: #FFFFFF; }");
}
void XMLCommProtocolWidget::selectXMLFile()
{
//QString fileName = QFileDialog::getOpenFileName(this, tr("Load Protocol Definition File"), ".", "*.xml");
QSettings settings(QGC::COMPANYNAME, QGC::APPNAME);
QSettings settings("MAVLink Consortium", "MAVLink Generator");
const QString mavlinkXML = "MAVLINK_XML_FILE";
QString dirPath = settings.value(mavlinkXML, QCoreApplication::applicationDirPath() + "../").toString();
QFileInfo dir(dirPath);
......@@ -43,11 +41,11 @@ void XMLCommProtocolWidget::selectXMLFile()
if (dialog.exec()) {
fileNames = dialog.selectedFiles();
}
if (fileNames.size() > 0) {
m_ui->fileNameLabel->setText(fileNames.first());
QFile file(fileNames.first());
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
const QString instanceText(QString::fromUtf8(file.readAll()));
setXML(instanceText);
......@@ -66,13 +64,13 @@ void XMLCommProtocolWidget::setXML(const QString& xml)
{
m_ui->xmlTextView->setText(xml);
QDomDocument doc;
if (doc.setContent(xml)) {
m_ui->validXMLLabel->setText(tr("<font color=\"green\">Valid XML file</font>"));
} else {
m_ui->validXMLLabel->setText(tr("<font color=\"red\">File is NOT valid XML, please fix in editor</font>"));
}
if (model != NULL) {
m_ui->xmlTreeView->reset();
//delete model;
......@@ -87,7 +85,7 @@ void XMLCommProtocolWidget::setXML(const QString& xml)
void XMLCommProtocolWidget::selectOutputDirectory()
{
QSettings settings(QGC::COMPANYNAME, QGC::APPNAME);
QSettings settings("MAVLink Consortium", "MAVLink Generator");
const QString mavlinkOutputDir = "MAVLINK_OUTPUT_DIR";
QString dirPath = settings.value(mavlinkOutputDir, QCoreApplication::applicationDirPath() + "../").toString();
QFileDialog dialog;
......@@ -98,7 +96,7 @@ void XMLCommProtocolWidget::selectOutputDirectory()
if (dialog.exec()) {
fileNames = dialog.selectedFiles();
}
if (fileNames.size() > 0) {
m_ui->outputDirNameLabel->setText(fileNames.first());
// Store directory for next time
......@@ -115,25 +113,25 @@ void XMLCommProtocolWidget::generate()
QMessageBox::critical(this, tr("Please select an XML input file first"), tr("You have to select an input XML file before generating C files."), QMessageBox::Ok);
return;
}
// Check if output dir is selected
if (!QFileInfo(m_ui->outputDirNameLabel->text().trimmed()).isDir()) {
QMessageBox::critical(this, tr("Please select output directory first"), tr("You have to select an output directory before generating C files."), QMessageBox::Ok);
return;
}
// First save file
save();
// Clean log
m_ui->compileLog->clear();
// Check XML validity
if (!m_ui->xmlTextView->syntaxcheck())
{
// Syntax check already gives output
return;
}
MAVLinkXMLParser* parser = new MAVLinkXMLParser(m_ui->fileNameLabel->text().trimmed(), m_ui->outputDirNameLabel->text().trimmed());
connect(parser, SIGNAL(parseState(QString)), m_ui->compileLog, SLOT(appendHtml(QString)));
bool result = parser->generate();
......@@ -157,7 +155,7 @@ void XMLCommProtocolWidget::save()
XMLCommProtocolWidget::~XMLCommProtocolWidget()
{
delete model;
if (model) delete model;
delete m_ui;
}
......@@ -165,10 +163,10 @@ void XMLCommProtocolWidget::changeEvent(QEvent *e)
{
QWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
m_ui->retranslateUi(this);
break;
default:
break;
case QEvent::LanguageChange:
m_ui->retranslateUi(this);
break;
default:
break;
}
}
......@@ -33,7 +33,6 @@ This file is part of the QGROUNDCONTROL project
#include <QtGui/QWidget>
#include "DomModel.h"
#include "MAVLinkSyntaxHighlighter.h"
namespace Ui
{
......@@ -64,7 +63,6 @@ protected slots:
void save();
protected:
MAVLinkSyntaxHighlighter* highlighter;
DomModel* model;
void changeEvent(QEvent *e);
......
......@@ -13,7 +13,7 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,100,0,0,0" columnstretch="1,1,1,100">
<layout class="QGridLayout" name="gridLayout" rowstretch="1,1,100,1,1,1" columnstretch="1,1,1,100">
<property name="topMargin">
<number>6</number>
</property>
......@@ -51,13 +51,25 @@
<string>Select input file</string>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../mavlinkgen.qrc">
<normaloff>:/images/status/folder-open.svg</normaloff>:/images/status/folder-open.svg</iconset>
</property>
</widget>
</item>
<item row="0" column="3" rowspan="6">
<widget class="QGCMAVLinkTextEdit" name="xmlTextView">
<property name="minimumSize">
<size>
<width>400</width>
<height>300</height>
</size>
</property>
<property name="baseSize">
<size>
<width>800</width>
<height>600</height>
</size>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
......@@ -85,7 +97,7 @@
<string>Select directory</string>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../mavlinkgen.qrc">
<normaloff>:/images/status/folder-open.svg</normaloff>:/images/status/folder-open.svg</iconset>
</property>
</widget>
......@@ -123,7 +135,7 @@
<string>Save and generate</string>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../mavlinkgen.qrc">
<normaloff>:/images/categories/applications-system.svg</normaloff>:/images/categories/applications-system.svg</iconset>
</property>
</widget>
......@@ -138,7 +150,7 @@
</customwidget>
</customwidgets>
<resources>
<include location="../../mavground.qrc"/>
<include location="../mavlinkgen.qrc"/>
</resources>
<connections/>
</ui>
......@@ -44,6 +44,8 @@
#include <QMainWindow>
#include "QGCVideoApp.h"
#include "QGCVideoMainWindow.h"
#include "UDPLink.h"
/**
......@@ -76,7 +78,7 @@ QGCVideoApp::QGCVideoApp(int &argc, char* argv[]) : QApplication(argc, argv)
setFont(fontDatabase.font(fontFamilyName, "Roman", 12));
// Create main window
QMainWindow* window = new QMainWindow();
QMainWindow* window = new QGCVideoMainWindow();
//window->setCentralWidget(new XMLCommProtocolWidget(window));
window->setWindowTitle(applicationName() + " " + applicationVersion());
window->show();
......
......@@ -32,14 +32,67 @@
#include "QGCVideoMainWindow.h"
#include "ui_QGCVideoMainWindow.h"
#include "UDPLink.h"
#include <QDebug>
QGCVideoMainWindow::QGCVideoMainWindow(QWidget *parent) :
QMainWindow(parent),
link(QHostAddress::Any, 5555),
ui(new Ui::QGCVideoMainWindow)
{
ui->setupUi(this);
// Set widgets in video mode
ui->video1Widget->enableVideo(true);
ui->video2Widget->enableVideo(true);
ui->video3Widget->enableVideo(true);
ui->video4Widget->enableVideo(true);
// Connect link to this widget, receive all bytes
connect(&link, SIGNAL(bytesReceived(LinkInterface*,QByteArray)), this, SLOT(receiveBytes(LinkInterface*,QByteArray)));
// Open port
link.connect();
}
QGCVideoMainWindow::~QGCVideoMainWindow()
{
delete ui;
}
void QGCVideoMainWindow::receiveBytes(LinkInterface* link, QByteArray data)
{
// There is no need to differentiate between links
// for this use case here
Q_UNUSED(link);
// Image data is stored in QByteArray
// Output bytes and load Lenna!
QString bytes;
QString ascii;
for (int i=0; i<data.size(); i++) {
unsigned char v = data[i];
bytes.append(QString().sprintf("%02x ", v));
if (data.at(i) > 31 && data.at(i) < 127)
{
ascii.append(data.at(i));
}
else
{
ascii.append(219);
}
}
qDebug() << "Received" << data.size() << "bytes";
qDebug() << bytes;
qDebug() << "ASCII:" << ascii;
// Load image into window
QImage test(":images/patterns/lenna.jpg");
ui->video1Widget->copyImage(test);
ui->video2Widget->copyImage(test);
ui->video3Widget->copyImage(test);
ui->video4Widget->copyImage(test);
}
......@@ -33,6 +33,7 @@
#define QGCVIDEOMAINWINDOW_H
#include <QMainWindow>
#include "UDPLink.h"
namespace Ui {
class QGCVideoMainWindow;
......@@ -46,6 +47,12 @@ public:
explicit QGCVideoMainWindow(QWidget *parent = 0);
~QGCVideoMainWindow();
public slots:
void receiveBytes(LinkInterface* link, QByteArray data);
protected:
UDPLink link;
private:
Ui::QGCVideoMainWindow *ui;
};
......
......@@ -160,7 +160,7 @@ QGCVideoWidget::QGCVideoWidget(QWidget* parent)
// Refresh timer
refreshTimer->setInterval(updateInterval);
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(paintQGCVideoWidget()));
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(paintHUD()));
// Resize to correct size and fill with image
//glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits());
......@@ -201,16 +201,12 @@ QSize QGCVideoWidget::sizeHint() const
void QGCVideoWidget::showEvent(QShowEvent* event)
{
// React only to internal (pre-display)
// events
Q_UNUSED(event)
refreshTimer->start(updateInterval);
}
void QGCVideoWidget::hideEvent(QHideEvent* event)
{
// React only to internal (pre-display)
// events
Q_UNUSED(event);
refreshTimer->stop();
}
......@@ -220,20 +216,20 @@ void QGCVideoWidget::contextMenuEvent (QContextMenuEvent* event)
QMenu menu(this);
// Update actions
enableHUDAction->setChecked(hudInstrumentsEnabled);
enableVideoAction->setChecked(videoEnabled);
// enableVideoAction->setChecked(videoEnabled);
menu.addAction(enableHUDAction);
//menu.addAction(selectQGCVideoWidgetColorAction);
menu.addAction(enableVideoAction);
menu.addAction(selectOfflineDirectoryAction);
// menu.addAction(enableVideoAction);
// menu.addAction(selectOfflineDirectoryAction);
//menu.addAction(selectVideoChannelAction);
menu.exec(event->globalPos());
}
void QGCVideoWidget::createActions()
{
enableHUDAction = new QAction(tr("Enable QGCVideoWidget"), this);
enableHUDAction->setStatusTip(tr("Show the QGCVideoWidget instruments in this window"));
enableHUDAction = new QAction(tr("Enable HUD"), this);
enableHUDAction->setStatusTip(tr("Show the HUD instruments in this window"));
enableHUDAction->setCheckable(true);
enableHUDAction->setChecked(hudInstrumentsEnabled);
connect(enableHUDAction, SIGNAL(triggered(bool)), this, SLOT(enableHUDInstruments(bool)));
......@@ -242,11 +238,11 @@ void QGCVideoWidget::createActions()
enableVideoAction->setStatusTip(tr("Show the video live feed"));
enableVideoAction->setCheckable(true);
enableVideoAction->setChecked(videoEnabled);
connect(enableVideoAction, SIGNAL(triggered(bool)), this, SLOT(enableVideo(bool)));
// connect(enableVideoAction, SIGNAL(triggered(bool)), this, SLOT(enableVideo(bool)));
selectOfflineDirectoryAction = new QAction(tr("Select image log"), this);
selectOfflineDirectoryAction->setStatusTip(tr("Load previously logged images into simulation / replay"));
connect(selectOfflineDirectoryAction, SIGNAL(triggered()), this, SLOT(selectOfflineDirectory()));
// connect(selectOfflineDirectoryAction, SIGNAL(triggered()), this, SLOT(selectOfflineDirectory()));
}
/**
......
......@@ -30,6 +30,7 @@ public slots:
/** @brief Copy an image from an external buffer */
void copyImage(const QImage& img);
void enableHUDInstruments(bool enabled) { hudInstrumentsEnabled = enabled; }
void enableVideo(bool enabled) { videoEnabled = enabled; }
protected slots:
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
#include "MAVLinkSyntaxHighlighter.h"
MAVLinkSyntaxHighlighter::MAVLinkSyntaxHighlighter(QObject *parent) :
QSyntaxHighlighter(parent)
{
}
void MAVLinkSyntaxHighlighter::highlightBlock(const QString &text)
{
QTextCharFormat myClassFormat;
myClassFormat.setFontWeight(QFont::Bold);
myClassFormat.setForeground(Qt::darkMagenta);
QString pattern = "\"[A-Za-z0-9]+\"";
QRegExp expression(pattern);
int index = text.indexOf(expression);
while (index >= 0) {
int length = expression.matchedLength();
setFormat(index, length, myClassFormat);
index = text.indexOf(expression, index + length);
}
}
#ifndef MAVLINKSYNTAXHIGHLIGHTER_H
#define MAVLINKSYNTAXHIGHLIGHTER_H
#include <QSyntaxHighlighter>
class MAVLinkSyntaxHighlighter : public QSyntaxHighlighter
{
Q_OBJECT
public:
explicit MAVLinkSyntaxHighlighter(QObject *parent = 0);
signals:
public slots:
void highlightBlock(const QString &text);
};
#endif // MAVLINKSYNTAXHIGHLIGHTER_H
......@@ -2,7 +2,6 @@
<qresource prefix="/markers">
<file>images/bigMarkerGreen.png</file>
<file>images/marker.png</file>
<file>images/compas.svg</file>
<file>images/airplane.svg</file>
<file>images/home.png</file>
<file>images/home.svg</file>
......@@ -12,6 +11,7 @@
<file>images/mapquad.png</file>
<file>images/dragons1.jpg</file>
<file>images/dragons2.jpeg</file>
<file>images/compas.svg</file>
</qresource>
<qresource prefix="/uavs">
<file>images/airplanepip.png</file>
......
......@@ -38,6 +38,8 @@ namespace mapcontrol
void TrailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option);
Q_UNUSED(widget);
// painter->drawRect(QRectF(-3,-3,6,6));
painter->setBrush(m_brush);
painter->drawEllipse(-2,-2,4,4);
......
......@@ -27,7 +27,16 @@
#include "waypointitem.h"
namespace mapcontrol
{
WayPointItem::WayPointItem(const internals::PointLatLng &coord,double const& altitude, MapGraphicItem *map):coord(coord),reached(false),description(""),shownumber(true),isDragging(false),altitude(altitude),heading(0),map(map),autoreachedEnabled(true)
WayPointItem::WayPointItem(const internals::PointLatLng &coord,double const& altitude, MapGraphicItem *map) :
map(map),
coord(coord),
reached(false),
description(""),
shownumber(true),
isDragging(false),
altitude(altitude),
heading(0),
autoreachedEnabled(true)
{
text=0;
numberI=0;
......
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch>
This file is part of the PIXHAWK project
PIXHAWK 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.
PIXHAWK 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 PIXHAWK. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of class MAVLinkGen
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#include <QFile>
#include <QFlags>
#include <QThread>
#include <QSplashScreen>
#include <QPixmap>
#include <QDesktopWidget>
#include <QPainter>
#include <QStyleFactory>
#include <QAction>
#include <QSettings>
#include <QFontDatabase>
#include <QMainWindow>
#include "MAVLinkGen.h"
#include "XMLCommProtocolWidget.h"
/**
* @brief Constructor for the main application.
*
* This constructor initializes and starts the whole application. It takes standard
* command-line parameters
*
* @param argc The number of command-line parameters
* @param argv The string array of parameters
**/
MAVLinkGen::MAVLinkGen(int &argc, char* argv[]) : QApplication(argc, argv)
{
this->setApplicationName("MAVLink Generator");
this->setApplicationVersion("v. 1.0.0 (Beta)");
this->setOrganizationName(QLatin1String("QGroundControl"));
this->setOrganizationDomain("http://qgroundcontrol.org");
QSettings::setDefaultFormat(QSettings::IniFormat);
// Exit main application when last window is closed
connect(this, SIGNAL(lastWindowClosed()), this, SLOT(quit()));
// Set application font
QFontDatabase fontDatabase = QFontDatabase();
const QString fontFileName = ":/general/vera.ttf"; ///< Font file is part of the QRC file and compiled into the app
const QString fontFamilyName = "Bitstream Vera Sans";
if(!QFile::exists(fontFileName)) printf("ERROR! font file: %s DOES NOT EXIST!\n", fontFileName.toStdString().c_str());
fontDatabase.addApplicationFont(fontFileName);
setFont(fontDatabase.font(fontFamilyName, "Roman", 12));
// Create main window
QMainWindow* window = new QMainWindow();
window->setCentralWidget(new XMLCommProtocolWidget(window));
window->setWindowTitle(applicationName() + " " + applicationVersion());
// window->setBaseSize(qMin(1024, static_cast<int>(QApplication::desktop()->width()*0.8f)), qMin(900, static_cast<int>(QApplication::desktop()->height()*0.8f)));
window->show();
}
/**
* @brief Destructor for the groundstation. It destroys all loaded instances.
*
**/
MAVLinkGen::~MAVLinkGen()
{
}
......@@ -394,7 +394,6 @@ void DebugConsole::receiveBytes(LinkInterface* link, QByteArray bytes)
case (unsigned char)'\n': // Accept line feed
if (lastByte != '\r') // Do not break line again for CR+LF
str.append(byte); // only break line for single LF or CR bytes
else ;
break;
case (unsigned char)' ': // space of any type means don't add another on hex output
case (unsigned char)'\t': // Accept tab
......
......@@ -75,7 +75,6 @@ inline bool isinf(T value)
*/
HUD::HUD(int width, int height, QWidget* parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent),
u(NULL),
uas(NULL),
yawInt(0.0f),
mode(tr("UNKNOWN MODE")),
......@@ -309,7 +308,6 @@ void HUD::setActiveUAS(UASInterface* uas)
// Set new UAS
this->uas = uas;
this->u = dynamic_cast<UAS*>(this->uas);
}
}
......@@ -1631,5 +1629,9 @@ void HUD::setPixels(int imgid, const unsigned char* imageData, int length, int s
void HUD::copyImage()
{
qDebug() << "HUD::copyImage()";
this->glImage = QGLWidget::convertToGLFormat(this->u->getImage());
UAS* u = dynamic_cast<UAS*>(this->uas);
if (u)
{
this->glImage = QGLWidget::convertToGLFormat(u->getImage());
}
}
......@@ -219,7 +219,6 @@ protected:
QAction* selectVideoChannelAction;
void paintEvent(QPaintEvent *event);
bool imageRequested;
UAS* u;
};
......
......@@ -69,7 +69,6 @@ void JoystickWidget::setZ(float z)
void JoystickWidget::setHat(float x, float y)
{
qDebug() << __FILE__ << __LINE__ << "HAT X:" << x << "HAT Y:" << y;
updateStatus(tr("Hat position: x: %1, y: %2").arg(x, y));
}
......@@ -129,7 +128,6 @@ void JoystickWidget::pressKey(int key)
break;
}
QTimer::singleShot(20, this, SLOT(clearKeys()));
qDebug() << __FILE__ << __LINE__ << "KEY" << key << " pressed on joystick";
updateStatus(tr("Key %1 pressed").arg(key));
}
......
......@@ -37,6 +37,9 @@
</property>
<item row="4" column="2" colspan="3">
<widget class="QSlider" name="ySlider">
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
......@@ -68,7 +71,14 @@
</widget>
</item>
<item row="0" column="1" rowspan="3" colspan="5">
<widget class="QDial" name="dial"/>
<widget class="QDial" name="dial">
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_2">
......@@ -114,6 +124,9 @@
</item>
<item row="1" column="0" rowspan="2">
<widget class="QSlider" name="xSlider">
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
......
......@@ -135,9 +135,8 @@ MainWindow::MainWindow(QWidget *parent):
connect(LinkManager::instance(), SIGNAL(newLink(LinkInterface*)), this, SLOT(addLink(LinkInterface*)));
// Connect user interface devices
if (!joystick) {
joystick = new JoystickInput();
}
joystickWidget = 0;
joystick = new JoystickInput();
// Enable and update view
presentView();
......
......@@ -87,7 +87,7 @@ void QGCParamSlider::setActiveUAS(UASInterface* activeUas)
void QGCParamSlider::requestParameter()
{
if (parameterIndex != -1) {
if (parameterIndex != -1 && uas) {
uas->requestParameter(this->component, this->parameterIndex);
}
}
......
......@@ -16,10 +16,10 @@
#include "UASManager.h"
QGCToolWidget::QGCToolWidget(const QString& title, QWidget *parent) :
QWidget(parent),
mav(NULL),
mainMenuAction(NULL),
ui(new Ui::QGCToolWidget)
QWidget(parent),
mav(NULL),
mainMenuAction(NULL),
ui(new Ui::QGCToolWidget)
{
ui->setupUi(this);
setObjectName(title);
......@@ -110,8 +110,12 @@ QList<QGCToolWidget*> QGCToolWidget::createWidgetsFromSettings(QWidget* parent,
void QGCToolWidget::loadSettings(const QString& settings)
{
QSettings(settings, QSettings::IniFormat);
loadSettings(settings);
QSettings set(settings, QSettings::IniFormat);
QStringList groups = set.childGroups();
QString widgetName = groups.first();
setTitle(widgetName);
qDebug() << "WIDGET TITLE LOADED: " << widgetName;
loadSettings(set);
}
void QGCToolWidget::loadSettings(QSettings& settings)
......@@ -373,6 +377,7 @@ void QGCToolWidget::setTitle()
settings.remove("");
settings.endGroup();
parent->setWindowTitle(text);
setWindowTitle(text);
storeWidgetsToSettings();
emit titleChanged(text);
......@@ -381,6 +386,23 @@ void QGCToolWidget::setTitle()
}
}
void QGCToolWidget::setTitle(QString title)
{
QDockWidget* parent = dynamic_cast<QDockWidget*>(this->parentWidget());
if (parent) {
QSettings settings;
settings.beginGroup(parent->windowTitle());
settings.remove("");
settings.endGroup();
parent->setWindowTitle(title);
}
setWindowTitle(title);
storeWidgetsToSettings();
emit titleChanged(title);
if (mainMenuAction) mainMenuAction->setText(title);
}
void QGCToolWidget::setMainMenuAction(QAction* action)
{
this->mainMenuAction = action;
......
......@@ -86,6 +86,7 @@ protected slots:
void addAction();
void addCommand();
void setTitle();
void setTitle(QString title);
private:
......
......@@ -15,32 +15,24 @@ MAV2DIcon::MAV2DIcon(mapcontrol::MapGraphicItem* map,mapcontrol::OPMapWidget* pa
selected(uas->getSelected()),
uasid(uas->getUASID())
{
//connect
size = QSize(radius, radius);
mypen = new QPen(uas->getColor());
drawIcon(mypen);
pic = QPixmap(size);
drawIcon();
}
MAV2DIcon::MAV2DIcon(mapcontrol::MapGraphicItem* map, mapcontrol::OPMapWidget* parent, qreal lat, qreal lon, qreal alt, QPen* pen)
MAV2DIcon::MAV2DIcon(mapcontrol::MapGraphicItem* map, mapcontrol::OPMapWidget* parent, qreal lat, qreal lon, qreal alt, QColor color)
: UAVItem(map,parent),
radius(20),
type(0),
airframe(0),
iconColor(Qt::yellow),
iconColor(color),
selected(false),
uasid(0)
{
if (pen == NULL)
{
mypen = new QPen(Qt::red);
drawIcon(mypen);
}
else
{
drawIcon(pen);
}
size = QSize(radius, radius);
SetUAVPos(internals::PointLatLng(lat, lon), alt);
pic = QPixmap(size);
drawIcon();
SetUAVPos(internals::PointLatLng(lat, lon), alt, color);
}
MAV2DIcon::~MAV2DIcon()
......@@ -48,19 +40,10 @@ MAV2DIcon::~MAV2DIcon()
//delete pic;
}
void MAV2DIcon::setPen(QPen* pen)
{
if (pen != NULL)
{
mypen = pen;
drawIcon(pen);
}
}
void MAV2DIcon::setSelectedUAS(bool selected)
{
this->selected = selected;
drawIcon(mypen);
drawIcon();
}
/**
......@@ -78,14 +61,13 @@ void MAV2DIcon::setYaw(float yaw)
if (diff > 0.1f) {
this->yaw = yaw;
drawIcon(mypen);
drawIcon();
// FIXME
}
}
void MAV2DIcon::drawIcon(QPen* pen)
void MAV2DIcon::drawIcon()
{
Q_UNUSED(pen);
pic.fill(Qt::transparent);
QPainter painter(&pic);
painter.setRenderHint(QPainter::TextAntialiasing);
......@@ -98,21 +80,19 @@ void MAV2DIcon::drawIcon(QPen* pen)
painter.translate(radius/2, radius/2);
// Draw selected indicator
painter.setBrush(Qt::NoBrush);
if (selected) {
// qDebug() << "SYSTEM IS NOW SELECTED";
// QColor color(Qt::yellow);
// color.setAlpha(0.3f);
painter.setBrush(Qt::NoBrush);
// QPen selPen(color);
// int width = 5;
// selPen.setWidth(width);
QPen pen(Qt::yellow);
pen.setWidth(2);
painter.setPen(pen);
painter.drawEllipse(QPoint(0, 0), radius/2-1, radius/2-1);
//qDebug() << "Painting ellipse" << radius/2-width << width;
//selPen->deleteLater();
}
else
{
QPen pen(Qt::white);
pen.setWidth(1);
painter.setPen(pen);
}
painter.drawEllipse(QPoint(0, 0), radius/2-1, radius/2-1);
drawAirframePolygon(airframe, painter, radius, iconColor, yaw);
}
......
......@@ -27,7 +27,7 @@ public:
* @param alignment alignment (Middle or TopLeft)
* @param pen QPen for drawing
*/
MAV2DIcon(mapcontrol::MapGraphicItem* map,mapcontrol::OPMapWidget* parent, UASInterface* uas, int radius = 10, int type=0);
MAV2DIcon(mapcontrol::MapGraphicItem* map,mapcontrol::OPMapWidget* parent, UASInterface* uas, int radius = 40, int type=0);
/*!
*
......@@ -37,18 +37,10 @@ public:
* @param alignment alignment (Middle or TopLeft)
* @param pen QPen for drawing
*/
MAV2DIcon(mapcontrol::MapGraphicItem* map,mapcontrol::OPMapWidget* parent, qreal lat=0, qreal lon=0, qreal alt=0, QPen* pen=0);
MAV2DIcon(mapcontrol::MapGraphicItem* map,mapcontrol::OPMapWidget* parent, qreal lat=0, qreal lon=0, qreal alt=0, QColor color=QColor());
virtual ~MAV2DIcon();
//! sets the QPen which is used for drawing the circle
/*!
* A QPen can be used to modify the look of the drawn circle
* @param pen the QPen which should be used for drawing
* @see http://doc.trolltech.com/4.3/qpen.html
*/
virtual void setPen(QPen* pen);
/** @brief Mark this system as selected */
void setSelectedUAS(bool selected);
void setYaw(float yaw);
......@@ -62,10 +54,7 @@ public:
return uasid;
}
void drawIcon(QPen* pen);
void drawIcon() {
drawIcon(mypen);
}
void drawIcon();
static void drawAirframePolygon(int airframe, QPainter& painter, int radius, QColor& iconColor, float yaw);
protected:
......@@ -76,7 +65,6 @@ protected:
QColor iconColor; ///< Color to be used for the icon
bool selected; ///< Wether this is the system currently in focus
int uasid; ///< ID of tracked system
QPen* mypen;
QSize size;
};
......
......@@ -42,11 +42,11 @@ public:
protected:
mapcontrol::OPMapWidget* parent; ///< Parent widget
int radius; ///< Radius / diameter of the icon in pixels
Waypoint* waypoint; ///< Waypoint data container this icon represents
QColor color;
int radius; ///< Radius / diameter of the icon in pixels
bool showAcceptanceRadius;
bool showOrbit;
QColor color;
// QSize size;
};
......
QT += net
TEMPLATE = app
TARGET = qgroundcontrol-server
BASEDIR = ../..
BUILDDIR = $$BASEDIR/build/qgroundcontrol-server
LANGUAGE = C++
CONFIG += release
CONFIG -= debug
OBJECTS_DIR = $$BUILDDIR/qgroundcontrol-server/obj
MOC_DIR = $$BUILDDIR/qgroundcontrol-server/moc
macx:DESTDIR = $$BASEDIR/bin/mac
INCLUDEPATH += $$BASEDIR/. \
$$BASEDIR/src \
$$BASEDIR/src/comm \
$$BASEDIR/standalone/qgroundcontrol-server/src
HEADERS += src/QGroundControlServer.h \
$$BASEDIR/src/comm/MAVLinkProtocol.h
SOURCES += src/main.cc \
src/QGroundControlServer.cc \
$$BASEDIR/src/comm/MAVLinkProtocol.cc
RESOURCES = $$BASEDIR/mavground.qrc
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch>
This file is part of the PIXHAWK project
PIXHAWK 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.
PIXHAWK 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 PIXHAWK. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of class MAVLinkGen
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef MAVLINKGEN_H
#define MAVLINKGEN_H
#include <QApplication>
/**
* @brief The main application and management class.
*
* This class is started by the main method and provides
* the central management unit of the groundstation application.
*
**/
class MAVLinkGen : public QApplication
{
Q_OBJECT
public:
MAVLinkGen(int &argc, char* argv[]);
~MAVLinkGen();
protected:
private:
};
#endif /* MAVLINKGEN_H */
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch>
This file is part of the PIXHAWK project
PIXHAWK 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.
PIXHAWK 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 PIXHAWK. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Main executable
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#include <QtGui/QApplication>
#include "MAVLinkGen.h"
/**
* @brief Starts the application
*
* @param argc Number of commandline arguments
* @param argv Commandline arguments
* @return exit code, 0 for normal exit and !=0 for error cases
*/
int main(int argc, char *argv[])
{
MAVLinkGen gen(argc, argv);
return gen.exec();
}
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