10,862 changes: 6,041 additions & 4,821 deletions i18n/qgis_bg.ts

Large diffs are not rendered by default.

8,164 changes: 4,472 additions & 3,692 deletions i18n/qgis_da_DK.ts

Large diffs are not rendered by default.

4,695 changes: 2,940 additions & 1,755 deletions i18n/qgis_de.ts

Large diffs are not rendered by default.

4,356 changes: 2,629 additions & 1,727 deletions i18n/qgis_gl_ES.ts

Large diffs are not rendered by default.

2,418 changes: 2,051 additions & 367 deletions i18n/qgis_lv.ts

Large diffs are not rendered by default.

19,799 changes: 11,002 additions & 8,797 deletions i18n/qgis_zh_CN.ts

Large diffs are not rendered by default.

8,423 changes: 4,878 additions & 3,545 deletions i18n/qgis_zh_TW.ts

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<file>themes/default/mActionFileSmall.png</file>
<file>themes/default/mActionFolder.png</file>
<file>themes/default/mActionFormAnnotation.png</file>
<file>themes/default/mActionFreezeLabels.png</file>
<file>themes/default/mActionFromSelectedFeature.png</file>
<file>themes/default/mActionFullHistogramStretch.png</file>
<file>themes/default/mActionGroupItems.png</file>
Expand Down Expand Up @@ -143,6 +144,7 @@
<file>themes/default/mActionSelectRectangle.png</file>
<file>themes/default/mActionShowAllLayers.png</file>
<file>themes/default/mActionShowBookmarks.png</file>
<file>themes/default/mActionShowFrozenLabels.png</file>
<file>themes/default/mActionShowPluginManager.png</file>
<file>themes/default/mActionSimplify.png</file>
<file>themes/default/mActionSplitFeatures.png</file>
Expand Down Expand Up @@ -199,6 +201,7 @@
<file>themes/default/mIconWms.png</file>
<file>themes/default/mIconWmsLayer.png</file>
<file>themes/default/mIconWarn.png</file>
<file>themes/default/mIconZoom.png</file>
<file>themes/default/mIconZip.png</file>
<file>themes/default/mMapserverExport.png</file>
<file>themes/default/plugin.png</file>
Expand Down Expand Up @@ -389,6 +392,7 @@
<file>themes/gis/mActionTouch.png</file>
<file>themes/default/mActionAddMssqlLayer.png</file>
<file>themes/default/mActionTouch.png</file>
<file>themes/default/mActionTouch2.png</file>
<file>themes/classic/mActionTouch.png</file>
<file>flags/af.png</file>
<file>flags/ar.png</file>
Expand Down
Binary file added images/themes/default/mActionFreezeLabels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes/default/mActionTouch2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes/default/mIconZoom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ms-windows/osgeo4w/browser.bat.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ call "%OSGEO4W_ROOT%"\apps\grass\grass-@grassversion@\etc\env.bat
@echo off
path %PATH%;%OSGEO4W_ROOT%\apps\@package@\bin;%OSGEO4W_ROOT%\apps\grass\grass-@grassversion@\lib
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/@package@
start "Quantum GIS Browser" /B "%OSGEO4W_ROOT%"\@package@-browser.exe %*
start "Quantum GIS Browser" /B "%OSGEO4W_ROOT%"\bin\@package@-browser.exe %*
4 changes: 2 additions & 2 deletions python/core/core.sip
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@
%Include qgsrenderer.sip
%Include qgsrunprocess.sip
%Include qgsscalecalculator.sip
%Include qgssearchstring.sip
%Include qgssearchtreenode.sip
%Include qgssinglesymbolrenderer.sip
%Include qgssnapper.sip
%Include qgsspatialindex.sip
Expand All @@ -100,3 +98,5 @@
%Include qgsgpsdconnection.sip
%Include qgsnmeaconnection.sip
%Include qgsgpsdetector.sip

%Include qgspaintenginehack.sip
53 changes: 44 additions & 9 deletions python/core/qgscomposermap.sip
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class QgsComposerMap : QgsComposerItem
enum GridAnnotationPosition
{
InsideMapFrame = 0,
OutsideMapFrame
OutsideMapFrame,
Disabled
};

enum GridAnnotationDirection
Expand All @@ -47,6 +48,21 @@ class QgsComposerMap : QgsComposerItem
BoundaryDirection
};

/**Enum for different frame borders*/
enum Border
{
Left,
Right,
Bottom,
Top
};

enum GridFrameStyle
{
NoGridFrame = 0,
Zebra //black / white pattern
};

/**@deprecated*/
void draw( QPainter *painter, const QgsRectangle& extent, const QSize& size, int dpi );

Expand Down Expand Up @@ -195,20 +211,32 @@ class QgsComposerMap : QgsComposerItem
void setShowGridAnnotation( bool show );
bool showGridAnnotation() const;

/**Sets position of grid annotations. Possibilities are inside or outside of the map frame
@note this function was added in version 1.4*/
void setGridAnnotationPosition( GridAnnotationPosition p );
GridAnnotationPosition gridAnnotationPosition() const;
/**Sets position of grid annotations. Possibilities are inside / outside of the map frame or disabled
@note this function was added in version 1.9*/
void setGridAnnotationPosition( GridAnnotationPosition p, QgsComposerMap::Border border );
/**@note: this function was added in version 1.9*/
GridAnnotationPosition gridAnnotationPosition( QgsComposerMap::Border border ) const;

/**Sets distance between map frame and annotations
@note this function was added in version 1.4*/
void setAnnotationFrameDistance( double d );
double annotationFrameDistance() const;

/**Sets grid annotation direction. Can be horizontal, vertical, direction of axis and horizontal and vertical
@note this function was added in version 1.4*/
void setGridAnnotationDirection( GridAnnotationDirection d );
GridAnnotationDirection gridAnnotationDirection() const;
/**Sets grid annotation direction. Can be horizontal or vertical
@note this function was added in version 1.9*/
void setGridAnnotationDirection( GridAnnotationDirection d, QgsComposerMap::Border border );
/**@note: this function was added in version 1.9*/
GridAnnotationDirection gridAnnotationDirection( QgsComposerMap::Border border ) const;

/**Set grid frame style (NoGridFrame or Zebra)
@note: this function was added in version 1.9*/
void setGridFrameStyle( GridFrameStyle style );
GridFrameStyle gridFrameStyle() const;

/**Set grid frame width
@note: this function was added in version 1.9*/
void setGridFrameWidth( double w );
double gridFrameWidth() const;

/**In case of annotations, the bounding rectangle can be larger than the map item rectangle
@note this function was added in version 1.4*/
Expand All @@ -226,6 +254,13 @@ class QgsComposerMap : QgsComposerItem

void updateItem();

/**Sets overview frame map. -1 disables the overview frame
@note: this function was added in version 1.9*/
void setOverviewFrameMap( int mapId );
/**Returns id of overview frame (or -1 if no overfiew frame)
@note: this function was added in version 1.9*/
int overviewFrameMapId() const;

public slots:

/**Called if map canvas has changed*/
Expand Down
19 changes: 19 additions & 0 deletions python/core/qgscomposition.sip
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class QgsComposition: QGraphicsScene
/**Returns width of paper item*/
double paperWidth() const;

/**Note: added in version 1.9*/
void setNumPages( int pages );
/**Note: added in version 1.9*/
int numPages() const;

void setSnapToGridEnabled( bool b );
bool snapToGridEnabled() const;

Expand Down Expand Up @@ -172,4 +177,18 @@ class QgsComposition: QGraphicsScene

/**Convenience function to create a QgsAddRemoveItemCommand, connect its signals and push it to the undo stack*/
void pushAddRemoveCommand( QgsComposerItem* item, const QString& text, QgsAddRemoveItemCommand::State state );

//printing

void exportAsPDF( const QString& file );

void print( QPrinter &printer );

//! print composer page to image
//! If the image does not fit into memory, a null image is returned
QImage printPageAsRaster( int page );

/**Render a page to a paint device
@note added in version 1.9*/
void renderPage( QPainter* p, int page );
};
3 changes: 3 additions & 0 deletions python/core/qgsmaprenderer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public:
//! return infos about labels at a given (map) position
//! @note: this method was added in version 1.7
virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p )= 0;
//! return infos about labels within a given (map) rectangle
//! @note: this method was added in version 1.9
virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r ) = 0;


//! called when passing engine among map renderers
Expand Down
8 changes: 8 additions & 0 deletions python/core/qgspaintenginehack.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class QgsPaintEngineHack : QPaintEngine
{
%TypeHeaderCode
#include <qgspaintenginehack.h>
%End
public:
static void fixEngineFlags( QPaintEngine *engine );
};
46 changes: 0 additions & 46 deletions python/core/qgssearchstring.sip

This file was deleted.

210 changes: 0 additions & 210 deletions python/core/qgssearchtreenode.sip

This file was deleted.

5 changes: 3 additions & 2 deletions python/core/qgsvectorlayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
typedef QList<int> QgsAttributeList;
typedef QSet<qint64> QgsFeatureIds;
typedef QSet<int> QgsAttributeIds;
typedef qint64 QgsFeatureId;


/** @note added in 1.7 */
Expand Down Expand Up @@ -675,8 +676,8 @@ signals:
void featureDeleted(qint64 fid);
void layerDeleted();

void attributeValueChanged(qint64 fid, int idx, const QVariant &);
void geometryChanged(qint64 fid, QgsGeometry & );
void attributeValueChanged(QgsFeatureId fid, int idx, const QVariant &);
void geometryChanged(QgsFeatureId fid, QgsGeometry & );

/** Signals emitted after committing changes
\note added in v1.6 */
Expand Down
5 changes: 4 additions & 1 deletion python/gui/qgsscalecombobox.sip
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ class QgsScaleComboBox : QComboBox
#include <qgsscalecombobox.h>
%End

public:
public:
QgsScaleComboBox(QWidget * parent = 0);
~QgsScaleComboBox();

public slots:
void updateScales( const QStringList &scales = QStringList() );
};

4 changes: 2 additions & 2 deletions python/plugins/db_manager/db_plugins/postgis/data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def _createCursor(self):

def _sanitizeTableField(self, field):
# get fields, ignore geometry columns
if field.dataType.lower() == "geometry":
if QString(field.dataType).toLower() == "geometry":
return u"CASE WHEN %(fld)s IS NULL THEN NULL ELSE GeometryType(%(fld)s) END AS %(fld)s" % {'fld': self.db.quoteId(field.name)}
elif field.dataType.lower() == "raster":
elif QString(field.dataType).toLower() == "raster":
return u"CASE WHEN %(fld)s IS NULL THEN NULL ELSE 'RASTER' END AS %(fld)s" % {'fld': self.db.quoteId(field.name)}
return u"%s::text" % self.db.quoteId(field.name)

Expand Down
24 changes: 12 additions & 12 deletions python/plugins/db_manager/db_plugins/spatialite/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def getVectorTables(self, schema=None):

# get geometry info from geometry_columns if exists
sql = u"""SELECT m.name, m.type = 'view', g.f_table_name, g.f_geometry_column, g.type, g.coord_dimension, g.srid
FROM sqlite_master AS m JOIN geometry_columns AS g ON lower(m.name) = lower(g.f_table_name)
FROM sqlite_master AS m JOIN geometry_columns AS g ON upper(m.name) = upper(g.f_table_name)
WHERE m.type in ('table', 'view')
ORDER BY m.name, g.f_geometry_column"""

Expand Down Expand Up @@ -243,9 +243,9 @@ def getRasterTables(self, schema=None):

# get geometry info from geometry_columns if exists
sql = u"""SELECT r.table_name||'_rasters', m.type = 'view', r.table_name, r.geometry_column, g.srid
FROM sqlite_master AS m JOIN geometry_columns AS g ON lower(m.name) = lower(g.f_table_name)
JOIN layer_params AS r ON REPLACE(m.name, '_metadata', '') = r.table_name
WHERE m.type in ('table', 'view') AND m.name = r.table_name||'_metadata'
FROM sqlite_master AS m JOIN geometry_columns AS g ON upper(m.name) = upper(g.f_table_name)
JOIN layer_params AS r ON upper(REPLACE(m.name, '_metadata', '')) = upper(r.table_name)
WHERE m.type in ('table', 'view') AND upper(m.name) = upper(r.table_name||'_metadata')
ORDER BY r.table_name"""

self._execute(c, sql)
Expand Down Expand Up @@ -298,7 +298,7 @@ def getTableConstraints(self, table):
def getTableTriggers(self, table):
c = self._get_cursor()
schema, tablename = self.getSchemaTableName(table)
sql = u"SELECT name, sql FROM sqlite_master WHERE lower(tbl_name) = lower(%s) AND type = 'trigger'" % (self.quoteString(tablename))
sql = u"SELECT name, sql FROM sqlite_master WHERE tbl_name = %s AND type = 'trigger'" % (self.quoteString(tablename))
self._execute(c, sql)
return c.fetchall()

Expand Down Expand Up @@ -339,7 +339,7 @@ def getSpatialRefInfo(self, srid):
def isVectorTable(self, table):
if self.has_geometry_columns:
schema, tablename = self.getSchemaTableName(table)
sql = u"SELECT count(*) FROM geometry_columns WHERE f_table_name = %s" % self.quoteString(tablename)
sql = u"SELECT count(*) FROM geometry_columns WHERE upper(f_table_name) = upper(%s)" % self.quoteString(tablename)
c = self._execute(None, sql)
ret = c.fetchone()
return res != None and ret[0] > 0
Expand All @@ -353,8 +353,8 @@ def isRasterTable(self, table):

sql = u"""SELECT count(*)
FROM layer_params AS r JOIN geometry_columns AS g
ON r.table_name||'_metadata' = g.f_table_name
WHERE r.table_name = REPLACE(%s, '_rasters', '')""" % self.quoteString(tablename)
ON upper(r.table_name||'_metadata') = upper(g.f_table_name)
WHERE upper(r.table_name) = upper(REPLACE(%s, '_rasters', ''))""" % self.quoteString(tablename)
c = self._execute(None, sql)
ret = c.fetchone()
return res != None and ret[0] > 0
Expand Down Expand Up @@ -388,7 +388,7 @@ def deleteTable(self, table):
sql = u"DROP TABLE %s" % self.quoteId(table)
self._execute(c, sql)
schema, tablename = self.getSchemaTableName(table)
sql = u"DELETE FROM geometry_columns WHERE lower(f_table_name) = lower(%s)" % self.quoteString(tablename)
sql = u"DELETE FROM geometry_columns WHERE upper(f_table_name) = upper(%s)" % self.quoteString(tablename)
self._execute(c, sql)
self._commit()

Expand Down Expand Up @@ -417,7 +417,7 @@ def renameTable(self, table, new_table):

# update geometry_columns
if self.has_geometry_columns:
sql = u"UPDATE geometry_columns SET f_table_name=%s WHERE f_table_name=%s" % (self.quoteString(new_table), self.quoteString(tablename))
sql = u"UPDATE geometry_columns SET f_table_name = %s WHERE upper(f_table_name) = upper(%s)" % (self.quoteString(new_table), self.quoteString(tablename))
self._execute(c, sql)

self._commit()
Expand Down Expand Up @@ -480,7 +480,7 @@ def setColumnNull(self, table, column, is_null):
def isGeometryColumn(self, table, column):
c = self._get_cursor()
schema, tablename = self.getSchemaTableName(table)
sql = u"SELECT count(*) > 0 FROM geometry_columns WHERE lower(f_table_name)=lower(%s) AND lower(f_geometry_column)=lower(%s)" % (self.quoteString(tablename), self.quoteString(column))
sql = u"SELECT count(*) > 0 FROM geometry_columns WHERE upper(f_table_name) = upper(%s) AND upper(f_geometry_column) = upper(%s)" % (self.quoteString(tablename), self.quoteString(column))
self._execute(c, sql)
return c.fetchone()[0] == 't'

Expand Down Expand Up @@ -547,7 +547,7 @@ def hasSpatialIndex(self, table, geom_column='geometry'):
return False
c = self._get_cursor()
schema, tablename = self.getSchemaTableName(table)
sql = u"SELECT spatial_index_enabled FROM geometry_columns WHERE f_table_name = %s AND f_geometry_column = %s" % (self.quoteString(tablename), self.quoteString(geom_column))
sql = u"SELECT spatial_index_enabled FROM geometry_columns WHERE upper(f_table_name) = upper(%s) AND upper(f_geometry_column) = upper(%s)" % (self.quoteString(tablename), self.quoteString(geom_column))
self._execute(c, sql)
row = c.fetchone()
return row != None and row[0] == 1
Expand Down
3 changes: 3 additions & 0 deletions python/plugins/db_manager/db_plugins/spatialite/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ class SLVectorTable(SLTable, VectorTable):
def __init__(self, row, db, schema=None):
SLTable.__init__(self, row[:-5], db, schema)
VectorTable.__init__(self, db, schema)
# SpatiaLite does case-insensitive checks for table names, but the
# SL provider didn't do the same in QGis < 1.9, so self.geomTableName
# stores the table name like stored in the geometry_columns table
self.geomTableName, self.geomColumn, self.geomType, self.geomDim, self.srid = row[-5:]

def uri(self):
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/fTools/tools/doValidate.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def __init__(self, iface):
def closeEvent(self, e):
settings = QSettings()
settings.setValue( "/fTools/ValidateDialog/geometry", QVariant(self.saveGeometry()) )
QMainWindow.closeEvent(self, e)
QDialog.closeEvent(self, e)
del self.marker

def keyPressEvent( self, e ):
Expand Down
11 changes: 10 additions & 1 deletion python/plugins/plugin_installer/installer_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,16 @@ def addItem(p):
a.setText(2,ver)
a.setToolTip(2,verTip)
a.setText(3,desc)
a.setToolTip(3,descTip)
# split the tooltip into multiple lines when they are too long
tmp = ""
splitTip = ""
for word in descTip.split(" "):
if len(tmp + word) < 80:
tmp = tmp + " " + word
else:
splitTip += tmp + "\n"
tmp = word
a.setToolTip(3, splitTip+tmp)
a.setText(4,p["author"])
if p["homepage"]:
a.setToolTip(4,p["homepage"])
Expand Down
Binary file modified resources/srs.db
Binary file not shown.
4 changes: 2 additions & 2 deletions scripts/tsstat.pl
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
tr => 'Osman Yilmaz',
uk => 'Сергей Якунин',
vi => 'Bùi Hữu Mạnh',
zh_CN => 'Zhang Jun',
zh_TW => 'Nungyao Lin',
zh_CN => 'Calvin Ngei, Zhang Jun',
zh_TW => 'Nung-yao Lin',
};

my $maxn;
Expand Down
2 changes: 2 additions & 0 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ SET(QGIS_APP_SRCS
qgsmaptooledit.cpp
qgsmaptoolfeatureaction.cpp
qgsmaptoolformannotation.cpp
qgsmaptoolfreezelabels.cpp
qgsmaptoolidentify.cpp
qgsmaptoollabel.cpp
qgsmaptoolmeasureangle.cpp
Expand Down Expand Up @@ -203,6 +204,7 @@ SET (QGIS_APP_MOC_HDRS
qgsmaptooldeletering.h
qgsmaptooldeletevertex.h
qgsmaptoolfeatureaction.h
qgsmaptoolfreezelabels.h
qgsmaptoolidentify.h
qgsmaptoolmeasureangle.h
qgsmaptoolmovefeature.h
Expand Down
362 changes: 145 additions & 217 deletions src/app/composer/qgscomposer.cpp

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions src/app/composer/qgscomposer.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,20 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
//! Changes elements that are not suitable for this project
void cleanupAfterTemplateRead();

//! Print to a printer object
void print( QPrinter &printer );

//! Writes state under DOM element
void writeXML( QDomNode& parentNode, QDomDocument& doc );

//! Removes all the item from the graphics scene and deletes them
void deleteItems();

//! Restores composer map preview states.
//! Initially after reading from xml, states are set to rectangle to achieve faster project loading.
void restoreComposerMapStates();

//! Fills icons into composer picture widgets
//! To make loading from project faster, the previews are generated when the composer becomes visible.
void initialiseComposerPicturePreviews();

/**Composer title*/
QString mTitle;

Expand Down
2 changes: 2 additions & 0 deletions src/app/composer/qgscomposerlabelwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ void QgsComposerLabelWidget::on_mTextEdit_textChanged()
if ( mComposerLabel )
{
mComposerLabel->beginCommand( tr( "Label text changed" ), QgsComposerMergeCommand::ComposerLabelSetText );
mComposerLabel->blockSignals( true );
mComposerLabel->setText( mTextEdit->toPlainText() );
mComposerLabel->update();
mComposerLabel->blockSignals( false );
mComposerLabel->endCommand();
}
}
Expand Down
384 changes: 326 additions & 58 deletions src/app/composer/qgscomposermapwidget.cpp

Large diffs are not rendered by default.

40 changes: 36 additions & 4 deletions src/app/composer/qgscomposermapwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
#define QGSCOMPOSERMAPWIDGET_H

#include "ui_qgscomposermapwidgetbase.h"

class QgsComposerMap;
#include "qgscomposermap.h"

/** \ingroup MapComposer
* Input widget for the configuration of QgsComposerMap
Expand All @@ -44,6 +43,8 @@ class QgsComposerMapWidget: public QWidget, private Ui::QgsComposerMapWidgetBase
void on_mUpdatePreviewButton_clicked();
void on_mKeepLayerListCheckBox_stateChanged( int state );
void on_mDrawCanvasItemsCheckBox_stateChanged( int state );
void on_mOverviewFrameMapComboBox_currentIndexChanged( const QString& text );
void on_mOverviewFrameStyleButton_clicked();

void on_mXMinLineEdit_editingFinished();
void on_mXMaxLineEdit_editingFinished();
Expand All @@ -61,11 +62,28 @@ class QgsComposerMapWidget: public QWidget, private Ui::QgsComposerMapWidgetBase
void on_mCrossWidthSpinBox_valueChanged( double d );
void on_mAnnotationFontButton_clicked();
void on_mDistanceToMapFrameSpinBox_valueChanged( double d );
void on_mAnnotationPositionComboBox_currentIndexChanged( const QString& text );

//annotation position
void on_mAnnotationPositionLeftComboBox_currentIndexChanged( const QString& text );
void on_mAnnotationPositionRightComboBox_currentIndexChanged( const QString& text );
void on_mAnnotationPositionTopComboBox_currentIndexChanged( const QString& text );
void on_mAnnotationPositionBottomComboBox_currentIndexChanged( const QString& text );

//annotation direction
void on_mAnnotationDirectionComboBoxLeft_currentIndexChanged( const QString& text );
void on_mAnnotationDirectionComboBoxRight_currentIndexChanged( const QString& text );
void on_mAnnotationDirectionComboBoxTop_currentIndexChanged( const QString& text );
void on_mAnnotationDirectionComboBoxBottom_currentIndexChanged( const QString& text );

void on_mDrawAnnotationCheckBox_stateChanged( int state );
void on_mAnnotationDirectionComboBox_currentIndexChanged( const QString& text );
void on_mCoordinatePrecisionSpinBox_valueChanged( int value );

void on_mFrameStyleComboBox_currentIndexChanged( const QString& text );
void on_mFrameWidthSpinBox_valueChanged( double d );

protected:
void showEvent( QShowEvent * event );

private slots:

/**Sets the GUI elements to the values of mPicture*/
Expand All @@ -82,6 +100,20 @@ class QgsComposerMapWidget: public QWidget, private Ui::QgsComposerMapWidgetBase

/**Blocks / unblocks the signals of all GUI elements*/
void blockAllSignals( bool b );

void handleChangedAnnotationPosition( QgsComposerMap::Border border, const QString& text );
void handleChangedAnnotationDirection( QgsComposerMap::Border border, const QString& text );

void insertAnnotationPositionEntries( QComboBox* c );
void insertAnnotationDirectionEntries( QComboBox* c );

void initAnnotationPositionBox( QComboBox* c, QgsComposerMap::GridAnnotationPosition pos );
void initAnnotationDirectionBox( QComboBox* c, QgsComposerMap::GridAnnotationDirection dir );

void updateOverviewSymbolMarker();

/**Updates the map combo box with the current composer map ids*/
void refreshMapComboBox();
};

#endif
12 changes: 12 additions & 0 deletions src/app/composer/qgscompositionwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c )

if ( mComposition )
{
mNumPagesSpinBox->setValue( mComposition->numPages() );

//read printout resolution from composition
mResolutionSpinBox->setValue( mComposition->printResolution() );

Expand Down Expand Up @@ -328,6 +330,15 @@ void QgsCompositionWidget::on_mPaperHeightDoubleSpinBox_editingFinished()
applyWidthHeight();
}

void QgsCompositionWidget::on_mNumPagesSpinBox_valueChanged( int value )
{
if ( !mComposition )
{
return;
}
mComposition->setNumPages( value );
}

void QgsCompositionWidget::displayCompositionWidthHeight()
{
if ( !mComposition )
Expand Down Expand Up @@ -519,6 +530,7 @@ void QgsCompositionWidget::blockSignals( bool block )
mPaperUnitsComboBox->blockSignals( block );
mPaperWidthDoubleSpinBox->blockSignals( block );
mPaperHeightDoubleSpinBox->blockSignals( block );
mNumPagesSpinBox->blockSignals( block );
mPaperOrientationComboBox->blockSignals( block );
mResolutionSpinBox->blockSignals( block );
mPrintAsRasterCheckBox->blockSignals( block );
Expand Down
1 change: 1 addition & 0 deletions src/app/composer/qgscompositionwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class QgsCompositionWidget: public QWidget, private Ui::QgsCompositionWidgetBase
void on_mPaperOrientationComboBox_currentIndexChanged( const QString& text );
void on_mPaperWidthDoubleSpinBox_editingFinished();
void on_mPaperHeightDoubleSpinBox_editingFinished();
void on_mNumPagesSpinBox_valueChanged( int value );
void on_mResolutionSpinBox_valueChanged( const int value );
void on_mPrintAsRasterCheckBox_stateChanged( int state );

Expand Down
48 changes: 35 additions & 13 deletions src/app/legend/qgslegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,13 +674,13 @@ void QgsLegend::handleRightClickEvent( QTreeWidgetItem* item, const QPoint& posi
}
else if ( li->type() == QgsLegendItem::LEGEND_GROUP )
{
theMenu.addAction( QgisApp::getThemeIcon( "/mActionZoomToLayer.png" ),
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionZoomToLayer.png" ),
tr( "Zoom to Group" ), this, SLOT( legendLayerZoom() ) );

// use QGisApp::removeLayer() to remove all selected layers+groups
theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemoveLayer.png" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) );
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionRemoveLayer.png" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) );

theMenu.addAction( QgisApp::getThemeIcon( "/mActionSetCRS.png" ),
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionSetCRS.png" ),
tr( "&Set Group CRS" ), this, SLOT( legendGroupSetCRS() ) );
}

Expand Down Expand Up @@ -709,11 +709,11 @@ void QgsLegend::handleRightClickEvent( QTreeWidgetItem* item, const QPoint& posi
}
}

theMenu.addAction( QgisApp::getThemeIcon( "/folder_new.png" ), tr( "&Add New Group" ), this, SLOT( addGroupToCurrentItem() ) );
theMenu.addAction( QgisApp::getThemeIcon( "/mActionExpandTree.png" ), tr( "&Expand All" ), this, SLOT( expandAll() ) );
theMenu.addAction( QgisApp::getThemeIcon( "/mActionCollapseTree.png" ), tr( "&Collapse All" ), this, SLOT( collapseAll() ) );
theMenu.addAction( QgsApplication::getThemeIcon( "/folder_new.png" ), tr( "&Add New Group" ), this, SLOT( addGroupToCurrentItem() ) );
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionExpandTree.png" ), tr( "&Expand All" ), this, SLOT( expandAll() ) );
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionCollapseTree.png" ), tr( "&Collapse All" ), this, SLOT( collapseAll() ) );

QAction *updateDrawingOrderAction = theMenu.addAction( QgisApp::getThemeIcon( "/mUpdateDrawingOrder.png" ), tr( "&Update Drawing Order" ), this, SLOT( toggleDrawingOrderUpdate() ) );
QAction *updateDrawingOrderAction = theMenu.addAction( QgsApplication::getThemeIcon( "/mUpdateDrawingOrder.png" ), tr( "&Update Drawing Order" ), this, SLOT( toggleDrawingOrderUpdate() ) );
updateDrawingOrderAction->setCheckable( true );
updateDrawingOrderAction->setChecked( mUpdateDrawingOrder );

Expand All @@ -722,10 +722,10 @@ void QgsLegend::handleRightClickEvent( QTreeWidgetItem* item, const QPoint& posi

void QgsLegend::initPixmaps()
{
mPixmaps.mOriginalPixmap = QgisApp::getThemePixmap( "/mActionFileSmall.png" );
mPixmaps.mInOverviewPixmap = QgisApp::getThemePixmap( "/mActionInOverview.png" );
mPixmaps.mEditablePixmap = QgisApp::getThemePixmap( "/mIconEditable.png" );
mPixmaps.mProjectionErrorPixmap = QgisApp::getThemePixmap( "/mIconProjectionProblem.png" );
mPixmaps.mOriginalPixmap = QgsApplication::getThemePixmap( "/mActionFileSmall.png" );
mPixmaps.mInOverviewPixmap = QgsApplication::getThemePixmap( "/mActionInOverview.png" );
mPixmaps.mEditablePixmap = QgsApplication::getThemePixmap( "/mIconEditable.png" );
mPixmaps.mProjectionErrorPixmap = QgsApplication::getThemePixmap( "/mIconProjectionProblem.png" );
}

Qt::CheckState QgsLegend::layerCheckState( QgsMapLayer * layer )
Expand Down Expand Up @@ -884,10 +884,16 @@ void QgsLegend::addLayers( QList<QgsMapLayer *> theLayerList )
//Note if the canvas was previously blank so we can
//zoom to all layers at the end if neeeded
bool myFirstLayerFlag = false;
QgsCoordinateReferenceSystem myPreviousCrs;
if ( layers().count() < 1 )
{
myFirstLayerFlag = true;
}
else
{
// remember CRS of present layer
myPreviousCrs = layers().first()->crs();
}

//iteratively add the layers to the canvas
for ( int i = 0; i < theLayerList.size(); ++i )
Expand Down Expand Up @@ -956,10 +962,26 @@ void QgsLegend::addLayers( QList<QgsMapLayer *> theLayerList )
mMapCanvas->zoomToFullExtent();
mMapCanvas->clearExtentHistory();
}
else
{
if ( settings.value( "/Projections/otfTransformAutoEnable", true ).toBool() &&
!mMapCanvas->mapRenderer()->hasCrsTransformEnabled() )
{
// Verify if all layers have the same CRS
foreach( QgsMapLayer *l, layers() )
{
if ( myPreviousCrs != l->crs() )
{
// Set to the previous de facto used so that extent does not change
mMapCanvas->mapRenderer()->setDestinationCrs( myPreviousCrs );
mMapCanvas->mapRenderer()->setProjectionsEnabled( true );
break;
}
}
}
}
//make the QTreeWidget item up-to-date
doItemsLayout();


}

//deprecated since 1.8 - delegates to addLayers
Expand Down
6 changes: 3 additions & 3 deletions src/app/legend/qgslegendgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ QgsLegendGroup::QgsLegendGroup( QTreeWidgetItem * theItem, QString theName )
mType = LEGEND_GROUP;
setFlags( Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
setCheckState( 0, Qt::Checked );
QIcon myIcon = QgisApp::getThemeIcon( "/mActionFolder.png" );
QIcon myIcon = QgsApplication::getThemeIcon( "/mActionFolder.png" );
setIcon( 0, myIcon );
}
QgsLegendGroup::QgsLegendGroup( QTreeWidget* theListView, QString theString )
Expand All @@ -34,7 +34,7 @@ QgsLegendGroup::QgsLegendGroup( QTreeWidget* theListView, QString theString )
mType = LEGEND_GROUP;
setFlags( Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
setCheckState( 0, Qt::Checked );
QIcon myIcon = QgisApp::getThemeIcon( "/mActionFolder.png" );
QIcon myIcon = QgsApplication::getThemeIcon( "/mActionFolder.png" );
setIcon( 0, myIcon );
}

Expand All @@ -43,7 +43,7 @@ QgsLegendGroup::QgsLegendGroup( QString name ): QgsLegendItem()
mType = LEGEND_GROUP;
setFlags( Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
setCheckState( 0, Qt::Checked );
QIcon myIcon = QgisApp::getThemeIcon( + "/mActionFolder.png" );
QIcon myIcon = QgsApplication::getThemeIcon( + "/mActionFolder.png" );
setText( 0, name );
setIcon( 0, myIcon );
}
Expand Down
26 changes: 13 additions & 13 deletions src/app/legend/qgslegendlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ void QgsLegendLayer::updateIcon()
if ( theFile->isInOverview() )
{
// Overlay the overview icon on the default icon
QPixmap myPixmap = QgisApp::getThemePixmap( "/mIconOverview.png" );
QPixmap myPixmap = QgsApplication::getThemePixmap( "/mIconOverview.png" );
QPainter p( &newIcon );
p.drawPixmap( 0, 0, myPixmap );
p.end();
Expand All @@ -334,7 +334,7 @@ void QgsLegendLayer::updateIcon()
//editable
if ( theLayer->isEditable() )
{
QPixmap myPixmap = QgisApp::getThemePixmap( "/mIconEditable.png" );
QPixmap myPixmap = QgsApplication::getThemePixmap( "/mIconEditable.png" );
// use editable icon instead of the layer's type icon
newIcon = myPixmap;

Expand Down Expand Up @@ -371,15 +371,15 @@ QPixmap QgsLegendLayer::getOriginalPixmap()
switch ( vlayer->geometryType() )
{
case QGis::Point:
return QgisApp::getThemePixmap( "/mIconPointLayer.png" );
return QgsApplication::getThemePixmap( "/mIconPointLayer.png" );
case QGis::Line:
return QgisApp::getThemePixmap( "/mIconLineLayer.png" );
return QgsApplication::getThemePixmap( "/mIconLineLayer.png" );
case QGis::Polygon:
return QgisApp::getThemePixmap( "/mIconPolygonLayer.png" );
return QgsApplication::getThemePixmap( "/mIconPolygonLayer.png" );
case QGis::NoGeometry:
return QgisApp::getThemePixmap( "/mIconTableLayer.png" );
return QgsApplication::getThemePixmap( "/mIconTableLayer.png" );
default:
return QgisApp::getThemePixmap( "/mIconLayer.png" );
return QgsApplication::getThemePixmap( "/mIconLayer.png" );
}
}
else if ( theLayer->type() == QgsMapLayer::RasterLayer )
Expand All @@ -400,7 +400,7 @@ QPixmap QgsLegendLayer::getOriginalPixmap()
}

// undefined - should never reach this
return QgisApp::getThemePixmap( "/mIconLayer.png" );
return QgsApplication::getThemePixmap( "/mIconLayer.png" );
}

void QgsLegendLayer::addToPopupMenu( QMenu& theMenu )
Expand All @@ -409,7 +409,7 @@ void QgsLegendLayer::addToPopupMenu( QMenu& theMenu )
QAction *toggleEditingAction = QgisApp::instance()->actionToggleEditing();

// zoom to layer extent
theMenu.addAction( QgisApp::getThemeIcon( "/mActionZoomToLayer.png" ),
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionZoomToLayer.png" ),
tr( "&Zoom to Layer Extent" ), legend(), SLOT( legendLayerZoom() ) );
if ( lyr->type() == QgsMapLayer::RasterLayer )
{
Expand All @@ -430,13 +430,13 @@ void QgsLegendLayer::addToPopupMenu( QMenu& theMenu )
showInOverviewAction->blockSignals( false );

// remove from canvas
theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemoveLayer.png" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) );
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionRemoveLayer.png" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) );

// set layer crs
theMenu.addAction( QgisApp::getThemeIcon( "/mActionSetCRS.png" ), tr( "&Set Layer CRS" ), QgisApp::instance(), SLOT( setLayerCRS() ) );
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionSetCRS.png" ), tr( "&Set Layer CRS" ), QgisApp::instance(), SLOT( setLayerCRS() ) );

// assign layer crs to project
theMenu.addAction( QgisApp::getThemeIcon( "/mActionSetProjectCRS.png" ), tr( "Set &Project CRS from Layer" ), QgisApp::instance(), SLOT( setProjectCRSFromLayer() ) );
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionSetProjectCRS.png" ), tr( "Set &Project CRS from Layer" ), QgisApp::instance(), SLOT( setProjectCRSFromLayer() ) );

theMenu.addSeparator();

Expand All @@ -445,7 +445,7 @@ void QgsLegendLayer::addToPopupMenu( QMenu& theMenu )
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( lyr );

// attribute table
theMenu.addAction( QgisApp::getThemeIcon( "/mActionOpenTable.png" ), tr( "&Open Attribute Table" ),
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionOpenTable.png" ), tr( "&Open Attribute Table" ),
QgisApp::instance(), SLOT( attributeTable() ) );

// allow editing
Expand Down
2 changes: 1 addition & 1 deletion src/app/legend/qgslegendpropertygroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ QgsLegendPropertyGroup::QgsLegendPropertyGroup( QTreeWidgetItem* theLegendItem,
: QgsLegendItem( theLegendItem, theString )
{
mType = LEGEND_PROPERTY_GROUP;
QIcon myIcon = QgisApp::getThemeIcon( "/mIconProperties.png" );
QIcon myIcon = QgsApplication::getThemeIcon( "/mIconProperties.png" );
setText( 0, theString );
setIcon( 0, myIcon );
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/legend/qgslegendsymbologygroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ QgsLegendSymbologyGroup::QgsLegendSymbologyGroup( QTreeWidgetItem * theItem, QSt
: QgsLegendItem( theItem, theString )
{
mType = LEGEND_SYMBOL_GROUP;
QIcon myIcon = QgisApp::getThemeIcon( "/mIconSymbology.png" );
QIcon myIcon = QgsApplication::getThemeIcon( "/mIconSymbology.png" );
setText( 0, theString );
setIcon( 0, myIcon );
}
Expand Down
432 changes: 261 additions & 171 deletions src/app/qgisapp.cpp

Large diffs are not rendered by default.

38 changes: 22 additions & 16 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@ class QgsTileScaleWidget;
#include <QPointer>
#include <QSslError>

#ifdef HAVE_TOUCH
#include <QGestureEvent>
#include <QTapAndHoldGesture>
#endif

#include "qgsconfig.h"
#include "qgsfeature.h"
#include "qgspoint.h"
#include "qgssnappingdialog.h"

#include "ui_qgisapp.h"

#ifdef HAVE_TOUCH
#include <QGestureEvent>
#include <QTapAndHoldGesture>
#endif

/*! \class QgisApp
* \brief Main window for the Qgis application
*/
Expand Down Expand Up @@ -183,15 +183,6 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
//! update proxy settings
void namUpdate();

//! Helper to get a theme icon. It will fall back to the
//default theme if the active theme does not have the required
//icon.
static QIcon getThemeIcon( const QString theName );
//! Helper to get a theme icon as a pixmap. It will fall back to the
//default theme if the active theme does not have the required
//icon.
static QPixmap getThemePixmap( const QString theName );

/** Add a dock widget to the main window. Overloaded from QMainWindow.
* After adding the dock widget to the ui (by delegating to the QMainWindow
* parent class, it will also add it to the View menu list of docks.*/
Expand Down Expand Up @@ -318,6 +309,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QAction *actionAbout() { return mActionAbout; }
QAction *actionSponsors() { return mActionSponsors; }

QAction *actionShowFrozenLabels() { return mActionShowFrozenLabels; }

//! Menus
QMenu *fileMenu() { return mFileMenu; }
QMenu *editMenu() { return mEditMenu; }
Expand Down Expand Up @@ -479,6 +472,9 @@ class QgisApp : public QMainWindow, private Ui::MainWindow

QgsMessageLogViewer *logViewer() { return mLogViewer; }

//! Update file menu with the project templates
void updateProjectFromTemplates();

protected:

//! Handle state changes (WindowTitleChange)
Expand Down Expand Up @@ -626,8 +622,13 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
void fileOpen();
//! Create a new project
void fileNew();
//! As above but allows forcing without prompt
void fileNew( bool thePromptToSaveFlag );
//! Create a new blank project (no template)
void fileNewBlank();
//! As above but allows forcing without prompt and forcing blank project
void fileNew( bool thePromptToSaveFlag, bool forceBlank = false );
//! Create a new file from a template project
bool fileNewFromTemplate( QString fileName );
void fileNewFromTemplateAction( QAction * qAction );
//! Calculate new rasters from existing ones
void showRasterCalculator();
void embedLayers();
Expand Down Expand Up @@ -862,6 +863,10 @@ class QgisApp : public QMainWindow, private Ui::MainWindow

bool loadAnnotationItemsFromProject( const QDomDocument& doc );

//! Toggles whether to show frozen labels
void showFrozenLabels( bool show );
//! Activates freeze labels tool
void freezeLabels();
//! Activates the move label tool
void moveLabel();
//! Activates rotate label tool
Expand Down Expand Up @@ -1066,6 +1071,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QgsMapTool* mAnnotation;
QgsMapTool* mFormAnnotation;
QgsMapTool* mTextAnnotation;
QgsMapTool* mFreezeLabels;
QgsMapTool* mMoveLabel;
QgsMapTool* mRotateLabel;
QgsMapTool* mChangeLabelProperties;
Expand Down
24 changes: 22 additions & 2 deletions src/app/qgsattributedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,29 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
}

mFormNr = smFormCounter++;
QgsPythonRunner::run( QString( "_qgis_featureform_%1 = wrapinstance( %2, QtGui.QDialog )" ).arg( mFormNr ).arg(( unsigned long ) mDialog ) );

QString expr = QString( "%1(_qgis_featureform_%2,'%3',%4)" ).arg( vl->editFormInit() ).arg( mFormNr ).arg( vl->id() ).arg( mFeature->id() );
QString form = QString( "_qgis_featureform_%1 = wrapinstance( %2, QtGui.QDialog )" )
.arg( mFormNr )
.arg(( unsigned long ) mDialog );

QString layer = QString( "_qgis_layer_%1 = wrapinstance( %2, qgis.core.QgsVectorLayer )" )
.arg( vl->id() )
.arg(( unsigned long ) vl );

QString feature = QString( "_qgis_feature_%1 = wrapinstance( %2, qgis.core.QgsFeature )" )
.arg( mFeature->id() )
.arg(( unsigned long ) mFeature );

QgsPythonRunner::run( form );
QgsPythonRunner::run( feature );
QgsPythonRunner::run( layer );

QString expr = QString( "%1(_qgis_featureform_%2, _qgis_layer_%3, _qgis_feature_%4)" )
.arg( vl->editFormInit() )
.arg( mFormNr )
.arg( vl->id() )
.arg( mFeature->id() );

QgsDebugMsg( QString( "running featureForm init: %1" ).arg( expr ) );
QgsPythonRunner::run( expr );
}
Expand Down
24 changes: 12 additions & 12 deletions src/app/qgsattributetabledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,18 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid

updateTitle();

mRemoveSelectionButton->setIcon( QgisApp::getThemeIcon( "/mActionUnselectAttributes.png" ) );
mSelectedToTopButton->setIcon( QgisApp::getThemeIcon( "/mActionSelectedToTop.png" ) );
mCopySelectedRowsButton->setIcon( QgisApp::getThemeIcon( "/mActionCopySelected.png" ) );
mZoomMapToSelectedRowsButton->setIcon( QgisApp::getThemeIcon( "/mActionZoomToSelected.png" ) );
mPanMapToSelectedRowsButton->setIcon( QgisApp::getThemeIcon( "/mActionPanToSelected.png" ) );
mInvertSelectionButton->setIcon( QgisApp::getThemeIcon( "/mActionInvertSelection.png" ) );
mToggleEditingButton->setIcon( QgisApp::getThemeIcon( "/mActionToggleEditing.png" ) );
mSaveEditsButton->setIcon( QgisApp::getThemeIcon( "/mActionSaveEdits.png" ) );
mDeleteSelectedButton->setIcon( QgisApp::getThemeIcon( "/mActionDeleteSelected.png" ) );
mOpenFieldCalculator->setIcon( QgisApp::getThemeIcon( "/mActionCalculateField.png" ) );
mAddAttribute->setIcon( QgisApp::getThemeIcon( "/mActionNewAttribute.png" ) );
mRemoveAttribute->setIcon( QgisApp::getThemeIcon( "/mActionDeleteAttribute.png" ) );
mRemoveSelectionButton->setIcon( QgsApplication::getThemeIcon( "/mActionUnselectAttributes.png" ) );
mSelectedToTopButton->setIcon( QgsApplication::getThemeIcon( "/mActionSelectedToTop.png" ) );
mCopySelectedRowsButton->setIcon( QgsApplication::getThemeIcon( "/mActionCopySelected.png" ) );
mZoomMapToSelectedRowsButton->setIcon( QgsApplication::getThemeIcon( "/mActionZoomToSelected.png" ) );
mPanMapToSelectedRowsButton->setIcon( QgsApplication::getThemeIcon( "/mActionPanToSelected.png" ) );
mInvertSelectionButton->setIcon( QgsApplication::getThemeIcon( "/mActionInvertSelection.png" ) );
mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( "/mActionToggleEditing.png" ) );
mSaveEditsButton->setIcon( QgsApplication::getThemeIcon( "/mActionSaveEdits.png" ) );
mDeleteSelectedButton->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteSelected.png" ) );
mOpenFieldCalculator->setIcon( QgsApplication::getThemeIcon( "/mActionCalculateField.png" ) );
mAddAttribute->setIcon( QgsApplication::getThemeIcon( "/mActionNewAttribute.png" ) );
mRemoveAttribute->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteAttribute.png" ) );

// toggle editing
bool canChangeAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::ChangeAttributeValues;
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsbrowserdockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ QgsBrowserDockWidget::QgsBrowserDockWidget( QWidget * parent ) :
mBrowserView = new QgsBrowserTreeView( this );

QToolButton* refreshButton = new QToolButton( this );
refreshButton->setIcon( QgisApp::instance()->getThemeIcon( "mActionDraw.png" ) );
refreshButton->setIcon( QgsApplication::getThemeIcon( "mActionDraw.png" ) );
// remove this to save space
refreshButton->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
refreshButton->setText( tr( "Refresh" ) );
Expand All @@ -97,7 +97,7 @@ QgsBrowserDockWidget::QgsBrowserDockWidget( QWidget * parent ) :
connect( refreshButton, SIGNAL( clicked() ), this, SLOT( refresh() ) );

QToolButton* addLayersButton = new QToolButton( this );
addLayersButton->setIcon( QgisApp::instance()->getThemeIcon( "mActionAddLayer.png" ) );
addLayersButton->setIcon( QgsApplication::getThemeIcon( "mActionAddLayer.png" ) );
// remove this to save space
addLayersButton->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
addLayersButton->setText( tr( "Add Selection" ) );
Expand All @@ -106,7 +106,7 @@ QgsBrowserDockWidget::QgsBrowserDockWidget( QWidget * parent ) :
connect( addLayersButton, SIGNAL( clicked() ), this, SLOT( addSelectedLayers() ) );

QToolButton* collapseButton = new QToolButton( this );
collapseButton->setIcon( QgisApp::instance()->getThemeIcon( "mActionCollapseTree.png" ) );
collapseButton->setIcon( QgsApplication::getThemeIcon( "mActionCollapseTree.png" ) );
collapseButton->setToolTip( tr( "Collapse All" ) );
collapseButton->setAutoRaise( true );
connect( collapseButton, SIGNAL( clicked() ), mBrowserView, SLOT( collapseAll() ) );
Expand Down
18 changes: 9 additions & 9 deletions src/app/qgscustomprojectiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ QgsCustomProjectionDialog::QgsCustomProjectionDialog( QWidget *parent, Qt::WFlag
QSettings settings;
restoreGeometry( settings.value( "/Windows/CustomProjection/geometry" ).toByteArray() );

pbnFirst->setIcon( QgisApp::getThemeIcon( "mIconFirst.png" ) );
pbnPrevious->setIcon( QgisApp::getThemeIcon( "mIconPrevious.png" ) );
pbnNext->setIcon( QgisApp::getThemeIcon( "mIconNext.png" ) );
pbnLast->setIcon( QgisApp::getThemeIcon( "mIconLast.png" ) );
pbnNew->setIcon( QgisApp::getThemeIcon( "mIconNew.png" ) );
pbnSave->setIcon( QgisApp::getThemeIcon( "mActionFileSave.png" ) );
pbnDelete->setIcon( QgisApp::getThemeIcon( "mIconDelete.png" ) );
pbnFirst->setIcon( QgsApplication::getThemeIcon( "mIconFirst.png" ) );
pbnPrevious->setIcon( QgsApplication::getThemeIcon( "mIconPrevious.png" ) );
pbnNext->setIcon( QgsApplication::getThemeIcon( "mIconNext.png" ) );
pbnLast->setIcon( QgsApplication::getThemeIcon( "mIconLast.png" ) );
pbnNew->setIcon( QgsApplication::getThemeIcon( "mIconNew.png" ) );
pbnSave->setIcon( QgsApplication::getThemeIcon( "mActionFileSave.png" ) );
pbnDelete->setIcon( QgsApplication::getThemeIcon( "mIconDelete.png" ) );
// user database is created at QGIS startup in QgisApp::createDB
// we just check whether there is our database [MD]
QFileInfo myFileInfo;
Expand Down Expand Up @@ -594,7 +594,7 @@ void QgsCustomProjectionDialog::on_pbnNew_clicked()
if ( pbnNew->text() == tr( "Abort" ) )
{
//if we get here, user has aborted add record
pbnNew->setIcon( QgisApp::getThemeIcon( "mIconNew.png" ) );
pbnNew->setIcon( QgsApplication::getThemeIcon( "mIconNew.png" ) );
//next line needed for new/abort logic
pbnNew->setText( tr( "New" ) );
//get back to the last used record before insert was pressed
Expand All @@ -616,7 +616,7 @@ void QgsCustomProjectionDialog::on_pbnNew_clicked()
pbnNext->setEnabled( false );
pbnLast->setEnabled( false );
pbnDelete->setEnabled( false );
pbnNew->setIcon( QgisApp::getThemeIcon( "mIconNew.png" ) );
pbnNew->setIcon( QgsApplication::getThemeIcon( "mIconNew.png" ) );
//next line needed for new/abort logic
pbnNew->setText( tr( "Abort" ) );
//clear the controls
Expand Down
4 changes: 3 additions & 1 deletion src/app/qgsembedlayerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "qgsembedlayerdialog.h"
#include "qgsproject.h"
#include "qgisapp.h"
#include "qgsapplication.h"

#include <QDomDocument>
#include <QFileDialog>
#include <QFileInfo>
Expand Down Expand Up @@ -172,7 +174,7 @@ void QgsEmbedLayerDialog::addLegendGroupToTreeWidget( const QDomElement& groupEl
{
groupItem = new QTreeWidgetItem( parent );
}
groupItem->setIcon( 0, QgisApp::getThemeIcon( "mActionFolder.png" ) );
groupItem->setIcon( 0, QgsApplication::getThemeIcon( "mActionFolder.png" ) );
groupItem->setText( 0, groupElem.attribute( "name" ) );
groupItem->setData( 0, Qt::UserRole, "group" );

Expand Down
19 changes: 5 additions & 14 deletions src/app/qgshighlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "qgsmaprenderer.h"
#include "qgscoordinatetransform.h"
#include "qgsvectorlayer.h"
#include <QPainter>

/*!
\class QgsHighlight
Expand Down Expand Up @@ -93,11 +92,11 @@ void QgsHighlight::paintLine( QPainter *p, QgsPolyline line )

void QgsHighlight::paintPolygon( QPainter *p, QgsPolygon polygon )
{
QPolygonF poly;
// OddEven fill rule by default
QPainterPath path;

// just ring outlines, no fill
p->setPen( mPen );
p->setBrush( Qt::NoBrush );
p->setBrush( mBrush );

for ( int i = 0; i < polygon.size(); i++ )
{
Expand All @@ -110,18 +109,10 @@ void QgsHighlight::paintPolygon( QPainter *p, QgsPolygon polygon )

ring[ polygon[i].size()] = ring[ 0 ];

p->drawPolygon( ring );

if ( i == 0 )
poly = ring;
else
poly = poly.subtracted( ring );
path.addPolygon( ring );
}

// just fill, no outline
p->setPen( Qt::NoPen );
p->setBrush( mBrush );
p->drawPolygon( poly );
p->drawPath( path );
}

/*!
Expand Down
1 change: 1 addition & 0 deletions src/app/qgshighlight.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <QList>
#include <QPen>
#include <QPainter>
#include <QPainterPath>

class QgsVectorLayer;

Expand Down
10 changes: 5 additions & 5 deletions src/app/qgsidentifyresults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ void QgsIdentifyResults::addFeature( QgsVectorLayer *vlayer,
if ( vlayer->pendingFields().size() > 0 )
{
QTreeWidgetItem *editItem = new QTreeWidgetItem( QStringList() << "" << ( vlayer->isEditable() ? tr( "Edit feature form" ) : tr( "View feature form" ) ) );
editItem->setIcon( 0, QgisApp::getThemeIcon( vlayer->isEditable() ? "/mIconEditable.png" : "/mIconEditable.png" ) );
editItem->setIcon( 0, QgsApplication::getThemeIcon( vlayer->isEditable() ? "/mIconEditable.png" : "/mIconEditable.png" ) );
editItem->setData( 0, Qt::UserRole, "edit" );
actionItem->addChild( editItem );
}
Expand All @@ -239,7 +239,7 @@ void QgsIdentifyResults::addFeature( QgsVectorLayer *vlayer,
continue;

QTreeWidgetItem *twi = new QTreeWidgetItem( QStringList() << "" << action.name() );
twi->setIcon( 0, QgisApp::getThemeIcon( "/mAction.png" ) );
twi->setIcon( 0, QgsApplication::getThemeIcon( "/mAction.png" ) );
twi->setData( 0, Qt::UserRole, "action" );
twi->setData( 0, Qt::UserRole + 1, QVariant::fromValue( i ) );
actionItem->addChild( twi );
Expand Down Expand Up @@ -329,7 +329,7 @@ void QgsIdentifyResults::editingToggled()
continue;

QTreeWidgetItem *editItem = actions->child( j );
editItem->setIcon( 0, QgisApp::getThemeIcon( vlayer->isEditable() ? "/mIconEditable.png" : "/mIconEditable.png" ) );
editItem->setIcon( 0, QgsApplication::getThemeIcon( vlayer->isEditable() ? "/mIconEditable.png" : "/mIconEditable.png" ) );
editItem->setText( 1, vlayer->isEditable() ? tr( "Edit feature form" ) : tr( "View feature form" ) );
}
}
Expand Down Expand Up @@ -434,7 +434,7 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
if ( featItem )
{
mActionPopup->addAction(
QgisApp::getThemeIcon( vlayer->isEditable() ? "/mIconEditable.png" : "/mIconEditable.png" ),
QgsApplication::getThemeIcon( vlayer->isEditable() ? "/mIconEditable.png" : "/mIconEditable.png" ),
vlayer->isEditable() ? tr( "Edit feature form" ) : tr( "View feature form" ),
this, SLOT( featureForm() ) );
mActionPopup->addAction( tr( "Zoom to feature" ), this, SLOT( zoomToFeature() ) );
Expand Down Expand Up @@ -474,7 +474,7 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
continue;

QgsFeatureAction *a = new QgsFeatureAction( action.name(), mFeatures[ featIdx ], vlayer, i, idx, this );
mActionPopup->addAction( QgisApp::getThemeIcon( "/mAction.png" ), action.name(), a, SLOT( execute() ) );
mActionPopup->addAction( QgsApplication::getThemeIcon( "/mAction.png" ), action.name(), a, SLOT( execute() ) );
}
}

Expand Down
533 changes: 533 additions & 0 deletions src/app/qgsmaptoolfreezelabels.cpp

Large diffs are not rendered by default.

103 changes: 103 additions & 0 deletions src/app/qgsmaptoolfreezelabels.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/***************************************************************************
qgsmaptoolfreezelabels.h
--------------------
begin : 2012-07-12
copyright : (C) 2012 by Larry Shaffer
email : larrys at dakotacarto dot com
***************************************************************************/

/***************************************************************************
* *
* 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 QGSMAPTOOLFREEZELABELS_H
#define QGSMAPTOOLFREEZELABELS_H

#include "qgsmaptoollabel.h"
#include "qgsrectangle.h"
#include "qgslegend.h"
#include "qgscoordinatetransform.h"

class QgsHighlight;
class QgsLabelPosition;

/**A map tool for freezing (writing to attribute table) and thawing label positions and rotation*/
class QgsMapToolFreezeLabels: public QgsMapToolLabel
{
Q_OBJECT

public:
QgsMapToolFreezeLabels( QgsMapCanvas *canvas );
~QgsMapToolFreezeLabels();

//! Overridden mouse move event
virtual void canvasMoveEvent( QMouseEvent * e );

//! Overridden mouse press event
virtual void canvasPressEvent( QMouseEvent * e );

//! Overridden mouse release event
virtual void canvasReleaseEvent( QMouseEvent * e );

bool isShowingFrozen() const { return mShowFrozen; }
void setShowingFrozen( bool showing ) { mShowFrozen = showing; }

//! Called when Show Frozen Labels tool is toggled, via its qgisapp.cpp slot
void showFrozenLabels( bool show );

//! Remove rectangles from around frozen labels
void removeFrozenHighlights();

public slots:

//! Update frozen label highlights on layer edit mode change
void updateFrozenLabels();

//! Render highlight rectangles around frozen labels
void highlightFrozenLabels();

protected:

//! Mapping of feature ids of layers that have been highlighted
QMap<QString, QgsHighlight*> mHighlights;

//! Flag to indicate a map canvas drag operation is taking place
bool mDragging;
//! Flag to indicate whether to draw the highlight for frozen labels
bool mShowFrozen;

//! Stores actual select rect
QRect mSelectRect;

//! Stores selection marquee
QgsRubberBand* mRubberBand;

private:

//! Pointer to map renderer
QgsMapRenderer* mRender;

//! Highlights a given label relative to whether its frozen and editable
void highlightLabel( QgsVectorLayer* vlayer,
const QgsLabelPosition& labelpos,
const QString& id,
const QColor& color );

//! Select valid labels to freeze or thaw
void freezeThawLabels( const QgsRectangle& ext, QMouseEvent * e );

//! Freeze or thaw label relative to whether its editable
bool freezeThawLabel( QgsVectorLayer* vlayer,
const QgsLabelPosition& labelpos,
bool freeze );

//! Hide chosen label by setting font size to 0
bool hideLabel( QgsVectorLayer* vlayer, const QgsLabelPosition& labelpos );
};

#endif // QGSMAPTOOLFREEZELABELS_H
35 changes: 35 additions & 0 deletions src/app/qgsmaptoollabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,3 +449,38 @@ bool QgsMapToolLabel::labelMoveable( const QgsMapLayer* ml, int& xCol, int& yCol

return true;
}

bool QgsMapToolLabel::layerCanFreeze( const QgsMapLayer* ml, int& xCol, int& yCol ) const
{
const QgsVectorLayer* vlayer = dynamic_cast<const QgsVectorLayer*>( ml );
if ( !vlayer || !vlayer->isEditable() )
{
return false;
}

bool xColOk, yColOk;

QVariant xColumn = ml->customProperty( "labeling/dataDefinedProperty9" );
if ( !xColumn.isValid() )
{
return false;
}
xCol = xColumn.toInt( &xColOk );
if ( !xColOk )
{
return false;
}

QVariant yColumn = ml->customProperty( "labeling/dataDefinedProperty10" );
if ( !yColumn.isValid() )
{
return false;
}
yCol = yColumn.toInt( &yColOk );
if ( !yColOk )
{
return false;
}

return true;
}
5 changes: 5 additions & 0 deletions src/app/qgsmaptoollabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ class QgsMapToolLabel: public QgsMapTool
@param yCol out: index of the attribute for data defined y coordinate
@return true if labels of layer can be moved*/
bool diagramMoveable( const QgsMapLayer* ml, int& xCol, int& yCol ) const;
/**Returns true if layer has attribute fields set up
@param xCol out: index of the attribute for data defined x coordinate
@param yCol out: index of the attribute for data defined y coordinate
@return true if layer fields set up and exist*/
bool layerCanFreeze( const QgsMapLayer* ml, int& xCol, int& yCol ) const;

protected:
QgsRubberBand* mLabelRubberBand;
Expand Down
3 changes: 2 additions & 1 deletion src/app/qgsmaptoolrotatelabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <QMouseEvent>

#include "qgisapp.h"
#include "qgsapplication.h"

QgsMapToolRotateLabel::QgsMapToolRotateLabel( QgsMapCanvas* canvas ): QgsMapToolLabel( canvas ), mRotationItem( 0 ), mRotationPreviewBox( 0 )
{
Expand Down Expand Up @@ -76,7 +77,7 @@ void QgsMapToolRotateLabel::canvasPressEvent( QMouseEvent *e )

mRotationItem = new QgsPointRotationItem( mCanvas );
mRotationItem->setOrientation( QgsPointRotationItem::Counterclockwise );
mRotationItem->setSymbol( QgisApp::instance()->getThemePixmap( "mActionRotatePointSymbols.png" ).toImage() );
mRotationItem->setSymbol( QgsApplication::getThemePixmap( "mActionRotatePointSymbols.png" ).toImage() );
mRotationItem->setPointLocation( mRotationPoint );
mRotationItem->setSymbolRotation( mCurrentRotation );
}
Expand Down
5 changes: 3 additions & 2 deletions src/app/qgsmergeattributesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "qgsmergeattributesdialog.h"
#include "qgisapp.h"
#include "qgsapplication.h"
#include "qgsfield.h"
#include "qgsmapcanvas.h"
#include "qgsrubberband.h"
Expand Down Expand Up @@ -46,8 +47,8 @@ QgsMergeAttributesDialog::QgsMergeAttributesDialog( const QgsFeatureList &featur
mTableWidget->setSelectionBehavior( QAbstractItemView::SelectRows );
mTableWidget->setSelectionMode( QAbstractItemView::SingleSelection );

mFromSelectedPushButton->setIcon( QgisApp::getThemeIcon( "mActionFromSelectedFeature.png" ) );
mRemoveFeatureFromSelectionButton->setIcon( QgisApp::getThemeIcon( "mActionRemoveSelectedFeature.png" ) );
mFromSelectedPushButton->setIcon( QgsApplication::getThemeIcon( "mActionFromSelectedFeature.png" ) );
mRemoveFeatureFromSelectionButton->setIcon( QgsApplication::getThemeIcon( "mActionRemoveSelectedFeature.png" ) );

QSettings settings;
restoreGeometry( settings.value( "/Windows/MergeAttributes/geometry" ).toByteArray() );
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsnewspatialitelayerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ QgsNewSpatialiteLayerDialog::QgsNewSpatialiteLayerDialog( QWidget *parent, Qt::W
QSettings settings;
restoreGeometry( settings.value( "/Windows/NewSpatiaLiteLayer/geometry" ).toByteArray() );

mAddAttributeButton->setIcon( QgisApp::getThemeIcon( "/mActionNewAttribute.png" ) );
mRemoveAttributeButton->setIcon( QgisApp::getThemeIcon( "/mActionDeleteAttribute.png" ) );
mAddAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionNewAttribute.png" ) );
mRemoveAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteAttribute.png" ) );
mTypeBox->addItem( tr( "Text data" ), "text" );
mTypeBox->addItem( tr( "Whole number" ), "integer" );
mTypeBox->addItem( tr( "Decimal number" ), "real" );
Expand Down
346 changes: 325 additions & 21 deletions src/app/qgsoptions.cpp

Large diffs are not rendered by default.

43 changes: 41 additions & 2 deletions src/app/qgsoptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase
QString theme();

public slots:
void on_cbxProjectDefaultNew_toggled( bool checked );
void on_pbnProjectDefaultSetCurrent_clicked();
void on_pbnProjectDefaultReset_clicked();
void on_pbnTemplateFolderBrowse_pressed();
void on_pbnTemplateFolderReset_pressed();
//! Slot called when user chooses to change the project wide projection.
void on_pbnSelectProjection_clicked();
//! Slot called when user chooses to change the default 'on the fly' projection.
Expand Down Expand Up @@ -103,7 +108,7 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase
*/
void on_mBtnAddPluginPath_clicked();

/* Let the user remove a path to the list of search paths
/* Let the user remove a path from the list of search paths
* used for finding Plugin libs.
* @note added in QGIS 1.7
*/
Expand All @@ -115,7 +120,7 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase
*/
void on_mBtnAddSVGPath_clicked();

/* Let the user remove a path to the list of search paths
/* Let the user remove a path from the list of search paths
* used for finding SVG files.
* @note added in QGIS 1.4
*/
Expand All @@ -126,6 +131,39 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase
void on_mBrowseCacheDirectory_clicked();
void on_mClearCache_clicked();

/** Let the user add a scale to the list of scales
* used in scale combobox
* @note added in QGIS 2.0
*/
void on_pbnAddScale_clicked();

/** Let the user remove a scale from the list of scales
* used in scale combobox
* @note added in QGIS 2.0
*/
void on_pbnRemoveScale_clicked();

/** Let the user restore default scales
* used in scale combobox
* @note added in QGIS 2.0
*/
void on_pbnDefaultScaleValues_clicked();

/** Let the user load scales from file
* @note added in QGIS 2.0
*/
void on_pbnImportScales_clicked();

/** Let the user load scales from file
* @note added in QGIS 2.0
*/
void on_pbnExportScales_clicked();

/** Auto slot executed when the active page in the main widget stack is changed
* @note added in 2.0
*/
void on_tabWidget_currentChanged( int theTab );

/* Load the list of drivers available in GDAL
* @note added in 2.0
*/
Expand All @@ -147,6 +185,7 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase
QStringList i18nList();
QgsCoordinateReferenceSystem mDefaultCrs;
QgsCoordinateReferenceSystem mLayerDefaultCrs;
bool mLoadedGdalDriverList;
};

#endif // #ifndef QGSOPTIONS_H
290 changes: 289 additions & 1 deletion src/app/qgsprojectproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,23 @@
#include "qgsrenderer.h"
#include "qgssnappingdialog.h"
#include "qgsrasterlayer.h"
#include "qgsscaleutils.h"
#include "qgsgenericprojectionselector.h"
#include "qgsstylev2.h"
#include "qgssymbolv2.h"
#include "qgsstylev2managerdialog.h"
#include "qgsvectorcolorrampv2.h"
#include "qgssymbolv2propertiesdialog.h"

//qt includes
#include <QColorDialog>
#include <QInputDialog>
#include <QFileDialog>
#include <QHeaderView> // Qt 4.4
#include <QMessageBox>

//stdc++ includes


QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *parent, Qt::WFlags fl )
: QDialog( parent, fl )
, mMapCanvas( mapCanvas )
Expand Down Expand Up @@ -108,6 +115,22 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
myColor = QColor( myRedInt, myGreenInt, myBlueInt );
pbnCanvasColor->setColor( myColor );

//get project scales
QStringList myScales = QgsProject::instance()->readListEntry( "Scales", "/ScalesList" );
if ( !myScales.isEmpty() )
{
QStringList::const_iterator scaleIt = myScales.constBegin();
for ( ; scaleIt != myScales.constEnd(); ++scaleIt )
{
QListWidgetItem* newItem = new QListWidgetItem( lstScales );
newItem->setText( *scaleIt );
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
lstScales->addItem( newItem );
}
}

grpProjectScales->setChecked( QgsProject::instance()->readBoolEntry( "Scales", "/useProjectScales" ) );

QgsMapLayer* currentLayer = 0;

QStringList noIdentifyLayerIdList = QgsProject::instance()->readListEntry( "Identify", "/disabledLayers" );
Expand Down Expand Up @@ -276,6 +299,10 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
twWFSLayers->setRowCount( j );
twWFSLayers->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents );

// Default Styles
mStyle = QgsStyleV2::defaultStyle();
populateStyles();

restoreState();
}

Expand Down Expand Up @@ -414,6 +441,33 @@ void QgsProjectProperties::apply()
QgsProject::instance()->writeEntry( "Gui", "/CanvasColorGreenPart", myColor.green() );
QgsProject::instance()->writeEntry( "Gui", "/CanvasColorBluePart", myColor.blue() );

//save project scales
QStringList myScales;
for ( int i = 0; i < lstScales->count(); ++i )
{
myScales.append( lstScales->item( i )->text() );
}

if ( !myScales.isEmpty() )
{
QgsProject::instance()->writeEntry( "Scales", "/ScalesList", myScales );
QgsProject::instance()->writeEntry( "Scales", "/useProjectScales", grpProjectScales->isChecked() );
}
else
{
QgsProject::instance()->removeEntry( "Scales", "/" );
}

//use global or project scales depending on checkbox state
if ( grpProjectScales->isChecked() )
{
emit scalesChanged( myScales );
}
else
{
emit scalesChanged();
}

QStringList noIdentifyLayerList;
for ( int i = 0; i < twIdentifyLayers->rowCount(); i++ )
{
Expand Down Expand Up @@ -506,6 +560,14 @@ void QgsProjectProperties::apply()
}
QgsProject::instance()->writeEntry( "WFSLayers", "/", wfsLayerList );

// Default Styles
QgsProject::instance()->writeEntry( "DefaultStyles", "/Marker", cboStyleMarker->currentText() );
QgsProject::instance()->writeEntry( "DefaultStyles", "/Line", cboStyleLine->currentText() );
QgsProject::instance()->writeEntry( "DefaultStyles", "/Fill", cboStyleFill->currentText() );
QgsProject::instance()->writeEntry( "DefaultStyles", "/ColorRamp", cboStyleColorRamp->currentText() );
QgsProject::instance()->writeEntry( "DefaultStyles", "/AlphaInt", 255 - mTransparencySlider->value() );
QgsProject::instance()->writeEntry( "DefaultStyles", "/RandomColors", cbxStyleRandomColors->isChecked() );

//todo XXX set canvas color
emit refresh();
}
Expand Down Expand Up @@ -677,3 +739,229 @@ void QgsProjectProperties::on_pbnWMSSetUsedSRS_clicked()
mWMSList->clear();
mWMSList->addItems( crsList.values() );
}

void QgsProjectProperties::on_pbnAddScale_clicked()
{
int myScale = QInputDialog::getInt(
this,
tr( "Enter scale" ),
tr( "Scale denominator" ),
-1,
1
);

if ( myScale != -1 )
{
QListWidgetItem* newItem = new QListWidgetItem( lstScales );
newItem->setText( QString( "1:%1" ).arg( myScale ) );
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
lstScales->addItem( newItem );
lstScales->setCurrentItem( newItem );
}
}

void QgsProjectProperties::on_pbnRemoveScale_clicked()
{
int currentRow = lstScales->currentRow();
QListWidgetItem* itemToRemove = lstScales->takeItem( currentRow );
delete itemToRemove;
}

void QgsProjectProperties::on_pbnImportScales_clicked()
{
QString fileName = QFileDialog::getOpenFileName( this, tr( "Load scales" ), ".",
tr( "XML files (*.xml *.XML)" ) );
if ( fileName.isEmpty() )
{
return;
}

QString msg;
QStringList myScales;
if ( !QgsScaleUtils::loadScaleList( fileName, myScales, msg ) )
{
QgsDebugMsg( msg );
}

QStringList::const_iterator scaleIt = myScales.constBegin();
for ( ; scaleIt != myScales.constEnd(); ++scaleIt )
{
QListWidgetItem* newItem = new QListWidgetItem( lstScales );
newItem->setText( *scaleIt );
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
lstScales->addItem( newItem );
}
}

void QgsProjectProperties::on_pbnExportScales_clicked()
{
QString fileName = QFileDialog::getSaveFileName( this, tr( "Save scales" ), ".",
tr( "XML files (*.xml *.XML)" ) );
if ( fileName.isEmpty() )
{
return;
}

// ensure the user never ommited the extension from the file name
if ( !fileName.toLower().endsWith( ".xml" ) )
{
fileName += ".xml";
}

QStringList myScales;
for ( int i = 0; i < lstScales->count(); ++i )
{
myScales.append( lstScales->item( i )->text() );
}

QString msg;
if ( !QgsScaleUtils::saveScaleList( fileName, myScales, msg ) )
{
QgsDebugMsg( msg );
}
}

void QgsProjectProperties::populateStyles()
{
// Styles - taken from qgsstylev2managerdialog

// use QComboBox and QString lists for shorter code
QStringList prefList;
QList<QComboBox*> cboList;
cboList << cboStyleMarker;
prefList << QgsProject::instance()->readEntry( "DefaultStyles", "/Marker", "" );
cboList << cboStyleLine;
prefList << QgsProject::instance()->readEntry( "DefaultStyles", "/Line", "" );
cboList << cboStyleFill;
prefList << QgsProject::instance()->readEntry( "DefaultStyles", "/Fill", "" );
cboList << cboStyleColorRamp;
prefList << QgsProject::instance()->readEntry( "DefaultStyles", "/ColorRamp", "" );
for ( int i = 0; i < cboList.count(); i++ )
{
cboList[i]->clear();
cboList[i]->addItem( "" );
}

// populate symbols
QStringList symbolNames = mStyle->symbolNames();
for ( int i = 0; i < symbolNames.count(); ++i )
{
QString name = symbolNames[i];
QgsSymbolV2* symbol = mStyle->symbol( name );
QComboBox* cbo = 0;
switch ( symbol->type() )
{
case QgsSymbolV2::Marker :
cbo = cboStyleMarker;
break;
case QgsSymbolV2::Line :
cbo = cboStyleLine;
break;
case QgsSymbolV2::Fill :
cbo = cboStyleFill;
break;
}
if ( cbo )
{
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( symbol, cbo->iconSize() );
cbo->addItem( icon, name );
}
delete symbol;
}

// populate color ramps
QStringList colorRamps = mStyle->colorRampNames();
for ( int i = 0; i < colorRamps.count(); ++i )
{
QString name = colorRamps[i];
QgsVectorColorRampV2* ramp = mStyle->colorRamp( name );
QIcon icon = QgsSymbolLayerV2Utils::colorRampPreviewIcon( ramp, cboStyleColorRamp->iconSize() );
cboStyleColorRamp->addItem( icon, name );
delete ramp;
}

// set current index if found
for ( int i = 0; i < cboList.count(); i++ )
{
int index = cboList[i]->findText( prefList[i], Qt::MatchCaseSensitive );
if ( index >= 0 )
cboList[i]->setCurrentIndex( index );
}

// random colors
cbxStyleRandomColors->setChecked( QgsProject::instance()->readBoolEntry( "DefaultStyles", "/RandomColors", true ) );

// alpha transparency
int transparencyInt = 255 - QgsProject::instance()->readNumEntry( "DefaultStyles", "/AlphaInt", 255 );
mTransparencySlider->setValue( transparencyInt );
on_mTransparencySlider_valueChanged( transparencyInt );
}

void QgsProjectProperties::on_pbtnStyleManager_clicked()
{
QgsStyleV2ManagerDialog dlg( mStyle, this );
dlg.exec();
populateStyles();
}

void QgsProjectProperties::on_pbtnStyleMarker_clicked()
{
editSymbol( cboStyleMarker );
}

void QgsProjectProperties::on_pbtnStyleLine_clicked()
{
editSymbol( cboStyleLine );
}

void QgsProjectProperties::on_pbtnStyleFill_clicked()
{
editSymbol( cboStyleFill );
}

void QgsProjectProperties::on_pbtnStyleColorRamp_clicked()
{
// TODO for now just open style manager
// code in QgsStyleV2ManagerDialog::editColorRamp()
on_pbtnStyleManager_clicked();
}

void QgsProjectProperties::on_mTransparencySlider_valueChanged( int value )
{
double alpha = 1 - ( value / 255.0 );
double transparencyPercent = ( 1 - alpha ) * 100;
mTransparencyLabel->setText( tr( "Transparency %1%" ).arg(( int ) transparencyPercent ) );
}

void QgsProjectProperties::editSymbol( QComboBox* cbo )
{
QString symbolName = cbo->currentText();
if ( symbolName == "" )
{
QMessageBox::information( this, "", tr( "Select a valid symbol" ) );
return;
}
QgsSymbolV2* symbol = mStyle->symbol( symbolName );
if ( ! symbol )
{
QMessageBox::warning( this, "", tr( "Invalid symbol : " ) + symbolName );
return;
}

// let the user edit the symbol and update list when done
QgsSymbolV2PropertiesDialog dlg( symbol, 0, this );
if ( dlg.exec() == 0 )
{
delete symbol;
return;
}

// by adding symbol to style with the same name the old effectively gets overwritten
mStyle->addSymbol( symbolName, symbol );

// update icon
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( symbol, cbo->iconSize() );
cbo->setItemIcon( cbo->currentIndex(), icon );
}


41 changes: 40 additions & 1 deletion src/app/qgsprojectproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "qgscontexthelp.h"

class QgsMapCanvas;

class QgsStyleV2;

/*! Dialog to set project level properties
Expand Down Expand Up @@ -83,6 +83,28 @@ class QgsProjectProperties : public QDialog, private Ui::QgsProjectPropertiesBas
*/
void on_pbnCanvasColor_clicked();

/*! Let the user add a scale to the list of project scales
* used in scale combobox instead of global ones
* @note added in QGIS 2.0
*/
void on_pbnAddScale_clicked();

/*! Let the user remove a scale from the list of project scales
* used in scale combobox instead of global ones
* @note added in QGIS 2.0
*/
void on_pbnRemoveScale_clicked();

/** Let the user load scales from file
* @note added in QGIS 2.0
*/
void on_pbnImportScales_clicked();

/** Let the user load scales from file
* @note added in QGIS 2.0
*/
void on_pbnExportScales_clicked();

/*!
* Slots for WMS project settings
*/
Expand All @@ -91,6 +113,16 @@ class QgsProjectProperties : public QDialog, private Ui::QgsProjectPropertiesBas
void on_pbnWMSRemoveSRS_clicked();
void on_pbnWMSSetUsedSRS_clicked();

/*!
* Slots for Styles
*/
void on_pbtnStyleManager_clicked();
void on_pbtnStyleMarker_clicked();
void on_pbtnStyleLine_clicked();
void on_pbtnStyleFill_clicked();
void on_pbtnStyleColorRamp_clicked();
void on_mTransparencySlider_valueChanged( int value );

/*!
* Slot to show the context help for this dialog
*/
Expand All @@ -107,12 +139,19 @@ class QgsProjectProperties : public QDialog, private Ui::QgsProjectPropertiesBas
//! Signal used to inform listeners that the mouse display precision may have changed
void displayPrecisionChanged();

//! Signal used to inform listeners that project scale list may have chnaged
void scalesChanged( const QStringList &scales = QStringList() );

//! let listening canvases know to refresh
void refresh();


private:
QgsMapCanvas* mMapCanvas;
QgsStyleV2* mStyle;

void populateStyles();
void editSymbol( QComboBox* cbo );

/*!
* Function to save dialog window state
Expand Down
441 changes: 162 additions & 279 deletions src/app/qgsrasterlayerproperties.cpp

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/app/qgsrasterlayerproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class QgsMapLayer;
class QgsMapCanvas;
class QgsRasterLayer;
class QgsMapToolEmitPoint;
class QgsRasterRenderer;
class QgsRasterRendererWidget;
class QgsRasterHistogramWidget;

/**Property sheet for a raster map layer
*@author Tim Sutton
Expand Down Expand Up @@ -68,8 +70,6 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
void on_pbnExportTransparentPixelValues_clicked();
/** \brief auto slot executed when the active page in the main widget stack is changed */
void on_tabBar_currentChanged( int theTab );
/** \brief slot executed when user wishes to refresh raster histogram */
void refreshHistogram();
/** \brief slow executed when user wishes to import transparency values */
void on_pbnImportTransparentPixelValues_clicked();
/** \brief slot executed when user presses "Remove Selected Row" button on the transparency page */
Expand All @@ -94,8 +94,6 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
void on_pbnSaveStyleAs_clicked();
/** Help button */
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
/** This slot lets you save the histogram as an image to disk */
void on_mSaveAsImageButton_clicked();
/**Enable or disable Build pyramids button depending on selection in pyramids list*/
void toggleBuildPyramidsButton();

Expand Down Expand Up @@ -140,7 +138,7 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
QgsRasterRendererWidget* mRendererWidget;

/** \brief Clear the current transparency table and populate the table with the correct types for current drawing mode and data type*/
void populateTransparencyTable();
void populateTransparencyTable( QgsRasterRenderer* renderer );

void setRendererWidget( const QString& rendererName );

Expand All @@ -162,5 +160,7 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope

QgsMapCanvas* mMapCanvas;
QgsMapToolEmitPoint* mPixelSelectorTool;

QgsRasterHistogramWidget* mHistogramWidget;
};
#endif
10 changes: 5 additions & 5 deletions src/app/qgstipfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ QgsTipFactory::QgsTipFactory() : QObject()
myTip.setContent( tr( "Quantum GIS is open source software."
" This means that the software source code can be freely viewed"
" and modified. The GPL places a restriction that any modifications"
" you make must be made available to the Quantum GIS project, and"
" that you can not create a new version of Quantum GIS under a"
" 'closed source' license. Visit <a href=\"http://qgis.org\">"
" the QGIS home page (http://qgis.org)</a> for more"
" information." ) );
" you make must be made available in source form to whoever you give"
" modified versions to, and that you can not create a new version of"
" Quantum GIS under a 'closed source' license. Visit"
" <a href=\"http://qgis.org\"> the QGIS home page (http://qgis.org)</a>"
" for more information." ) );
addGenericTip( myTip );
//
myTip.setTitle( tr( "QGIS Publications" ) );
Expand Down
5 changes: 3 additions & 2 deletions src/app/qgsundowidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qgslegend.h"

#include "qgisapp.h"
#include "qgsapplication.h"

QgsUndoWidget::QgsUndoWidget( QWidget * parent, QgsMapCanvas * mapCanvas )
: QDockWidget( parent )
Expand Down Expand Up @@ -148,13 +149,13 @@ void QgsUndoWidget::setupUi( QDockWidget *UndoWidget )

undoButton = new QPushButton( dockWidgetContents );
undoButton->setObjectName( QString::fromUtf8( "undoButton" ) );
undoButton->setIcon( QgisApp::instance()->getThemeIcon( "mActionUndo.png" ) );
undoButton->setIcon( QgsApplication::getThemeIcon( "mActionUndo.png" ) );

gridLayout->addWidget( undoButton, 1, 0, 1, 1 );

redoButton = new QPushButton( dockWidgetContents );
redoButton->setObjectName( QString::fromUtf8( "redoButton" ) );
redoButton->setIcon( QgisApp::instance()->getThemeIcon( "mActionRedo.png" ) );
redoButton->setIcon( QgsApplication::getThemeIcon( "mActionRedo.png" ) );

gridLayout->addWidget( redoButton, 1, 1, 1, 1 );

Expand Down
10 changes: 5 additions & 5 deletions src/app/qgsvectorlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
connect( layer, SIGNAL( attributeAdded( int ) ), this, SLOT( attributeAdded( int ) ) );
connect( layer, SIGNAL( attributeDeleted( int ) ), this, SLOT( attributeDeleted( int ) ) );

mAddAttributeButton->setIcon( QgisApp::getThemeIcon( "/mActionNewAttribute.png" ) );
mDeleteAttributeButton->setIcon( QgisApp::getThemeIcon( "/mActionDeleteAttribute.png" ) );
mToggleEditingButton->setIcon( QgisApp::getThemeIcon( "/mActionToggleEditing.png" ) );
mCalculateFieldButton->setIcon( QgisApp::getThemeIcon( "/mActionCalculateField.png" ) );
mAddAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionNewAttribute.png" ) );
mDeleteAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteAttribute.png" ) );
mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( "/mActionToggleEditing.png" ) );
mCalculateFieldButton->setIcon( QgsApplication::getThemeIcon( "/mActionCalculateField.png" ) );

connect( btnUseNewSymbology, SIGNAL( clicked() ), this, SLOT( useNewSymbology() ) );

Expand Down Expand Up @@ -179,7 +179,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
for ( ; it != overlayPluginList.constEnd(); ++it )
{
QgsApplyDialog* d = ( *it )->dialog( lyr );
position = tabWidget->insertTab( tabWidget->count(), qobject_cast<QDialog*>( d ), QgisApp::getThemeIcon( "propertyicons/diagram.png" ), tr( "Overlay" ) );
position = tabWidget->insertTab( tabWidget->count(), qobject_cast<QDialog*>( d ), QgsApplication::getThemeIcon( "propertyicons/diagram.png" ), tr( "Overlay" ) );
tabWidget->setCurrentIndex( position ); //ugly, but otherwise the properties dialog is a mess
mOverlayDialogs.push_back( d );
}
Expand Down
14 changes: 8 additions & 6 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ SET(QGIS_CORE_SRCS
qgsrectangle.cpp
qgsrunprocess.cpp
qgsscalecalculator.cpp
qgssearchstring.cpp
qgssearchtreenode.cpp
qgssnapper.cpp
qgscoordinatereferencesystem.cpp
qgstolerance.cpp
Expand Down Expand Up @@ -192,6 +190,9 @@ SET(QGIS_CORE_SRCS
symbology/qgssymbologyutils.cpp

qgsspatialindex.cpp

qgspaintenginehack.cpp
qgsscaleutils.cpp
)

IF(WIN32)
Expand Down Expand Up @@ -248,9 +249,9 @@ IF (WITH_INTERNAL_SPATIALITE)
INCLUDE_DIRECTORIES(BEFORE spatialite/headers/spatialite)
ENDIF (WITH_INTERNAL_SPATIALITE)

ADD_FLEX_FILES(QGIS_CORE_SRCS qgssearchstringlexer.ll qgsexpressionlexer.ll)
ADD_FLEX_FILES(QGIS_CORE_SRCS qgsexpressionlexer.ll)

ADD_BISON_FILES(QGIS_CORE_SRCS qgssearchstringparser.yy qgsexpressionparser.yy)
ADD_BISON_FILES(QGIS_CORE_SRCS qgsexpressionparser.yy)

SET(QGIS_CORE_MOC_HDRS
qgsapplication.h
Expand Down Expand Up @@ -366,8 +367,6 @@ SET(QGIS_CORE_HDRS
qgsrendercontext.h
qgsrunprocess.h
qgsscalecalculator.h
qgssearchstring.h
qgssearchtreenode.h
qgssnapper.h
qgscoordinatereferencesystem.h
qgsvectordataprovider.h
Expand Down Expand Up @@ -434,6 +433,9 @@ SET(QGIS_CORE_HDRS
qgsdiagramrendererv2.h

qgsspatialindex.h

qgspaintenginehack.h
qgsscaleutils.h
)

IF (QT_MOBILITY_LOCATION_FOUND)
Expand Down
35 changes: 8 additions & 27 deletions src/core/composer/qgscomposeritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,14 @@ bool QgsComposerItem::imageSizeConsideringRotation( double& width, double& heigh
return true;
}

if ( doubleNear( qAbs( mRotation ), 90 ) || doubleNear( qAbs( mRotation ), 270 ) )
{
double tmp = width;
width = height;
height = tmp;
return true;
}

double x1 = 0;
double y1 = 0;
double x2 = width;
Expand Down Expand Up @@ -990,33 +998,6 @@ bool QgsComposerItem::imageSizeConsideringRotation( double& width, double& heigh
width = sqrt(( x2 - p1.x() ) * ( x2 - p1.x() ) + ( y2 - p1.y() ) * ( y2 - p1.y() ) );
height = sqrt(( p3.x() - x2 ) * ( p3.x() - x2 ) + ( p3.y() - y2 ) * ( p3.y() - y2 ) );
return true;


#if 0
double x1 = 0;
double y1 = 0;
double x2 = width;
double y2 = 0;
double x3 = width;
double y3 = height;

if ( !cornerPointOnRotatedAndScaledRect( x1, y1, width, height ) )
{
return false;
}
if ( !cornerPointOnRotatedAndScaledRect( x2, y2, width, height ) )
{
return false;
}
if ( !cornerPointOnRotatedAndScaledRect( x3, y3, width, height ) )
{
return false;
}

width = sqrt(( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) );
height = sqrt(( x3 - x2 ) * ( x3 - x2 ) + ( y3 - y2 ) * ( y3 - y2 ) );
return true;
#endif //0
}

bool QgsComposerItem::cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height ) const
Expand Down
Loading