Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
4e1c7dcf
Commit
4e1c7dcf
authored
Dec 12, 2010
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved application persistence
parent
73436f42
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
9 deletions
+92
-9
Core.cc
src/Core.cc
+3
-0
SerialLink.cc
src/comm/SerialLink.cc
+31
-6
UAS.cc
src/uas/UAS.cc
+4
-3
MainWindow.cc
src/ui/MainWindow.cc
+48
-0
MainWindow.h
src/ui/MainWindow.h
+3
-0
SerialConfigurationWindow.cc
src/ui/SerialConfigurationWindow.cc
+1
-0
XMLCommProtocolWidget.cc
src/ui/XMLCommProtocolWidget.cc
+2
-0
No files found.
src/Core.cc
View file @
4e1c7dcf
...
@@ -157,6 +157,9 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
...
@@ -157,6 +157,9 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
**/
**/
Core
::~
Core
()
Core
::~
Core
()
{
{
mainWindow
->
storeSettings
();
mainWindow
->
hide
();
mainWindow
->
deleteLater
();
// Delete singletons
// Delete singletons
delete
LinkManager
::
instance
();
delete
LinkManager
::
instance
();
delete
UASManager
::
instance
();
delete
UASManager
::
instance
();
...
...
src/comm/SerialLink.cc
View file @
4e1c7dcf
...
@@ -30,9 +30,11 @@ This file is part of the QGROUNDCONTROL project
...
@@ -30,9 +30,11 @@ This file is part of the QGROUNDCONTROL project
#include <QTimer>
#include <QTimer>
#include <QDebug>
#include <QDebug>
#include <QSettings>
#include <QMutexLocker>
#include <QMutexLocker>
#include "SerialLink.h"
#include "SerialLink.h"
#include "LinkManager.h"
#include "LinkManager.h"
#include "QGC.h"
#include <MG.h>
#include <MG.h>
#ifdef _WIN32
#ifdef _WIN32
#include "windows.h"
#include "windows.h"
...
@@ -54,12 +56,26 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
...
@@ -54,12 +56,26 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
#endif
#endif
// Set unique ID and add link to the list of links
// Set unique ID and add link to the list of links
this
->
id
=
getNextLinkId
();
this
->
id
=
getNextLinkId
();
// Load defaults from settings
QSettings
settings
(
QGC
::
COMPANYNAME
,
QGC
::
APPNAME
);
if
(
settings
.
contains
(
"SERIALLINK_COMM_PORT"
))
{
this
->
porthandle
=
settings
.
value
(
"SERIALLINK_COMM_PORT"
).
toString
();
setBaudRate
(
settings
.
value
(
"SERIALLINK_COMM_BAUD"
).
toInt
());
setParityType
(
settings
.
value
(
"SERIALLINK_COMM_PARITY"
).
toInt
());
setStopBitsType
(
settings
.
value
(
"SERIALLINK_COMM_STOPBITS"
).
toInt
());
setDataBitsType
(
settings
.
value
(
"SERIALLINK_COMM_DATABITS"
).
toInt
());
}
else
{
this
->
baudrate
=
baudrate
;
this
->
baudrate
=
baudrate
;
this
->
flow
=
flow
;
this
->
flow
=
flow
;
this
->
parity
=
parity
;
this
->
parity
=
parity
;
this
->
dataBits
=
dataBits
;
this
->
dataBits
=
dataBits
;
this
->
stopBits
=
stopBits
;
this
->
stopBits
=
stopBits
;
this
->
timeout
=
1
;
///< The timeout controls how long the program flow should wait for new serial bytes. As we're polling, we don't want to wait at all.
this
->
timeout
=
1
;
///< The timeout controls how long the program flow should wait for new serial bytes. As we're polling, we don't want to wait at all.
}
// Set the port name
// Set the port name
if
(
porthandle
==
""
)
if
(
porthandle
==
""
)
...
@@ -282,6 +298,15 @@ bool SerialLink::connect()
...
@@ -282,6 +298,15 @@ bool SerialLink::connect()
**/
**/
bool
SerialLink
::
hardwareConnect
()
bool
SerialLink
::
hardwareConnect
()
{
{
// Store settings
QSettings
settings
(
QGC
::
COMPANYNAME
,
QGC
::
APPNAME
);
settings
.
setValue
(
"SERIALLINK_COMM_PORT"
,
this
->
porthandle
);
settings
.
setValue
(
"SERIALLINK_COMM_BAUD"
,
this
->
baudrate
);
settings
.
setValue
(
"SERIALLINK_COMM_PARITY"
,
this
->
parity
);
settings
.
setValue
(
"SERIALLINK_COMM_STOPBITS"
,
this
->
stopBits
);
settings
.
setValue
(
"SERIALLINK_COMM_DATABITS"
,
this
->
dataBits
);
settings
.
sync
();
QObject
::
connect
(
port
,
SIGNAL
(
aboutToClose
()),
this
,
SIGNAL
(
disconnected
()));
QObject
::
connect
(
port
,
SIGNAL
(
aboutToClose
()),
this
,
SIGNAL
(
disconnected
()));
port
->
open
(
QIODevice
::
ReadWrite
);
port
->
open
(
QIODevice
::
ReadWrite
);
...
...
src/uas/UAS.cc
View file @
4e1c7dcf
...
@@ -365,9 +365,10 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
...
@@ -365,9 +365,10 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
positionLock
=
true
;
positionLock
=
true
;
// Send to patch antenna
// Send to patch antenna
mavlink_message_t
msg
;
// FIXME Message re-routing should be implemented differently
mavlink_msg_global_position_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
pos
.
usec
,
pos
.
lat
,
pos
.
lon
,
pos
.
alt
,
pos
.
vx
,
pos
.
vy
,
pos
.
vz
);
//mavlink_message_t msg;
sendMessage
(
msg
);
//mavlink_msg_global_position_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, pos.usec, pos.lat, pos.lon, pos.alt, pos.vx, pos.vy, pos.vz);
//sendMessage(msg);
}
}
break
;
break
;
case
MAVLINK_MSG_ID_GPS_RAW
:
case
MAVLINK_MSG_ID_GPS_RAW
:
...
...
src/ui/MainWindow.cc
View file @
4e1c7dcf
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include <QHostInfo>
#include <QHostInfo>
#include "MG.h"
#include "MG.h"
#include "QGC.h"
#include "MAVLinkSimulationLink.h"
#include "MAVLinkSimulationLink.h"
#include "SerialLink.h"
#include "SerialLink.h"
#include "UDPLink.h"
#include "UDPLink.h"
...
@@ -89,6 +90,32 @@ MainWindow::MainWindow(QWidget *parent) :
...
@@ -89,6 +90,32 @@ MainWindow::MainWindow(QWidget *parent) :
// QMenu* centerMenu = createCenterWidgetMenu();
// QMenu* centerMenu = createCenterWidgetMenu();
// centerMenu->setTitle("Center");
// centerMenu->setTitle("Center");
// ui.menuBar->addMenu(centerMenu);
// ui.menuBar->addMenu(centerMenu);
// Load previous widget setup
// FIXME WORK IN PROGRESS
QSettings
settings
(
QGC
::
COMPANYNAME
,
QGC
::
APPNAME
);
QList
<
QDockWidget
*>
dockwidgets
=
qFindChildren
<
QDockWidget
*>
(
this
);
if
(
dockwidgets
.
size
())
{
settings
.
beginGroup
(
"mainwindow/dockwidgets"
);
for
(
int
i
=
0
;
i
<
dockwidgets
.
size
();
++
i
)
{
QDockWidget
*
dockWidget
=
dockwidgets
.
at
(
i
);
if
(
dockWidget
->
parentWidget
()
==
this
)
{
if
(
settings
.
contains
(
dockWidget
->
windowTitle
()))
{
dockWidget
->
setVisible
(
settings
.
value
(
dockWidget
->
windowTitle
(),
dockWidget
->
isVisible
()).
toBool
());
}
}
}
settings
.
endGroup
();
}
this
->
show
();
this
->
show
();
}
}
...
@@ -98,6 +125,27 @@ MainWindow::~MainWindow()
...
@@ -98,6 +125,27 @@ MainWindow::~MainWindow()
statusBar
=
NULL
;
statusBar
=
NULL
;
}
}
void
MainWindow
::
storeSettings
()
{
QSettings
settings
(
QGC
::
COMPANYNAME
,
QGC
::
APPNAME
);
QList
<
QDockWidget
*>
dockwidgets
=
qFindChildren
<
QDockWidget
*>
(
this
);
if
(
dockwidgets
.
size
())
{
settings
.
beginGroup
(
"mainwindow/dockwidgets"
);
for
(
int
i
=
0
;
i
<
dockwidgets
.
size
();
++
i
)
{
QDockWidget
*
dockWidget
=
dockwidgets
.
at
(
i
);
if
(
dockWidget
->
parentWidget
()
==
this
)
{
settings
.
setValue
(
dockWidget
->
windowTitle
(),
QVariant
(
dockWidget
->
isVisible
()));
}
}
settings
.
endGroup
();
}
settings
.
sync
();
}
QMenu
*
MainWindow
::
createCenterWidgetMenu
()
QMenu
*
MainWindow
::
createCenterWidgetMenu
()
{
{
QMenu
*
menu
=
NULL
;
QMenu
*
menu
=
NULL
;
...
...
src/ui/MainWindow.h
View file @
4e1c7dcf
...
@@ -87,6 +87,9 @@ public:
...
@@ -87,6 +87,9 @@ public:
~
MainWindow
();
~
MainWindow
();
public
slots
:
public
slots
:
/** @brief Store the mainwindow settings */
void
storeSettings
();
/**
/**
* @brief Shows a status message on the bottom status bar
* @brief Shows a status message on the bottom status bar
*
*
...
...
src/ui/SerialConfigurationWindow.cc
View file @
4e1c7dcf
...
@@ -33,6 +33,7 @@ This file is part of the QGROUNDCONTROL project
...
@@ -33,6 +33,7 @@ This file is part of the QGROUNDCONTROL project
#include <SerialConfigurationWindow.h>
#include <SerialConfigurationWindow.h>
#include <SerialLinkInterface.h>
#include <SerialLinkInterface.h>
#include <QDir>
#include <QDir>
#include <QSettings>
#include <QFileInfoList>
#include <QFileInfoList>
#ifdef _WIN32
#ifdef _WIN32
#include <QextSerialEnumerator.h>
#include <QextSerialEnumerator.h>
...
...
src/ui/XMLCommProtocolWidget.cc
View file @
4e1c7dcf
...
@@ -57,6 +57,7 @@ void XMLCommProtocolWidget::selectXMLFile()
...
@@ -57,6 +57,7 @@ void XMLCommProtocolWidget::selectXMLFile()
setXML
(
instanceText
);
setXML
(
instanceText
);
// Store filename for next time
// Store filename for next time
settings
.
setValue
(
mavlinkXML
,
QFileInfo
(
file
).
absoluteFilePath
());
settings
.
setValue
(
mavlinkXML
,
QFileInfo
(
file
).
absoluteFilePath
());
settings
.
sync
();
}
}
else
else
{
{
...
@@ -112,6 +113,7 @@ void XMLCommProtocolWidget::selectOutputDirectory()
...
@@ -112,6 +113,7 @@ void XMLCommProtocolWidget::selectOutputDirectory()
m_ui
->
outputDirNameLabel
->
setText
(
fileNames
.
first
());
m_ui
->
outputDirNameLabel
->
setText
(
fileNames
.
first
());
// Store directory for next time
// Store directory for next time
settings
.
setValue
(
mavlinkOutputDir
,
QFileInfo
(
fileNames
.
first
()).
absoluteFilePath
());
settings
.
setValue
(
mavlinkOutputDir
,
QFileInfo
(
fileNames
.
first
()).
absoluteFilePath
());
settings
.
sync
();
//QFile file(fileName);
//QFile file(fileName);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment