Skip to content

Commit

Permalink
Merge resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrook committed May 10, 2013
2 parents 0d464b2 + 4292976 commit 799870d
Show file tree
Hide file tree
Showing 23 changed files with 1,042 additions and 794 deletions.
56 changes: 28 additions & 28 deletions doc/TRANSLATORS

Large diffs are not rendered by default.

1,520 changes: 790 additions & 730 deletions i18n/qgis_de.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion python/console/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def __init__(self, parent=None):
self.saveFileButton.setToolTip(saveFileBt)
self.saveFileButton.setText(saveFileBt)
## Action for Save File As
saveAsFileBt = QCoreApplication.translate("PythonConsole", "Save As..")
saveAsFileBt = QCoreApplication.translate("PythonConsole", "Save As...")
self.saveAsFileButton = QAction(self)
self.saveAsFileButton.setCheckable(False)
self.saveAsFileButton.setEnabled(True)
Expand Down
34 changes: 34 additions & 0 deletions src/app/composer/qgscomposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,18 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
showBlendModePrintingWarning();
}

// If we are not printing as raster, temporarily disable advanced effects
// as QPrinter does not support composition modes and can result
// in items missing from the output
if ( mComposition->printAsRaster() )
{
mComposition->setUseAdvancedEffects( true );
}
else
{
mComposition->setUseAdvancedEffects( false );
}

bool hasAnAtlas = mComposition->atlasComposition().enabled();
bool atlasOnASingleFile = hasAnAtlas && mComposition->atlasComposition().singleFile();
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
Expand Down Expand Up @@ -795,6 +807,11 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
mComposition->exportAsPDF( outputFileName );
}

if ( ! mComposition->useAdvancedEffects() )
{
//Switch advanced effects back on
mComposition->setUseAdvancedEffects( true );
}
mView->setPaintingEnabled( true );
QApplication::restoreOverrideCursor();
}
Expand All @@ -816,6 +833,18 @@ void QgsComposer::on_mActionPrint_triggered()
showBlendModePrintingWarning();
}

// If we are not printing as raster, temporarily disable advanced effects
// as QPrinter does not support composition modes and can result
// in items missing from the output
if ( mComposition->printAsRaster() )
{
mComposition->setUseAdvancedEffects( true );
}
else
{
mComposition->setUseAdvancedEffects( false );
}

//orientation and page size are already set to QPrinter in the page setup dialog
QPrintDialog printDialog( &mPrinter, 0 );
if ( printDialog.exec() != QDialog::Accepted )
Expand Down Expand Up @@ -887,6 +916,11 @@ void QgsComposer::on_mActionPrint_triggered()
painter.end();
}

if ( ! mComposition->useAdvancedEffects() )
{
//Switch advanced effects back on
mComposition->setUseAdvancedEffects( true );
}
mView->setPaintingEnabled( true );
QApplication::restoreOverrideCursor();
}
Expand Down
13 changes: 12 additions & 1 deletion src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,7 @@ void QgisApp::createActions()

connect( mActionHelpContents, SIGNAL( triggered() ), this, SLOT( helpContents() ) );
connect( mActionHelpAPI, SIGNAL( triggered() ), this, SLOT( apiDocumentation() ) );
connect( mActionNeedSupport, SIGNAL( triggered() ), this, SLOT( supportProviders() ) );
connect( mActionQgisHomePage, SIGNAL( triggered() ), this, SLOT( helpQgisHomePage() ) );
connect( mActionCheckQgisVersion, SIGNAL( triggered() ), this, SLOT( checkQgisVersion() ) );
connect( mActionAbout, SIGNAL( triggered() ), this, SLOT( about() ) );
Expand Down Expand Up @@ -6556,7 +6557,12 @@ void QgisApp::adjustBrightnessContrast( int delta, bool updateBrightness )

void QgisApp::helpContents()
{
openURL( "index.html" );
// We should really ship the HTML version of the docs local too.
openURL( QString( "http://docs.qgis.org/%1.%2/html/%3/docs/user_manual/" )
.arg( QGis::QGIS_VERSION_INT / 10000 )
.arg( QGis::QGIS_VERSION_INT / 100 % 100 )
.arg( tr( "en", "documentation language" ) ),
false );
}

void QgisApp::apiDocumentation()
Expand All @@ -6571,6 +6577,11 @@ void QgisApp::apiDocumentation()
}
}

void QgisApp::supportProviders()
{
openURL( tr( "http://www.qgis.org/en/commercial-support.html" ), false );
}

void QgisApp::helpQgisHomePage()
{
openURL( "http://qgis.org", false );
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
void helpContents();
//! Open the API documentation in a browser
void apiDocumentation();
//! Open the QGIS support page
void supportProviders();
//! Open the QGIS homepage in users browser
void helpQgisHomePage();
//! Open a url in the users configured browser
Expand Down
7 changes: 4 additions & 3 deletions src/app/qgsvectorlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
this, SLOT( loadStyleMenuTriggered( QAction * ) ) ) ;

//for saving
mSaveAsMenu->addAction( tr( "Save on database (%1)" ).arg( layer->providerType() ) );
mSaveAsMenu->addAction( tr( "Save in database (%1)" ).arg( layer->providerType() ) );
}

QObject::connect( mSaveAsMenu, SIGNAL( triggered( QAction * ) ),
Expand Down Expand Up @@ -327,7 +327,6 @@ void QgsVectorLayerProperties::reset( void )
// populate the general information
mLayerOrigNameLineEdit->setText( layer->originalName() );
txtDisplayName->setText( layer->name() );
txtLayerSource->setText( layer->publicSource() );
pbnQueryBuilder->setWhatsThis( tr( "This button opens the query "
"builder and allows you to create a subset of features to display on "
"the map canvas rather than displaying all features in the layer" ) );
Expand Down Expand Up @@ -730,6 +729,7 @@ void QgsVectorLayerProperties::saveStyleAs( StyleType styleType )
apply();

layer->saveStyleToDatabase( styleName, styleDesc, isDefault, uiFileContent, msgError );

if ( !msgError.isNull() )
{
QMessageBox::warning( this, infoWindowTitle, msgError );
Expand All @@ -738,6 +738,7 @@ void QgsVectorLayerProperties::saveStyleAs( StyleType styleType )
{
QMessageBox::information( this, infoWindowTitle, tr( "Style saved" ) );
}

}
else
{
Expand Down Expand Up @@ -857,7 +858,7 @@ void QgsVectorLayerProperties::showListOfStylesFromDatabase()
else
{
QMessageBox::warning( this, tr( "Error occured retrieving styles from database" ),
tr( "The style retrieved is not a valid named style. Error message: %1" )
tr( "The retrieved style is not a valid named style. Error message: %1" )
.arg( errorMsg ) );
}

Expand Down
10 changes: 9 additions & 1 deletion src/core/composer/qgscomposeritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ QgsComposerItem::QgsComposerItem( QgsComposition* composition, bool manageZValue
, mLastValidViewScaleFactor( -1 )
, mRotation( 0 )
, mBlendMode( QPainter::CompositionMode_SourceOver )
, mEffectsEnabled( true )
, mTransparency( 0 )
, mLastUsedPositionMode( UpperLeft )
, mId( "" )
Expand All @@ -78,6 +79,7 @@ QgsComposerItem::QgsComposerItem( qreal x, qreal y, qreal width, qreal height, Q
, mLastValidViewScaleFactor( -1 )
, mRotation( 0 )
, mBlendMode( QPainter::CompositionMode_SourceOver )
, mEffectsEnabled( true )
, mTransparency( 0 )
, mLastUsedPositionMode( UpperLeft )
, mId( "" )
Expand Down Expand Up @@ -107,7 +109,6 @@ void QgsComposerItem::init( bool manageZValue )
// Setup composer effect
mEffect = new QgsComposerEffect();
setGraphicsEffect( mEffect );

}

QgsComposerItem::~QgsComposerItem()
Expand Down Expand Up @@ -906,6 +907,13 @@ void QgsComposerItem::setTransparency( int transparency )
setOpacity( 1. - ( transparency / 100. ) );
}

void QgsComposerItem::setEffectsEnabled( bool effectsEnabled )
{
//enable or disable the QgsComposerEffect applied to this item
mEffectsEnabled = effectsEnabled;
mEffect->setEnabled( effectsEnabled );
}

void QgsComposerItem::hoverMoveEvent( QGraphicsSceneHoverEvent * event )
{
if ( isSelected() )
Expand Down
11 changes: 10 additions & 1 deletion src/core/composer/qgscomposeritem.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,15 @@ class CORE_EXPORT QgsComposerItem: public QObject, public QGraphicsRectItem
/** Sets the item's transparency */
void setTransparency( int transparency );

/** Returns true if effects (eg blend modes) are enabled for the item
* @note introduced in 2.0
*/
bool effectsEnabled() const {return mEffectsEnabled;}
/** Sets whether effects (eg blend modes) are enabled for the item
* @note introduced in 2.0
*/
void setEffectsEnabled( bool effectsEnabled );

/**Composite operations for item groups do nothing per default*/
virtual void addItem( QgsComposerItem* item ) { Q_UNUSED( item ); }
virtual void removeItems() {}
Expand Down Expand Up @@ -337,7 +346,7 @@ class CORE_EXPORT QgsComposerItem: public QObject, public QGraphicsRectItem

/**Composition blend mode for item*/
QPainter::CompositionMode mBlendMode;

bool mEffectsEnabled;
QgsComposerEffect *mEffect;

/**Item transparency*/
Expand Down
3 changes: 3 additions & 0 deletions src/core/composer/qgscomposermap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ void QgsComposerMap::draw( QPainter *painter, const QgsRectangle& extent, const
// force vector output (no caching of marker images etc.)
theRendererContext->setForceVectorOutput( true );

// make the renderer respect the composition's useAdvancedEffects flag
theRendererContext->setUseAdvancedEffects( mComposition->useAdvancedEffects() );

//force composer map scale for scale dependent visibility
double bk_scale = theMapRenderer.scale();
theMapRenderer.setScale( scale() );
Expand Down
64 changes: 56 additions & 8 deletions src/core/composer/qgscomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,25 @@
#include <QDir>


QgsComposition::QgsComposition( QgsMapRenderer* mapRenderer ) :
QGraphicsScene( 0 ), mMapRenderer( mapRenderer ), mPlotStyle( QgsComposition::Preview ), mPageWidth( 297 ), mPageHeight( 210 ), mSpaceBetweenPages( 10 ), mPrintAsRaster( false ), mSelectionTolerance( 0.0 ),
mSnapToGrid( false ), mSnapGridResolution( 10.0 ), mSnapGridOffsetX( 0.0 ), mSnapGridOffsetY( 0.0 ), mAlignmentSnap( true ), mAlignmentSnapTolerance( 2 ),
mActiveItemCommand( 0 ), mActiveMultiFrameCommand( 0 ), mAtlasComposition( this )
QgsComposition::QgsComposition( QgsMapRenderer* mapRenderer )
: QGraphicsScene( 0 ),
mMapRenderer( mapRenderer ),
mPlotStyle( QgsComposition::Preview ),
mPageWidth( 297 ),
mPageHeight( 210 ),
mSpaceBetweenPages( 10 ),
mPrintAsRaster( false ),
mUseAdvancedEffects( true ),
mSelectionTolerance( 0.0 ),
mSnapToGrid( false ),
mSnapGridResolution( 10.0 ),
mSnapGridOffsetX( 0.0 ),
mSnapGridOffsetY( 0.0 ),
mAlignmentSnap( true ),
mAlignmentSnapTolerance( 2 ),
mActiveItemCommand( 0 ),
mActiveMultiFrameCommand( 0 ),
mAtlasComposition( this )
{
setBackgroundBrush( Qt::gray );
addPaperItem();
Expand All @@ -59,10 +74,25 @@ QgsComposition::QgsComposition( QgsMapRenderer* mapRenderer ) :
loadSettings();
}

QgsComposition::QgsComposition():
QGraphicsScene( 0 ), mMapRenderer( 0 ), mPlotStyle( QgsComposition::Preview ), mPageWidth( 297 ), mPageHeight( 210 ), mSpaceBetweenPages( 10 ), mPrintAsRaster( false ),
mSelectionTolerance( 0.0 ), mSnapToGrid( false ), mSnapGridResolution( 10.0 ), mSnapGridOffsetX( 0.0 ), mSnapGridOffsetY( 0.0 ), mAlignmentSnap( true ),
mAlignmentSnapTolerance( 2 ), mActiveItemCommand( 0 ), mActiveMultiFrameCommand( 0 ), mAtlasComposition( this )
QgsComposition::QgsComposition()
: QGraphicsScene( 0 ),
mMapRenderer( 0 ),
mPlotStyle( QgsComposition::Preview ),
mPageWidth( 297 ),
mPageHeight( 210 ),
mSpaceBetweenPages( 10 ),
mPrintAsRaster( false ),
mUseAdvancedEffects( true ),
mSelectionTolerance( 0.0 ),
mSnapToGrid( false ),
mSnapGridResolution( 10.0 ),
mSnapGridOffsetX( 0.0 ),
mSnapGridOffsetY( 0.0 ),
mAlignmentSnap( true ),
mAlignmentSnapTolerance( 2 ),
mActiveItemCommand( 0 ),
mActiveMultiFrameCommand( 0 ),
mAtlasComposition( this )
{
loadSettings();

Expand Down Expand Up @@ -318,6 +348,24 @@ const QgsComposerItem* QgsComposition::getComposerItemByUuid( QString theUuid )
return 0;
}


void QgsComposition::setUseAdvancedEffects( bool effectsEnabled )
{
mUseAdvancedEffects = effectsEnabled;

//toggle effects for all composer items
QList<QGraphicsItem*> itemList = items();
QList<QGraphicsItem*>::const_iterator itemIt = itemList.constBegin();
for ( ; itemIt != itemList.constEnd(); ++itemIt )
{
QgsComposerItem* composerItem = dynamic_cast<QgsComposerItem*>( *itemIt );
if ( composerItem )
{
composerItem->setEffectsEnabled( effectsEnabled );
}
}
}

int QgsComposition::pixelFontSize( double pointSize ) const
{
//in QgsComposition, one unit = one mm
Expand Down
10 changes: 10 additions & 0 deletions src/core/composer/qgscomposition.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ class CORE_EXPORT QgsComposition: public QGraphicsScene
bool printAsRaster() const {return mPrintAsRaster;}
void setPrintAsRaster( bool enabled ) { mPrintAsRaster = enabled; }

/**Returns true if a composition should use advanced effects such as blend modes
@note added in 1.9*/
bool useAdvancedEffects() const {return mUseAdvancedEffects;}
/**Used to enable or disable advanced effects such as blend modes in a composition
@note: added in version 1.9*/
void setUseAdvancedEffects( bool effectsEnabled );

double selectionTolerance() const { return mSelectionTolerance; }
void setSelectionTolerance( double tol );

Expand Down Expand Up @@ -375,6 +382,9 @@ class CORE_EXPORT QgsComposition: public QGraphicsScene
/**Flag if map should be printed as a raster (via QImage). False by default*/
bool mPrintAsRaster;

/**Flag if advanced visual effects such as blend modes should be used. True by default*/
bool mUseAdvancedEffects;

/**Distance tolerance for item selection (in mm)*/
double mSelectionTolerance;

Expand Down
13 changes: 8 additions & 5 deletions src/core/qgsmaprenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,12 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale )
.arg( ml->blendMode() )
);

// Set the QPainter composition mode so that this layer is rendered using
// the desired blending mode
mypContextPainter->setCompositionMode( ml->blendMode() );
if ( mRenderContext.useAdvancedEffects() )
{
// Set the QPainter composition mode so that this layer is rendered using
// the desired blending mode
mypContextPainter->setCompositionMode( ml->blendMode() );
}

if ( !ml->hasScaleBasedVisibility() || ( ml->minimumScale() <= mScale && mScale < ml->maximumScale() ) || mOverview )
{
Expand Down Expand Up @@ -515,7 +518,7 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale )
// before compositing this on the map. This effectively flattens the layer and prevents
// blending occuring between objects on the layer
// (this is not required for raster layers or when layer caching is enabled, since that has the same effect)
if (( ml->blendMode() != QPainter::CompositionMode_SourceOver ) &&
if (( mRenderContext.useAdvancedEffects() ) && ( ml->blendMode() != QPainter::CompositionMode_SourceOver ) &&
( ml->type() != QgsMapLayer::RasterLayer ) &&
( split || !mySettings.value( "/qgis/enable_render_caching", false ).toBool() ) )
{
Expand Down Expand Up @@ -581,7 +584,7 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale )
}

// If we flattened this layer for alternate blend modes, composite it now
if (( ml->blendMode() != QPainter::CompositionMode_SourceOver ) &&
if (( mRenderContext.useAdvancedEffects() ) && ( ml->blendMode() != QPainter::CompositionMode_SourceOver ) &&
( ml->type() != QgsMapLayer::RasterLayer ) &&
( split || !mySettings.value( "/qgis/enable_render_caching", false ).toBool() ) )
{
Expand Down
Loading

0 comments on commit 799870d

Please sign in to comment.