Skip to content

Commit 6055c11

Browse files
mbernasocchijef-n
authored andcommittedFeb 8, 2012
android goodies (pull request #94):
[Marco Bernasocchi] - adding needed files to support internal GPS via QtMobility, implementation of QgsQtLocationConnection is only a stub - cleaning up methods names - adding mobility to CMakeLists - testing - added hack to test parseData() - adding more parsing stuff - Adding debugging info and making connection fail if no QtSatellite datasource available - Initial working GPS with coordinates bug (values shifted) - Adding Initial GPS support to android using QtLocation - Adding Ground speed and direction - put ok button on top of widget to make it usable until scroll area is added (HACK to be Reverted later) - added vertical and horizontal accurancy - Removing test values qtlocationconnection - refactor debug messages - adding compass plugin - trying NathanW suggestion - adding new compass plugin - Fixed satellitesUpdated signals - removing setDataRate - temporarely removed calibrationLevel display to be reverted when https://sourceforge.net/p/necessitas/tickets/153/ is fixed - addin comment - making QLineEdits readonly - added calibration level support [Jürgen E. Fischer] - squashed, reindented and skipped some already addressed changes to qgisapp and vector layer provider
1 parent d2b5ed9 commit 6055c11

23 files changed

+1537
-100
lines changed
 

‎CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,17 @@ IF (WITH_BINDINGS)
8080
SET (BINDINGS_GLOBAL_INSTALL FALSE CACHE BOOL "Install bindings to global python directory? (might need root)")
8181
ENDIF (WITH_BINDINGS)
8282

83+
#BUILD WITH QtMobility by default on android only. Other platform can force it
84+
IF (ANDROID)
85+
SET (DEFAULT_WITH_QTMOBILITY TRUE)
86+
ELSE (ANDROID)
87+
SET (DEFAULT_WITH_QTMOBILITY FALSE)
88+
ENDIF (ANDROID)
89+
SET (WITH_QTMOBILITY ${DEFAULT_WITH_QTMOBILITY} CACHE BOOL "Determines QtMobility related code should be build (for example internal GPS)")
90+
IF (WITH_QTMOBILITY)
91+
FIND_PACKAGE(QtMobility 1.1.0)
92+
ENDIF (WITH_QTMOBILITY)
93+
8394
SET (WITH_GLOBE FALSE CACHE BOOL "Determines whether Globe plugin should be built")
8495
IF (WITH_GLOBE)
8596
SET(QT_USE_QTOPENGL 1)

‎cmake/FindQtMobility.cmake

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
INCLUDE(FindQt4)
2+
3+
set(MOBILITY_CONFIG_MKSPECS_FILE "")
4+
IF(EXISTS "${QT_MKSPECS_DIR}/features/mobilityconfig.prf")
5+
set(MOBILITY_CONFIG_MKSPECS_FILE "${QT_MKSPECS_DIR}/features/mobilityconfig.prf")
6+
ELSEIF(EXISTS "${QT_MKSPECS_DIR}/features/mobility.prf")
7+
set(MOBILITY_CONFIG_MKSPECS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmakes/mobilityconfig.prf")
8+
ENDIF()
9+
10+
macro(export_component component)
11+
IF(NOT ${MOBILITY_CONFIG_MKSPECS_FILE} STREQUAL "")
12+
FILE(READ ${MOBILITY_CONFIG_MKSPECS_FILE} MOBILITY_FILE_CONTENTS)
13+
STRING(TOLOWER ${component} _COMPONENT)
14+
IF(${MOBILITY_FILE_CONTENTS} MATCHES "MOBILITY_CONFIG=.*${_COMPONENT}.*")
15+
STRING(TOUPPER ${component} _COMPONENT)
16+
SET(QT_MOBILITY_${_COMPONENT}_FOUND 1)
17+
SET(QT_MOBILITY_${_COMPONENT}_INCLUDE_DIR ${QT_MOBILITY_PARENT_INCLUDE_DIR}/Qt${component})
18+
SET(QT_MOBILITY_${_COMPONENT}_LIBRARY Qt${component})
19+
ADD_DEFINITIONS(-DHAVE_QT_MOBILITY_${_COMPONENT})
20+
ENDIF()
21+
ENDIF()
22+
endmacro()
23+
24+
set(VERSION_INFO "")
25+
set(FEATURE_FILE_PREFIX "${QT_MKSPECS_DIR}/features/mobility")
26+
27+
if(DEFINED MOBILITY_VERSION)
28+
if(MOBILITY_VERSION STREQUAL "1.1" AND EXISTS "${FEATURE_FILE_PREFIX}11.prf")
29+
set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}11.prf")
30+
set(VERSION_INFO "1.1")
31+
elseif(MOBILITY_VERSION STREQUAL "1.2" AND EXISTS "${FEATURE_FILE_PREFIX}12.prf")
32+
set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}12.prf")
33+
set(VERSION_INFO "1.2")
34+
elseif(MOBILITY_VERSION STREQUAL "default" AND EXISTS "${FEATURE_FILE_PREFIX}.prf")
35+
set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}.prf")
36+
set(VERSION_INFO "system's default")
37+
else()
38+
message(STATUS "Couldn't find QtMobility version: ${MOBILITY_VERSION}")
39+
endif()
40+
endif()
41+
42+
if(NOT DEFINED MOBILITY_PRF_FILE)
43+
if(EXISTS "${FEATURE_FILE_PREFIX}.prf")
44+
set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}.prf")
45+
set(VERSION_INFO "system's default")
46+
elseif(EXISTS "${FEATURE_FILE_PREFIX}12.prf")
47+
set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}12.prf")
48+
set(VERSION_INFO "1.2")
49+
elseif(EXISTS "${FEATURE_FILE_PREFIX}11.prf")
50+
set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}11.prf")
51+
set(VERSION_INFO "1.1")
52+
else()
53+
message(FATAL_ERROR "Couldn't find any version of QtMobility.")
54+
endif()
55+
endif()
56+
57+
message(STATUS "Using QtMobility version: ${VERSION_INFO}")
58+
59+
IF(DEFINED MOBILITY_PRF_FILE)
60+
FILE(READ ${MOBILITY_PRF_FILE} MOBILITY_FILE_CONTENTS)
61+
62+
STRING(REGEX MATCH "MOBILITY_PREFIX=([^\n]+)" QT_MOBILITY_PREFIX "${MOBILITY_FILE_CONTENTS}")
63+
SET(QT_MOBILITY_PREFIX ${CMAKE_MATCH_1})
64+
65+
STRING(REGEX MATCH "MOBILITY_INCLUDE=([^\n]+)" QT_MOBILITY_INCLUDE_DIR "${MOBILITY_FILE_CONTENTS}")
66+
SET(QT_MOBILITY_INCLUDE_DIR ${CMAKE_MATCH_1})
67+
68+
STRING(REGEX MATCH "MOBILITY_LIB=([^\n]+)" "\\1" QT_MOBILITY_LIBRARY "${MOBILITY_FILE_CONTENTS}")
69+
SET(QT_MOBILITY_LIBRARY_DIR ${CMAKE_MATCH_1})
70+
71+
#VERSION
72+
IF(NOT ${MOBILITY_CONFIG_MKSPECS_FILE} STREQUAL "")
73+
FILE(READ ${MOBILITY_CONFIG_MKSPECS_FILE} MOBILITY_CONFIG_FILE_CONTENTS)
74+
STRING(REGEX MATCH "MOBILITY_VERSION = ([^\n]+)" QT_MOBILITY_VERSION "${MOBILITY_CONFIG_FILE_CONTENTS}")
75+
SET(QT_MOBILITY_VERSION ${CMAKE_MATCH_1})
76+
77+
STRING(REGEX MATCH "MOBILITY_MAJOR_VERSION = ([^\n]+)" QT_MOBILITY_MAJOR_VERSION "${MOBILITY_CONFIG_FILE_CONTENTS}")
78+
SET(QT_MOBILITY_MAJOR_VERSION ${CMAKE_MATCH_1})
79+
80+
STRING(REGEX MATCH "MOBILITY_MINOR_VERSION = ([^\n]+)" QT_MOBILITY_MINOR_VERSION "${MOBILITY_CONFIG_FILE_CONTENTS}")
81+
SET(QT_MOBILITY_MINOR_VERSION ${CMAKE_MATCH_1})
82+
83+
STRING(REGEX MATCH "MOBILITY_PATCH_VERSION = ([^\n]+)" QT_MOBILITY_PATCH_VERSION "${MOBILITY_CONFIG_FILE_CONTENTS}")
84+
SET(QT_MOBILITY_PATCH_VERSION ${CMAKE_MATCH_1})
85+
86+
message(STATUS "QtMobility version: ${QT_MOBILITY_VERSION}")
87+
ELSE()
88+
SET(QT_MOBILITY_VERSION 1.0.0)
89+
SET(QT_MOBILITY_MAJOR_VERSION 1)
90+
SET(QT_MOBILITY_MINOR_VERSION 0)
91+
SET(QT_MOBILITY_PATCH_VERSION 0)
92+
ENDIF()
93+
94+
SET(QT_MOBILITY_PARENT_INCLUDE_DIR ${QT_MOBILITY_INCLUDE_DIR})
95+
SET(QT_MOBILITY_INCLUDE_DIR ${QT_MOBILITY_INCLUDE_DIR}/QtMobility)
96+
97+
IF(QtMobility_FIND_VERSION_EXACT)
98+
IF(QT_MOBILITY_VERSION VERSION_EQUAL QtMobility_FIND_VERSION)
99+
SET(QT_MOBILITY_FOUND TRUE)
100+
ELSE()
101+
SET(QT_MOBILITY_FOUND FALSE)
102+
IF(QT_MOBILITY_VERSION VERSION_LESS QtMobility_FIND_VERSION)
103+
SET(QT_MOBILITY_TOO_OLD TRUE)
104+
ELSE()
105+
SET(QT_MOBILITY_TOO_NEW TRUE)
106+
ENDIF()
107+
ENDIF()
108+
ELSE()
109+
IF(QT_MOBILITY_VERSION VERSION_LESS QtMobility_FIND_VERSION)
110+
SET(QT_MOBILITY_FOUND FALSE)
111+
SET(QT_MOBILITY_TOO_OLD TRUE)
112+
ELSE()
113+
SET(QT_MOBILITY_FOUND TRUE)
114+
ENDIF()
115+
ENDIF()
116+
ELSE()
117+
SET(QT_MOBILITY_FOUND NOTFOUND)
118+
SET(QT_MOBILITY_PREFIX NOTFOUND)
119+
SET(QT_MOBILITY_INCLUDE NOTFOUND)
120+
SET(QT_MOBILITY_LIB NOTFOUND)
121+
ENDIF()
122+
123+
IF(NOT QT_MOBILITY_FOUND)
124+
if(QT_MOBILITY_TOO_OLD)
125+
MESSAGE(FATAL_ERROR "The installed QtMobility version ${QT_MOBILITY_VERSION} it too old, version ${QtMobility_FIND_VERSION} is required.")
126+
ELSEIF(QT_MOBILITY_TOO_NEW)
127+
MESSAGE(FATAL_ERROR "The installed QtMobility version ${QT_MOBILITY_VERSION} it too new, version ${QtMobility_FIND_VERSION} is required.")
128+
ELSE()
129+
MESSAGE(FATAL_ERROR "QtMobility not found.")
130+
ENDIF()
131+
ELSE()
132+
INCLUDE_DIRECTORIES(${QT_MOBILITY_INCLUDE_DIR})
133+
export_component(Bearer)
134+
export_component(Feedback)
135+
export_component(Gallery)
136+
export_component(PublishSubscribe)
137+
export_component(Location)
138+
export_component(Organizer)
139+
export_component(ServiceFramework)
140+
export_component(SystemInfo)
141+
export_component(Contacts)
142+
export_component(Connectivity)
143+
export_component(Messaging)
144+
export_component(Versit)
145+
export_component(Sensors)
146+
# VersitOrganizer
147+
if(QT_MOBILITY_VERSIT_FOUND AND QT_MOBILITY_ORGANIZER_FOUND)
148+
SET(QT_MOBILITY_VERSITORGANIZER_FOUND 1)
149+
SET(QT_MOBILITY_VERSITORGANIZER_INCLUDE_DIR ${QT_MOBILITY_PARENT_INCLUDE_DIR}/QtVersitOrganizer)
150+
SET(QT_MOBILITY_VERSITORGANIZER_LIBRARY QtVersitOrganizer)
151+
endif()
152+
153+
# MultimediaKit - it's just 'multimedia' in the .prf file.
154+
IF(NOT ${MOBILITY_CONFIG_MKSPECS_FILE} STREQUAL "")
155+
FILE(READ ${MOBILITY_CONFIG_MKSPECS_FILE} MOBILITY_FILE_CONTENTS)
156+
IF(${MOBILITY_FILE_CONTENTS} MATCHES "MOBILITY_CONFIG=.*multimedia.*")
157+
SET(QT_MOBILITY_MULTIMEDIAKIT_FOUND 1)
158+
SET(QT_MOBILITY_MULTIMEDIAKIT_INCLUDE_DIR ${QT_MOBILITY_PARENT_INCLUDE_DIR}/QtMultimediaKit)
159+
SET(QT_MOBILITY_MULTIMEDIAKIT_LIBRARY QtMultimediaKit)
160+
ENDIF()
161+
ENDIF()
162+
163+
ENDIF()

‎src/app/gps/qgsgpsinformationwidget.cpp

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/***************************************************************************
2-
qgsgpsinformationwidget.h - description
2+
qgsgpsinformationwidget.cpp - description
33
-------------------
44
begin : Sat Jan 01 2010
55
copyright : (C) 2010 by Tim Sutton and Marco Hugentobler
@@ -184,6 +184,10 @@ QgsGPSInformationWidget::QgsGPSInformationWidget( QgsMapCanvas * thepCanvas, QWi
184184
{
185185
mRadAutodetect->setChecked( true );
186186
}
187+
else if ( myPortMode == "internalGPS" )
188+
{
189+
mRadInternal->setChecked( true );
190+
}
187191
else if ( myPortMode == "explicitPort" )
188192
{
189193
mRadUserPath->setChecked( true );
@@ -192,6 +196,11 @@ QgsGPSInformationWidget::QgsGPSInformationWidget( QgsMapCanvas * thepCanvas, QWi
192196
{
193197
mRadGpsd->setChecked( true );
194198
}
199+
//disable the internal port method if build is without QtLocation
200+
#ifndef HAVE_QT_MOBILITY_LOCATION
201+
mRadInternal->setDisabled( true );
202+
mRadAutodetect->setChecked( true );
203+
#endif
195204

196205
//auto digitising behaviour
197206
mCbxAutoAddVertices->setChecked( mySettings.value( "/gps/autoAddVertices", "false" ).toBool() );
@@ -256,6 +265,10 @@ QgsGPSInformationWidget::~QgsGPSInformationWidget()
256265
{
257266
mySettings.setValue( "/gps/portMode", "scanPorts" );
258267
}
268+
else if ( mRadInternal->isChecked() )
269+
{
270+
mySettings.setValue( "/gps/portMode", "internalGPS" );
271+
}
259272
else if ( mRadUserPath->isChecked() )
260273
{
261274
mySettings.setValue( "/gps/portMode", "explicitPort" );
@@ -406,6 +419,10 @@ void QgsGPSInformationWidget::connectGps()
406419
{
407420
port = QString( "%1:%2:%3" ).arg( mGpsdHost->text() ).arg( mGpsdPort->text() ).arg( mGpsdDevice->text() );
408421
}
422+
else if ( mRadInternal->isChecked() )
423+
{
424+
port = QString( "internalGPS" );
425+
}
409426

410427
mGPSPlainTextEdit->appendPlainText( tr( "Connecting..." ) );
411428
showStatusBarMessage( tr( "Connecting to GPS device..." ) );
@@ -678,10 +695,12 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in
678695
mTxtDateTime->setText( info.utcDateTime.toString( mDateTimeFormat ) ); //user specified format string for testing the millisecond part of time
679696
}
680697
mTxtSpeed->setText( tr( "%1 km/h" ).arg( info.speed, 0, 'f', 1 ) );
681-
mTxtDirection->setText( QString::number( info.direction, 'f', 1 ) );
698+
mTxtDirection->setText( QString::number( info.direction, 'f', 1 ) + QString::fromUtf8( "°" ) );
682699
mTxtHdop->setText( QString::number( info.hdop, 'f', 1 ) );
683700
mTxtVdop->setText( QString::number( info.vdop, 'f', 1 ) );
684701
mTxtPdop->setText( QString::number( info.pdop, 'f', 1 ) );
702+
mTxtHacc->setText( QString::number( info.hacc, 'f', 1 ) + "m" );
703+
mTxtVacc->setText( QString::number( info.vacc, 'f', 1 ) + "m" );
685704
mTxtFixMode->setText( info.fixMode == 'A' ? tr( "Automatic" ) : info.fixMode == 'M' ? tr( "Manual" ) : "" ); // A=automatic 2d/3d, M=manual; allowing for anything else
686705
mTxtFixType->setText( info.fixType == 3 ? tr( "3D" ) : info.fixType == 2 ? tr( "2D" ) : info.fixType == 1 ? tr( "No fix" ) : QString::number( info.fixType ) ); // 1=no fix, 2=2D, 3=3D; allowing for anything else
687706
mTxtQuality->setText( info.quality == 2 ? tr( "Differential" ) : info.quality == 1 ? tr( "Non-differential" ) : info.quality == 0 ? tr( "No position" ) : info.quality > 2 ? QString::number( info.quality ) : "" ); // allowing for anything else
@@ -794,7 +813,7 @@ void QgsGPSInformationWidget::on_mBtnAddVertex_clicked( )
794813

795814
void QgsGPSInformationWidget::addVertex( )
796815
{
797-
816+
QgsDebugMsg( "Adding Vertex" );
798817
if ( !mpRubberBand )
799818
{
800819
createRubberBand( );

‎src/core/CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,13 @@ ELSE(WIN32)
191191
ADD_DEFINITIONS(-D_TTY_POSIX_)
192192
ENDIF(WIN32)
193193

194+
IF (QT_MOBILITY_LOCATION_FOUND)
195+
SET(QGIS_CORE_SRCS
196+
${QGIS_CORE_SRCS}
197+
gps/qgsqtlocationconnection.cpp
198+
)
199+
ENDIF (QT_MOBILITY_LOCATION_FOUND)
200+
194201
IF (WITH_INTERNAL_SPATIALITE)
195202
IF (WIN32 OR APPLE OR ANDROID)
196203
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
@@ -274,6 +281,13 @@ SET(QGIS_CORE_MOC_HDRS
274281
gps/qextserialport/qextserialenumerator.h
275282
)
276283

284+
IF (QT_MOBILITY_LOCATION_FOUND)
285+
SET(QGIS_CORE_MOC_HDRS
286+
${QGIS_CORE_MOC_HDRS}
287+
gps/qgsqtlocationconnection.h
288+
)
289+
ENDIF (QT_MOBILITY_LOCATION_FOUND)
290+
277291
QT4_WRAP_CPP(QGIS_CORE_MOC_SRCS ${QGIS_CORE_MOC_HDRS})
278292

279293
# install headers
@@ -394,6 +408,13 @@ SET(QGIS_CORE_HDRS
394408
qgsspatialindex.h
395409
)
396410

411+
IF (QT_MOBILITY_LOCATION_FOUND)
412+
SET(QGIS_CORE_HDRS
413+
${QGIS_CORE_HDRS}
414+
gps/qgsqtlocationconnection.h
415+
)
416+
ENDIF (QT_MOBILITY_LOCATION_FOUND)
417+
397418
INCLUDE_DIRECTORIES(
398419
${CMAKE_CURRENT_SOURCE_DIR}
399420
composer
@@ -494,6 +515,10 @@ IF(APPLE)
494515
TARGET_LINK_LIBRARIES(qgis_core "-framework CoreFoundation -framework IOKit")
495516
ENDIF(APPLE)
496517

518+
IF (QT_MOBILITY_LOCATION_FOUND)
519+
TARGET_LINK_LIBRARIES(qgis_core ${QT_MOBILITY_LOCATION_LIBRARY})
520+
ENDIF (QT_MOBILITY_LOCATION_FOUND)
521+
497522
TARGET_LINK_LIBRARIES(qgis_core
498523
${QT_QTMAIN_LIBRARY}
499524
${QT_QTXML_LIBRARY}

‎src/core/gps/qgsgpsconnection.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ void QgsGPSConnection::clearLastGPSInformation()
9494
mLastGPSInformation.satellitesInView.clear();
9595
mLastGPSInformation.speed = 0;
9696
mLastGPSInformation.vdop = 0;
97+
mLastGPSInformation.hacc = -1;
98+
mLastGPSInformation.vacc = -1;
9799
mLastGPSInformation.quality = -1; // valid values: 0,1,2, maybe others
98100
mLastGPSInformation.satellitesUsed = 0;
99101
mLastGPSInformation.fixMode = ' ';

‎src/core/gps/qgsgpsconnection.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ struct CORE_EXPORT QgsGPSInformation
4444
double pdop;
4545
double hdop;
4646
double vdop;
47+
double hacc; //horizontal accurancy in meters
48+
double vacc; //vertical accurancy in meters
4749
QDateTime utcDateTime;
4850
QChar fixMode;
4951
int fixType;

‎src/core/gps/qgsgpsdetector.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
#include "qgsnmeaconnection.h"
2323
#include "qgsgpsdconnection.h"
2424

25+
#ifdef HAVE_QT_MOBILITY_LOCATION
26+
#include "qgsqtlocationconnection.h"
27+
#endif
28+
2529
#include <QStringList>
2630
#include <QFileInfo>
2731
#include <QTimer>
@@ -30,6 +34,10 @@ QList< QPair<QString, QString> > QgsGPSDetector::availablePorts()
3034
{
3135
QList< QPair<QString, QString> > devs;
3236

37+
// try local QtLocation first
38+
#ifdef HAVE_QT_MOBILITY_LOCATION
39+
devs << QPair<QString, QString>( "internalGPS", tr( "internal GPS" ) );
40+
#endif
3341
// try local gpsd first
3442
devs << QPair<QString, QString>( "localhost:2947:", tr( "local gpsd" ) );
3543

@@ -145,6 +153,15 @@ void QgsGPSDetector::advance()
145153

146154
mConn = new QgsGpsdConnection( gpsParams[0], gpsParams[1].toShort(), gpsParams[2] );
147155
}
156+
else if ( mPortList[ mPortIndex ].first.contains( "internalGPS" ) )
157+
{
158+
#ifdef HAVE_QT_MOBILITY_LOCATION
159+
mConn = new QgsQtLocationConnection();
160+
#else
161+
qWarning( "QT_MOBILITY_LOCATION not found and mPortList matches internalGPS, this should never happen" );
162+
#endif
163+
}
164+
148165
else
149166
{
150167
QextSerialPort *serial = new QextSerialPort( mPortList[ mPortIndex ].first, QextSerialPort::EventDriven );
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
/***************************************************************************
2+
QgsQtLocationConnection.cpp - description
3+
---------------------
4+
begin : December 7th, 2011
5+
copyright : (C) 2011 by Marco Bernasocchi, Bernawebdesign.ch
6+
email : marco at bernawebdesign dot ch
7+
***************************************************************************/
8+
9+
/***************************************************************************
10+
* *
11+
* This program is free software; you can redistribute it and/or modify *
12+
* it under the terms of the GNU General Public License as published by *
13+
* the Free Software Foundation; either version 2 of the License, or *
14+
* (at your option) any later version. *
15+
* *
16+
***************************************************************************/
17+
18+
#include "qgsqtlocationconnection.h"
19+
#include "qgslogger.h"
20+
21+
#include <QLocalSocket>
22+
#include <QTimer>
23+
#include <QMetaType>
24+
25+
QgsQtLocationConnection::QgsQtLocationConnection( ): QgsGPSConnection( new QLocalSocket() )
26+
{
27+
//needed to fix https://sourceforge.net/p/necessitas/tickets/146/
28+
qRegisterMetaType< QList<QGeoSatelliteInfo> >( "QList<QGeoSatelliteInfo>" );
29+
30+
startGPS();
31+
startSatelliteMonitor();
32+
33+
//HACK to signal the gpsinformationwidget that we have a QtLocationConnection
34+
QTimer::singleShot( 500, this, SLOT( broadcastConnectionAvailable() ) );
35+
}
36+
37+
QgsQtLocationConnection::~QgsQtLocationConnection()
38+
{
39+
//connection will be closed by base class
40+
QgsDebugMsg( "entered." );
41+
}
42+
43+
//Needed to make connection detectable (half HACK)
44+
//this signals that the device has started the GPS sucessfully,
45+
//not that it has a fix yet.
46+
void QgsQtLocationConnection::broadcastConnectionAvailable()
47+
{
48+
if ( locationDataSource )
49+
{
50+
mStatus = GPSDataReceived;
51+
emit stateChanged( mLastGPSInformation );
52+
}
53+
}
54+
55+
//TODO: Temporarely needed to workaround https://sourceforge.net/p/necessitas/tickets/147/
56+
void QgsQtLocationConnection::positionUpdated( const QGeoPositionInfo &info )
57+
{
58+
mInfo = info;
59+
parseData();
60+
}
61+
62+
void QgsQtLocationConnection::parseData()
63+
{
64+
if ( locationDataSource )
65+
{
66+
mStatus = GPSDataReceived;
67+
//const QGeoPositionInfo &info = locationDataSource->lastKnownPosition();
68+
qDebug() << mInfo;
69+
if ( mInfo.isValid() )
70+
{
71+
// mInfo.HorizontalAccuracy;
72+
mLastGPSInformation.latitude = mInfo.coordinate().latitude();
73+
mLastGPSInformation.longitude = mInfo.coordinate().longitude() ;
74+
mLastGPSInformation.elevation = mInfo.coordinate().altitude();
75+
mLastGPSInformation.speed = mInfo.attribute( QGeoPositionInfo::GroundSpeed ) * 3.6; // m/s to km/h
76+
mLastGPSInformation.direction = mInfo.attribute( QGeoPositionInfo::Direction );
77+
mLastGPSInformation.utcDateTime = mInfo.timestamp();
78+
mLastGPSInformation.fixType = mInfo.coordinate().type() + 1;
79+
//< fixType, used for navigation (1 = Fix not available; 2 = 2D; 3 = 3D)
80+
//< coordinate().type(), returns 0 = Fix not available; 1 = 2D; 2 = 3D)
81+
mLastGPSInformation.hacc = mInfo.attribute( QGeoPositionInfo::HorizontalAccuracy ); //< Horizontal dilution of precision
82+
mLastGPSInformation.vacc = mInfo.attribute( QGeoPositionInfo::VerticalAccuracy ); //< Vertical dilution of precision
83+
84+
//TODO implement dop maybe by getting a
85+
//http://developer.android.com/reference/android/location/GpsStatus.NmeaListener.html
86+
//into QtLocation and subclass QgsNMEAConnection directly?
87+
mLastGPSInformation.pdop; //< Dilution of precision
88+
mLastGPSInformation.hdop; //< Horizontal dilution of precision
89+
mLastGPSInformation.vdop; //< Vertical dilution of precision
90+
91+
mLastGPSInformation.fixMode; //< Mode (M = Manual, forced to operate in 2D or 3D; A = Automatic, 3D/2D)
92+
mLastGPSInformation.quality; //< GPS quality indicator (0 = Invalid; 1 = Fix; 2 = Differential, 3 = Sensitive)
93+
mLastGPSInformation.status; //< Status (A = active or V = void)
94+
95+
emit stateChanged( mLastGPSInformation );
96+
QgsDebugMsg( "Valid QGeoPositionInfo, positionUpdated" );
97+
}
98+
}
99+
}
100+
101+
void QgsQtLocationConnection::satellitesInViewUpdated(
102+
const QList<QGeoSatelliteInfo>& satellites )
103+
{
104+
// The number of satellites in view is updated
105+
mLastGPSInformation.satellitesInView.clear();
106+
for ( int i = 0; i < satellites.size(); ++i )
107+
{
108+
QGeoSatelliteInfo currentSatellite = satellites.at( i );
109+
QgsSatelliteInfo satelliteInfo;
110+
satelliteInfo.azimuth = currentSatellite.attribute( QGeoSatelliteInfo::Azimuth );
111+
satelliteInfo.elevation = currentSatellite.attribute( QGeoSatelliteInfo::Elevation );
112+
satelliteInfo.id = currentSatellite.prnNumber();
113+
satelliteInfo.signal = currentSatellite.signalStrength();
114+
mLastGPSInformation.satellitesInView.append( satelliteInfo );
115+
}
116+
mLastGPSInformation.satInfoComplete = true; //to be used to determine when to graph signal and satellite position
117+
emit stateChanged( mLastGPSInformation );
118+
QgsDebugMsg( "satellitesInViewUpdated" );
119+
}
120+
121+
void QgsQtLocationConnection::satellitesInUseUpdated(
122+
const QList<QGeoSatelliteInfo>& satellites )
123+
{
124+
// The number of satellites in use is updated
125+
mLastGPSInformation.satellitesUsed = QString::number( satellites.count() ).toInt();
126+
127+
mLastGPSInformation.satPrn.clear();
128+
for ( int i = 0; i < satellites.size(); ++i )
129+
{
130+
QGeoSatelliteInfo currentSatellite = satellites.at( i );
131+
//add pnr to mLastGPSInformation.satPrn
132+
mLastGPSInformation.satPrn.append( currentSatellite.prnNumber() );
133+
134+
//set QgsSatelliteInfo.inuse to true for the satellites in use
135+
for ( int i = 0; i < mLastGPSInformation.satellitesInView.size(); ++i )
136+
{
137+
QgsSatelliteInfo satInView = mLastGPSInformation.satellitesInView.at( i );
138+
if ( satInView.id == currentSatellite.prnNumber() )
139+
{
140+
satInView.inUse = true;
141+
break;
142+
}
143+
}
144+
}
145+
mLastGPSInformation.satInfoComplete = true; //to be used to determine when to graph signal and satellite position
146+
emit stateChanged( mLastGPSInformation );
147+
QgsDebugMsg( "satellitesInUseUpdated" );
148+
}
149+
150+
void QgsQtLocationConnection::startGPS()
151+
{
152+
QgsDebugMsg( "Starting GPS QtLocation connection" );
153+
// Obtain the location data source if it is not obtained already
154+
if ( !locationDataSource )
155+
{
156+
locationDataSource = QGeoPositionInfoSource::createDefaultSource( this );
157+
if ( locationDataSource )
158+
{
159+
locationDataSource->setPreferredPositioningMethods( QGeoPositionInfoSource::SatellitePositioningMethods ); //QGeoPositionInfoSource::AllPositioningMethods
160+
// locationDataSource->setUpdateInterval(2000);
161+
// Whenever the location data source signals that the current
162+
// position is updated, the positionUpdated function is called.
163+
QObject::connect( locationDataSource,
164+
SIGNAL( positionUpdated( QGeoPositionInfo ) ),
165+
this,
166+
SLOT( positionUpdated( QGeoPositionInfo ) ) );
167+
// Start listening for position updates
168+
locationDataSource->startUpdates();
169+
}
170+
else
171+
{
172+
// Not able to obtain the location data source
173+
QgsDebugMsg( "No QtLocation Position Source" );
174+
}
175+
}
176+
else
177+
{
178+
// Start listening for position updates
179+
locationDataSource->startUpdates();
180+
}
181+
}
182+
183+
void QgsQtLocationConnection::startSatelliteMonitor()
184+
{
185+
QgsDebugMsg( "Starting GPS QtLocation satellite monitor" );
186+
if ( !satelliteInfoSource )
187+
{
188+
satelliteInfoSource = QGeoSatelliteInfoSource::createDefaultSource( this );
189+
if ( satelliteInfoSource )
190+
{
191+
QgsDebugMsg( "satelliteMonitor started" );
192+
// Whenever the satellite info source signals that the number of
193+
// satellites in use is updated, the satellitesInUseUpdated function
194+
// is called
195+
QObject::connect( satelliteInfoSource,
196+
SIGNAL( satellitesInUseUpdated(
197+
const QList<QGeoSatelliteInfo>& ) ),
198+
this,
199+
SLOT( satellitesInUseUpdated(
200+
const QList<QGeoSatelliteInfo>& ) ) );
201+
202+
// Whenever the satellite info source signals that the number of
203+
// satellites in view is updated, the satellitesInViewUpdated function
204+
// is called
205+
QObject::connect( satelliteInfoSource,
206+
SIGNAL( satellitesInViewUpdated(
207+
const QList<QGeoSatelliteInfo>& ) ),
208+
this,
209+
SLOT( satellitesInViewUpdated(
210+
const QList<QGeoSatelliteInfo>& ) ) );
211+
212+
// Start listening for satellite updates
213+
satelliteInfoSource->startUpdates();
214+
}
215+
else
216+
{
217+
// Not able to obtain the Satellite data source
218+
QgsDebugMsg( "No QtLocation Satellite Source" );
219+
}
220+
}
221+
else
222+
{
223+
// Start listening for position updates
224+
satelliteInfoSource->startUpdates();
225+
}
226+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/***************************************************************************
2+
QgsQtLocationConnection.h - description
3+
-------------------
4+
begin : December 7th, 2011
5+
copyright : (C) 2011 by Marco Bernasocchi, Bernawebdesign.ch
6+
email : marco at bernawebdesign dot ch
7+
***************************************************************************/
8+
9+
/***************************************************************************
10+
* *
11+
* This program is free software; you can redistribute it and/or modify *
12+
* it under the terms of the GNU General Public License as published by *
13+
* the Free Software Foundation; either version 2 of the License, or *
14+
* (at your option) any later version. *
15+
* *
16+
***************************************************************************/
17+
18+
#ifndef QGSQTLOCATIONCONNECTION_H
19+
#define QGSQTLOCATIONCONNECTION_H
20+
21+
#include "qgsgpsconnection.h"
22+
#include <QtCore/QPointer>
23+
#include <QtLocation/QGeoPositionInfoSource>
24+
#include <QtLocation/QGeoSatelliteInfo>
25+
#include <QtLocation/QGeoSatelliteInfoSource>
26+
27+
QTM_USE_NAMESPACE
28+
29+
class CORE_EXPORT QgsQtLocationConnection: public QgsGPSConnection
30+
{
31+
Q_OBJECT
32+
public:
33+
QgsQtLocationConnection();
34+
~QgsQtLocationConnection();
35+
36+
protected slots:
37+
/**Needed to make QtLocation detected*/
38+
void broadcastConnectionAvailable( );
39+
40+
/**Parse available data source content*/
41+
void parseData();
42+
43+
/**Called when the position updated.*/
44+
void positionUpdated( const QGeoPositionInfo &info );
45+
46+
/**Called when the number of satellites in view is updated.*/
47+
void satellitesInViewUpdated( const QList<QGeoSatelliteInfo>& satellites );
48+
49+
/**Called when the number of satellites in use is updated.*/
50+
void satellitesInUseUpdated( const QList<QGeoSatelliteInfo>& satellites );
51+
52+
private:
53+
void startGPS();
54+
void startSatelliteMonitor();
55+
QString mDevice;
56+
QGeoPositionInfo mInfo;
57+
QPointer<QGeoPositionInfoSource> locationDataSource;
58+
QPointer<QGeoSatelliteInfoSource> satelliteInfoSource;
59+
60+
};
61+
62+
#endif // QGSQTLOCATIONCONNECTION_H

‎src/plugins/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ IF (WITH_GLOBE)
3636
ADD_SUBDIRECTORY(globe)
3737
ENDIF (WITH_GLOBE)
3838

39+
40+
IF (QT_MOBILITY_SENSORS_FOUND)
41+
ADD_SUBDIRECTORY(compass)
42+
ENDIF (QT_MOBILITY_SENSORS_FOUND)
43+
3944
# headers installed in qgis_core target
4045

4146
SUBDIRS (heatmap)

‎src/plugins/compass/CMakeLists.txt

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
########################################################
3+
# Files
4+
5+
SET (COMPASS_SRCS
6+
compass.cpp
7+
qgscompassplugin.cpp
8+
qgscompassplugingui.cpp
9+
)
10+
11+
SET (COMPASS_UIS qgscompasspluginguibase.ui)
12+
13+
SET (COMPASS_MOC_HDRS
14+
compass.h
15+
qgscompassplugin.h
16+
qgscompassplugingui.h
17+
)
18+
19+
SET (COMPASS_RCCS compass.qrc)
20+
21+
########################################################
22+
# Build
23+
24+
QT4_WRAP_UI (COMPASS_UIS_H ${COMPASS_UIS})
25+
26+
QT4_WRAP_CPP (COMPASS_MOC_SRCS ${COMPASS_MOC_HDRS})
27+
28+
QT4_ADD_RESOURCES(COMPASS_RCC_SRCS ${COMPASS_RCCS})
29+
30+
ADD_LIBRARY (compassplugin MODULE ${COMPASS_SRCS} ${COMPASS_MOC_SRCS} ${COMPASS_RCC_SRCS} ${COMPASS_UIS_H})
31+
32+
INCLUDE_DIRECTORIES(
33+
${CMAKE_CURRENT_BINARY_DIR}
34+
../../core ../../core/raster ../../core/renderer ../../core/symbology
35+
../../gui
36+
..
37+
)
38+
39+
TARGET_LINK_LIBRARIES(compassplugin
40+
qgis_core
41+
qgis_gui
42+
${QT_MOBILITY_SENSORS_LIBRARY}
43+
)
44+
45+
46+
########################################################
47+
# Install
48+
49+
INSTALL(TARGETS compassplugin
50+
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
51+
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})

‎src/plugins/compass/compass.cpp

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/***************************************************************************
2+
compass.cpp
3+
Functions:
4+
-------------------
5+
begin : Jan 28, 2012
6+
copyright : (C) 2012 by Marco Bernasocchi
7+
email : marco@bernawebdesign.ch
8+
9+
***************************************************************************/
10+
11+
/***************************************************************************
12+
* *
13+
* This program is free software; you can redistribute it and/or modify *
14+
* it under the terms of the GNU General Public License as published by *
15+
* the Free Software Foundation; either version 2 of the License, or *
16+
* (at your option) any later version. *
17+
* *
18+
***************************************************************************/
19+
20+
#include "compass.h"
21+
22+
Compass::Compass()
23+
{
24+
// mRateVal = 0;
25+
// if (mRateVal > 0)
26+
// {
27+
// qDebug() << "Compasssensor setdatarate " << endl;
28+
// mSensor.setDataRate(mRateVal);
29+
// }
30+
// qDebug() << "Data rate 2: " << mSensor.dataRate();
31+
mSensor.addFilter( this );
32+
start();
33+
}
34+
35+
Compass::~Compass()
36+
{
37+
}
38+
39+
bool Compass::filter( QCompassReading *reading )
40+
{
41+
// int diff = ( reading->timestamp() - stamp );
42+
// stamp = reading->timestamp();
43+
44+
// QString str;
45+
// str = QString("%1 deg (%2 CalibLevel)")
46+
// .arg(reading->azimuth(), 3, 'f', 0)
47+
// .arg(reading->calibrationLevel(), 3, 'f', 0);
48+
// qDebug() << str << endl;
49+
50+
emit azimuthChanged( reading->azimuth(), reading->calibrationLevel() );
51+
return false; // don't store the reading in the sensor
52+
}
53+
54+
bool Compass::isActive()
55+
{
56+
return mSensor.isActive();
57+
}
58+
59+
bool Compass::start()
60+
{
61+
mSensor.start();
62+
if ( !mSensor.isActive() )
63+
{
64+
qDebug() << "Compasssensor didn't start!" << endl;
65+
return false;
66+
}
67+
return true;
68+
}
69+
70+
bool Compass::stop()
71+
{
72+
mSensor.stop();
73+
if ( mSensor.isActive() )
74+
{
75+
qDebug() << "Compasssensor didn't stop!" << endl;
76+
return false;
77+
}
78+
return true;
79+
}

‎src/plugins/compass/compass.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/***************************************************************************
2+
compass.h
3+
Functions: Reads data from a QtMobility QCompass
4+
-------------------
5+
begin : Jan 28, 2012
6+
copyright : (C) 2012 by Marco Bernasocchi
7+
email : marco@bernawebdesign.ch
8+
9+
***************************************************************************/
10+
11+
/***************************************************************************
12+
* *
13+
* This program is free software; you can redistribute it and/or modify *
14+
* it under the terms of the GNU General Public License as published by *
15+
* the Free Software Foundation; either version 2 of the License, or *
16+
* (at your option) any later version. *
17+
* *
18+
***************************************************************************/
19+
20+
#ifndef _COMPASS_H__
21+
#define _COMPASS_H__
22+
23+
#include <QtGui>
24+
#include <QtCore>
25+
#include <QtSensors/QCompass>
26+
#include <QObject>
27+
28+
QTM_USE_NAMESPACE
29+
30+
class Compass : public QObject, public QCompassFilter
31+
{
32+
Q_OBJECT
33+
public:
34+
Compass();
35+
~Compass();
36+
bool filter( QCompassReading *reading );
37+
bool isActive();
38+
bool start();
39+
bool stop();
40+
41+
private:
42+
qtimestamp stamp;
43+
int mRateVal;
44+
QCompass mSensor;
45+
46+
signals:
47+
void azimuthChanged( const QVariant &azimuth, const QVariant &calibrationLevel );
48+
};
49+
50+
#endif // _COMPASS_H__

‎src/plugins/compass/compass.qrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<RCC>
2+
<qresource prefix="/">
3+
<file>icons/mCompassRun.png</file>
4+
</qresource>
5+
</RCC>
7.2 KB
Loading
Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
/***************************************************************************
2+
qgscompassplugin.cpp
3+
Functions:
4+
-------------------
5+
begin : Jan 28, 2012
6+
copyright : (C) 2012 by Marco Bernasocchi
7+
email : marco@bernawebdesign.ch
8+
9+
***************************************************************************/
10+
11+
/***************************************************************************
12+
* *
13+
* This program is free software; you can redistribute it and/or modify *
14+
* it under the terms of the GNU General Public License as published by *
15+
* the Free Software Foundation; either version 2 of the License, or *
16+
* (at your option) any later version. *
17+
* *
18+
***************************************************************************/
19+
20+
// includes
21+
22+
#include <qgisinterface.h>
23+
#include <qgisgui.h>
24+
#include <qgsapplication.h>
25+
#include "qgscompassplugin.h"
26+
27+
#include <QMenu>
28+
#include <QAction>
29+
#include <QFile>
30+
#include <QToolBar>
31+
#include <QMessageBox>
32+
#include "qgscompassplugingui.h"
33+
34+
35+
static const QString sName = QObject::tr( "Internal Compass" );
36+
static const QString sDescription = QObject::tr( "Shows a QtSensors compass reading" );
37+
static const QString sCategory = QObject::tr( "Plugins" );
38+
static const QString sPluginVersion = QObject::tr( "Version 0.9" );
39+
static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
40+
static const QString sPluginIcon = ":/compass.svn";
41+
42+
/**
43+
* Constructor for the plugin. The plugin is passed a pointer to the main app
44+
* and an interface object that provides access to exposed functions in QGIS.
45+
* @param qgis Pointer to the QGIS main window
46+
* @param _qI Pointer to the QGIS interface object
47+
*/
48+
QgsCompassPlugin::QgsCompassPlugin( QgisInterface * themQGisIface )
49+
: QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ),
50+
mQGisIface( themQGisIface )
51+
{
52+
/** Initialize the plugin */
53+
mDock = NULL;
54+
}
55+
56+
QgsCompassPlugin::~QgsCompassPlugin()
57+
{
58+
}
59+
60+
/* Following functions return name, description, version, and type for the plugin */
61+
QString QgsCompassPlugin::name()
62+
{
63+
return sName;
64+
}
65+
66+
QString QgsCompassPlugin::version()
67+
{
68+
return sPluginVersion;
69+
70+
}
71+
72+
QString QgsCompassPlugin::description()
73+
{
74+
return sDescription;
75+
76+
}
77+
78+
QString QgsCompassPlugin::category()
79+
{
80+
return sCategory;
81+
82+
}
83+
84+
int QgsCompassPlugin::type()
85+
{
86+
return QgisPlugin::UI;
87+
}
88+
89+
//method defined in interface
90+
void QgsCompassPlugin::help()
91+
{
92+
//implement me!
93+
}
94+
95+
/*
96+
* Initialize the GUI interface for the plugin
97+
*/
98+
void QgsCompassPlugin::initGui()
99+
{
100+
101+
// Create the action for tool
102+
mActionRunCompass = new QAction( QIcon(), tr( "Show compass" ), this );
103+
connect( mActionRunCompass, SIGNAL( triggered() ), this, SLOT( run() ) );
104+
105+
mActionAboutCompass = new QAction( QIcon(), tr( "&About" ), this );
106+
connect( mActionAboutCompass, SIGNAL( triggered() ), this, SLOT( about() ) );
107+
108+
setCurrentTheme( "" );
109+
// this is called when the icon theme is changed
110+
connect( mQGisIface, SIGNAL( currentThemeChanged( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
111+
112+
// Add the icon to the toolbar
113+
mQGisIface->pluginToolBar()->addAction( mActionRunCompass );
114+
//mQGisIface->pluginToolBar()->addAction( mActionAboutCompass );
115+
mQGisIface->addPluginToMenu( sName, mActionRunCompass );
116+
mQGisIface->addPluginToMenu( sName, mActionAboutCompass );
117+
// this is called when the icon theme is changed
118+
119+
}
120+
121+
// Slot called when the buffer menu item is activated
122+
void QgsCompassPlugin::run()
123+
{
124+
if ( ! mDock )
125+
{
126+
mDock = new QDockWidget( "Internal Compass", mQGisIface->mainWindow() );
127+
mQgsCompassPluginGui = new QgsCompassPluginGui( mDock );
128+
mDock->setWidget( mQgsCompassPluginGui );
129+
mDock->setFeatures( QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
130+
mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mDock );
131+
132+
}
133+
mDock->show();
134+
QObject::connect( mDock, SIGNAL( visibilityChanged( bool ) ), mQgsCompassPluginGui, SLOT( handleVisibilityChanged( bool ) ) );
135+
}
136+
137+
// Unload the plugin by cleaning up the GUI
138+
void QgsCompassPlugin::unload()
139+
{
140+
// remove the GUI
141+
mQGisIface->removeToolBarIcon( mActionRunCompass );
142+
mQGisIface->removePluginMenu( sName, mActionRunCompass );
143+
144+
//mQGisIface->removeToolBarIcon( mActionAboutCompass );
145+
mQGisIface->removePluginMenu( sName, mActionAboutCompass );
146+
147+
delete mActionRunCompass;
148+
delete mActionAboutCompass;
149+
delete mDock;
150+
}
151+
152+
//! Set icons to the current theme
153+
void QgsCompassPlugin::setCurrentTheme( QString )
154+
{
155+
mActionRunCompass->setIcon( getThemeIcon( "/mCompassRun.png" ) );
156+
mActionAboutCompass->setIcon( getThemeIcon( "/mActionAbout.png" ) );
157+
}
158+
159+
QIcon QgsCompassPlugin::getThemeIcon( const QString &theName )
160+
{
161+
if ( QFile::exists( QgsApplication::activeThemePath() + "/plugins" + theName ) )
162+
{
163+
return QIcon( QgsApplication::activeThemePath() + "/plugins" + theName );
164+
}
165+
else if ( QFile::exists( QgsApplication::defaultThemePath() + "/plugins" + theName ) )
166+
{
167+
return QIcon( QgsApplication::defaultThemePath() + "/plugins" + theName );
168+
}
169+
else
170+
{
171+
return QIcon( ":/icons" + theName );
172+
}
173+
}
174+
175+
void QgsCompassPlugin::about( )
176+
{
177+
QString title = QString( "About Internal Compass" );
178+
// sort by date of contribution
179+
QString text = QString( "<center><b>Internal Compass</b></center>"
180+
"<center>%1</center>"
181+
"<p>Shows reading of an internal compass using QtSensors<br/>"
182+
"<b>Developer:</b>"
183+
"<ol type=disc>"
184+
"<li>Marco Bernasocchi"
185+
"</ol>"
186+
"<p><b>Homepage:</b><br>"
187+
"<a href=\"http://opengis.ch\">http://opengis.ch</a></p>"
188+
"<p><b>Compass calibration:</b><br/>"
189+
"To calibrate the compass slowly rotate the device three times around each axis or "
190+
"rotate it like a on a Mobius strip.<br/>"
191+
"This <a href='http://www.youtube.com/watch?v=oNJJPeoG8lQ'>Video</a> demonstrates the process "
192+
"(this can be done from within QGIS as well).</p>"
193+
).arg( sPluginVersion );
194+
195+
// create dynamicaly because on Mac this dialog is modeless
196+
QWidget *w = new QWidget;
197+
w->setAttribute( Qt::WA_DeleteOnClose );
198+
w->setWindowIcon( getThemeIcon( "/compass.png" ) );
199+
QMessageBox::about( w, title, text );
200+
}
201+
202+
/**
203+
* Required extern functions needed for every plugin
204+
* These functions can be called prior to creating an instance
205+
* of the plugin class
206+
*/
207+
// Class factory to return a new instance of the plugin class
208+
QGISEXTERN QgisPlugin * classFactory( QgisInterface * themQGisIfacePointer )
209+
{
210+
return new QgsCompassPlugin( themQGisIfacePointer );
211+
}
212+
// Return the name of the plugin - note that we do not user class members as
213+
// the class may not yet be insantiated when this method is called.
214+
QGISEXTERN QString name()
215+
{
216+
return sName;
217+
}
218+
219+
// Return the description
220+
QGISEXTERN QString description()
221+
{
222+
return sDescription;
223+
}
224+
225+
// Return the category
226+
QGISEXTERN QString category()
227+
{
228+
return sCategory;
229+
}
230+
231+
// Return the type (either UI or MapLayer plugin)
232+
QGISEXTERN int type()
233+
{
234+
return sPluginType;
235+
}
236+
237+
// Return the version number for the plugin
238+
QGISEXTERN QString version()
239+
{
240+
return sPluginVersion;
241+
}
242+
243+
QGISEXTERN QString icon()
244+
{
245+
return sPluginIcon;
246+
}
247+
248+
// Delete ourself
249+
QGISEXTERN void unload( QgisPlugin * thePluginPointer )
250+
{
251+
delete thePluginPointer;
252+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/***************************************************************************
2+
qgscompassplugin.h
3+
Functions:
4+
-------------------
5+
begin : Jan 28, 2012
6+
copyright : (C) 2012 by Marco Bernasocchi
7+
email : marco@bernawebdesign.ch
8+
9+
***************************************************************************/
10+
11+
/***************************************************************************
12+
* *
13+
* This program is free software; you can redistribute it and/or modify *
14+
* it under the terms of the GNU General Public License as published by *
15+
* the Free Software Foundation; either version 2 of the License, or *
16+
* (at your option) any later version. *
17+
* *
18+
***************************************************************************/
19+
#ifndef PLUGIN
20+
#define PLUGIN
21+
#include "../qgisplugin.h"
22+
#include "ui_qgscompasspluginguibase.h"
23+
#include "qgscompassplugingui.h"
24+
25+
class QgisInterface;
26+
27+
/**
28+
* \class QgsCompassPlugin
29+
*
30+
*/
31+
class QgsCompassPlugin: public QObject, public QgisPlugin, private Ui::QgsCompassPluginGuiBase
32+
{
33+
Q_OBJECT
34+
public:
35+
/**
36+
* Constructor for a plugin. The QgisInterface pointer is passed by
37+
* QGIS when it attempts to instantiate the plugin.
38+
* @param qI Pointer to the QgisInterface object
39+
*/
40+
QgsCompassPlugin( QgisInterface * );
41+
/**
42+
* Virtual function to return the name of the plugin. The name will be used when presenting a list
43+
* of installable plugins to the user
44+
*/
45+
virtual QString name();
46+
/**
47+
* Virtual function to return the version of the plugin.
48+
*/
49+
virtual QString version();
50+
/**
51+
* Virtual function to return a description of the plugins functions
52+
*/
53+
virtual QString description();
54+
/**
55+
* Virtual function to return a plugin category
56+
*/
57+
virtual QString category();
58+
/**
59+
* Return the plugin type
60+
*/
61+
virtual int type();
62+
//! Destructor
63+
virtual ~ QgsCompassPlugin();
64+
public slots:
65+
//! init the gui
66+
virtual void initGui();
67+
//! Show the dialog box
68+
void run();
69+
//! unload the plugin
70+
void unload();
71+
//! show the help document
72+
void help();
73+
//! update the plugins theme when the app tells us its theme is changed
74+
void setCurrentTheme( QString theThemeName );
75+
QIcon getThemeIcon( const QString &theThemeName );
76+
void about();
77+
private:
78+
79+
80+
//! Name of the plugin
81+
QString pluginNameQString;
82+
//! Version
83+
QString pluginVersionQString;
84+
//! Descrption of the plugin
85+
QString pluginDescriptionQString;
86+
//! Category of the plugin
87+
QString pluginCategoryQString;
88+
//! Plugin type as defined in Plugin::PLUGINTYPE
89+
int pluginType;
90+
//! Pointer to the QGIS interface object
91+
QgisInterface *mQGisIface;
92+
//! Pointer to the QAction object used in the menu and toolbar
93+
QAction *mActionRunCompass;
94+
QAction *mActionAboutCompass;
95+
96+
QDockWidget *mDock;
97+
QgsCompassPluginGui *mQgsCompassPluginGui;
98+
};
99+
100+
#endif
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
/***************************************************************************
2+
qgscompassplugingui.cpp
3+
Functions:
4+
-------------------
5+
begin : Jan 28, 2012
6+
copyright : (C) 2012 by Marco Bernasocchi
7+
email : marco@bernawebdesign.ch
8+
9+
***************************************************************************/
10+
11+
/***************************************************************************
12+
* *
13+
* This program is free software; you can redistribute it and/or modify *
14+
* it under the terms of the GNU General Public License as published by *
15+
* the Free Software Foundation; either version 2 of the License, or *
16+
* (at your option) any later version. *
17+
* *
18+
***************************************************************************/
19+
20+
#include "qgisinterface.h"
21+
//#include "qgscontexthelp.h"
22+
#include "qgslogger.h"
23+
#include <QPainter>
24+
25+
#include "qgscompassplugingui.h"
26+
#include "compass.h"
27+
28+
QgsCompassPluginGui::QgsCompassPluginGui( QWidget * parent, Qt::WFlags fl )
29+
: QWidget( parent, fl )
30+
{
31+
setupUi( this );
32+
33+
compass = new Compass();
34+
35+
if ( ! compass->isActive() )
36+
{
37+
this->mWarningLabel->setText( "<font color='red'>No compass detected</font>" );
38+
}
39+
40+
QObject::connect( compass, SIGNAL( azimuthChanged( const QVariant&, const QVariant& ) ), this, SLOT( handleAzimuth( const QVariant&, const QVariant& ) ) );
41+
}
42+
43+
QgsCompassPluginGui::~QgsCompassPluginGui()
44+
{
45+
}
46+
47+
void QgsCompassPluginGui::handleVisibilityChanged( bool visible )
48+
{
49+
if ( visible )
50+
{
51+
compass->start();
52+
}
53+
else
54+
{
55+
compass->stop();
56+
}
57+
}
58+
59+
void QgsCompassPluginGui::handleAzimuth( const QVariant &azimuth, const QVariant &calLevel )
60+
{
61+
this->mAzimutDisplay->setText( QString( "%1" ).arg( azimuth.toInt() ) + QString::fromUtf8( "°" ) );
62+
63+
//TODO check when https://sourceforge.net/p/necessitas/tickets/153/ is fixed
64+
qreal calibrationLevel = calLevel.toReal() / 3;
65+
if ( calibrationLevel == 1 )
66+
{
67+
this->mCalibrationLabel->setStyleSheet( "Background-color:green" );
68+
}
69+
else if ( calibrationLevel <= 1 / 3 )
70+
{
71+
this->mCalibrationLabel->setStyleSheet( "Background-color:red" );
72+
this->mWarningLabel->setText( "<font color='red'><a href='http://www.youtube.com/watch?v=oNJJPeoG8lQ'>Compass calibration</a> needed</font>" );
73+
}
74+
else
75+
{
76+
this->mCalibrationLabel->setStyleSheet( "Background-color:yellow" );
77+
}
78+
rotatePixmap( this->mArrowPixmapLabel, QString( ":/images/north_arrows/default.png" ), -azimuth.toInt() );
79+
}
80+
81+
//Copied from QgsDecorationNorthArrowDialog adapted to be portable
82+
void QgsCompassPluginGui::rotatePixmap( QLabel * pixmapLabel, QString myFileNameQString, int theRotationInt )
83+
{
84+
QPixmap myQPixmap;
85+
if ( myQPixmap.load( myFileNameQString ) )
86+
{
87+
QPixmap myPainterPixmap( myQPixmap.height(), myQPixmap.width() );
88+
myPainterPixmap.fill();
89+
QPainter myQPainter;
90+
myQPainter.begin( &myPainterPixmap );
91+
92+
myQPainter.setRenderHint( QPainter::SmoothPixmapTransform );
93+
94+
double centerXDouble = myQPixmap.width() / 2;
95+
double centerYDouble = myQPixmap.height() / 2;
96+
//save the current canvas rotation
97+
myQPainter.save();
98+
//myQPainter.translate( (int)centerXDouble, (int)centerYDouble );
99+
100+
//rotate the canvas
101+
myQPainter.rotate( theRotationInt );
102+
//work out how to shift the image so that it appears in the center of the canvas
103+
//(x cos a + y sin a - x, -x sin a + y cos a - y)
104+
const double PI = 3.14159265358979323846;
105+
double myRadiansDouble = ( PI / 180 ) * theRotationInt;
106+
int xShift = static_cast<int>((
107+
( centerXDouble * cos( myRadiansDouble ) ) +
108+
( centerYDouble * sin( myRadiansDouble ) )
109+
) - centerXDouble );
110+
int yShift = static_cast<int>((
111+
( -centerXDouble * sin( myRadiansDouble ) ) +
112+
( centerYDouble * cos( myRadiansDouble ) )
113+
) - centerYDouble );
114+
115+
//draw the pixmap in the proper position
116+
myQPainter.drawPixmap( xShift, yShift, myQPixmap );
117+
118+
//unrotate the canvas again
119+
myQPainter.restore();
120+
myQPainter.end();
121+
122+
pixmapLabel->setPixmap( myPainterPixmap );
123+
}
124+
else
125+
{
126+
QPixmap myPainterPixmap( 200, 200 );
127+
myPainterPixmap.fill();
128+
QPainter myQPainter;
129+
myQPainter.begin( &myPainterPixmap );
130+
QFont myQFont( "time", 12, QFont::Bold );
131+
myQPainter.setFont( myQFont );
132+
myQPainter.setPen( Qt::red );
133+
myQPainter.drawText( 10, 20, tr( "Pixmap not found" ) );
134+
myQPainter.end();
135+
pixmapLabel->setPixmap( myPainterPixmap );
136+
}
137+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/***************************************************************************
2+
qgscompassplugingui.h
3+
Functions:
4+
-------------------
5+
begin : Jan 28, 2012
6+
copyright : (C) 2012 by Marco Bernasocchi
7+
email : marco@bernawebdesign.ch
8+
9+
***************************************************************************/
10+
11+
/***************************************************************************
12+
* *
13+
* This program is free software; you can redistribute it and/or modify *
14+
* it under the terms of the GNU General Public License as published by *
15+
* the Free Software Foundation; either version 2 of the License, or *
16+
* (at your option) any later version. *
17+
* *
18+
***************************************************************************/
19+
#ifndef PLUGINGUI_H
20+
#define PLUGINGUI_H
21+
22+
#include "ui_qgscompasspluginguibase.h"
23+
#include "qgscontexthelp.h"
24+
25+
#include <QtGui/QDockWidget>
26+
#include "compass.h"
27+
28+
29+
class QgisInterface;
30+
31+
/**
32+
* \class QgsCompassPluginGui
33+
*/
34+
class QgsCompassPluginGui : public QWidget, private Ui::QgsCompassPluginGuiBase
35+
{
36+
Q_OBJECT
37+
38+
public:
39+
QgsCompassPluginGui( QWidget* parent = 0, Qt::WFlags fl = 0 );
40+
~QgsCompassPluginGui();
41+
42+
private:
43+
QgisInterface * qI;
44+
Compass *compass;
45+
46+
private slots:
47+
// void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
48+
void handleVisibilityChanged( bool visible );
49+
void handleAzimuth( const QVariant &azimuth, const QVariant &calibrationLevel );
50+
void rotatePixmap( QLabel *pixmapLabel, QString myFileNameQString, int theRotationInt );
51+
};
52+
53+
#endif
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>QgsCompassPluginGuiBase</class>
4+
<widget class="QWidget" name="QgsCompassPluginGuiBase">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>251</width>
10+
<height>70</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Internal Compass</string>
15+
</property>
16+
<layout class="QVBoxLayout" name="verticalLayout">
17+
<item>
18+
<layout class="QHBoxLayout" name="horizontalLayout">
19+
<item>
20+
<widget class="QLabel" name="mCompassLabel">
21+
<property name="text">
22+
<string>Azimut</string>
23+
</property>
24+
</widget>
25+
</item>
26+
<item>
27+
<widget class="QLineEdit" name="mAzimutDisplay">
28+
<property name="sizePolicy">
29+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
30+
<horstretch>0</horstretch>
31+
<verstretch>0</verstretch>
32+
</sizepolicy>
33+
</property>
34+
<property name="readOnly">
35+
<bool>true</bool>
36+
</property>
37+
</widget>
38+
</item>
39+
<item>
40+
<widget class="QLabel" name="mCalibrationLabel">
41+
<property name="sizePolicy">
42+
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
43+
<horstretch>10</horstretch>
44+
<verstretch>10</verstretch>
45+
</sizepolicy>
46+
</property>
47+
<property name="text">
48+
<string/>
49+
</property>
50+
</widget>
51+
</item>
52+
<item>
53+
<widget class="QLabel" name="mArrowPixmapLabel">
54+
<property name="text">
55+
<string/>
56+
</property>
57+
<property name="alignment">
58+
<set>Qt::AlignHCenter|Qt::AlignTop</set>
59+
</property>
60+
</widget>
61+
</item>
62+
</layout>
63+
</item>
64+
<item>
65+
<widget class="QLabel" name="mWarningLabel">
66+
<property name="text">
67+
<string/>
68+
</property>
69+
</widget>
70+
</item>
71+
</layout>
72+
</widget>
73+
<resources/>
74+
<connections/>
75+
</ui>

‎src/ui/qgsgpsinformationwidgetbase.ui

Lines changed: 184 additions & 80 deletions
Large diffs are not rendered by default.

‎src/ui/qgsrasterlayerpropertiesbase.ui

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<bool>true</bool>
2626
</property>
2727
<layout class="QGridLayout" name="gridLayout">
28-
<item row="0" column="0" colspan="4">
28+
<item row="1" column="0" colspan="4">
2929
<widget class="QTabWidget" name="tabBar">
3030
<property name="currentIndex">
3131
<number>0</number>
@@ -1801,14 +1801,15 @@
18011801
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
18021802
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
18031803
p, li { white-space: pre-wrap; }
1804-
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
1804+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
18051805
&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
18061806
&lt;tr&gt;
18071807
&lt;td style=&quot;border: none;&quot;&gt;
1808-
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
1808+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:9pt;&quot;&gt;&lt;/p&gt;
1809+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:9pt;&quot;&gt;&lt;/p&gt;
18091810
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
18101811
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;&quot;&gt;&lt;/p&gt;
1811-
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;&quot;&gt;&lt;/p&gt;
1812+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
18121813
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;&quot;&gt;&lt;/p&gt;
18131814
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;&quot;&gt;&lt;/p&gt;
18141815
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;&quot;&gt;&lt;/p&gt;
@@ -1818,7 +1819,7 @@ p, li { white-space: pre-wrap; }
18181819
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;&quot;&gt;&lt;/p&gt;
18191820
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;&quot;&gt;&lt;/p&gt;
18201821
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;&quot;&gt;&lt;/p&gt;
1821-
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';&quot;&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
1822+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
18221823
</property>
18231824
</widget>
18241825
</item>
@@ -1922,35 +1923,35 @@ p, li { white-space: pre-wrap; }
19221923
</widget>
19231924
</widget>
19241925
</item>
1925-
<item row="1" column="0">
1926+
<item row="2" column="0">
19261927
<widget class="QPushButton" name="pbnLoadDefaultStyle">
19271928
<property name="text">
19281929
<string>Restore Default Style</string>
19291930
</property>
19301931
</widget>
19311932
</item>
1932-
<item row="1" column="1">
1933+
<item row="2" column="1">
19331934
<widget class="QPushButton" name="pbnSaveDefaultStyle">
19341935
<property name="text">
19351936
<string>Save As Default</string>
19361937
</property>
19371938
</widget>
19381939
</item>
1939-
<item row="1" column="2">
1940+
<item row="2" column="2">
19401941
<widget class="QPushButton" name="pbnLoadStyle">
19411942
<property name="text">
19421943
<string>Load Style ...</string>
19431944
</property>
19441945
</widget>
19451946
</item>
1946-
<item row="1" column="3">
1947+
<item row="2" column="3">
19471948
<widget class="QPushButton" name="pbnSaveStyleAs">
19481949
<property name="text">
19491950
<string>Save Style ...</string>
19501951
</property>
19511952
</widget>
19521953
</item>
1953-
<item row="2" column="0" colspan="4">
1954+
<item row="0" column="0" colspan="4">
19541955
<widget class="QDialogButtonBox" name="buttonBox">
19551956
<property name="orientation">
19561957
<enum>Qt::Horizontal</enum>
@@ -1982,7 +1983,6 @@ p, li { white-space: pre-wrap; }
19821983
<tabstop>leBlueMin</tabstop>
19831984
<tabstop>leBlueMax</tabstop>
19841985
<tabstop>sboxThreeBandStdDev</tabstop>
1985-
<tabstop>buttonBox</tabstop>
19861986
<tabstop>leNoDataValue</tabstop>
19871987
<tabstop>tableTransparency</tabstop>
19881988
<tabstop>leDisplayName</tabstop>

‎src/ui/qgsvectorlayerpropertiesbase.ui

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<bool>true</bool>
2222
</property>
2323
<layout class="QGridLayout" name="gridLayout_8">
24-
<item row="0" column="0">
24+
<item row="1" column="0">
2525
<widget class="QTabWidget" name="tabWidget">
2626
<property name="currentIndex">
2727
<number>0</number>
@@ -330,8 +330,8 @@
330330
<rect>
331331
<x>0</x>
332332
<y>0</y>
333-
<width>736</width>
334-
<height>542</height>
333+
<width>446</width>
334+
<height>481</height>
335335
</rect>
336336
</property>
337337
<layout class="QGridLayout" name="gridLayout_3">
@@ -1207,7 +1207,7 @@
12071207
</widget>
12081208
</widget>
12091209
</item>
1210-
<item row="1" column="0">
1210+
<item row="2" column="0">
12111211
<layout class="QHBoxLayout" name="horizontalLayout">
12121212
<item>
12131213
<widget class="QPushButton" name="pbnLoadDefaultStyle">
@@ -1239,7 +1239,7 @@
12391239
</item>
12401240
</layout>
12411241
</item>
1242-
<item row="2" column="0">
1242+
<item row="0" column="0">
12431243
<widget class="QDialogButtonBox" name="buttonBox">
12441244
<property name="orientation">
12451245
<enum>Qt::Horizontal</enum>
@@ -1268,7 +1268,6 @@
12681268
<tabstop>leMaximumScale</tabstop>
12691269
<tabstop>txtSubsetSQL</tabstop>
12701270
<tabstop>pbnQueryBuilder</tabstop>
1271-
<tabstop>buttonBox</tabstop>
12721271
</tabstops>
12731272
<resources>
12741273
<include location="../../images/images.qrc"/>

0 commit comments

Comments
 (0)
Please sign in to comment.