Commit 3ae6d915 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #4465 from AlexeyBulatov/pr/autoconnect

Auto connect on start for UDP links
parents d02b8cc9 2d75a33c
......@@ -439,6 +439,9 @@ bool QGCApplication::_initForNormalAppBoot(void)
"Your saved settings have been reset to defaults.");
}
// Connect links with flag AutoconnectLink
toolbox()->linkManager()->startAutoConnectedLinks();
if (getQGCMapEngine()->wasCacheReset()) {
showMessage("The Offline Map Cache database has been upgraded. "
"Your old map cache sets have been reset.");
......
......@@ -104,7 +104,6 @@ public:
void loadSettings (QSettings& settings, const QString& root);
void saveSettings (QSettings& settings, const QString& root);
void updateSettings ();
bool isAutoConnectAllowed () { return false; }
QString settingsURL () { return "BluetoothSettings.qml"; }
public slots:
......
......@@ -93,7 +93,7 @@ public:
* Is Auto Connect allowed for this type?
* @return True if this type can be set as an Auto Connect configuration
*/
virtual bool isAutoConnectAllowed() { return true; }
virtual bool isAutoConnectAllowed() { return false; }
/*!
* @brief Connection type
......
......@@ -990,3 +990,14 @@ QList<LinkInterface*> LinkManager::links(void)
return rawLinks;
}
void LinkManager::startAutoConnectedLinks(void)
{
SharedLinkConfigurationPointer conf;
for(int i = 0; i < _sharedConfigurations.count(); i++) {
conf = _sharedConfigurations[i];
if (conf->isAutoConnect())
createConnectedLink(conf);
}
}
......@@ -171,6 +171,8 @@ public:
SharedLinkConfigurationPointer addConfiguration(LinkConfiguration* config);
void startAutoConnectedLinks(void);
signals:
void autoconnectUDPChanged (bool autoconnect);
void autoconnectPixhawkChanged (bool autoconnect);
......
......@@ -40,7 +40,6 @@ public:
void loadSettings (QSettings& settings, const QString& root);
void saveSettings (QSettings& settings, const QString& root);
void updateSettings ();
bool isAutoConnectAllowed () { return false; }
QString settingsURL () { return "LogReplaySettings.qml"; }
signals:
void fileNameChanged();
......
......@@ -131,12 +131,13 @@ public:
QStringList hostList () { return _hostList; }
/// From LinkConfiguration
LinkType type () { return LinkConfiguration::TypeUdp; }
void copyFrom (LinkConfiguration* source);
void loadSettings (QSettings& settings, const QString& root);
void saveSettings (QSettings& settings, const QString& root);
void updateSettings ();
QString settingsURL () { return "UdpSettings.qml"; }
LinkType type () { return LinkConfiguration::TypeUdp; }
void copyFrom (LinkConfiguration* source);
void loadSettings (QSettings& settings, const QString& root);
void saveSettings (QSettings& settings, const QString& root);
void updateSettings ();
bool isAutoConnectAllowed () { return true; }
QString settingsURL () { return "UdpSettings.qml"; }
signals:
void localPortChanged ();
......
......@@ -271,12 +271,11 @@ Rectangle {
height: ScreenTools.defaultFontPixelHeight * 0.5
width: parent.width
}
/*
//-- Auto Connect
//-- Auto Connect on Start
QGCCheckBox {
text: "Automatically Connect on Start"
checked: false
enabled: editConfig ? editConfig.autoConnectAllowed : false
visible: editConfig ? editConfig.autoConnectAllowed : false
onCheckedChanged: {
if(editConfig) {
editConfig.autoConnect = checked
......@@ -287,7 +286,6 @@ Rectangle {
checked = editConfig.autoConnect
}
}
*/
Item {
height: ScreenTools.defaultFontPixelHeight
width: parent.width
......
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