Skip to content

Commit

Permalink
Merge branch 'master' of github.com:qgis/Quantum-GIS
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Mar 1, 2012
2 parents 643db0e + 8459b58 commit 32be114
Show file tree
Hide file tree
Showing 26 changed files with 1,354 additions and 594 deletions.
1,100 changes: 579 additions & 521 deletions i18n/qgis_de.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions images/images.qrc
Expand Up @@ -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>
Expand Down
Binary file added images/themes/default/mActionOffsetCurve.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/app/CMakeLists.txt
Expand Up @@ -58,6 +58,7 @@ SET(QGIS_APP_SRCS
qgsmaptoolmovefeature.cpp
qgsmaptoolmovelabel.cpp
qgsmaptoolmovevertex.cpp
qgsmaptooloffsetcurve.cpp
qgsmaptoolreshape.cpp
qgsmaptoolrotatelabel.cpp
qgsmaptoolrotatepointsymbols.cpp
Expand Down Expand Up @@ -201,6 +202,7 @@ SET (QGIS_APP_MOC_HDRS
qgsmaptoolmovefeature.h
qgsmaptoolmovelabel.h
qgsmaptoolmovevertex.h
qgsmaptooloffsetcurve.h
qgsmaptoolreshape.h
qgsmaptoolrotatelabel.h
qgsmaptoolrotatepointsymbols.h
Expand Down
16 changes: 16 additions & 0 deletions src/app/composer/qgscomposer.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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 );
}

Expand Down
2 changes: 2 additions & 0 deletions src/app/composer/qgscomposer.h
Expand Up @@ -27,6 +27,7 @@ class QgsComposerArrow;
class QgsComposerLabel;
class QgsComposerLegend;
class QgsComposerPicture;
class QgsComposerPictureWidget;
class QgsComposerScaleBar;
class QgsComposerShape;
class QgsComposerAttributeTable;
Expand Down Expand Up @@ -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;
Expand Down
24 changes: 10 additions & 14 deletions src/app/composer/qgscomposerpicturewidget.cpp
Expand Up @@ -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 );

Expand All @@ -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() ) );
}
Expand Down Expand Up @@ -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() )
Expand Down Expand Up @@ -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++ )
Expand Down Expand Up @@ -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();
}

13 changes: 7 additions & 6 deletions src/app/composer/qgscomposerpicturewidget.h
Expand Up @@ -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();
Expand All @@ -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*/
Expand Down
32 changes: 24 additions & 8 deletions src/app/qgisapp.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand All @@ -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 );
Expand Down Expand Up @@ -6259,6 +6271,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionAddPart->setEnabled( false );
mActionDeletePart->setEnabled( false );
mActionMoveFeature->setEnabled( false );
mActionOffsetCurve->setEnabled( false );
mActionNodeTool->setEnabled( false );
}

Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions src/app/qgisapp.h
Expand Up @@ -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; }
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolmovefeature.cpp
Expand Up @@ -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,
Expand Down

0 comments on commit 32be114

Please sign in to comment.