Skip to content
Permalink
Browse files

Use auto geometry restore for decoration dialogs

  • Loading branch information
nirvn committed Nov 15, 2018
1 parent 6fa8820 commit 1e29878df5c280e7e2a9721d2c30d1c014816b05
@@ -19,7 +19,7 @@
#include "qgsexpressioncontext.h"
#include "qgshelp.h"
#include "qgsmapcanvas.h"
#include "qgssettings.h"
#include "qgsgui.h"

//qt includes
#include <QColorDialog>
@@ -33,14 +33,14 @@ QgsDecorationCopyrightDialog::QgsDecorationCopyrightDialog( QgsDecorationCopyrig
, mDeco( deco )
{
setupUi( this );

QgsGui::enableAutoGeometryRestore( this );

connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsDecorationCopyrightDialog::buttonBox_accepted );
connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsDecorationCopyrightDialog::buttonBox_rejected );
connect( mInsertExpressionButton, &QPushButton::clicked, this, &QgsDecorationCopyrightDialog::mInsertExpressionButton_clicked );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsDecorationCopyrightDialog::showHelp );

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

QPushButton *applyButton = buttonBox->button( QDialogButtonBox::Apply );
connect( applyButton, &QAbstractButton::clicked, this, &QgsDecorationCopyrightDialog::apply );

@@ -78,12 +78,6 @@ QgsDecorationCopyrightDialog::QgsDecorationCopyrightDialog( QgsDecorationCopyrig
mButtonFontStyle->setTextFormat( mDeco.textFormat() );
}

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

void QgsDecorationCopyrightDialog::buttonBox_accepted()
{
apply();
@@ -9,6 +9,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/

#ifndef QGSCOPYRIGHTLABELPLUGINGUI_H
#define QGSCOPYRIGHTLABELPLUGINGUI_H

@@ -26,7 +27,6 @@ class APP_EXPORT QgsDecorationCopyrightDialog : public QDialog, private Ui::QgsD

public:
QgsDecorationCopyrightDialog( QgsDecorationCopyright &deco, QWidget *parent = nullptr );
~QgsDecorationCopyrightDialog() override;

private slots:
void buttonBox_accepted();
@@ -26,13 +26,16 @@
#include "qgssymbolselectordialog.h"
#include "qgisapp.h"
#include "qgsguiutils.h"
#include "qgssettings.h"
#include "qgsgui.h"

QgsDecorationGridDialog::QgsDecorationGridDialog( QgsDecorationGrid &deco, QWidget *parent )
: QDialog( parent )
, mDeco( deco )
{
setupUi( this );

QgsGui::enableAutoGeometryRestore( this );

connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsDecorationGridDialog::buttonBox_accepted );
connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsDecorationGridDialog::buttonBox_rejected );
connect( mGridTypeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsDecorationGridDialog::mGridTypeComboBox_currentIndexChanged );
@@ -45,9 +48,6 @@ QgsDecorationGridDialog::QgsDecorationGridDialog( QgsDecorationGrid &deco, QWidg

mAnnotationFontButton->setMode( QgsFontButton::ModeQFont );

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

grpEnable->setChecked( mDeco.enabled() );

// mXMinLineEdit->setValidator( new QDoubleValidator( mXMinLineEdit ) );
@@ -157,12 +157,6 @@ void QgsDecorationGridDialog::updateDecoFromGui()
mDeco.setMarkerSymbol( mMarkerSymbolButton->clonedSymbol< QgsMarkerSymbol >() );
}

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

void QgsDecorationGridDialog::showHelp()
{
QgsHelp::openHelp( QStringLiteral( "introduction/general_tools.html#grid" ) );
@@ -15,6 +15,7 @@
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSDECORATIONGRIDDIALOG_H
#define QGSDECORATIONGRIDDIALOG_H

@@ -32,7 +33,6 @@ class APP_EXPORT QgsDecorationGridDialog : public QDialog, private Ui::QgsDecora

public:
QgsDecorationGridDialog( QgsDecorationGrid &decoGrid, QWidget *parent = nullptr );
~QgsDecorationGridDialog() override;

private slots:
void apply();
@@ -28,20 +28,21 @@
#include "qgsguiutils.h"
#include "qgssettings.h"
#include "qgstextformatwidget.h"
#include "qgsgui.h"

QgsDecorationLayoutExtentDialog::QgsDecorationLayoutExtentDialog( QgsDecorationLayoutExtent &deco, QWidget *parent )
: QDialog( parent )
, mDeco( deco )
{
setupUi( this );

QgsGui::enableAutoGeometryRestore( this );

connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsDecorationLayoutExtentDialog::buttonBox_accepted );
connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsDecorationLayoutExtentDialog::buttonBox_rejected );

mSymbolButton->setSymbolType( QgsSymbol::Fill );

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

updateGuiElements();
connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsDecorationLayoutExtentDialog::apply );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsDecorationLayoutExtentDialog::showHelp );
@@ -65,12 +66,6 @@ void QgsDecorationLayoutExtentDialog::updateDecoFromGui()
mDeco.setLabelExtents( mCheckBoxLabelExtents->isChecked() );
}

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

void QgsDecorationLayoutExtentDialog::buttonBox_accepted()
{
apply();
@@ -14,6 +14,7 @@
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSDECORATIONLAYOUTEXTENTDIALOG_H
#define QGSDECORATIONLAYOUTEXTENTDIALOG_H

@@ -33,7 +34,6 @@ class APP_EXPORT QgsDecorationLayoutExtentDialog : public QDialog, private Ui::Q

public:
QgsDecorationLayoutExtentDialog( QgsDecorationLayoutExtent &decoration, QWidget *parent = nullptr );
~QgsDecorationLayoutExtentDialog() override;

private slots:
void apply();
@@ -15,10 +15,10 @@
#include "qgslogger.h"
#include "qgshelp.h"
#include "qgsproject.h"
#include "qgssettings.h"
#include "qgssymbollayerutils.h"
#include "qgssvgcache.h"
#include "qgssvgselectorwidget.h"
#include "qgsgui.h"

#include <QPainter>
#include <cmath>
@@ -31,12 +31,12 @@ QgsDecorationNorthArrowDialog::QgsDecorationNorthArrowDialog( QgsDecorationNorth
, mDeco( deco )
{
setupUi( this );

QgsGui::enableAutoGeometryRestore( this );

connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsDecorationNorthArrowDialog::buttonBox_accepted );
connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsDecorationNorthArrowDialog::buttonBox_rejected );

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

QPushButton *applyButton = buttonBox->button( QDialogButtonBox::Apply );
connect( applyButton, &QAbstractButton::clicked, this, &QgsDecorationNorthArrowDialog::apply );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsDecorationNorthArrowDialog::showHelp );
@@ -105,12 +105,6 @@ QgsDecorationNorthArrowDialog::QgsDecorationNorthArrowDialog( QgsDecorationNorth
drawNorthArrow();
}

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

void QgsDecorationNorthArrowDialog::showHelp()
{
QgsHelp::openHelp( QStringLiteral( "introduction/general_tools.html#north-arrow" ) );
@@ -9,6 +9,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/

#ifndef QGSNORTHARROWPLUGINGUI_H
#define QGSNORTHARROWPLUGINGUI_H

@@ -23,7 +24,6 @@ class APP_EXPORT QgsDecorationNorthArrowDialog : public QDialog, private Ui::Qgs

public:
QgsDecorationNorthArrowDialog( QgsDecorationNorthArrow &deco, QWidget *parent = nullptr );
~QgsDecorationNorthArrowDialog() override;

private:
void updateSvgPath( const QString &svgPath );
@@ -14,7 +14,7 @@
#include "qgsdecorationscalebar.h"
#include "qgslogger.h"
#include "qgshelp.h"
#include "qgssettings.h"
#include "qgsgui.h"

#include <QColorDialog>
#include <QDialogButtonBox>
@@ -25,13 +25,13 @@ QgsDecorationScaleBarDialog::QgsDecorationScaleBarDialog( QgsDecorationScaleBar
, mDeco( deco )
{
setupUi( this );

QgsGui::enableAutoGeometryRestore( this );

connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsDecorationScaleBarDialog::buttonBox_accepted );
connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsDecorationScaleBarDialog::buttonBox_rejected );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsDecorationScaleBarDialog::showHelp );

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

QPushButton *applyButton = buttonBox->button( QDialogButtonBox::Apply );
connect( applyButton, &QAbstractButton::clicked, this, &QgsDecorationScaleBarDialog::apply );

@@ -88,12 +88,6 @@ QgsDecorationScaleBarDialog::QgsDecorationScaleBarDialog( QgsDecorationScaleBar
mButtonFontStyle->setTextFormat( mDeco.mTextFormat );
}

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

void QgsDecorationScaleBarDialog::showHelp()
{
QgsHelp::openHelp( QStringLiteral( "introduction/general_tools.html#scale-bar" ) );
@@ -9,6 +9,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/

#ifndef QGSSCALEBARPLUGINGUI_H
#define QGSSCALEBARPLUGINGUI_H

@@ -24,7 +25,6 @@ class APP_EXPORT QgsDecorationScaleBarDialog : public QDialog, private Ui::QgsDe

public:
QgsDecorationScaleBarDialog( QgsDecorationScaleBar &deco, int units, QWidget *parent = nullptr );
~QgsDecorationScaleBarDialog() override;

private slots:
void buttonBox_accepted();
@@ -22,7 +22,6 @@
#include "qgsexpressioncontext.h"
#include "qgshelp.h"
#include "qgsmapcanvas.h"
#include "qgssettings.h"
#include "qgsgui.h"

#include <QColorDialog>

0 comments on commit 1e29878

Please sign in to comment.
You can’t perform that action at this time.