1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-22 12:54:14 +01:00

OP37/GCS MapLib - Various fixes to improve stability, created diagnostics screen available from maps context menu.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2674 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
zedamota 2011-02-01 18:18:29 +00:00 committed by zedamota
parent 12cdec0ae7
commit 8c5fe506b3
16 changed files with 2791 additions and 2601 deletions

View File

@ -15,7 +15,8 @@ SOURCES += opmaps.cpp \
placemark.cpp \ placemark.cpp \
point.cpp \ point.cpp \
size.cpp \ size.cpp \
kibertilecache.cpp kibertilecache.cpp \
diagnostics.cpp
HEADERS += opmaps.h \ HEADERS += opmaps.h \
size.h \ size.h \
maptype.h \ maptype.h \
@ -35,4 +36,5 @@ HEADERS += opmaps.h \
placemark.h \ placemark.h \
point.h \ point.h \
kibertilecache.h \ kibertilecache.h \
debugheader.h debugheader.h \
diagnostics.h

View File

@ -0,0 +1,31 @@
/**
******************************************************************************
*
* @file diagnostics.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "diagnostics.h"
diagnostics::diagnostics():networkerrors(0),emptytiles(0),timeouts(0),runningThreads(0)
{
}

View File

@ -0,0 +1,43 @@
/**
******************************************************************************
*
* @file diagnostics.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DIAGNOSTICS_H
#define DIAGNOSTICS_H
#include <QString>
struct diagnostics
{
diagnostics();
int networkerrors;
int emptytiles;
int timeouts;
int runningThreads;
QString toString()
{
return QString("Network errors:%1\nEmpty Tiles:%2\nTimeOuts:%3\nRunningThreads:%4").arg(networkerrors).arg(emptytiles).arg(timeouts).arg(runningThreads);
}
};
#endif // DIAGNOSTICS_H

View File

@ -199,9 +199,20 @@ namespace core {
q.exec(); q.exec();
if(!tT.isActive()){ if(!tT.isActive()){
errorvars.lock();
++diag.timeouts;
errorvars.unlock();
return ret; return ret;
} }
tT.stop(); tT.stop();
if( (reply->error()!=QNetworkReply::NoError))
{
errorvars.lock();
++diag.networkerrors;
errorvars.unlock();
reply->deleteLater();
return ret;
}
ret=reply->readAll(); ret=reply->readAll();
reply->deleteLater();//TODO can't this be global?? reply->deleteLater();//TODO can't this be global??
if(ret.isEmpty()) if(ret.isEmpty())
@ -209,6 +220,9 @@ namespace core {
#ifdef DEBUG_GMAPS #ifdef DEBUG_GMAPS
qDebug()<<"Invalid Tile"; qDebug()<<"Invalid Tile";
#endif //DEBUG_GMAPS #endif //DEBUG_GMAPS
errorvars.lock();
++diag.emptytiles;
errorvars.unlock();
return ret; return ret;
} }
#ifdef DEBUG_GMAPS #ifdef DEBUG_GMAPS
@ -247,4 +261,14 @@ namespace core {
{ {
return Cache::Instance()->ImageCache.ExportMapDataToDB(file,Cache::Instance()->ImageCache.GtileCache()+QDir::separator()+"Data.qmdb"); return Cache::Instance()->ImageCache.ExportMapDataToDB(file,Cache::Instance()->ImageCache.GtileCache()+QDir::separator()+"Data.qmdb");
} }
diagnostics OPMaps::GetDiagnostics()
{
diagnostics i;
errorvars.lock();
i=diag;
errorvars.unlock();
return i;
} }
}

View File

@ -39,6 +39,7 @@
#include "pureimagecache.h" #include "pureimagecache.h"
#include "alllayersoftype.h" #include "alllayersoftype.h"
#include "urlfactory.h" #include "urlfactory.h"
#include "diagnostics.h"
//#include "point.h" //#include "point.h"
@ -68,6 +69,8 @@ namespace core {
AccessMode::Types GetAccessMode()const{return accessmode;} AccessMode::Types GetAccessMode()const{return accessmode;}
void setAccessMode(const AccessMode::Types& mode){accessmode=mode;} void setAccessMode(const AccessMode::Types& mode){accessmode=mode;}
int RetryLoadTile; int RetryLoadTile;
diagnostics GetDiagnostics();
private: private:
bool useMemoryCache; bool useMemoryCache;
LanguageType::Types Language; LanguageType::Types Language;
@ -75,12 +78,11 @@ namespace core {
// PureImageCache ImageCacheLocal;//TODO Criar acesso Get Set // PureImageCache ImageCacheLocal;//TODO Criar acesso Get Set
TileCacheQueue TileDBcacheQueue; TileCacheQueue TileDBcacheQueue;
OPMaps(); OPMaps();
OPMaps(OPMaps const&){} OPMaps(OPMaps const&){}
OPMaps& operator=(OPMaps const&){ return *this; } OPMaps& operator=(OPMaps const&){ return *this; }
static OPMaps* m_pInstance; static OPMaps* m_pInstance;
diagnostics diag;
QMutex errorvars;
protected: protected:
// MemoryCache TilesInMemory; // MemoryCache TilesInMemory;

View File

@ -194,6 +194,7 @@ namespace core {
qlonglong id=++ConnCounter; qlonglong id=++ConnCounter;
Mcounter.unlock(); Mcounter.unlock();
{ {
Mcounter.lock();
QSqlDatabase cn; QSqlDatabase cn;
cn = QSqlDatabase::addDatabase("QSQLITE",QString::number(id)); cn = QSqlDatabase::addDatabase("QSQLITE",QString::number(id));
QString db=gtilecache+"Data.qmdb"; QString db=gtilecache+"Data.qmdb";
@ -219,30 +220,30 @@ namespace core {
} }
cn.close(); cn.close();
} }
Mcounter.unlock();
} }
QSqlDatabase::removeDatabase(QString::number(id)); QSqlDatabase::removeDatabase(QString::number(id));
return true; return true;
} }
QByteArray PureImageCache::GetImageFromCache(MapType::Types type, Point pos, int zoom) QByteArray PureImageCache::GetImageFromCache(MapType::Types type, Point pos, int zoom)
{ {
bool ret=true;
QByteArray ar; QByteArray ar;
QString dir=gtilecache; QString dir=gtilecache;
Mcounter.lock(); Mcounter.lock();
qlonglong id=++ConnCounter; qlonglong id=++ConnCounter;
Mcounter.unlock(); Mcounter.unlock();
#ifdef DEBUG_PUREIMAGECACHE #ifdef DEBUG_PUREIMAGECACHE
// qDebug()<<"Cache dir="<<dir<<" Try to GET:"<<pos.X()+","+pos.Y(); qDebug()<<"Cache dir="<<dir<<" Try to GET:"<<pos.X()+","+pos.Y();
#endif //DEBUG_PUREIMAGECACHE #endif //DEBUG_PUREIMAGECACHE
{ {
QString db=dir+"Data.qmdb"; QString db=dir+"Data.qmdb";
ret=QFileInfo(db).exists();
if(ret)
{ {
Mcounter.lock();
QSqlDatabase cn; QSqlDatabase cn;
cn = QSqlDatabase::addDatabase("QSQLITE",QString::number(id)); cn = QSqlDatabase::addDatabase("QSQLITE",QString::number(id));
cn.setDatabaseName(db); cn.setDatabaseName(db);
if(cn.open()) if(cn.open())
{ {
@ -252,15 +253,12 @@ namespace core {
query.next(); query.next();
if(query.isValid()) if(query.isValid())
{ {
ar=query.value(0).toByteArray(); ar=query.value(0).toByteArray();
} }
} }
cn.close(); cn.close();
} }
Mcounter.unlock();
} }
} }
QSqlDatabase::removeDatabase(QString::number(id)); QSqlDatabase::removeDatabase(QString::number(id));

View File

@ -49,9 +49,6 @@ UrlFactory::UrlFactory()
isCorrectedGoogleVersions = false; isCorrectedGoogleVersions = false;
UseGeocoderCache=true; UseGeocoderCache=true;
UsePlacemarkCache=true; UsePlacemarkCache=true;
// timer.setSingleShot(true);
} }
UrlFactory::~UrlFactory() UrlFactory::~UrlFactory()
{ {
@ -98,6 +95,12 @@ void UrlFactory::TryCorrectGoogleVersions()
QNetworkReply *reply; QNetworkReply *reply;
QNetworkRequest qheader; QNetworkRequest qheader;
QNetworkAccessManager network; QNetworkAccessManager network;
QEventLoop q;
QTimer tT;
tT.setSingleShot(true);
connect(&network, SIGNAL(finished(QNetworkReply*)),
&q, SLOT(quit()));
connect(&tT, SIGNAL(timeout()), &q, SLOT(quit()));
network.setProxy(Proxy); network.setProxy(Proxy);
#ifdef DEBUG_URLFACTORY #ifdef DEBUG_URLFACTORY
qDebug()<<"Correct GoogleVersion"; qDebug()<<"Correct GoogleVersion";
@ -108,23 +111,18 @@ void UrlFactory::TryCorrectGoogleVersions()
qheader.setUrl(QUrl(url)); qheader.setUrl(QUrl(url));
qheader.setRawHeader("User-Agent",UserAgent); qheader.setRawHeader("User-Agent",UserAgent);
reply=network.get(qheader); reply=network.get(qheader);
QTime time; tT.start(Timeout);
time.start(); q.exec();
while( (!(reply->isFinished()) || (time.elapsed()>(6*Timeout))) ){QCoreApplication::processEvents(QEventLoop::AllEvents);} if(!tT.isActive())
#ifdef DEBUG_URLFACTORY
qDebug()<<"Finished?"<<reply->error()<<" abort?"<<(time.elapsed()>Timeout*6);
#endif //DEBUG_URLFACTORY
if( (reply->error()!=QNetworkReply::NoError) | (time.elapsed()>Timeout*6))
{
#ifdef DEBUG_URLFACTORY
qDebug()<<"Try corrected version network error:";
#endif //DEBUG_URLFACTORY
return; return;
} tT.stop();
if( (reply->error()!=QNetworkReply::NoError))
{ {
#ifdef DEBUG_URLFACTORY #ifdef DEBUG_URLFACTORY
qDebug()<<"Try corrected version withou abort or error:"<<reply->errorString(); qDebug()<<"Try corrected version withou abort or error:"<<reply->errorString();
#endif //DEBUG_URLFACTORY #endif //DEBUG_URLFACTORY
return;
}
QString html=QString(reply->readAll()); QString html=QString(reply->readAll());
QRegExp reg("\"*http://mt0.google.com/vt/lyrs=m@(\\d*)",Qt::CaseInsensitive); QRegExp reg("\"*http://mt0.google.com/vt/lyrs=m@(\\d*)",Qt::CaseInsensitive);
if(reg.indexIn(html)!=-1) if(reg.indexIn(html)!=-1)
@ -154,9 +152,9 @@ void UrlFactory::TryCorrectGoogleVersions()
VersionGoogleSatellite = gc[1]; VersionGoogleSatellite = gc[1];
VersionGoogleSatelliteKorea = VersionGoogleSatellite; VersionGoogleSatelliteKorea = VersionGoogleSatellite;
VersionGoogleSatelliteChina = "s@" + VersionGoogleSatellite; VersionGoogleSatelliteChina = "s@" + VersionGoogleSatellite;
#ifdef DEBUG_URLFACTORY
qDebug()<<"TryCorrectGoogleVersions, VersionGoogleSatellite: "<<VersionGoogleSatellite; qDebug()<<"TryCorrectGoogleVersions, VersionGoogleSatellite: "<<VersionGoogleSatellite;
#endif //DEBUG_URLFACTORY
} }
reg=QRegExp("\"*http://mt0.google.com/vt/lyrs=t@(\\d*),r@(\\d*)",Qt::CaseInsensitive); reg=QRegExp("\"*http://mt0.google.com/vt/lyrs=t@(\\d*),r@(\\d*)",Qt::CaseInsensitive);
if(reg.indexIn(html)!=-1) if(reg.indexIn(html)!=-1)
@ -168,11 +166,12 @@ void UrlFactory::TryCorrectGoogleVersions()
qDebug()<<"TryCorrectGoogleVersions, VersionGoogleTerrain: "<<VersionGoogleTerrain; qDebug()<<"TryCorrectGoogleVersions, VersionGoogleTerrain: "<<VersionGoogleTerrain;
#endif //DEBUG_URLFACTORY #endif //DEBUG_URLFACTORY
} }
reply->deleteLater();
} }
reply->deleteLater();
}
} }
QString UrlFactory::MakeImageUrl(const MapType::Types &type,const Point &pos,const int &zoom,const QString &language) QString UrlFactory::MakeImageUrl(const MapType::Types &type,const Point &pos,const int &zoom,const QString &language)
{ {
#ifdef DEBUG_URLFACTORY #ifdef DEBUG_URLFACTORY

View File

@ -34,7 +34,7 @@ using namespace projections;
namespace internals { namespace internals {
Core::Core():MouseWheelZooming(false),currentPosition(0,0),currentPositionPixel(0,0),LastLocationInBounds(-1,-1),sizeOfMapArea(0,0) Core::Core():MouseWheelZooming(false),currentPosition(0,0),currentPositionPixel(0,0),LastLocationInBounds(-1,-1),sizeOfMapArea(0,0)
,minOfTiles(0,0),maxOfTiles(0,0),zoom(0),isDragging(false),TooltipTextPadding(10,10),loaderLimit(5),maxzoom(21),started(false) ,minOfTiles(0,0),maxOfTiles(0,0),zoom(0),isDragging(false),TooltipTextPadding(10,10),loaderLimit(5),maxzoom(21),started(false),runningThreads(0)
{ {
mousewheelzoomtype=MouseWheelZoomType::MousePositionAndCenter; mousewheelzoomtype=MouseWheelZoomType::MousePositionAndCenter;
SetProjection(new MercatorProjection()); SetProjection(new MercatorProjection());
@ -53,6 +53,9 @@ namespace internals {
void Core::run() void Core::run()
{ {
MrunningThreads.lock();
++runningThreads;
MrunningThreads.unlock();
#ifdef DEBUG_CORE #ifdef DEBUG_CORE
qlonglong debug; qlonglong debug;
Mdebug.lock(); Mdebug.lock();
@ -216,7 +219,19 @@ namespace internals {
emit OnTilesStillToLoad(tilesToload<0? 0:tilesToload); emit OnTilesStillToLoad(tilesToload<0? 0:tilesToload);
loaderLimit.release(); loaderLimit.release();
} }
MrunningThreads.lock();
--runningThreads;
MrunningThreads.unlock();
} }
diagnostics Core::GetDiagnostics()
{
MrunningThreads.lock();
diag=OPMaps::Instance()->GetDiagnostics();
diag.runningThreads=runningThreads;
MrunningThreads.unlock();
return diag;
}
void Core::SetZoom(const int &value) void Core::SetZoom(const int &value)
{ {
if (!isDragging) if (!isDragging)

View File

@ -49,6 +49,8 @@
#include "../internals/projections/platecarreeprojectionpergo.h" #include "../internals/projections/platecarreeprojectionpergo.h"
#include "../core/geodecoderstatus.h" #include "../core/geodecoderstatus.h"
#include "../core/opmaps.h" #include "../core/opmaps.h"
#include "../core/diagnostics.h"
#include <QSemaphore> #include <QSemaphore>
#include <QThread> #include <QThread>
#include <QDateTime> #include <QDateTime>
@ -190,7 +192,7 @@ public:
bool isStarted(){return started;} bool isStarted(){return started;}
diagnostics GetDiagnostics();
signals: signals:
void OnCurrentPositionChanged(internals::PointLatLng point); void OnCurrentPositionChanged(internals::PointLatLng point);
void OnTileLoadComplete(); void OnTileLoadComplete();
@ -257,6 +259,9 @@ private:
int tilesToload; int tilesToload;
int maxzoom; int maxzoom;
QMutex MrunningThreads;
int runningThreads;
diagnostics diag;
protected: protected:
bool started; bool started;

View File

@ -30,7 +30,7 @@
#include <QGraphicsItem> #include <QGraphicsItem>
#include "../internals/core.h" #include "../internals/core.h"
//#include "../internals/point.h" //#include "../internals/point.h"
#include "../core/diagnostics.h"
#include "configuration.h" #include "configuration.h"
#include <QtGui> #include <QtGui>
#include <QTransform> #include <QTransform>

View File

@ -19,8 +19,8 @@ LIBS += -L../build \
-linternals \ -linternals \
-lcore -lcore
TARGETDEPS += ../build/libcore.a POST_TARGETDEPS += ../build/libcore.a
TARGETDEPS += ../build/libinternals.a POST_TARGETDEPS += ../build/libinternals.a
HEADERS += mapgraphicitem.h \ HEADERS += mapgraphicitem.h \
opmapwidget.h \ opmapwidget.h \

View File

@ -33,7 +33,7 @@
namespace mapcontrol namespace mapcontrol
{ {
OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config):QGraphicsView(parent),configuration(config),UAV(0),GPS(0),Home(0),followmouse(true),compass(0),showuav(false),showhome(false) OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config):QGraphicsView(parent),configuration(config),UAV(0),GPS(0),Home(0),followmouse(true),compass(0),showuav(false),showhome(false),showDiag(false),diagGraphItem(0),diagTimer(0)
{ {
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
core=new internals::Core; core=new internals::Core;
@ -50,11 +50,35 @@ namespace mapcontrol
connect(map->core,SIGNAL(OnTileLoadComplete()),this,SIGNAL(OnTileLoadComplete())); connect(map->core,SIGNAL(OnTileLoadComplete()),this,SIGNAL(OnTileLoadComplete()));
connect(map->core,SIGNAL(OnTileLoadStart()),this,SIGNAL(OnTileLoadStart())); connect(map->core,SIGNAL(OnTileLoadStart()),this,SIGNAL(OnTileLoadStart()));
connect(map->core,SIGNAL(OnTilesStillToLoad(int)),this,SIGNAL(OnTilesStillToLoad(int))); connect(map->core,SIGNAL(OnTilesStillToLoad(int)),this,SIGNAL(OnTilesStillToLoad(int)));
SetShowDiagnostics(showDiag);
this->setMouseTracking(followmouse); this->setMouseTracking(followmouse);
SetShowCompass(true); SetShowCompass(true);
} }
void OPMapWidget::SetShowDiagnostics(bool const& value)
{
showDiag=value;
if(!showDiag)
{
if(diagGraphItem!=0)
{
delete diagGraphItem;
diagGraphItem=0;
}
if(diagTimer!=0)
{
delete diagTimer;
diagTimer=0;
}
}
else
{
diagTimer=new QTimer();
connect(diagTimer,SIGNAL(timeout()),this,SLOT(diagRefresh()));
diagTimer->start(500);
}
}
void OPMapWidget::SetShowUAV(const bool &value) void OPMapWidget::SetShowUAV(const bool &value)
{ {
if(value && UAV==0) if(value && UAV==0)
@ -264,6 +288,28 @@ namespace mapcontrol
connect(this,SIGNAL(WPNumberChanged(int,int,WayPointItem*)),item,SLOT(WPRenumbered(int,int,WayPointItem*))); connect(this,SIGNAL(WPNumberChanged(int,int,WayPointItem*)),item,SLOT(WPRenumbered(int,int,WayPointItem*)));
connect(this,SIGNAL(WPDeleted(int)),item,SLOT(WPDeleted(int))); connect(this,SIGNAL(WPDeleted(int)),item,SLOT(WPDeleted(int)));
} }
void OPMapWidget::diagRefresh()
{
if(showDiag)
{
if(diagGraphItem==0)
{
diagGraphItem=new QGraphicsTextItem();
mscene.addItem(diagGraphItem);
diagGraphItem->setPos(10,100);
diagGraphItem->setZValue(3);
diagGraphItem->setFlag(QGraphicsItem::ItemIsMovable,true);
diagGraphItem->setDefaultTextColor(Qt::yellow);
}
diagGraphItem->setPlainText(core->GetDiagnostics().toString());
}
else
if(diagGraphItem!=0)
{
delete diagGraphItem;
diagGraphItem=0;
}
}
////////////////////////////////////////////// //////////////////////////////////////////////
void OPMapWidget::SetShowCompass(const bool &value) void OPMapWidget::SetShowCompass(const bool &value)

View File

@ -31,6 +31,7 @@
#include "../core/geodecoderstatus.h" #include "../core/geodecoderstatus.h"
#include "../core/maptype.h" #include "../core/maptype.h"
#include "../core/languagetype.h" #include "../core/languagetype.h"
#include "../core/diagnostics.h"
#include "configuration.h" #include "configuration.h"
#include <QObject> #include <QObject>
#include <QtOpenGL/QGLWidget> #include <QtOpenGL/QGLWidget>
@ -346,6 +347,7 @@ namespace mapcontrol
bool ShowUAV()const{return showuav;} bool ShowUAV()const{return showuav;}
void SetShowHome(bool const& value); void SetShowHome(bool const& value);
bool ShowHome()const{return showhome;} bool ShowHome()const{return showhome;}
void SetShowDiagnostics(bool const& value);
private: private:
internals::Core *core; internals::Core *core;
MapGraphicItem *map; MapGraphicItem *map;
@ -360,6 +362,11 @@ namespace mapcontrol
QGraphicsSvgItem *compass; QGraphicsSvgItem *compass;
bool showuav; bool showuav;
bool showhome; bool showhome;
QTimer * diagTimer;
QGraphicsTextItem * diagGraphItem;
bool showDiag;
private slots:
void diagRefresh();
// WayPointItem* item;//apagar // WayPointItem* item;//apagar
protected: protected:
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);

View File

@ -463,6 +463,8 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(showCompassAct); menu.addAction(showCompassAct);
menu.addAction(showDiagnostics);
menu.addSeparator()->setText(tr("Zoom")); menu.addSeparator()->setText(tr("Zoom"));
menu.addAction(zoomInAct); menu.addAction(zoomInAct);
@ -1373,6 +1375,12 @@ void OPMapGadgetWidget::createActions()
showCompassAct->setChecked(true); showCompassAct->setChecked(true);
connect(showCompassAct, SIGNAL(toggled(bool)), this, SLOT(onShowCompassAct_toggled(bool))); connect(showCompassAct, SIGNAL(toggled(bool)), this, SLOT(onShowCompassAct_toggled(bool)));
showDiagnostics = new QAction(tr("Show Diagnostics"), this);
showDiagnostics->setStatusTip(tr("Show/Hide the diagnostics"));
showDiagnostics->setCheckable(true);
showDiagnostics->setChecked(false);
connect(showDiagnostics, SIGNAL(toggled(bool)), this, SLOT(onShowDiagnostics_toggled(bool)));
showHomeAct = new QAction(tr("Show Home"), this); showHomeAct = new QAction(tr("Show Home"), this);
showHomeAct->setStatusTip(tr("Show/Hide the Home location")); showHomeAct->setStatusTip(tr("Show/Hide the Home location"));
showHomeAct->setCheckable(true); showHomeAct->setCheckable(true);
@ -1614,6 +1622,14 @@ void OPMapGadgetWidget::onShowCompassAct_toggled(bool show)
m_map->SetShowCompass(show); m_map->SetShowCompass(show);
} }
void OPMapGadgetWidget::onShowDiagnostics_toggled(bool show)
{
if (!m_widget || !m_map)
return;
m_map->SetShowDiagnostics(show);
}
void OPMapGadgetWidget::onShowHomeAct_toggled(bool show) void OPMapGadgetWidget::onShowHomeAct_toggled(bool show)
{ {
if (!m_widget || !m_map) if (!m_widget || !m_map)

View File

@ -185,6 +185,7 @@ private slots:
void onCopyMouseLonToClipAct_triggered(); void onCopyMouseLonToClipAct_triggered();
// void onFindPlaceAct_triggered(); // void onFindPlaceAct_triggered();
void onShowCompassAct_toggled(bool show); void onShowCompassAct_toggled(bool show);
void onShowDiagnostics_toggled(bool show);
void onShowUAVAct_toggled(bool show); void onShowUAVAct_toggled(bool show);
void onShowHomeAct_toggled(bool show); void onShowHomeAct_toggled(bool show);
void onGoZoomInAct_triggered(); void onGoZoomInAct_triggered();
@ -265,6 +266,7 @@ private:
QAction *copyMouseLonToClipAct; QAction *copyMouseLonToClipAct;
QAction *findPlaceAct; QAction *findPlaceAct;
QAction *showCompassAct; QAction *showCompassAct;
QAction *showDiagnostics;
QAction *showHomeAct; QAction *showHomeAct;
QAction *showUAVAct; QAction *showUAVAct;
QAction *zoomInAct; QAction *zoomInAct;