Skip to content

Commit 32be114

Browse files
committed
Merge branch 'master' of github.com:qgis/Quantum-GIS
2 parents 643db0e + 8459b58 commit 32be114

26 files changed

+1354
-594
lines changed

i18n/qgis_de.ts

+579-521
Large diffs are not rendered by default.

images/images.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
<file>themes/default/mActionNewFolder.png</file>
109109
<file>themes/default/mActionNewVectorLayer.png</file>
110110
<file>themes/default/mActionNodeTool.png</file>
111+
<file>themes/default/mActionOffsetCurve.png</file>
111112
<file>themes/default/mActionOpenTable.png</file>
112113
<file>themes/default/mActionOptions.png</file>
113114
<file>themes/default/mActionPan.png</file>
1.19 KB
Loading

src/app/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ SET(QGIS_APP_SRCS
5858
qgsmaptoolmovefeature.cpp
5959
qgsmaptoolmovelabel.cpp
6060
qgsmaptoolmovevertex.cpp
61+
qgsmaptooloffsetcurve.cpp
6162
qgsmaptoolreshape.cpp
6263
qgsmaptoolrotatelabel.cpp
6364
qgsmaptoolrotatepointsymbols.cpp
@@ -201,6 +202,7 @@ SET (QGIS_APP_MOC_HDRS
201202
qgsmaptoolmovefeature.h
202203
qgsmaptoolmovelabel.h
203204
qgsmaptoolmovevertex.h
205+
qgsmaptooloffsetcurve.h
204206
qgsmaptoolreshape.h
205207
qgsmaptoolrotatelabel.h
206208
qgsmaptoolrotatepointsymbols.h

src/app/composer/qgscomposer.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,14 @@ void QgsComposer::showEvent( QShowEvent* event )
11341134
mapIt.key()->update();
11351135
}
11361136
mMapsToRestore.clear();
1137+
1138+
//create composer picture widget previews
1139+
QList< QgsComposerPictureWidget* >::iterator picIt = mPicturePreviews.begin();
1140+
for ( ; picIt != mPicturePreviews.end(); ++picIt )
1141+
{
1142+
( *picIt )->addStandardDirectoriesToPreview();
1143+
}
1144+
mPicturePreviews.clear();
11371145
}
11381146

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

13841392
QgsComposerPictureWidget* pWidget = new QgsComposerPictureWidget( picture );
1393+
if ( isVisible() )
1394+
{
1395+
pWidget->addStandardDirectoriesToPreview();
1396+
}
1397+
else
1398+
{
1399+
mPicturePreviews.append( pWidget );
1400+
}
13851401
mItemWidgetMap.insert( picture, pWidget );
13861402
}
13871403

src/app/composer/qgscomposer.h

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class QgsComposerArrow;
2727
class QgsComposerLabel;
2828
class QgsComposerLegend;
2929
class QgsComposerPicture;
30+
class QgsComposerPictureWidget;
3031
class QgsComposerScaleBar;
3132
class QgsComposerShape;
3233
class QgsComposerAttributeTable;
@@ -322,6 +323,7 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
322323

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

326328
QDockWidget* mItemDock;
327329
QDockWidget* mUndoDock;

src/app/composer/qgscomposerpicturewidget.cpp

+10-14
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <QSettings>
3131
#include <QSvgRenderer>
3232

33-
QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture ): QWidget(), mPicture( picture ), mPreviewInitialized( false )
33+
QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture ): QWidget(), mPicture( picture )
3434
{
3535
setupUi( this );
3636

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

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

47-
//add preview icons on demand in showEvent()
48-
4947
connect( mPicture, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) );
5048
connect( mPicture, SIGNAL( rotationChanged( double ) ), this, SLOT( setGuiElementValues() ) );
5149
}
@@ -261,17 +259,6 @@ void QgsComposerPictureWidget::on_mRotationFromComposerMapCheckBox_stateChanged(
261259
mPicture->endCommand();
262260
}
263261

264-
void QgsComposerPictureWidget::showEvent( QShowEvent * event )
265-
{
266-
refreshMapComboBox();
267-
if ( !mPreviewInitialized )
268-
{
269-
addStandardDirectoriesToPreview();
270-
mPreviewInitialized = true;
271-
}
272-
QWidget::showEvent( event );
273-
}
274-
275262
void QgsComposerPictureWidget::on_mComposerMapComboBox_activated( const QString & text )
276263
{
277264
if ( !mPicture || text.isEmpty() || !mPicture->useRotationMap() )
@@ -481,6 +468,8 @@ int QgsComposerPictureWidget::addDirectoryToPreview( const QString& path )
481468

482469
void QgsComposerPictureWidget::addStandardDirectoriesToPreview()
483470
{
471+
mPreviewListWidget->clear();
472+
484473
//list all directories in $prefix/share/qgis/svg
485474
QStringList svgPaths = QgsApplication::svgPaths();
486475
for ( int i = 0; i < svgPaths.size(); i++ )
@@ -536,3 +525,10 @@ bool QgsComposerPictureWidget::testImageFile( const QString& filename ) const
536525
QString formatName = QString( QImageReader::imageFormat( filename ) );
537526
return !formatName.isEmpty(); //file is in a supported pixel format
538527
}
528+
529+
void QgsComposerPictureWidget::showEvent( QShowEvent * event )
530+
{
531+
Q_UNUSED( event );
532+
refreshMapComboBox();
533+
}
534+

src/app/composer/qgscomposerpicturewidget.h

+7-6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ class QgsComposerPictureWidget: public QWidget, private Ui::QgsComposerPictureWi
3333
QgsComposerPictureWidget( QgsComposerPicture* picture );
3434
~QgsComposerPictureWidget();
3535

36+
/**Add the icons of the standard directories to the preview*/
37+
void addStandardDirectoriesToPreview();
38+
3639
public slots:
3740
void on_mPictureBrowseButton_clicked();
3841
void on_mPictureLineEdit_editingFinished();
@@ -45,21 +48,19 @@ class QgsComposerPictureWidget: public QWidget, private Ui::QgsComposerPictureWi
4548
void on_mRotationFromComposerMapCheckBox_stateChanged( int state );
4649
void on_mComposerMapComboBox_activated( const QString & text );
4750

51+
protected:
52+
void showEvent( QShowEvent * event );
53+
4854
private slots:
4955
/**Sets the GUI elements to the values of mPicture*/
5056
void setGuiElementValues();
5157

52-
protected:
53-
void showEvent( QShowEvent * event );
54-
5558
private:
5659
QgsComposerPicture* mPicture;
57-
bool mPreviewInitialized;
5860

5961
/**Add the icons of a directory to the preview. Returns 0 in case of success*/
6062
int addDirectoryToPreview( const QString& path );
61-
/**Add the icons of the standard directories to the preview*/
62-
void addStandardDirectoriesToPreview();
63+
6364
/**Tests if a file is valid svg*/
6465
bool testSvgFile( const QString& filename ) const;
6566
/**Tests if a file is a valid pixel format*/

src/app/qgisapp.cpp

+24-8
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@
210210
#include "qgsmaptoolmeasureangle.h"
211211
#include "qgsmaptoolmovefeature.h"
212212
#include "qgsmaptoolmovevertex.h"
213+
#include "qgsmaptooloffsetcurve.h"
213214
#include "qgsmaptoolpan.h"
214215
#include "qgsmaptoolselect.h"
215216
#include "qgsmaptoolselectrectangle.h"
@@ -627,7 +628,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
627628

628629
#ifdef ANDROID
629630
//add reacting to long click in android
630-
grabGesture(Qt::TapAndHoldGesture);
631+
grabGesture( Qt::TapAndHoldGesture );
631632
#endif
632633

633634
// update windows
@@ -740,9 +741,9 @@ bool QgisApp::event( QEvent * event )
740741
done = true;
741742
}
742743
#ifdef ANDROID
743-
else if (event->type() == QEvent::Gesture )
744+
else if ( event->type() == QEvent::Gesture )
744745
{
745-
done = gestureEvent(static_cast<QGestureEvent*>(event));
746+
done = gestureEvent( static_cast<QGestureEvent*>( event ) );
746747
}
747748
#endif
748749
else
@@ -814,6 +815,7 @@ void QgisApp::createActions()
814815
connect( mActionNodeTool, SIGNAL( triggered() ), this, SLOT( nodeTool() ) );
815816
connect( mActionRotatePointSymbols, SIGNAL( triggered() ), this, SLOT( rotatePointSymbols() ) );
816817
connect( mActionSnappingOptions, SIGNAL( triggered() ), this, SLOT( snappingOptions() ) );
818+
connect( mActionOffsetCurve, SIGNAL( triggered() ), this, SLOT( offsetCurve() ) );
817819

818820
// View Menu Items
819821

@@ -1016,6 +1018,7 @@ void QgisApp::createActionGroups()
10161018
mMapToolGroup->addAction( mActionMeasureAngle );
10171019
mMapToolGroup->addAction( mActionAddFeature );
10181020
mMapToolGroup->addAction( mActionMoveFeature );
1021+
mMapToolGroup->addAction( mActionOffsetCurve );
10191022
mMapToolGroup->addAction( mActionReshapeFeatures );
10201023
mMapToolGroup->addAction( mActionSplitFeatures );
10211024
mMapToolGroup->addAction( mActionDeleteSelected );
@@ -1664,6 +1667,8 @@ void QgisApp::createCanvasTools()
16641667
mMapTools.mAddFeature->setAction( mActionAddFeature );
16651668
mMapTools.mMoveFeature = new QgsMapToolMoveFeature( mMapCanvas );
16661669
mMapTools.mMoveFeature->setAction( mActionMoveFeature );
1670+
mMapTools.mOffsetCurve = new QgsMapToolOffsetCurve( mMapCanvas );
1671+
mMapTools.mOffsetCurve->setAction( mActionOffsetCurve );
16671672
mMapTools.mReshapeFeatures = new QgsMapToolReshape( mMapCanvas );
16681673
mMapTools.mReshapeFeatures->setAction( mActionReshapeFeatures );
16691674
mMapTools.mSplitFeatures = new QgsMapToolSplitFeatures( mMapCanvas );
@@ -3588,6 +3593,11 @@ void QgisApp::moveFeature()
35883593
mMapCanvas->setMapTool( mMapTools.mMoveFeature );
35893594
}
35903595

3596+
void QgisApp::offsetCurve()
3597+
{
3598+
mMapCanvas->setMapTool( mMapTools.mOffsetCurve );
3599+
}
3600+
35913601
void QgisApp::simplifyFeature()
35923602
{
35933603
mMapCanvas->setMapTool( mMapTools.mSimplifyFeature );
@@ -6127,6 +6137,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
61276137
mActionFeatureAction->setEnabled( false );
61286138
mActionAddFeature->setEnabled( false );
61296139
mActionMoveFeature->setEnabled( false );
6140+
mActionOffsetCurve->setEnabled( false );
61306141
mActionNodeTool->setEnabled( false );
61316142
mActionDeleteSelected->setEnabled( false );
61326143
mActionCutFeatures->setEnabled( false );
@@ -6141,6 +6152,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
61416152
mActionDeleteRing->setEnabled( false );
61426153
mActionDeletePart->setEnabled( false );
61436154
mActionReshapeFeatures->setEnabled( false );
6155+
mActionOffsetCurve->setEnabled( false );
61446156
mActionSplitFeatures->setEnabled( false );
61456157
mActionMergeFeatures->setEnabled( false );
61466158
mActionMergeFeatureAttributes->setEnabled( false );
@@ -6259,6 +6271,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
62596271
mActionAddPart->setEnabled( false );
62606272
mActionDeletePart->setEnabled( false );
62616273
mActionMoveFeature->setEnabled( false );
6274+
mActionOffsetCurve->setEnabled( false );
62626275
mActionNodeTool->setEnabled( false );
62636276
}
62646277

@@ -6291,6 +6304,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
62916304
mActionReshapeFeatures->setEnabled( true );
62926305
mActionSplitFeatures->setEnabled( true );
62936306
mActionSimplifyFeature->setEnabled( true );
6307+
mActionOffsetCurve->setEnabled( dprovider->capabilities() & QgsVectorDataProvider::ChangeAttributeValues );
62946308
}
62956309
else
62966310
{
@@ -6370,6 +6384,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
63706384
mActionAddPart->setEnabled( false );
63716385
mActionNodeTool->setEnabled( false );
63726386
mActionMoveFeature->setEnabled( false );
6387+
mActionOffsetCurve->setEnabled( false );
63736388
mActionCopyFeatures->setEnabled( false );
63746389
mActionCutFeatures->setEnabled( false );
63756390
mActionPasteFeatures->setEnabled( false );
@@ -7278,18 +7293,19 @@ QMenu* QgisApp::createPopupMenu()
72787293
}
72797294

72807295
#ifdef ANDROID
7281-
bool QgisApp::gestureEvent(QGestureEvent *event)
7296+
bool QgisApp::gestureEvent( QGestureEvent *event )
72827297
{
7283-
if (QGesture *tapAndHold = event->gesture(Qt::TapAndHoldGesture))
7298+
if ( QGesture *tapAndHold = event->gesture( Qt::TapAndHoldGesture ) )
72847299
{
7285-
tapAndHoldTriggered(static_cast<QTapAndHoldGesture *>(tapAndHold));
7300+
tapAndHoldTriggered( static_cast<QTapAndHoldGesture *>( tapAndHold ) );
72867301
}
72877302
return true;
72887303
}
72897304

7290-
void QgisApp::tapAndHoldTriggered(QTapAndHoldGesture *gesture)
7305+
void QgisApp::tapAndHoldTriggered( QTapAndHoldGesture *gesture )
72917306
{
7292-
if (gesture->state() == Qt::GestureFinished) {
7307+
if ( gesture->state() == Qt::GestureFinished )
7308+
{
72937309
QPoint pos = gesture->position().toPoint();
72947310
QWidget * receiver = QApplication::widgetAt( pos );
72957311
qDebug() << "tapAndHoldTriggered: LONG CLICK gesture happened at " << pos;

src/app/qgisapp.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
242242
QAction *actionDeletePart() { return mActionDeletePart; }
243243
QAction *actionNodeTool() { return mActionNodeTool; }
244244
QAction *actionSnappingOptions() { return mActionSnappingOptions; }
245+
QAction *actionOffsetCurve() { return mActionOffsetCurve; }
245246

246247
QAction *actionPan() { return mActionPan; }
247248
QAction *actionPanToSelected() { return mActionPanToSelected; }
@@ -673,6 +674,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
673674
void addFeature();
674675
//! activates the move feature tool
675676
void moveFeature();
677+
//! activates the offset curve tool
678+
void offsetCurve();
676679
//! activates the reshape features tool
677680
void reshapeFeatures();
678681
//! activates the split features tool
@@ -991,6 +994,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
991994
QgsMapTool* mMeasureAngle;
992995
QgsMapTool* mAddFeature;
993996
QgsMapTool* mMoveFeature;
997+
QgsMapTool* mOffsetCurve;
994998
QgsMapTool* mReshapeFeatures;
995999
QgsMapTool* mSplitFeatures;
9961000
QgsMapTool* mSelect;
@@ -1161,8 +1165,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
11611165
QString mOldScale;
11621166

11631167
#ifdef ANDROID
1164-
bool gestureEvent(QGestureEvent *event);
1165-
void tapAndHoldTriggered(QTapAndHoldGesture *gesture);
1168+
bool gestureEvent( QGestureEvent *event );
1169+
void tapAndHoldTriggered( QTapAndHoldGesture *gesture );
11661170
#endif
11671171
};
11681172

src/app/qgsmaptoolmovefeature.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void QgsMapToolMoveFeature::canvasPressEvent( QMouseEvent * e )
6868
}
6969

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

0 commit comments

Comments
 (0)