Skip to content

Commit 5d5f355

Browse files
committed
Merge branch 'master' of https://github.com/qgis/Quantum-GIS
2 parents cb07ae4 + 0533e2d commit 5d5f355

22 files changed

+306
-177
lines changed

python/gui/qgsmapoverviewcanvas.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class QgsMapOverviewCanvas : QWidget
2626

2727
void enableAntiAliasing( bool flag );
2828

29-
void updateFullExtent( const QgsRectangle& rect );
29+
void updateFullExtent();
3030

3131
public slots:
3232

python/plugins/sextante/taudem/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FILE(GLOB PY_FILES *.py)
22
FILE(GLOB DESCR_FILES description/*.txt)
3-
FILE(GLOB HELP_FILES help/*.html)
3+
FILE(GLOB HELP_FILES help/*.*)
44

55
PLUGIN_INSTALL(sextante taudem ${PY_FILES})
66
PLUGIN_INSTALL(sextante taudem/description ${DESCR_FILES})

src/app/qgisapp.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -3377,6 +3377,9 @@ bool QgisApp::addProject( QString projectFile )
33773377
}
33783378
}
33793379

3380+
// load PAL engine settings
3381+
mLBL->loadEngineSettings();
3382+
33803383
emit projectRead(); // let plug-ins know that we've read in a new
33813384
// project so that they can check any project
33823385
// specific plug-in state

src/app/qgsannotationwidget.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ QgsAnnotationWidget::QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * par
4242
}
4343
mFrameWidthSpinBox->setValue( mItem->frameBorderWidth() );
4444
mFrameColorButton->setColor( mItem->frameColor() );
45+
mBackgroundColorButton->setColor( mItem->frameBackgroundColor() );
4546

4647
const QgsMarkerSymbolV2* symbol = mItem->markerSymbol();
4748
if ( symbol )
@@ -66,6 +67,7 @@ void QgsAnnotationWidget::apply()
6667
mItem->setMapPositionFixed( mMapPositionFixedCheckBox->checkState() == Qt::Checked );
6768
mItem->setFrameBorderWidth( mFrameWidthSpinBox->value() );
6869
mItem->setFrameColor( mFrameColorButton->color() );
70+
mItem->setFrameBackgroundColor( mBackgroundColorButton->color() );
6971
mItem->setMarkerSymbol( mMarkerSymbol );
7072
mMarkerSymbol = 0; //item takes ownership
7173
mItem->update();
@@ -129,3 +131,24 @@ void QgsAnnotationWidget::updateCenterIcon()
129131
mMapMarkerButton->setIcon( icon );
130132
}
131133

134+
void QgsAnnotationWidget::on_mBackgroundColorButton_clicked()
135+
{
136+
if ( !mItem )
137+
{
138+
return;
139+
}
140+
141+
QColor bgColor;
142+
#if QT_VERSION >= 0x040500
143+
bgColor = QColorDialog::getColor( mItem->frameBackgroundColor(), 0, tr( "Select background color" ), QColorDialog::ShowAlphaChannel );
144+
#else
145+
bgColor = QColorDialog::getColor( mItem->frameBackgroundColor() );
146+
#endif
147+
148+
if ( bgColor.isValid() )
149+
{
150+
mItem->setFrameBackgroundColor( bgColor );
151+
mBackgroundColorButton->setColor( bgColor );
152+
}
153+
}
154+

src/app/qgsannotationwidget.h

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class QgsAnnotationWidget: public QWidget, private Ui::QgsAnnotationWidgetBase
3737
private slots:
3838
void on_mMapMarkerButton_clicked();
3939
void on_mFrameColorButton_clicked();
40+
void on_mBackgroundColorButton_clicked();
4041

4142
private:
4243
QgsAnnotationItem* mItem;

src/app/qgslabelengineconfigdialog.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@
1515
#include "qgslabelengineconfigdialog.h"
1616

1717
#include "qgspallabeling.h"
18+
#include <pal/pal.h>
19+
20+
#include <QPushButton>
1821

1922
QgsLabelEngineConfigDialog::QgsLabelEngineConfigDialog( QgsPalLabeling* lbl, QWidget* parent )
2023
: QDialog( parent ), mLBL( lbl )
2124
{
2225
setupUi( this );
2326

2427
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( onOK() ) );
28+
connect( buttonBox->button( QDialogButtonBox::RestoreDefaults ), SIGNAL( clicked() ),
29+
this, SLOT( setDefaults() ) );
2530

2631
// search method
2732
cboSearchMethod->setCurrentIndex( mLBL->searchMethod() );
@@ -36,6 +41,8 @@ QgsLabelEngineConfigDialog::QgsLabelEngineConfigDialog( QgsPalLabeling* lbl, QWi
3641
chkShowCandidates->setChecked( mLBL->isShowingCandidates() );
3742

3843
chkShowAllLabels->setChecked( mLBL->isShowingAllLabels() );
44+
45+
mSaveWithProjectChkBox->setChecked( mLBL->isStoredWithProject() );
3946
}
4047

4148

@@ -52,5 +59,24 @@ void QgsLabelEngineConfigDialog::onOK()
5259

5360
mLBL->setShowingAllLabels( chkShowAllLabels->isChecked() );
5461

62+
if ( mSaveWithProjectChkBox->isChecked() )
63+
{
64+
mLBL->saveEngineSettings();
65+
}
66+
else if ( mLBL->isStoredWithProject() )
67+
{
68+
mLBL->clearEngineSettings();
69+
}
5570
accept();
5671
}
72+
73+
void QgsLabelEngineConfigDialog::setDefaults()
74+
{
75+
pal::Pal p;
76+
cboSearchMethod->setCurrentIndex(( int )p.getSearch() );
77+
spinCandPoint->setValue( p.getPointP() );
78+
spinCandLine->setValue( p.getLineP() );
79+
spinCandPolygon->setValue( p.getPolyP() );
80+
chkShowCandidates->setChecked( false );
81+
chkShowAllLabels->setChecked( false );
82+
}

src/app/qgslabelengineconfigdialog.h

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class QgsLabelEngineConfigDialog : public QDialog, private Ui::QgsEngineConfigDi
2929

3030
public slots:
3131
void onOK();
32+
/** @note Added in QGIS 1.9 */
33+
void setDefaults();
3234

3335
protected:
3436
QgsPalLabeling* mLBL;

src/app/qgsoptions.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
429429
cbxCreateRasterLegendIcons->setChecked( settings.value( "/qgis/createRasterLegendIcons", true ).toBool() );
430430
cbxCopyWKTGeomFromTable->setChecked( settings.value( "/qgis/copyGeometryAsWKT", true ).toBool() );
431431
leNullValue->setText( settings.value( "qgis/nullValue", "NULL" ).toString() );
432-
cbxIgnoreShapeEncoding->setChecked( settings.value( "/qgis/ignoreShapeEncoding", false ).toBool() );
432+
cbxIgnoreShapeEncoding->setChecked( settings.value( "/qgis/ignoreShapeEncoding", true ).toBool() );
433433

434434
cmbLegendDoubleClickAction->setCurrentIndex( settings.value( "/qgis/legendDoubleClickAction", 0 ).toInt() );
435435

src/app/qgssvgannotationdialog.cpp

+39-38
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,25 @@
2222
#include <QFileInfo>
2323
#include <QGraphicsScene>
2424

25-
QgsSvgAnnotationDialog::QgsSvgAnnotationDialog( QgsSvgAnnotationItem* item, QWidget * parent, Qt::WindowFlags f):
25+
QgsSvgAnnotationDialog::QgsSvgAnnotationDialog( QgsSvgAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ):
2626
QDialog( parent, f ), mItem( item ), mEmbeddedWidget( 0 )
2727
{
28-
setupUi( this );
29-
mEmbeddedWidget = new QgsAnnotationWidget( mItem );
30-
mEmbeddedWidget->show();
31-
mStackedWidget->addWidget( mEmbeddedWidget );
32-
mStackedWidget->setCurrentWidget( mEmbeddedWidget );
28+
setupUi( this );
29+
setWindowTitle( tr( "SVG annotation" ) );
30+
mEmbeddedWidget = new QgsAnnotationWidget( mItem );
31+
mEmbeddedWidget->show();
32+
mStackedWidget->addWidget( mEmbeddedWidget );
33+
mStackedWidget->setCurrentWidget( mEmbeddedWidget );
3334

34-
if( mItem )
35-
{
36-
mFileLineEdit->setText( mItem->filePath() );
37-
}
35+
if ( mItem )
36+
{
37+
mFileLineEdit->setText( mItem->filePath() );
38+
}
3839

39-
QObject::connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( applySettingsToItem() ) );
40-
QPushButton* deleteButton = new QPushButton( tr( "Delete" ) );
41-
QObject::connect( deleteButton, SIGNAL( clicked() ), this, SLOT( deleteItem() ) );
42-
mButtonBox->addButton( deleteButton, QDialogButtonBox::RejectRole );
40+
QObject::connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( applySettingsToItem() ) );
41+
QPushButton* deleteButton = new QPushButton( tr( "Delete" ) );
42+
QObject::connect( deleteButton, SIGNAL( clicked() ), this, SLOT( deleteItem() ) );
43+
mButtonBox->addButton( deleteButton, QDialogButtonBox::RejectRole );
4344
}
4445

4546
QgsSvgAnnotationDialog::QgsSvgAnnotationDialog(): QDialog(), mItem( 0 ), mEmbeddedWidget( 0 )
@@ -54,38 +55,38 @@ QgsSvgAnnotationDialog::~QgsSvgAnnotationDialog()
5455

5556
void QgsSvgAnnotationDialog::on_mBrowseToolButton_clicked()
5657
{
57-
QString directory;
58-
QFileInfo fi( mFileLineEdit->text() );
59-
if ( fi.exists() )
60-
{
61-
directory = fi.absolutePath();
62-
}
63-
QString filename = QFileDialog::getOpenFileName( 0, tr( "html" ), directory, "*.html" );
64-
mFileLineEdit->setText( filename );
58+
QString directory;
59+
QFileInfo fi( mFileLineEdit->text() );
60+
if ( fi.exists() )
61+
{
62+
directory = fi.absolutePath();
63+
}
64+
QString filename = QFileDialog::getOpenFileName( 0, tr( "Select SVG file" ), directory, tr( "SVG files" ) + " (*.svg)" );
65+
mFileLineEdit->setText( filename );
6566
}
6667

6768
void QgsSvgAnnotationDialog::applySettingsToItem()
6869
{
69-
if ( mEmbeddedWidget )
70-
{
71-
mEmbeddedWidget->apply();
72-
}
70+
if ( mEmbeddedWidget )
71+
{
72+
mEmbeddedWidget->apply();
73+
}
7374

74-
if( mItem )
75-
{
76-
mItem->setFilePath( mFileLineEdit->text() );
77-
mItem->update();
78-
}
75+
if ( mItem )
76+
{
77+
mItem->setFilePath( mFileLineEdit->text() );
78+
mItem->update();
79+
}
7980

8081
}
8182

8283
void QgsSvgAnnotationDialog::deleteItem()
8384
{
84-
QGraphicsScene* scene = mItem->scene();
85-
if ( scene )
86-
{
87-
scene->removeItem( mItem );
88-
}
89-
delete mItem;
90-
mItem = 0;
85+
QGraphicsScene* scene = mItem->scene();
86+
if ( scene )
87+
{
88+
scene->removeItem( mItem );
89+
}
90+
delete mItem;
91+
mItem = 0;
9192
}

src/app/qgstextannotationdialog.cpp

-22
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ QgsTextAnnotationDialog::QgsTextAnnotationDialog( QgsTextAnnotationItem* item, Q
3232
{
3333
mTextDocument = mItem->document();
3434
mTextEdit->setDocument( mTextDocument );
35-
mBackgroundColorButton->setColor( mItem->frameBackgroundColor() );
3635
}
3736
setCurrentFontPropertiesToGui();
3837

@@ -148,24 +147,3 @@ void QgsTextAnnotationDialog::deleteItem()
148147
mItem = 0;
149148
}
150149

151-
void QgsTextAnnotationDialog::on_mBackgroundColorButton_clicked()
152-
{
153-
if ( !mItem )
154-
{
155-
return;
156-
}
157-
158-
QColor bgColor;
159-
#if QT_VERSION >= 0x040500
160-
bgColor = QColorDialog::getColor( mItem->frameBackgroundColor(), 0, tr( "Select background color" ), QColorDialog::ShowAlphaChannel );
161-
#else
162-
bgColor = QColorDialog::getColor( mItem->frameBackgroundColor() );
163-
#endif
164-
165-
if ( bgColor.isValid() )
166-
{
167-
mItem->setFrameBackgroundColor( bgColor );
168-
mBackgroundColorButton->setColor( bgColor );
169-
}
170-
}
171-

src/app/qgstextannotationdialog.h

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class QgsTextAnnotationDialog: public QDialog, private Ui::QgsTextAnnotationDial
4444
void on_mFontColorButton_clicked();
4545
void setCurrentFontPropertiesToGui();
4646
void deleteItem();
47-
void on_mBackgroundColorButton_clicked();
4847
};
4948

5049
#endif // QGSTEXTANNOTATIONDIALOG_H

src/core/qgspallabeling.cpp

+43
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include <qgsvectordataprovider.h>
5050
#include <qgsgeometry.h>
5151
#include <qgsmaprenderer.h>
52+
#include <qgsproject.h>
5253
#include <QMessageBox>
5354

5455
using namespace pal;
@@ -1929,6 +1930,48 @@ void QgsPalLabeling::drawLabelBuffer( QPainter* p, QString text, const QFont& fo
19291930
p->drawPath( path );
19301931
}
19311932

1933+
void QgsPalLabeling::loadEngineSettings()
1934+
{
1935+
// start with engine defaults for new project, or project that has no saved settings
1936+
Pal p;
1937+
bool saved = false;
1938+
mSearch = ( QgsPalLabeling::Search )( QgsProject::instance()->readNumEntry(
1939+
"PAL", "/SearchMethod", ( int )p.getSearch(), &saved ) );
1940+
mCandPoint = QgsProject::instance()->readNumEntry(
1941+
"PAL", "/CandidatesPoint", p.getPointP(), &saved );
1942+
mCandLine = QgsProject::instance()->readNumEntry(
1943+
"PAL", "/CandidatesLine", p.getLineP(), &saved );
1944+
mCandPolygon = QgsProject::instance()->readNumEntry(
1945+
"PAL", "/CandidatesPolygon", p.getPolyP(), &saved );
1946+
mShowingCandidates = QgsProject::instance()->readBoolEntry(
1947+
"PAL", "/ShowingCandidates", false, &saved );
1948+
mShowingAllLabels = QgsProject::instance()->readBoolEntry(
1949+
"PAL", "/ShowingAllLabels", false, &saved );
1950+
mSavedWithProject = saved;
1951+
}
1952+
1953+
void QgsPalLabeling::saveEngineSettings()
1954+
{
1955+
QgsProject::instance()->writeEntry( "PAL", "/SearchMethod", ( int )mSearch );
1956+
QgsProject::instance()->writeEntry( "PAL", "/CandidatesPoint", mCandPoint );
1957+
QgsProject::instance()->writeEntry( "PAL", "/CandidatesLine", mCandLine );
1958+
QgsProject::instance()->writeEntry( "PAL", "/CandidatesPolygon", mCandPolygon );
1959+
QgsProject::instance()->writeEntry( "PAL", "/ShowingCandidates", mShowingCandidates );
1960+
QgsProject::instance()->writeEntry( "PAL", "/ShowingAllLabels", mShowingAllLabels );
1961+
mSavedWithProject = true;
1962+
}
1963+
1964+
void QgsPalLabeling::clearEngineSettings()
1965+
{
1966+
QgsProject::instance()->removeEntry( "PAL", "/SearchMethod" );
1967+
QgsProject::instance()->removeEntry( "PAL", "/CandidatesPoint" );
1968+
QgsProject::instance()->removeEntry( "PAL", "/CandidatesLine" );
1969+
QgsProject::instance()->removeEntry( "PAL", "/CandidatesPolygon" );
1970+
QgsProject::instance()->removeEntry( "PAL", "/ShowingCandidates" );
1971+
QgsProject::instance()->removeEntry( "PAL", "/ShowingAllLabels" );
1972+
mSavedWithProject = false;
1973+
}
1974+
19321975
QgsLabelingEngineInterface* QgsPalLabeling::clone()
19331976
{
19341977
QgsPalLabeling* lbl = new QgsPalLabeling();

src/core/qgspallabeling.h

+10
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,14 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
314314
const QColor& bufferColor = QColor( 255, 255, 255 ), bool drawBuffer = false );
315315
static void drawLabelBuffer( QPainter* p, QString text, const QFont& font, double size, QColor color , Qt::PenJoinStyle joinstyle = Qt::BevelJoin, bool noFill = false );
316316

317+
//! load/save engine settings to project file
318+
//! @note added in QGIS 1.9
319+
void loadEngineSettings();
320+
void saveEngineSettings();
321+
void clearEngineSettings();
322+
bool isStoredWithProject() const { return mSavedWithProject; }
323+
void setStoredWithProject( bool store ) { mSavedWithProject = store; }
324+
317325
protected:
318326
// hashtable of layer settings, being filled during labeling
319327
QHash<QgsVectorLayer*, QgsPalLayerSettings> mActiveLayers;
@@ -333,6 +341,8 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
333341

334342
bool mShowingAllLabels; // whether to avoid collisions or not
335343

344+
bool mSavedWithProject; // whether engine settings have been read from project file
345+
336346
QgsLabelSearchTree* mLabelSearchTree;
337347
};
338348

src/gui/qgsannotationitem.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ void QgsAnnotationItem::_writeXML( QDomDocument& doc, QDomElement& itemElem ) co
397397
annotationElem.setAttribute( "canvasPosY", QString::number( canvasPos.y() ) );
398398
annotationElem.setAttribute( "frameBorderWidth", QString::number( mFrameBorderWidth ) );
399399
annotationElem.setAttribute( "frameColor", mFrameColor.name() );
400+
annotationElem.setAttribute( "frameColorAlpha", mFrameColor.alpha() );
400401
annotationElem.setAttribute( "frameBackgroundColor", mFrameBackgroundColor.name() );
401402
annotationElem.setAttribute( "frameBackgroundColorAlpha", mFrameBackgroundColor.alpha() );
402403
annotationElem.setAttribute( "visible", isVisible() );
@@ -428,6 +429,7 @@ void QgsAnnotationItem::_readXML( const QDomDocument& doc, const QDomElement& an
428429
mMapPosition = mapPos;
429430
mFrameBorderWidth = annotationElem.attribute( "frameBorderWidth", "0.5" ).toDouble();
430431
mFrameColor.setNamedColor( annotationElem.attribute( "frameColor", "#000000" ) );
432+
mFrameColor.setAlpha( annotationElem.attribute( "frameColorAlpha", "255" ).toInt() );
431433
mFrameBackgroundColor.setNamedColor( annotationElem.attribute( "frameBackgroundColor" ) );
432434
mFrameBackgroundColor.setAlpha( annotationElem.attribute( "frameBackgroundColorAlpha", "255" ).toInt() );
433435
mFrameSize.setWidth( annotationElem.attribute( "frameWidth", "50" ).toDouble() );

0 commit comments

Comments
 (0)