Skip to content
Permalink
Browse files

Merge branch 'master' of github.com:qgis/Quantum-GIS

  • Loading branch information
timlinux committed Mar 1, 2012
2 parents 643db0e + 8459b58 commit 32be114f7606556b83b7c4a2b69b230baf0ab3fa

Large diffs are not rendered by default.

@@ -108,6 +108,7 @@
<file>themes/default/mActionNewFolder.png</file>
<file>themes/default/mActionNewVectorLayer.png</file>
<file>themes/default/mActionNodeTool.png</file>
<file>themes/default/mActionOffsetCurve.png</file>
<file>themes/default/mActionOpenTable.png</file>
<file>themes/default/mActionOptions.png</file>
<file>themes/default/mActionPan.png</file>
Binary file not shown.
@@ -58,6 +58,7 @@ SET(QGIS_APP_SRCS
qgsmaptoolmovefeature.cpp
qgsmaptoolmovelabel.cpp
qgsmaptoolmovevertex.cpp
qgsmaptooloffsetcurve.cpp
qgsmaptoolreshape.cpp
qgsmaptoolrotatelabel.cpp
qgsmaptoolrotatepointsymbols.cpp
@@ -201,6 +202,7 @@ SET (QGIS_APP_MOC_HDRS
qgsmaptoolmovefeature.h
qgsmaptoolmovelabel.h
qgsmaptoolmovevertex.h
qgsmaptooloffsetcurve.h
qgsmaptoolreshape.h
qgsmaptoolrotatelabel.h
qgsmaptoolrotatepointsymbols.h
@@ -1134,6 +1134,14 @@ void QgsComposer::showEvent( QShowEvent* event )
mapIt.key()->update();
}
mMapsToRestore.clear();

//create composer picture widget previews
QList< QgsComposerPictureWidget* >::iterator picIt = mPicturePreviews.begin();
for ( ; picIt != mPicturePreviews.end(); ++picIt )
{
( *picIt )->addStandardDirectoriesToPreview();
}
mPicturePreviews.clear();
}

#ifdef Q_WS_MAC
@@ -1382,6 +1390,14 @@ void QgsComposer::addComposerPicture( QgsComposerPicture* picture )
}

QgsComposerPictureWidget* pWidget = new QgsComposerPictureWidget( picture );
if ( isVisible() )
{
pWidget->addStandardDirectoriesToPreview();
}
else
{
mPicturePreviews.append( pWidget );
}
mItemWidgetMap.insert( picture, pWidget );
}

@@ -27,6 +27,7 @@ class QgsComposerArrow;
class QgsComposerLabel;
class QgsComposerLegend;
class QgsComposerPicture;
class QgsComposerPictureWidget;
class QgsComposerScaleBar;
class QgsComposerShape;
class QgsComposerAttributeTable;
@@ -322,6 +323,7 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase

//! We load composer map content from project xml only on demand. Therefore we need to store the real preview mode type
QMap< QgsComposerMap*, int > mMapsToRestore;
QList< QgsComposerPictureWidget* > mPicturePreviews;

QDockWidget* mItemDock;
QDockWidget* mUndoDock;
@@ -30,7 +30,7 @@
#include <QSettings>
#include <QSvgRenderer>

QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture ): QWidget(), mPicture( picture ), mPreviewInitialized( false )
QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture ): QWidget(), mPicture( picture )
{
setupUi( this );

@@ -44,8 +44,6 @@ QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture

mPreviewListWidget->setIconSize( QSize( 30, 30 ) );

//add preview icons on demand in showEvent()

connect( mPicture, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) );
connect( mPicture, SIGNAL( rotationChanged( double ) ), this, SLOT( setGuiElementValues() ) );
}
@@ -261,17 +259,6 @@ void QgsComposerPictureWidget::on_mRotationFromComposerMapCheckBox_stateChanged(
mPicture->endCommand();
}

void QgsComposerPictureWidget::showEvent( QShowEvent * event )
{
refreshMapComboBox();
if ( !mPreviewInitialized )
{
addStandardDirectoriesToPreview();
mPreviewInitialized = true;
}
QWidget::showEvent( event );
}

void QgsComposerPictureWidget::on_mComposerMapComboBox_activated( const QString & text )
{
if ( !mPicture || text.isEmpty() || !mPicture->useRotationMap() )
@@ -481,6 +468,8 @@ int QgsComposerPictureWidget::addDirectoryToPreview( const QString& path )

void QgsComposerPictureWidget::addStandardDirectoriesToPreview()
{
mPreviewListWidget->clear();

//list all directories in $prefix/share/qgis/svg
QStringList svgPaths = QgsApplication::svgPaths();
for ( int i = 0; i < svgPaths.size(); i++ )
@@ -536,3 +525,10 @@ bool QgsComposerPictureWidget::testImageFile( const QString& filename ) const
QString formatName = QString( QImageReader::imageFormat( filename ) );
return !formatName.isEmpty(); //file is in a supported pixel format
}

void QgsComposerPictureWidget::showEvent( QShowEvent * event )
{
Q_UNUSED( event );
refreshMapComboBox();
}

@@ -33,6 +33,9 @@ class QgsComposerPictureWidget: public QWidget, private Ui::QgsComposerPictureWi
QgsComposerPictureWidget( QgsComposerPicture* picture );
~QgsComposerPictureWidget();

/**Add the icons of the standard directories to the preview*/
void addStandardDirectoriesToPreview();

public slots:
void on_mPictureBrowseButton_clicked();
void on_mPictureLineEdit_editingFinished();
@@ -45,21 +48,19 @@ class QgsComposerPictureWidget: public QWidget, private Ui::QgsComposerPictureWi
void on_mRotationFromComposerMapCheckBox_stateChanged( int state );
void on_mComposerMapComboBox_activated( const QString & text );

protected:
void showEvent( QShowEvent * event );

private slots:
/**Sets the GUI elements to the values of mPicture*/
void setGuiElementValues();

protected:
void showEvent( QShowEvent * event );

private:
QgsComposerPicture* mPicture;
bool mPreviewInitialized;

/**Add the icons of a directory to the preview. Returns 0 in case of success*/
int addDirectoryToPreview( const QString& path );
/**Add the icons of the standard directories to the preview*/
void addStandardDirectoriesToPreview();

/**Tests if a file is valid svg*/
bool testSvgFile( const QString& filename ) const;
/**Tests if a file is a valid pixel format*/
@@ -210,6 +210,7 @@
#include "qgsmaptoolmeasureangle.h"
#include "qgsmaptoolmovefeature.h"
#include "qgsmaptoolmovevertex.h"
#include "qgsmaptooloffsetcurve.h"
#include "qgsmaptoolpan.h"
#include "qgsmaptoolselect.h"
#include "qgsmaptoolselectrectangle.h"
@@ -627,7 +628,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,

#ifdef ANDROID
//add reacting to long click in android
grabGesture(Qt::TapAndHoldGesture);
grabGesture( Qt::TapAndHoldGesture );
#endif

// update windows
@@ -740,9 +741,9 @@ bool QgisApp::event( QEvent * event )
done = true;
}
#ifdef ANDROID
else if (event->type() == QEvent::Gesture )
else if ( event->type() == QEvent::Gesture )
{
done = gestureEvent(static_cast<QGestureEvent*>(event));
done = gestureEvent( static_cast<QGestureEvent*>( event ) );
}
#endif
else
@@ -814,6 +815,7 @@ void QgisApp::createActions()
connect( mActionNodeTool, SIGNAL( triggered() ), this, SLOT( nodeTool() ) );
connect( mActionRotatePointSymbols, SIGNAL( triggered() ), this, SLOT( rotatePointSymbols() ) );
connect( mActionSnappingOptions, SIGNAL( triggered() ), this, SLOT( snappingOptions() ) );
connect( mActionOffsetCurve, SIGNAL( triggered() ), this, SLOT( offsetCurve() ) );

// View Menu Items

@@ -1016,6 +1018,7 @@ void QgisApp::createActionGroups()
mMapToolGroup->addAction( mActionMeasureAngle );
mMapToolGroup->addAction( mActionAddFeature );
mMapToolGroup->addAction( mActionMoveFeature );
mMapToolGroup->addAction( mActionOffsetCurve );
mMapToolGroup->addAction( mActionReshapeFeatures );
mMapToolGroup->addAction( mActionSplitFeatures );
mMapToolGroup->addAction( mActionDeleteSelected );
@@ -1664,6 +1667,8 @@ void QgisApp::createCanvasTools()
mMapTools.mAddFeature->setAction( mActionAddFeature );
mMapTools.mMoveFeature = new QgsMapToolMoveFeature( mMapCanvas );
mMapTools.mMoveFeature->setAction( mActionMoveFeature );
mMapTools.mOffsetCurve = new QgsMapToolOffsetCurve( mMapCanvas );
mMapTools.mOffsetCurve->setAction( mActionOffsetCurve );
mMapTools.mReshapeFeatures = new QgsMapToolReshape( mMapCanvas );
mMapTools.mReshapeFeatures->setAction( mActionReshapeFeatures );
mMapTools.mSplitFeatures = new QgsMapToolSplitFeatures( mMapCanvas );
@@ -3588,6 +3593,11 @@ void QgisApp::moveFeature()
mMapCanvas->setMapTool( mMapTools.mMoveFeature );
}

void QgisApp::offsetCurve()
{
mMapCanvas->setMapTool( mMapTools.mOffsetCurve );
}

void QgisApp::simplifyFeature()
{
mMapCanvas->setMapTool( mMapTools.mSimplifyFeature );
@@ -6127,6 +6137,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionFeatureAction->setEnabled( false );
mActionAddFeature->setEnabled( false );
mActionMoveFeature->setEnabled( false );
mActionOffsetCurve->setEnabled( false );
mActionNodeTool->setEnabled( false );
mActionDeleteSelected->setEnabled( false );
mActionCutFeatures->setEnabled( false );
@@ -6141,6 +6152,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionDeleteRing->setEnabled( false );
mActionDeletePart->setEnabled( false );
mActionReshapeFeatures->setEnabled( false );
mActionOffsetCurve->setEnabled( false );
mActionSplitFeatures->setEnabled( false );
mActionMergeFeatures->setEnabled( false );
mActionMergeFeatureAttributes->setEnabled( false );
@@ -6259,6 +6271,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionAddPart->setEnabled( false );
mActionDeletePart->setEnabled( false );
mActionMoveFeature->setEnabled( false );
mActionOffsetCurve->setEnabled( false );
mActionNodeTool->setEnabled( false );
}

@@ -6291,6 +6304,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionReshapeFeatures->setEnabled( true );
mActionSplitFeatures->setEnabled( true );
mActionSimplifyFeature->setEnabled( true );
mActionOffsetCurve->setEnabled( dprovider->capabilities() & QgsVectorDataProvider::ChangeAttributeValues );
}
else
{
@@ -6370,6 +6384,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionAddPart->setEnabled( false );
mActionNodeTool->setEnabled( false );
mActionMoveFeature->setEnabled( false );
mActionOffsetCurve->setEnabled( false );
mActionCopyFeatures->setEnabled( false );
mActionCutFeatures->setEnabled( false );
mActionPasteFeatures->setEnabled( false );
@@ -7278,18 +7293,19 @@ QMenu* QgisApp::createPopupMenu()
}

#ifdef ANDROID
bool QgisApp::gestureEvent(QGestureEvent *event)
bool QgisApp::gestureEvent( QGestureEvent *event )
{
if (QGesture *tapAndHold = event->gesture(Qt::TapAndHoldGesture))
if ( QGesture *tapAndHold = event->gesture( Qt::TapAndHoldGesture ) )
{
tapAndHoldTriggered(static_cast<QTapAndHoldGesture *>(tapAndHold));
tapAndHoldTriggered( static_cast<QTapAndHoldGesture *>( tapAndHold ) );
}
return true;
}

void QgisApp::tapAndHoldTriggered(QTapAndHoldGesture *gesture)
void QgisApp::tapAndHoldTriggered( QTapAndHoldGesture *gesture )
{
if (gesture->state() == Qt::GestureFinished) {
if ( gesture->state() == Qt::GestureFinished )
{
QPoint pos = gesture->position().toPoint();
QWidget * receiver = QApplication::widgetAt( pos );
qDebug() << "tapAndHoldTriggered: LONG CLICK gesture happened at " << pos;
@@ -242,6 +242,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QAction *actionDeletePart() { return mActionDeletePart; }
QAction *actionNodeTool() { return mActionNodeTool; }
QAction *actionSnappingOptions() { return mActionSnappingOptions; }
QAction *actionOffsetCurve() { return mActionOffsetCurve; }

QAction *actionPan() { return mActionPan; }
QAction *actionPanToSelected() { return mActionPanToSelected; }
@@ -673,6 +674,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
void addFeature();
//! activates the move feature tool
void moveFeature();
//! activates the offset curve tool
void offsetCurve();
//! activates the reshape features tool
void reshapeFeatures();
//! activates the split features tool
@@ -991,6 +994,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QgsMapTool* mMeasureAngle;
QgsMapTool* mAddFeature;
QgsMapTool* mMoveFeature;
QgsMapTool* mOffsetCurve;
QgsMapTool* mReshapeFeatures;
QgsMapTool* mSplitFeatures;
QgsMapTool* mSelect;
@@ -1161,8 +1165,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QString mOldScale;

#ifdef ANDROID
bool gestureEvent(QGestureEvent *event);
void tapAndHoldTriggered(QTapAndHoldGesture *gesture);
bool gestureEvent( QGestureEvent *event );
void tapAndHoldTriggered( QTapAndHoldGesture *gesture );
#endif
};

@@ -68,7 +68,7 @@ void QgsMapToolMoveFeature::canvasPressEvent( QMouseEvent * e )
}

//find first geometry under mouse cursor and store iterator to it
QgsPoint layerCoords = toLayerCoordinates(( QgsMapLayer* )vlayer, e->pos() );
QgsPoint layerCoords = toLayerCoordinates( vlayer, e->pos() );
QSettings settings;
double searchRadius = QgsTolerance::vertexSearchRadius( mCanvas->currentLayer(), mCanvas->mapRenderer() );
QgsRectangle selectRect( layerCoords.x() - searchRadius, layerCoords.y() - searchRadius,

0 comments on commit 32be114

Please sign in to comment.
You can’t perform that action at this time.