Skip to content

Commit

Permalink
[georef] Save/restore window positions
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 17, 2015
1 parent 049436e commit 4e663fe
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 5 deletions.
9 changes: 9 additions & 0 deletions src/plugins/georeferencer/qgsgeorefconfigdialog.cpp
Expand Up @@ -23,6 +23,9 @@ QgsGeorefConfigDialog::QgsGeorefConfigDialog( QWidget *parent ) :
{ {
setupUi( this ); setupUi( this );


QSettings s;
restoreGeometry( s.value( "/Plugin-GeoReferencer/ConfigWindow/geometry" ).toByteArray() );

readSettings(); readSettings();


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


} }


QgsGeorefConfigDialog::~QgsGeorefConfigDialog()
{
QSettings settings;
settings.setValue( "/Plugin-GeoReferencer/ConfigWindow/geometry", saveGeometry() );
}

void QgsGeorefConfigDialog::changeEvent( QEvent *e ) void QgsGeorefConfigDialog::changeEvent( QEvent *e )
{ {
QDialog::changeEvent( e ); QDialog::changeEvent( e );
Expand Down
1 change: 1 addition & 0 deletions src/plugins/georeferencer/qgsgeorefconfigdialog.h
Expand Up @@ -23,6 +23,7 @@ class QgsGeorefConfigDialog : public QDialog, private Ui::QgsGeorefConfigDialogB
Q_OBJECT Q_OBJECT
public: public:
QgsGeorefConfigDialog( QWidget *parent = 0 ); QgsGeorefConfigDialog( QWidget *parent = 0 );
~QgsGeorefConfigDialog();


protected: protected:
void changeEvent( QEvent *e ) override; void changeEvent( QEvent *e ) override;
Expand Down
8 changes: 6 additions & 2 deletions src/plugins/georeferencer/qgsgeorefplugingui.cpp
Expand Up @@ -87,6 +87,9 @@ QgsGeorefPluginGui::QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget
{ {
setupUi( this ); setupUi( this );


QSettings s;
restoreGeometry( s.value( "/Plugin-GeoReferencer/Window/geometry" ).toByteArray() );

createActions(); createActions();
createActionGroups(); createActionGroups();
createMenus(); createMenus();
Expand All @@ -105,7 +108,6 @@ QgsGeorefPluginGui::QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget


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


QSettings s;
if ( s.value( "/Plugin-GeoReferencer/Config/ShowDocked" ).toBool() ) if ( s.value( "/Plugin-GeoReferencer/Config/ShowDocked" ).toBool() )
{ {
dockThisWindow( true ); dockThisWindow( true );
Expand Down Expand Up @@ -135,6 +137,9 @@ void QgsGeorefPluginGui::dockThisWindow( bool dock )


QgsGeorefPluginGui::~QgsGeorefPluginGui() QgsGeorefPluginGui::~QgsGeorefPluginGui()
{ {
QSettings settings;
settings.setValue( "/Plugin-GeoReferencer/Window/geometry", saveGeometry() );

clearGCPData(); clearGCPData();


removeOldLayer(); removeOldLayer();
Expand All @@ -146,7 +151,6 @@ QgsGeorefPluginGui::~QgsGeorefPluginGui()
delete mToolDeletePoint; delete mToolDeletePoint;
delete mToolMovePoint; delete mToolMovePoint;
delete mToolMovePointQgis; delete mToolMovePointQgis;

} }


// ----------------------------- protected --------------------------------- // // ----------------------------- protected --------------------------------- //
Expand Down
8 changes: 6 additions & 2 deletions src/plugins/georeferencer/qgsmapcoordsdialog.cpp
Expand Up @@ -29,12 +29,14 @@ QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas* qgisCanvas, const QgsPoint
{ {
setupUi( this ); setupUi( this );


QSettings s;
restoreGeometry( s.value( "/Plugin-GeoReferencer/MapCoordsWindow/geometry" ).toByteArray() );

setAttribute( Qt::WA_DeleteOnClose ); setAttribute( Qt::WA_DeleteOnClose );


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


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


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


connect( mPointFromCanvasPushButton, SIGNAL( clicked( bool ) ), this, SLOT( setToolEmitPoint( bool ) ) ); connect( mPointFromCanvasPushButton, SIGNAL( clicked( bool ) ), this, SLOT( setToolEmitPoint( bool ) ) );
Expand All @@ -61,6 +62,9 @@ QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas* qgisCanvas, const QgsPoint
QgsMapCoordsDialog::~QgsMapCoordsDialog() QgsMapCoordsDialog::~QgsMapCoordsDialog()
{ {
delete mToolEmitPoint; delete mToolEmitPoint;

QSettings settings;
settings.setValue( "/Plugin-GeoReferencer/MapCoordsWindow/geometry", saveGeometry() );
} }


void QgsMapCoordsDialog::updateOK() void QgsMapCoordsDialog::updateOK()
Expand Down
10 changes: 9 additions & 1 deletion src/plugins/georeferencer/qgstransformsettingsdialog.cpp
Expand Up @@ -34,6 +34,9 @@ QgsTransformSettingsDialog::QgsTransformSettingsDialog( const QString &raster, c
{ {
setupUi( this ); setupUi( this );


QSettings s;
restoreGeometry( s.value( "/Plugin-GeoReferencer/TransformSettingsWindow/geometry" ).toByteArray() );

cmbTransformType->addItem( tr( "Linear" ), ( int )QgsGeorefTransform::Linear ); cmbTransformType->addItem( tr( "Linear" ), ( int )QgsGeorefTransform::Linear );
cmbTransformType->addItem( tr( "Helmert" ), ( int )QgsGeorefTransform::Helmert ); cmbTransformType->addItem( tr( "Helmert" ), ( int )QgsGeorefTransform::Helmert );
cmbTransformType->addItem( tr( "Polynomial 1" ), ( int )QgsGeorefTransform::PolynomialOrder1 ); cmbTransformType->addItem( tr( "Polynomial 1" ), ( int )QgsGeorefTransform::PolynomialOrder1 );
Expand All @@ -56,7 +59,6 @@ QgsTransformSettingsDialog::QgsTransformSettingsDialog( const QString &raster, c
} }
cmbCompressionComboBox->addItems( listCompressionTr ); cmbCompressionComboBox->addItems( listCompressionTr );


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


QgsTransformSettingsDialog::~QgsTransformSettingsDialog()
{
QSettings settings;
settings.setValue( "/Plugin-GeoReferencer/TransformSettingsWindow/geometry", saveGeometry() );
}

void QgsTransformSettingsDialog::getTransformSettings( QgsGeorefTransform::TransformParametrisation &tp, void QgsTransformSettingsDialog::getTransformSettings( QgsGeorefTransform::TransformParametrisation &tp,
QgsImageWarper::ResamplingMethod &rm, QgsImageWarper::ResamplingMethod &rm,
QString &comprMethod, QString &raster, QString &comprMethod, QString &raster,
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/georeferencer/qgstransformsettingsdialog.h
Expand Up @@ -29,6 +29,8 @@ class QgsTransformSettingsDialog : public QDialog, private Ui::QgsTransformSetti
public: public:
QgsTransformSettingsDialog( const QString &raster, const QString &output, QgsTransformSettingsDialog( const QString &raster, const QString &output,
int countGCPpoints, QWidget *parent = 0 ); int countGCPpoints, QWidget *parent = 0 );

~QgsTransformSettingsDialog();
void getTransformSettings( QgsGeorefTransform::TransformParametrisation &tp, void getTransformSettings( QgsGeorefTransform::TransformParametrisation &tp,
QgsImageWarper::ResamplingMethod &rm, QString &comprMethod, QgsImageWarper::ResamplingMethod &rm, QString &comprMethod,
QString &raster, QgsCoordinateReferenceSystem& proj, QString& pdfMapFile, QString& pdfReportFile, bool &zt, bool &loadInQgis, QString &raster, QgsCoordinateReferenceSystem& proj, QString& pdfMapFile, QString& pdfReportFile, bool &zt, bool &loadInQgis,
Expand Down

0 comments on commit 4e663fe

Please sign in to comment.