Consider feedback

This commit is contained in:
Marco Hugentobler 2019-01-22 16:11:04 +01:00
parent abd6297da6
commit ffae79b7d0
9 changed files with 54 additions and 31 deletions

View File

@ -571,8 +571,9 @@ in the area of the map item covered by the item.
QgsMapRendererJob::Errors renderingErrors() const;
%Docstring
renderingErrors
@return list of layer id / error message
Returns map rendering errors
:return: list of errors
%End
protected:

View File

@ -512,8 +512,8 @@ class CORE_EXPORT QgsLayoutItemMap : public QgsLayoutItem
bool isLabelBlockingItem( QgsLayoutItem *item ) const;
/**
* @brief renderingErrors
* @return list of layer id / error message
* \brief Returns map rendering errors
* \returns list of errors
*/
QgsMapRendererJob::Errors renderingErrors() const { return mRenderingErrors; }

View File

@ -55,7 +55,7 @@ struct LayerRenderJob
bool cached; // if true, img already contains cached image from previous rendering
QgsWeakMapLayerPointer layer;
int renderingTime; //!< Time it took to render the layer in ms (it is -1 if not rendered or still rendering)
QStringList errors; //! rendering errors
QStringList errors; //!< Rendering errors
};
typedef QList<LayerRenderJob> LayerRenderJobs;

View File

@ -46,9 +46,9 @@ const QgsProject *QgsConfigCache::project( const QString &path )
prj->setBadLayerHandler( badLayerHandler );
if ( prj->read( path ) )
{
if ( badLayerHandler->badLayers().size() > 0 )
if ( !badLayerHandler->badLayers().isEmpty() )
{
QString errorMsg = QString( "Layer(s) %1 not valid" ).arg( badLayerHandler->badLayers().join( ',' ) );
QString errorMsg = QStringLiteral( "Layer(s) %1 not valid" ).arg( badLayerHandler->badLayers().join( ',' ) );
QgsMessageLog::logMessage( errorMsg, QStringLiteral( "Server" ), Qgis::Critical );
throw QgsServerException( QStringLiteral( "Layer(s) not valid" ) );
}

View File

@ -1,14 +1,23 @@
/***************************************************************************
qgsstorebadlayerinfo.cpp
------------------------
begin : Jan 2019
copyright : (C) 2019 by Marco Hugentobler
email : marco dot hugentobler at sourcepole dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsstorebadlayerinfo.h"
#include <QDomElement>
QgsStoreBadLayerInfo::QgsStoreBadLayerInfo(): QgsProjectBadLayerHandler()
{
}
QgsStoreBadLayerInfo::~QgsStoreBadLayerInfo()
{
}
void QgsStoreBadLayerInfo::handleBadLayers( const QList<QDomNode> &layers )
{
mBadLayerIds.clear();

View File

@ -1,3 +1,20 @@
/***************************************************************************
qgsstorebadlayerinfo.h
----------------------
begin : Jan 2019
copyright : (C) 2019 by Marco Hugentobler
email : marco dot hugentobler at sourcepole dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSSTOREBADLAYERINFO_H
#define QGSSTOREBADLAYERINFO_H
@ -13,21 +30,17 @@ class QgsStoreBadLayerInfo: public QgsProjectBadLayerHandler
public:
/*Default constructor
*/
QgsStoreBadLayerInfo();
/*Destructor
*/
~QgsStoreBadLayerInfo();
QgsStoreBadLayerInfo() = default;
/**
* @brief handleBadLayers
* @param layers layer nodes
* \brief handleBadLayers
* \param layers layer nodes
*/
void handleBadLayers( const QList<QDomNode> &layers );
/**
* @brief badLayers
* @return ids of bad layers
* \brief badLayers
* \returns ids of bad layers
*/
QStringList badLayers() const { return mBadLayerIds; }

View File

@ -63,8 +63,8 @@ namespace QgsWms
QPainter *takePainter();
/**
* @brief Returns reported errors
* @return error list
* \brief Returns map rendering errors
* \returns error list
*/
QgsMapRendererJob::Errors errors() const { return mErrors; }

View File

@ -2938,9 +2938,9 @@ namespace QgsWms
}
//Log first error
QString errorMsg = QString( "Map rendering error in layer '%1'" ).arg( firstErrorLayerId );
QgsMessageLog::logMessage( errorMsg, "Server", Qgis::Critical );
throw QgsServerException( QString( "Map rendering error in layer '%1'" ).arg( layerWMSName ) );
QString errorMsg = QStringLiteral( "Map rendering error in layer '%1'" ).arg( firstErrorLayerId );
QgsMessageLog::logMessage( errorMsg, QStringLiteral( "Server" ), Qgis::Critical );
throw QgsServerException( QStringLiteral( "Map rendering error in layer '%1'" ).arg( layerWMSName ) );
}
}
@ -3265,7 +3265,7 @@ namespace QgsWms
return tmpImage->dotsPerMeterX() / 1000.0;
}
void QgsRenderer::handlePrintErrors( const QgsLayout *layout )
void QgsRenderer::handlePrintErrors( const QgsLayout *layout ) const
{
if ( !layout )
{

View File

@ -285,7 +285,7 @@ namespace QgsWms
void removeTemporaryLayers();
void handlePrintErrors( const QgsLayout *layout );
void handlePrintErrors( const QgsLayout *layout ) const;
private: