Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[georef] Save/restore window positions
  • 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 );

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

readSettings();

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 )
{
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
public:
QgsGeorefConfigDialog( QWidget *parent = 0 );
~QgsGeorefConfigDialog();

protected:
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 );

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

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

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

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

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

clearGCPData();

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

}

// ----------------------------- 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 );

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

setAttribute( Qt::WA_DeleteOnClose );

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

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

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

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

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

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 );

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

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

QSettings s;
cmbTransformType->setCurrentIndex( s.value( "/Plugin-GeoReferencer/lasttransformation", -1 ).toInt() );
cmbResampling->setCurrentIndex( s.value( "/Plugin-GeoReferencer/lastresampling", 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() );
}

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

void QgsTransformSettingsDialog::getTransformSettings( QgsGeorefTransform::TransformParametrisation &tp,
QgsImageWarper::ResamplingMethod &rm,
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:
QgsTransformSettingsDialog( const QString &raster, const QString &output,
int countGCPpoints, QWidget *parent = 0 );

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

0 comments on commit 4e663fe

Please sign in to comment.