Skip to content

Commit 4e663fe

Browse files
committedJun 17, 2015
[georef] Save/restore window positions
1 parent 049436e commit 4e663fe

File tree

6 files changed

+33
-5
lines changed

6 files changed

+33
-5
lines changed
 

‎src/plugins/georeferencer/qgsgeorefconfigdialog.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ QgsGeorefConfigDialog::QgsGeorefConfigDialog( QWidget *parent ) :
2323
{
2424
setupUi( this );
2525

26+
QSettings s;
27+
restoreGeometry( s.value( "/Plugin-GeoReferencer/ConfigWindow/geometry" ).toByteArray() );
28+
2629
readSettings();
2730

2831
mPaperSizeComboBox->addItem( tr( "A5 (148x210 mm)" ), QSizeF( 148, 210 ) );
@@ -55,6 +58,12 @@ QgsGeorefConfigDialog::QgsGeorefConfigDialog( QWidget *parent ) :
5558

5659
}
5760

61+
QgsGeorefConfigDialog::~QgsGeorefConfigDialog()
62+
{
63+
QSettings settings;
64+
settings.setValue( "/Plugin-GeoReferencer/ConfigWindow/geometry", saveGeometry() );
65+
}
66+
5867
void QgsGeorefConfigDialog::changeEvent( QEvent *e )
5968
{
6069
QDialog::changeEvent( e );

‎src/plugins/georeferencer/qgsgeorefconfigdialog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class QgsGeorefConfigDialog : public QDialog, private Ui::QgsGeorefConfigDialogB
2323
Q_OBJECT
2424
public:
2525
QgsGeorefConfigDialog( QWidget *parent = 0 );
26+
~QgsGeorefConfigDialog();
2627

2728
protected:
2829
void changeEvent( QEvent *e ) override;

‎src/plugins/georeferencer/qgsgeorefplugingui.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ QgsGeorefPluginGui::QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget
8787
{
8888
setupUi( this );
8989

90+
QSettings s;
91+
restoreGeometry( s.value( "/Plugin-GeoReferencer/Window/geometry" ).toByteArray() );
92+
9093
createActions();
9194
createActionGroups();
9295
createMenus();
@@ -105,7 +108,6 @@ QgsGeorefPluginGui::QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget
105108

106109
connect( mIface, SIGNAL( currentThemeChanged( QString ) ), this, SLOT( updateIconTheme( QString ) ) );
107110

108-
QSettings s;
109111
if ( s.value( "/Plugin-GeoReferencer/Config/ShowDocked" ).toBool() )
110112
{
111113
dockThisWindow( true );
@@ -135,6 +137,9 @@ void QgsGeorefPluginGui::dockThisWindow( bool dock )
135137

136138
QgsGeorefPluginGui::~QgsGeorefPluginGui()
137139
{
140+
QSettings settings;
141+
settings.setValue( "/Plugin-GeoReferencer/Window/geometry", saveGeometry() );
142+
138143
clearGCPData();
139144

140145
removeOldLayer();
@@ -146,7 +151,6 @@ QgsGeorefPluginGui::~QgsGeorefPluginGui()
146151
delete mToolDeletePoint;
147152
delete mToolMovePoint;
148153
delete mToolMovePointQgis;
149-
150154
}
151155

152156
// ----------------------------- protected --------------------------------- //

‎src/plugins/georeferencer/qgsmapcoordsdialog.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas* qgisCanvas, const QgsPoint
2929
{
3030
setupUi( this );
3131

32+
QSettings s;
33+
restoreGeometry( s.value( "/Plugin-GeoReferencer/MapCoordsWindow/geometry" ).toByteArray() );
34+
3235
setAttribute( Qt::WA_DeleteOnClose );
3336

3437
mPointFromCanvasPushButton = new QPushButton( QIcon( ":/icons/default/mPushButtonPencil.png" ), tr( "From map canvas" ) );
3538
mPointFromCanvasPushButton->setCheckable( true );
3639
buttonBox->addButton( mPointFromCanvasPushButton, QDialogButtonBox::ActionRole );
37-
adjustSize();
3840

3941
// User can input either DD or DMS coords (from QGis mapcanav we take DD coords)
4042
QgsDMSAndDDValidator *validator = new QgsDMSAndDDValidator( this );
@@ -44,7 +46,6 @@ QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas* qgisCanvas, const QgsPoint
4446
mToolEmitPoint = new QgsGeorefMapToolEmitPoint( qgisCanvas );
4547
mToolEmitPoint->setButton( mPointFromCanvasPushButton );
4648

47-
QSettings s;
4849
mSnapToBackgroundLayerBox->setChecked( s.value( "/Plugin-GeoReferencer/snapToBackgroundLayers", QVariant( false ) ).toBool() );
4950

5051
connect( mPointFromCanvasPushButton, SIGNAL( clicked( bool ) ), this, SLOT( setToolEmitPoint( bool ) ) );
@@ -61,6 +62,9 @@ QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas* qgisCanvas, const QgsPoint
6162
QgsMapCoordsDialog::~QgsMapCoordsDialog()
6263
{
6364
delete mToolEmitPoint;
65+
66+
QSettings settings;
67+
settings.setValue( "/Plugin-GeoReferencer/MapCoordsWindow/geometry", saveGeometry() );
6468
}
6569

6670
void QgsMapCoordsDialog::updateOK()

‎src/plugins/georeferencer/qgstransformsettingsdialog.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ QgsTransformSettingsDialog::QgsTransformSettingsDialog( const QString &raster, c
3434
{
3535
setupUi( this );
3636

37+
QSettings s;
38+
restoreGeometry( s.value( "/Plugin-GeoReferencer/TransformSettingsWindow/geometry" ).toByteArray() );
39+
3740
cmbTransformType->addItem( tr( "Linear" ), ( int )QgsGeorefTransform::Linear );
3841
cmbTransformType->addItem( tr( "Helmert" ), ( int )QgsGeorefTransform::Helmert );
3942
cmbTransformType->addItem( tr( "Polynomial 1" ), ( int )QgsGeorefTransform::PolynomialOrder1 );
@@ -56,7 +59,6 @@ QgsTransformSettingsDialog::QgsTransformSettingsDialog( const QString &raster, c
5659
}
5760
cmbCompressionComboBox->addItems( listCompressionTr );
5861

59-
QSettings s;
6062
cmbTransformType->setCurrentIndex( s.value( "/Plugin-GeoReferencer/lasttransformation", -1 ).toInt() );
6163
cmbResampling->setCurrentIndex( s.value( "/Plugin-GeoReferencer/lastresampling", 0 ).toInt() );
6264
cmbCompressionComboBox->setCurrentIndex( s.value( "/Plugin-GeoReferencer/lastcompression", 0 ).toInt() );
@@ -81,6 +83,12 @@ QgsTransformSettingsDialog::QgsTransformSettingsDialog( const QString &raster, c
8183
cbxLoadInQgisWhenDone->setChecked( s.value( "/Plugin-GeoReferencer/loadinqgis", false ).toBool() );
8284
}
8385

86+
QgsTransformSettingsDialog::~QgsTransformSettingsDialog()
87+
{
88+
QSettings settings;
89+
settings.setValue( "/Plugin-GeoReferencer/TransformSettingsWindow/geometry", saveGeometry() );
90+
}
91+
8492
void QgsTransformSettingsDialog::getTransformSettings( QgsGeorefTransform::TransformParametrisation &tp,
8593
QgsImageWarper::ResamplingMethod &rm,
8694
QString &comprMethod, QString &raster,

‎src/plugins/georeferencer/qgstransformsettingsdialog.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class QgsTransformSettingsDialog : public QDialog, private Ui::QgsTransformSetti
2929
public:
3030
QgsTransformSettingsDialog( const QString &raster, const QString &output,
3131
int countGCPpoints, QWidget *parent = 0 );
32+
33+
~QgsTransformSettingsDialog();
3234
void getTransformSettings( QgsGeorefTransform::TransformParametrisation &tp,
3335
QgsImageWarper::ResamplingMethod &rm, QString &comprMethod,
3436
QString &raster, QgsCoordinateReferenceSystem& proj, QString& pdfMapFile, QString& pdfReportFile, bool &zt, bool &loadInQgis,

0 commit comments

Comments
 (0)
Please sign in to comment.