Integrate Garmin Service warning

This commit is contained in:
Stefan Schake
2017-09-21 03:01:02 +02:00
parent dab0698932
commit 8b63dcffa4

View File

@@ -22,6 +22,7 @@
#include "ANT.h"
#include "ANTLogger.h"
#include "RealtimeData.h"
#include "GarminServiceHelper.h"
ANTlocalController::ANTlocalController(TrainSidebar *parent, DeviceConfiguration *dc) : RealtimeController(parent, dc)
{
@@ -64,6 +65,27 @@ ANTlocalController::setDevice(QString device)
int
ANTlocalController::start()
{
// Before we do the low level device opening, check for an active Garmin Service
if (GarminServiceHelper::isServiceRunning())
{
int dialogStatus = QMessageBox::warning(parent, tr("Found Garmin Express service"),
tr("The Garmin Express service is active on your computer.\n"
"This can block GoldenCheetah from accessing your ANT+ stick.\n\n"
"Do you want to temporarily disable the service?"),
QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok);
if (dialogStatus == QMessageBox::Ok)
{
if (!GarminServiceHelper::stopService())
{
// we failed to stop the service, tell the user
QMessageBox::critical(parent, tr("Failed stopping Garmin Express service"),
tr("GoldenCheetah failed to stop the Garmin Express service.\n"
"It might be necessary to manually disable it."));
}
}
}
logger->open();
myANTlocal->start();
myANTlocal->setup();