Skip to content

Commit

Permalink
Remove some dialogs geometry size settings
Browse files Browse the repository at this point in the history
replaced with automatic restoring
  • Loading branch information
DelazJ authored and nyalldawson committed Jun 21, 2019
1 parent a14aac2 commit 059277c
Show file tree
Hide file tree
Showing 40 changed files with 65 additions and 184 deletions.
1 change: 0 additions & 1 deletion python/gui/auto_generated/qgsmessageviewer.sip.in
Expand Up @@ -21,7 +21,6 @@ A generic message view for displaying QGIS messages.
%End
public:
QgsMessageViewer( QWidget *parent /TransferThis/ = 0, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, bool deleteOnClose = true );
~QgsMessageViewer();

virtual void setMessage( const QString &message, MessageType msgType );

Expand Down
1 change: 0 additions & 1 deletion python/gui/auto_generated/qgsnewmemorylayerdialog.sip.in
Expand Up @@ -31,7 +31,6 @@ Runs the dialog and creates a new memory layer
%Docstring
New dialog constructor.
%End
~QgsNewMemoryLayerDialog();

QgsWkbTypes::Type selectedType() const;
%Docstring
Expand Down
12 changes: 3 additions & 9 deletions src/app/layout/qgslayoutattributeselectiondialog.cpp
Expand Up @@ -21,6 +21,7 @@
#include "qgsfieldexpressionwidget.h"
#include "qgsdoublespinbox.h"
#include "qgssettings.h"
#include "qgsgui.h"
#include "qgslayouttablecolumn.h"

#include <QCheckBox>
Expand Down Expand Up @@ -885,6 +886,8 @@ QgsLayoutAttributeSelectionDialog::QgsLayoutAttributeSelectionDialog( QgsLayoutI

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

connect( mRemoveColumnPushButton, &QPushButton::clicked, this, &QgsLayoutAttributeSelectionDialog::mRemoveColumnPushButton_clicked );
connect( mAddColumnPushButton, &QPushButton::clicked, this, &QgsLayoutAttributeSelectionDialog::mAddColumnPushButton_clicked );
connect( mColumnUpPushButton, &QPushButton::clicked, this, &QgsLayoutAttributeSelectionDialog::mColumnUpPushButton_clicked );
Expand All @@ -896,9 +899,6 @@ QgsLayoutAttributeSelectionDialog::QgsLayoutAttributeSelectionDialog( QgsLayoutI
connect( mSortColumnUpPushButton, &QPushButton::clicked, this, &QgsLayoutAttributeSelectionDialog::mSortColumnUpPushButton_clicked );
connect( mSortColumnDownPushButton, &QPushButton::clicked, this, &QgsLayoutAttributeSelectionDialog::mSortColumnDownPushButton_clicked );

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

if ( mTable )
{
//set up models, views and delegates
Expand Down Expand Up @@ -933,12 +933,6 @@ QgsLayoutAttributeSelectionDialog::QgsLayoutAttributeSelectionDialog( QgsLayoutI
mOrderComboBox->insertItem( 1, tr( "Descending" ) );
}

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

void QgsLayoutAttributeSelectionDialog::mRemoveColumnPushButton_clicked()
{
//remove selected rows from model
Expand Down
2 changes: 0 additions & 2 deletions src/app/layout/qgslayoutattributeselectiondialog.h
Expand Up @@ -286,8 +286,6 @@ class QgsLayoutAttributeSelectionDialog: public QDialog, private Ui::QgsLayoutAt
public:
QgsLayoutAttributeSelectionDialog( QgsLayoutItemAttributeTable *table, QgsVectorLayer *vLayer, QWidget *parent = nullptr, Qt::WindowFlags f = nullptr );

~QgsLayoutAttributeSelectionDialog() override;

private slots:
void mRemoveColumnPushButton_clicked();
void mAddColumnPushButton_clicked();
Expand Down
10 changes: 2 additions & 8 deletions src/app/layout/qgslayoutlegendlayersdialog.cpp
Expand Up @@ -19,13 +19,13 @@
#include "qgsmaplayermodel.h"
#include "qgsmaplayerproxymodel.h"
#include "qgssettings.h"
#include "qgsgui.h"

QgsLayoutLegendLayersDialog::QgsLayoutLegendLayersDialog( QWidget *parent )
: QDialog( parent )
{
setupUi( this );
QgsSettings settings;
restoreGeometry( settings.value( QStringLiteral( "Windows/LayoutLegendLayers/geometry" ) ).toByteArray() );
QgsGui::enableAutoGeometryRestore( this );

mFilterLineEdit->setShowClearButton( true );
mFilterLineEdit->setShowSearchIcon( true );
Expand All @@ -41,12 +41,6 @@ QgsLayoutLegendLayersDialog::QgsLayoutLegendLayersDialog( QWidget *parent )
connect( mCheckBoxVisibleLayers, &QCheckBox::toggled, this, &QgsLayoutLegendLayersDialog::filterVisible );
}

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

void QgsLayoutLegendLayersDialog::setVisibleLayers( const QList<QgsMapLayer *> &layers )
{
mVisibleLayers = layers;
Expand Down
1 change: 0 additions & 1 deletion src/app/layout/qgslayoutlegendlayersdialog.h
Expand Up @@ -30,7 +30,6 @@ class QgsLayoutLegendLayersDialog: public QDialog, private Ui::QgsLayoutLegendLa

public:
QgsLayoutLegendLayersDialog( QWidget *parent = nullptr );
~QgsLayoutLegendLayersDialog() override;

/**
* Sets a list of visible \a layers, to use for filtering within the dialog.
Expand Down
12 changes: 3 additions & 9 deletions src/app/layout/qgslayouttablebackgroundcolorsdialog.cpp
Expand Up @@ -19,6 +19,7 @@
#include "qgslayouttable.h"
#include "qgslayout.h"
#include "qgssettings.h"
#include "qgsgui.h"

#include <QCheckBox>
#include <QPushButton>
Expand All @@ -28,6 +29,8 @@ QgsLayoutTableBackgroundColorsDialog::QgsLayoutTableBackgroundColorsDialog( QgsL
, mTable( table )
{
setupUi( this );
QgsGui::enableAutoGeometryRestore( this );

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

Expand All @@ -53,18 +56,9 @@ QgsLayoutTableBackgroundColorsDialog::QgsLayoutTableBackgroundColorsDialog( QgsL

connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsLayoutTableBackgroundColorsDialog::apply );

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

setGuiElementValues();
}

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

void QgsLayoutTableBackgroundColorsDialog::apply()
{
if ( !mTable )
Expand Down
2 changes: 0 additions & 2 deletions src/app/layout/qgslayouttablebackgroundcolorsdialog.h
Expand Up @@ -42,8 +42,6 @@ class QgsLayoutTableBackgroundColorsDialog: public QDialog, private Ui::QgsLayou
*/
QgsLayoutTableBackgroundColorsDialog( QgsLayoutTable *table, QWidget *parent = nullptr, Qt::WindowFlags flags = nullptr );

~QgsLayoutTableBackgroundColorsDialog() override;

private slots:

void apply();
Expand Down
7 changes: 1 addition & 6 deletions src/app/qgsattributetypedialog.cpp
Expand Up @@ -47,6 +47,7 @@ QgsAttributeTypeDialog::QgsAttributeTypeDialog( QgsVectorLayer *vl, int fieldIdx
, mFieldIdx( fieldIdx )
{
setupUi( this );
QgsGui::enableAutoGeometryRestore( this );

if ( fieldIdx < 0 )
return;
Expand Down Expand Up @@ -88,18 +89,12 @@ QgsAttributeTypeDialog::QgsAttributeTypeDialog( QgsVectorLayer *vl, int fieldIdx
}
);

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

constraintExpressionWidget->setAllowEmptyFieldName( true );
constraintExpressionWidget->setLayer( vl );
}

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

qDeleteAll( mEditorConfigWidgets );
}

Expand Down
12 changes: 3 additions & 9 deletions src/app/qgsdelattrdialog.cpp
Expand Up @@ -21,10 +21,13 @@
#include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h"
#include "qgssettings.h"
#include "qgsgui.h"

QgsDelAttrDialog::QgsDelAttrDialog( const QgsVectorLayer *vl )
{
setupUi( this );
QgsGui::enableAutoGeometryRestore( this );

if ( vl )
{
bool canDeleteAttributes = vl->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteAttributes;
Expand Down Expand Up @@ -57,15 +60,6 @@ QgsDelAttrDialog::QgsDelAttrDialog( const QgsVectorLayer *vl )
mEditModeInfo->setVisible( !vl->isEditable() );
mCanDeleteAttributesInfo->setVisible( !canDeleteAttributes );
}

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

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

QList<int> QgsDelAttrDialog::selectedAttributes()
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsdelattrdialog.h
Expand Up @@ -30,7 +30,7 @@ class APP_EXPORT QgsDelAttrDialog: public QDialog, private Ui::QgsDelAttrDialogB
Q_OBJECT
public:
QgsDelAttrDialog( const QgsVectorLayer *vl );
~QgsDelAttrDialog() override;

//! Returns the selected attribute indices
QList<int> selectedAttributes();
};
Expand Down
13 changes: 4 additions & 9 deletions src/app/qgsmergeattributesdialog.cpp
Expand Up @@ -60,6 +60,8 @@ QgsMergeAttributesDialog::QgsMergeAttributesDialog( const QgsFeatureList &featur

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

connect( mFromSelectedPushButton, &QPushButton::clicked, this, &QgsMergeAttributesDialog::mFromSelectedPushButton_clicked );
connect( mRemoveFeatureFromSelectionButton, &QPushButton::clicked, this, &QgsMergeAttributesDialog::mRemoveFeatureFromSelectionButton_clicked );
createTableWidgetContents();
Expand All @@ -75,28 +77,21 @@ QgsMergeAttributesDialog::QgsMergeAttributesDialog( const QgsFeatureList &featur
mFromSelectedPushButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionFromSelectedFeature.svg" ) ) );
mRemoveFeatureFromSelectionButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionRemoveSelectedFeature.svg" ) ) );

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

connect( mSkipAllButton, &QAbstractButton::clicked, this, &QgsMergeAttributesDialog::setAllToSkip );
connect( mTableWidget, &QTableWidget::cellChanged, this, &QgsMergeAttributesDialog::tableWidgetCellChanged );
}

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

connect( mFromSelectedPushButton, &QPushButton::clicked, this, &QgsMergeAttributesDialog::mFromSelectedPushButton_clicked );
connect( mRemoveFeatureFromSelectionButton, &QPushButton::clicked, this, &QgsMergeAttributesDialog::mRemoveFeatureFromSelectionButton_clicked );

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

QgsMergeAttributesDialog::~QgsMergeAttributesDialog()
{
QgsSettings settings;
settings.setValue( QStringLiteral( "Windows/MergeAttributes/geometry" ), saveGeometry() );

delete mSelectionRubberBand;
}

Expand Down
10 changes: 2 additions & 8 deletions src/app/qgsprojectlayergroupdialog.cpp
Expand Up @@ -21,6 +21,7 @@
#include "qgslayertreeutils.h"
#include "qgssettings.h"
#include "qgsziputils.h"
#include "qgsgui.h"

#include <QDomDocument>
#include <QFileDialog>
Expand Down Expand Up @@ -48,6 +49,7 @@ QgsProjectLayerGroupDialog::QgsProjectLayerGroupDialog( QWidget *parent, const Q
, mRootGroup( new QgsLayerTree )
{
setupUi( this );
QgsGui::enableAutoGeometryRestore( this );

QgsEmbeddedLayerTreeModel *model = new QgsEmbeddedLayerTreeModel( mRootGroup, this );
mTreeView->setModel( model );
Expand All @@ -74,21 +76,13 @@ QgsProjectLayerGroupDialog::QgsProjectLayerGroupDialog( QWidget *parent, const Q
}

connect( mProjectFileWidget, &QgsFileWidget::fileChanged, this, &QgsProjectLayerGroupDialog::changeProjectFile );

connect( mButtonBox, &QDialogButtonBox::accepted, this, &QgsProjectLayerGroupDialog::mButtonBox_accepted );

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


connect( mButtonBox, &QDialogButtonBox::rejected, this, &QDialog::reject );
connect( mButtonBox, &QDialogButtonBox::helpRequested, this, &QgsProjectLayerGroupDialog::showHelp );
}

QgsProjectLayerGroupDialog::~QgsProjectLayerGroupDialog()
{
QgsSettings settings;
settings.setValue( QStringLiteral( "Windows/EmbedLayer/geometry" ), saveGeometry() );

delete mRootGroup;
}

Expand Down
10 changes: 2 additions & 8 deletions src/app/qgsselectbyformdialog.cpp
Expand Up @@ -21,6 +21,7 @@
#include "qgssettings.h"
#include "qgsmessagebar.h"
#include "qgsexpressioncontextutils.h"
#include "qgsgui.h"


QgsSelectByFormDialog::QgsSelectByFormDialog( QgsVectorLayer *layer, const QgsAttributeEditorContext &context, QWidget *parent, Qt::WindowFlags fl )
Expand All @@ -44,18 +45,11 @@ QgsSelectByFormDialog::QgsSelectByFormDialog( QgsVectorLayer *layer, const QgsAt

connect( mForm, &QgsAttributeForm::closed, this, &QWidget::close );

QgsSettings settings;
restoreGeometry( settings.value( QStringLiteral( "Windows/SelectByForm/geometry" ) ).toByteArray() );
QgsGui::enableAutoGeometryRestore( this );

setWindowTitle( tr( "Select Features by Value" ) );
}

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

void QgsSelectByFormDialog::setMessageBar( QgsMessageBar *messageBar )
{
mMessageBar = messageBar;
Expand Down
2 changes: 0 additions & 2 deletions src/app/qgsselectbyformdialog.h
Expand Up @@ -49,8 +49,6 @@ class APP_EXPORT QgsSelectByFormDialog : public QDialog
const QgsAttributeEditorContext &context = QgsAttributeEditorContext(),
QWidget *parent = nullptr, Qt::WindowFlags fl = nullptr );

~QgsSelectByFormDialog() override;

/**
* Sets the message bar to display feedback from the form in. This is used in the search/filter
* mode to display the count of selected features.
Expand Down
10 changes: 3 additions & 7 deletions src/app/qgsvectorlayersavestyledialog.cpp
Expand Up @@ -20,13 +20,16 @@
#include "qgsvectorlayer.h"
#include "qgssettings.h"
#include "qgshelp.h"
#include "qgsgui.h"
#include "qgsmaplayerstylecategoriesmodel.h"

QgsVectorLayerSaveStyleDialog::QgsVectorLayerSaveStyleDialog( QgsVectorLayer *layer, QWidget *parent )
: QDialog( parent )
, mLayer( layer )
{
setupUi( this );
QgsGui::enableAutoGeometryRestore( this );

QgsSettings settings;

QString providerName = mLayer->providerType();
Expand Down Expand Up @@ -81,7 +84,6 @@ QgsVectorLayerSaveStyleDialog::QgsVectorLayerSaveStyleDialog( QgsVectorLayer *la
mModel->setCategories( lastStyleCategories );
mStyleCategoriesListView->setModel( mModel );

restoreGeometry( settings.value( QStringLiteral( "Windows/vectorLayerSaveStyle/geometry" ) ).toByteArray() );
mStyleCategoriesListView->adjustSize();
}

Expand All @@ -98,12 +100,6 @@ void QgsVectorLayerSaveStyleDialog::updateSaveButtonState()
( type != QgsVectorLayerProperties::DB && !mFileWidget->filePath().isEmpty() ) );
}

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

QgsVectorLayerSaveStyleDialog::SaveToDbSettings QgsVectorLayerSaveStyleDialog::saveToDbSettings() const
{
SaveToDbSettings settings;
Expand Down
1 change: 0 additions & 1 deletion src/app/qgsvectorlayersavestyledialog.h
Expand Up @@ -40,7 +40,6 @@ class QgsVectorLayerSaveStyleDialog : public QDialog, private Ui::QgsVectorLayer
};

explicit QgsVectorLayerSaveStyleDialog( QgsVectorLayer *layer, QWidget *parent = nullptr );
~QgsVectorLayerSaveStyleDialog() override;

SaveToDbSettings saveToDbSettings() const;
QString outputFilePath() const;
Expand Down

0 comments on commit 059277c

Please sign in to comment.