Skip to content

Commit

Permalink
enableAutoGeometryRestore dialog updates
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Dec 18, 2017
1 parent ea5f3c6 commit 8ca5b2a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 23 deletions.
11 changes: 3 additions & 8 deletions src/app/qgsbookmarks.cpp
Expand Up @@ -22,6 +22,7 @@
#include "qgsmessagelog.h"
#include "qgslogger.h"
#include "qgssettings.h"
#include "qgsgui.h"

#include <QFileDialog>
#include <QFileInfo>
Expand All @@ -42,8 +43,9 @@ QgsBookmarks::QgsBookmarks( QWidget *parent )

{
setupUi( this );
QgsGui::enableAutoGeometryRestore( this );

connect( lstBookmarks, &QTreeView::doubleClicked, this, &QgsBookmarks::lstBookmarks_doubleClicked );
restorePosition();

bookmarksDockContents->layout()->setMargin( 0 );
bookmarksDockContents->layout()->setContentsMargins( 0, 0, 0, 0 );
Expand Down Expand Up @@ -137,16 +139,9 @@ QgsBookmarks::~QgsBookmarks()
saveWindowLocation();
}

void QgsBookmarks::restorePosition()
{
QgsSettings settings;
restoreGeometry( settings.value( QStringLiteral( "Windows/Bookmarks/geometry" ) ).toByteArray() );
}

void QgsBookmarks::saveWindowLocation()
{
QgsSettings settings;
settings.setValue( QStringLiteral( "Windows/Bookmarks/geometry" ), saveGeometry() );
settings.setValue( QStringLiteral( "Windows/Bookmarks/headerstate" ), lstBookmarks->header()->saveState() );
}

Expand Down
1 change: 0 additions & 1 deletion src/app/qgsbookmarks.h
Expand Up @@ -164,7 +164,6 @@ class APP_EXPORT QgsBookmarks : public QgsDockWidget, private Ui::QgsBookmarksBa
QgsBookmarksProxyModel *mProxyModel = nullptr;

void saveWindowLocation();
void restorePosition();

};

Expand Down
8 changes: 3 additions & 5 deletions src/app/qgscustomization.cpp
Expand Up @@ -19,6 +19,7 @@
#include "qgsapplication.h"
#include "qgslogger.h"
#include "qgsstatusbar.h"
#include "qgsgui.h"

#include <QAction>
#include <QDir>
Expand Down Expand Up @@ -47,16 +48,15 @@ QgsCustomizationDialog::QgsCustomizationDialog( QWidget * parent, QSettings * se
{
mSettings = settings;
setupUi( this );
QgsGui::enableAutoGeometryRestore( this );

connect( actionSave, &QAction::triggered, this, &QgsCustomizationDialog::actionSave_triggered );
connect( actionLoad, &QAction::triggered, this, &QgsCustomizationDialog::actionLoad_triggered );
connect( actionExpandAll, &QAction::triggered, this, &QgsCustomizationDialog::actionExpandAll_triggered );
connect( actionCollapseAll, &QAction::triggered, this, &QgsCustomizationDialog::actionCollapseAll_triggered );
connect( actionSelectAll, &QAction::triggered, this, &QgsCustomizationDialog::actionSelectAll_triggered );
connect( mCustomizationEnabledCheckBox, &QCheckBox::toggled, this, &QgsCustomizationDialog::mCustomizationEnabledCheckBox_toggled );

QSettings appSettings;
restoreGeometry( appSettings.value( QStringLiteral( "Windows/Customization/geometry" ) ).toByteArray() );

init();
QStringList myHeaders;
myHeaders << tr( "Object name" ) << tr( "Label" );
Expand All @@ -74,8 +74,6 @@ QgsCustomizationDialog::QgsCustomizationDialog( QWidget * parent, QSettings * se

QgsCustomizationDialog::~QgsCustomizationDialog()
{
QSettings settings;
settings.setValue( QStringLiteral( "Windows/Customization/geometry" ), saveGeometry() );
}

QTreeWidgetItem *QgsCustomizationDialog::item( const QString &path, QTreeWidgetItem *widgetItem )
Expand Down
7 changes: 3 additions & 4 deletions src/app/qgscustomprojectiondialog.cpp
Expand Up @@ -26,6 +26,7 @@
#include "qgsprojectionselectiondialog.h"
#include "qgssettings.h"
#include "qgssqliteutils.h"
#include "qgsgui.h"

//qt includes
#include <QFileInfo>
Expand All @@ -47,6 +48,8 @@ QgsCustomProjectionDialog::QgsCustomProjectionDialog( QWidget *parent, Qt::Windo
: QDialog( parent, fl )
{
setupUi( this );
QgsGui::enableAutoGeometryRestore( this );

connect( pbnCalculate, &QPushButton::clicked, this, &QgsCustomProjectionDialog::pbnCalculate_clicked );
connect( pbnAdd, &QPushButton::clicked, this, &QgsCustomProjectionDialog::pbnAdd_clicked );
connect( pbnRemove, &QPushButton::clicked, this, &QgsCustomProjectionDialog::pbnRemove_clicked );
Expand All @@ -55,8 +58,6 @@ QgsCustomProjectionDialog::QgsCustomProjectionDialog( QWidget *parent, Qt::Windo
connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsCustomProjectionDialog::buttonBox_accepted );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsCustomProjectionDialog::showHelp );

QgsSettings settings;
restoreGeometry( settings.value( QStringLiteral( "Windows/CustomProjection/geometry" ) ).toByteArray() );

// user database is created at QGIS startup in QgisApp::createDB
// we just check whether there is our database [MD]
Expand All @@ -83,8 +84,6 @@ QgsCustomProjectionDialog::QgsCustomProjectionDialog( QWidget *parent, Qt::Windo

QgsCustomProjectionDialog::~QgsCustomProjectionDialog()
{
QgsSettings settings;
settings.setValue( QStringLiteral( "Windows/CustomProjection/geometry" ), saveGeometry() );
}


Expand Down
7 changes: 2 additions & 5 deletions src/gui/qgsprojectionselectiondialog.cpp
Expand Up @@ -21,17 +21,16 @@
#include "qgsprojectionselectiondialog.h"
#include "qgshelp.h"
#include <QApplication>
#include "qgsgui.h"

QgsProjectionSelectionDialog::QgsProjectionSelectionDialog( QWidget *parent,
Qt::WindowFlags fl )
: QDialog( parent, fl )
{
setupUi( this );
QgsGui::enableAutoGeometryRestore( this );
connect( mButtonBox, &QDialogButtonBox::helpRequested, this, &QgsProjectionSelectionDialog::showHelp );

QgsSettings settings;
restoreGeometry( settings.value( QStringLiteral( "Windows/ProjectionSelector/geometry" ) ).toByteArray() );

//we will show this only when a message is set
textEdit->hide();

Expand Down Expand Up @@ -73,8 +72,6 @@ bool QgsProjectionSelectionDialog::showNoProjection() const

QgsProjectionSelectionDialog::~QgsProjectionSelectionDialog()
{
QSettings settings;
settings.setValue( QStringLiteral( "Windows/ProjectionSelector/geometry" ), saveGeometry() );
}

QgsCoordinateReferenceSystem QgsProjectionSelectionDialog::crs() const
Expand Down

0 comments on commit 8ca5b2a

Please sign in to comment.