[QGIS Commit] r12722 - in trunk/qgis/src: app app/composer core/gps
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat Jan 9 15:51:55 EST 2010
Author: jef
Date: 2010-01-09 15:51:54 -0500 (Sat, 09 Jan 2010)
New Revision: 12722
Modified:
trunk/qgis/src/app/composer/qgsattributeselectiondialog.cpp
trunk/qgis/src/app/qgsmaptoolcapture.h
trunk/qgis/src/core/gps/posix_qextserialport.cpp
Log:
fix warnings
Modified: trunk/qgis/src/app/composer/qgsattributeselectiondialog.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgsattributeselectiondialog.cpp 2010-01-09 20:50:14 UTC (rev 12721)
+++ trunk/qgis/src/app/composer/qgsattributeselectiondialog.cpp 2010-01-09 20:51:54 UTC (rev 12722)
@@ -23,50 +23,50 @@
#include <QLabel>
#include <QLineEdit>
-QgsAttributeSelectionDialog::QgsAttributeSelectionDialog(const QgsVectorLayer* vLayer, const QSet<int>& enabledAttributes, const QMap<int, QString>& aliasMap, \
- QWidget * parent, Qt::WindowFlags f): QDialog(parent, f), mVectorLayer(vLayer)
+QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( const QgsVectorLayer* vLayer, const QSet<int>& enabledAttributes, const QMap<int, QString>& aliasMap,
+ QWidget * parent, Qt::WindowFlags f ): QDialog( parent, f ), mVectorLayer( vLayer )
{
- if( vLayer )
+ if ( vLayer )
+ {
+ mGridLayout = new QGridLayout( this );
+ QLabel* attributeLabel = new QLabel( QString( "<b>" ) + tr( "Attribute" ) + QString( "</b>" ), this );
+ attributeLabel->setTextFormat( Qt::RichText );
+ mGridLayout->addWidget( attributeLabel, 0, 0 );
+ QLabel* aliasLabel = new QLabel( QString( "<b>" ) + tr( "Alias" ) + QString( "</b>" ), this );
+ aliasLabel->setTextFormat( Qt::RichText );
+ mGridLayout->addWidget( aliasLabel, 0, 1 );
+
+ QgsFieldMap fieldMap = vLayer->pendingFields();
+ QgsFieldMap::const_iterator fieldIt = fieldMap.constBegin();
+ int layoutRowCounter = 1;
+ for ( ; fieldIt != fieldMap.constEnd(); ++fieldIt )
{
- mGridLayout = new QGridLayout(this);
- QLabel* attributeLabel = new QLabel(QString("<b>") + tr("Attribute") + QString("</b>"), this );
- attributeLabel->setTextFormat(Qt::RichText);
- mGridLayout->addWidget(attributeLabel, 0, 0);
- QLabel* aliasLabel = new QLabel(QString("<b>") + tr("Alias") + QString("</b>"), this );
- aliasLabel->setTextFormat(Qt::RichText);
- mGridLayout->addWidget(aliasLabel, 0, 1);
+ QCheckBox* attributeCheckBox = new QCheckBox( fieldIt.value().name(), this );
+ if ( enabledAttributes.size() < 1 || enabledAttributes.contains( fieldIt.key() ) )
+ {
+ attributeCheckBox->setCheckState( Qt::Checked );
+ }
+ else
+ {
+ attributeCheckBox->setCheckState( Qt::Unchecked );
+ }
+ mGridLayout->addWidget( attributeCheckBox, layoutRowCounter, 0 );
- QgsFieldMap fieldMap = vLayer->pendingFields();
- QgsFieldMap::const_iterator fieldIt = fieldMap.constBegin();
- int layoutRowCounter = 1;
- for(; fieldIt != fieldMap.constEnd(); ++fieldIt)
- {
- QCheckBox* attributeCheckBox = new QCheckBox(fieldIt.value().name(), this);
- if( enabledAttributes.size() < 1 || enabledAttributes.contains(fieldIt.key()) )
- {
- attributeCheckBox->setCheckState(Qt::Checked);
- }
- else
- {
- attributeCheckBox->setCheckState(Qt::Unchecked);
- }
- mGridLayout->addWidget(attributeCheckBox, layoutRowCounter, 0);
-
- QLineEdit* attributeLineEdit = new QLineEdit(this);
- QMap<int, QString>::const_iterator aliasIt = aliasMap.find( fieldIt.key() );
- if(aliasIt != aliasMap.constEnd())
- {
- attributeLineEdit->setText(aliasIt.value());
- }
- mGridLayout->addWidget(attributeLineEdit, layoutRowCounter, 1);
- ++layoutRowCounter;
- }
-
- QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
- QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
- QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
- mGridLayout->addWidget( buttonBox, layoutRowCounter, 0, 3, 1);
+ QLineEdit* attributeLineEdit = new QLineEdit( this );
+ QMap<int, QString>::const_iterator aliasIt = aliasMap.find( fieldIt.key() );
+ if ( aliasIt != aliasMap.constEnd() )
+ {
+ attributeLineEdit->setText( aliasIt.value() );
+ }
+ mGridLayout->addWidget( attributeLineEdit, layoutRowCounter, 1 );
+ ++layoutRowCounter;
}
+
+ QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this );
+ QObject::connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
+ QObject::connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
+ mGridLayout->addWidget( buttonBox, layoutRowCounter, 0, 3, 1 );
+ }
}
QgsAttributeSelectionDialog::~QgsAttributeSelectionDialog()
@@ -76,69 +76,56 @@
QSet<int> QgsAttributeSelectionDialog::enabledAttributes() const
{
- QSet<int> result;
- if(!mGridLayout || !mVectorLayer)
- {
- return result;
- }
+ QSet<int> result;
+ if ( !mGridLayout || !mVectorLayer )
+ {
+ return result;
+ }
- for( int i = 1; i < mGridLayout->rowCount(); ++i)
+ for ( int i = 1; i < mGridLayout->rowCount(); ++i )
+ {
+ QLayoutItem *checkBoxItem = mGridLayout->itemAtPosition( i, 0 );
+ if ( checkBoxItem )
{
- bool boxChecked = false;
- QLayoutItem* checkBoxItem = mGridLayout->itemAtPosition(i, 0);
- if(checkBoxItem)
- {
- QWidget* checkBoxWidget = checkBoxItem->widget();
- if(checkBoxWidget)
- {
- QCheckBox* checkBox = dynamic_cast<QCheckBox*>(checkBoxWidget);
- if(checkBox)
- {
- if(checkBox->checkState() == Qt::Checked)
- {
- result.insert(mVectorLayer->fieldNameIndex(checkBox->text()));
- }
- }
- }
- }
+ QCheckBox *checkBox = qobject_cast< QCheckBox * >( checkBoxItem->widget() );
+ if ( checkBox && checkBox->checkState() == Qt::Checked )
+ {
+ result.insert( mVectorLayer->fieldNameIndex( checkBox->text() ) );
+ }
}
+ }
- return result;
+ return result;
}
QMap<int, QString> QgsAttributeSelectionDialog::aliasMap() const
{
- QMap<int, QString> result;
- if(!mGridLayout || !mVectorLayer)
- {
- return result;
- }
+ QMap<int, QString> result;
+ if ( !mGridLayout || !mVectorLayer )
+ {
+ return result;
+ }
- for( int i = 1; i < mGridLayout->rowCount(); ++i)
+ for ( int i = 1; i < mGridLayout->rowCount(); ++i )
+ {
+ QLayoutItem* lineEditItem = mGridLayout->itemAtPosition( i, 1 );
+ QLayoutItem* checkBoxItem = mGridLayout->itemAtPosition( i, 0 );
+ if ( lineEditItem && checkBoxItem )
{
- QLayoutItem* lineEditItem = mGridLayout->itemAtPosition(i, 1);
- QLayoutItem* checkBoxItem = mGridLayout->itemAtPosition(i, 0);
- if(lineEditItem && checkBoxItem)
+ QLineEdit *lineEdit = qobject_cast<QLineEdit*>( lineEditItem->widget() );
+ QCheckBox *checkBox = qobject_cast<QCheckBox*>( checkBoxItem->widget() );
+ if ( lineEdit )
+ {
+ QString aliasText = lineEdit->text();
+ if ( !aliasText.isEmpty() && checkBox )
{
- QWidget* lineEditWidget = lineEditItem->widget();
- QWidget* checkBoxWidget = checkBoxItem->widget();
- if(lineEditWidget)
- {
- QLineEdit* lineEdit = dynamic_cast<QLineEdit*>(lineEditWidget);
- QCheckBox* checkBox = dynamic_cast<QCheckBox*>(checkBoxWidget);
- if(lineEdit)
- {
- QString aliasText = lineEdit->text();
- if(!aliasText.isEmpty())
- {
- //insert into map
- int fieldIndex = mVectorLayer->fieldNameIndex( checkBox->text() );
- result.insert(fieldIndex, aliasText);
- }
- }
- }
+ //insert into map
+ int fieldIndex = mVectorLayer->fieldNameIndex( checkBox->text() );
+ result.insert( fieldIndex, aliasText );
}
+ }
}
- return result;
+ }
+ return result;
}
Modified: trunk/qgis/src/app/qgsmaptoolcapture.h
===================================================================
--- trunk/qgis/src/app/qgsmaptoolcapture.h 2010-01-09 20:50:14 UTC (rev 12721)
+++ trunk/qgis/src/app/qgsmaptoolcapture.h 2010-01-09 20:51:54 UTC (rev 12722)
@@ -39,7 +39,7 @@
};
//! constructor
- QgsMapToolCapture( QgsMapCanvas* canvas, CaptureMode tool );
+ QgsMapToolCapture( QgsMapCanvas* canvas, CaptureMode mode );
//! destructor
virtual ~QgsMapToolCapture();
Modified: trunk/qgis/src/core/gps/posix_qextserialport.cpp
===================================================================
--- trunk/qgis/src/core/gps/posix_qextserialport.cpp 2010-01-09 20:50:14 UTC (rev 12721)
+++ trunk/qgis/src/core/gps/posix_qextserialport.cpp 2010-01-09 20:51:54 UTC (rev 12722)
@@ -13,6 +13,7 @@
#include <stdio.h>
#include "posix_qextserialport.h"
+#include "qgslogger.h"
/*!
\fn Posix_QextSerialPort::Posix_QextSerialPort()
@@ -858,10 +859,10 @@
{
/*open the port*/
Posix_File->setFileName( port );
- qDebug( "Trying to open File" );
+ QgsDebugMsg( "Trying to open File" );
if ( Posix_File->open( QIODevice::ReadWrite | QIODevice::Unbuffered ) )
{
- qDebug( "Opened File successfully" );
+ QgsDebugMsg( "Opened File successfully" );
/*set open mode*/
QIODevice::open( mode );
@@ -889,7 +890,7 @@
}
else
{
- qDebug( "Could not open File! Error code : %d", Posix_File->error() );
+ QgsDebugMsg( QString( "Could not open File! Error code: %1" ).arg( Posix_File->error() ) );
}
}
UNLOCK_MUTEX();
More information about the QGIS-commit
mailing list