[QGIS Commit] r12739 - in trunk/qgis/src: core/gps
plugins/gps_importer
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Jan 11 16:41:27 EST 2010
Author: jef
Date: 2010-01-11 16:41:25 -0500 (Mon, 11 Jan 2010)
New Revision: 12739
Modified:
trunk/qgis/src/core/gps/qgsgpsconnection.cpp
trunk/qgis/src/plugins/gps_importer/CMakeLists.txt
trunk/qgis/src/plugins/gps_importer/qgsgpsplugingui.cpp
Log:
use QgsGPSConnection::availablePorts() also in gps plugin
Modified: trunk/qgis/src/core/gps/qgsgpsconnection.cpp
===================================================================
--- trunk/qgis/src/core/gps/qgsgpsconnection.cpp 2010-01-11 21:34:44 UTC (rev 12738)
+++ trunk/qgis/src/core/gps/qgsgpsconnection.cpp 2010-01-11 21:41:25 UTC (rev 12739)
@@ -208,8 +208,6 @@
}
}
}
-
- devs << "usb:";
#endif
#ifdef __FreeBSD__ // freebsd
Modified: trunk/qgis/src/plugins/gps_importer/CMakeLists.txt
===================================================================
--- trunk/qgis/src/plugins/gps_importer/CMakeLists.txt 2010-01-11 21:34:44 UTC (rev 12738)
+++ trunk/qgis/src/plugins/gps_importer/CMakeLists.txt 2010-01-11 21:41:25 UTC (rev 12739)
@@ -38,7 +38,7 @@
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
- ../../core ../../core/raster ../../core/renderer ../../core/symbology
+ ../../core ../../core/gps
../../gui
..
${EXPAT_INCLUDE_DIR}
Modified: trunk/qgis/src/plugins/gps_importer/qgsgpsplugingui.cpp
===================================================================
--- trunk/qgis/src/plugins/gps_importer/qgsgpsplugingui.cpp 2010-01-11 21:34:44 UTC (rev 12738)
+++ trunk/qgis/src/plugins/gps_importer/qgsgpsplugingui.cpp 2010-01-11 21:41:25 UTC (rev 12739)
@@ -15,6 +15,7 @@
#include "qgsdataprovider.h"
#include "qgscontexthelp.h"
#include "qgslogger.h"
+#include "qgsgpsconnection.h"
//qt includes
#include <QFileDialog>
@@ -303,98 +304,12 @@
void QgsGPSPluginGui::populatePortComboBoxes()
{
-
+ QStringList devs = QgsGPSConnection::availablePorts() << "usb:";
cmbDLPort->clear();
-#ifdef linux
- // look for linux serial devices
- QString linuxDev( "/dev/ttyS%1" );
- for ( int i = 0; i < 10; ++i )
- {
- if ( QFileInfo( linuxDev.arg( i ) ).exists() )
- {
- cmbDLPort->addItem( linuxDev.arg( i ) );
- cmbULPort->addItem( linuxDev.arg( i ) );
- }
- else
- break;
- }
+ cmbDLPort->addItems( devs );
+ cmbULPort->clear();
+ cmbULPort->addItems( devs );
- // and the ttyUSB* devices (serial USB adaptor)
- linuxDev = "/dev/ttyUSB%1";
- for ( int i = 0; i < 10; ++i )
- {
- if ( QFileInfo( linuxDev.arg( i ) ).exists() )
- {
- cmbDLPort->addItem( linuxDev.arg( i ) );
- cmbULPort->addItem( linuxDev.arg( i ) );
- }
- else
- break;
- }
-
- cmbDLPort->addItem( "usb:" );
- cmbULPort->addItem( "usb:" );
-#endif
-
-#ifdef __FreeBSD__ // freebsd
- // and freebsd devices (untested)
- QString freebsdDev( "/dev/cuaa%1" );
- for ( int i = 0; i < 10; ++i )
- {
- if ( QFileInfo( freebsdDev.arg( i ) ).exists() )
- {
- cmbDLPort->addItem( freebsdDev.arg( i ) );
- cmbULPort->addItem( freebsdDev.arg( i ) );
- }
- else
- break;
- }
-
- // and the ucom devices (serial USB adaptors)
- freebsdDev = "/dev/ucom%1";
- for ( int i = 0; i < 10; ++i )
- {
- if ( QFileInfo( freebsdDev.arg( i ) ).exists() )
- {
- cmbDLPort->addItem( freebsdDev.arg( i ) );
- cmbULPort->addItem( freebsdDev.arg( i ) );
- }
- else
- break;
- }
-
-#endif
-
-#ifdef sparc
- // and solaris devices (also untested)
- QString solarisDev( "/dev/cua/%1" );
- for ( int i = 'a'; i < 'k'; ++i )
- {
- if ( QFileInfo( solarisDev.arg( char( i ) ) ).exists() )
- {
- cmbDLPort->addItem( solarisDev.arg( char( i ) ) );
- cmbULPort->addItem( solarisDev.arg( char( i ) ) );
- }
- else
- break;
- }
-#endif
-
-#ifdef WIN32
- cmbULPort->addItem( "com1" );
- cmbULPort->addItem( "com2" );
- cmbULPort->addItem( "com3" );
- cmbULPort->addItem( "com4" );
- cmbULPort->addItem( "usb:" );
- cmbDLPort->addItem( "com1" );
- cmbDLPort->addItem( "com2" );
- cmbDLPort->addItem( "com3" );
- cmbDLPort->addItem( "com4" );
- cmbDLPort->addItem( "usb:" );
-#endif
-
- // OSX, OpenBSD, NetBSD etc? Anyone?
-
// remember the last ports used
QSettings settings;
QString lastDLPort = settings.value( "/Plugin-GPS/lastdlport", "" ).toString();
More information about the QGIS-commit
mailing list