Skip to content
Permalink
Browse files
address Nyall reviews
  • Loading branch information
NEDJIMAbelgacem authored and nyalldawson committed Jan 12, 2022
1 parent a2150e5 commit f54136e616e10af0967c3b4b2b5b7400a0a4f95d

This file was deleted.

@@ -0,0 +1,95 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/project/qgsmapviewsmanager.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsMapViewsManager : QObject
{
%Docstring(signature="appended")

Manages storage of a set of views.

:py:class:`QgsMapViewsManager` handles the storage, serializing and deserializing
of views. Usually this class is not constructed directly, but rather
accessed through a :py:class:`QgsProject` via :py:func:`QgsProject.get3DViewsManager()` for example.

.. versionadded:: 3.24
%End

%TypeHeaderCode
#include "qgsmapviewsmanager.h"
%End
public:

explicit QgsMapViewsManager( QgsProject *project );
%Docstring
Constructor for QgsMapViewsManager. The project will become the parent object for this
manager.
%End

bool readXml( const QDomElement &element, const QDomDocument &doc );
%Docstring
Reads the manager's state from a DOM element, restoring all views
present in the XML document

.. seealso:: :py:func:`writeXml`
%End

QDomElement writeXml( QDomDocument &doc ) const;
%Docstring
Returns a DOM element representing the state of the manager.

.. seealso:: :py:func:`readXml`
%End

void clear();
%Docstring
Removes and deletes all views from the manager.
%End





void removeView( const QString &name );
%Docstring
Removes the configuration of the view named ``name``
%End

void renameView( const QString &oldTitle, const QString &newTitle );
%Docstring
Renames the view named ``oldTitle`` to ``newTitle``
%End

void setViewInitiallyVisible( const QString &name, bool visible );
%Docstring
Sets whether the view named ``name`` will be initially visible when the project is opened
%End

bool isViewOpen( const QString &name );
%Docstring
Returns whether the view named ``name`` will is opened
%End

signals:
void viewsListChanged();
%Docstring
Emitted when the views list has changed (whenever a view was removed, added, renamed..)
%End

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/core/project/qgsmapviewsmanager.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -745,7 +745,7 @@ the project.
%End


Qgs3DViewsManager *views3DManager();
QgsMapViewsManager *get3DViewsManager();
%Docstring
Returns the project's 3D views manager, which manages 3D views
in the project.
@@ -208,7 +208,6 @@
%Include auto_generated/./3d/qgs3dsymbolregistry.sip
%Include auto_generated/./3d/qgsabstract3dsymbol.sip
%Include auto_generated/./3d/qgsabstract3drenderer.sip
%Include auto_generated/./3d/qgs3dviewsmanager.sip
%Include auto_generated/annotations/qgsannotation.sip
%Include auto_generated/annotations/qgsannotationitem.sip
%Include auto_generated/annotations/qgsannotationitemeditoperation.sip
@@ -533,6 +532,7 @@
%Include auto_generated/project/qgsprojectutils.sip
%Include auto_generated/project/qgsprojectversion.sip
%Include auto_generated/project/qgsprojectviewsettings.sip
%Include auto_generated/project/qgsmapviewsmanager.sip
%Include auto_generated/providers/qgsabstractdbtablemodel.sip
%Include auto_generated/providers/qgsabstractdatabaseproviderconnection.sip
%Include auto_generated/providers/qgsabstractproviderconnection.sip
@@ -19,7 +19,7 @@
#include "qgs3dmapcanvasdockwidget.h"
#include "qgsnewnamedialog.h"
#include "qgs3dmapcanvas.h"
#include "qgs3dviewsmanager.h"
#include "qgsmapviewsmanager.h"

#include <QMessageBox>

@@ -46,7 +46,7 @@ Qgs3DViewsManagerDialog::Qgs3DViewsManagerDialog( QWidget *parent, Qt::WindowFla

connect( m3DViewsListView->selectionModel(), &QItemSelectionModel::currentChanged, this, &Qgs3DViewsManagerDialog::currentChanged );

connect( QgsProject::instance()->views3DManager(), &Qgs3DViewsManager::viewsListChanged, this, &Qgs3DViewsManagerDialog::onViewsListChanged );
connect( QgsProject::instance()->get3DViewsManager(), &QgsMapViewsManager::viewsListChanged, this, &Qgs3DViewsManagerDialog::onViewsListChanged );
m3DViewsListView->selectionModel()->setCurrentIndex( m3DViewsListView->model()->index( 0, 0 ), QItemSelectionModel::Select );
currentChanged( m3DViewsListView->selectionModel()->currentIndex(), m3DViewsListView->selectionModel()->currentIndex() );
}
@@ -63,18 +63,11 @@ void Qgs3DViewsManagerDialog::showClicked()

QString viewName = m3DViewsListView->selectionModel()->selectedRows().at( 0 ).data( Qt::DisplayRole ).toString();

Qgs3DMapCanvasDockWidget *widget = QgisApp::instance()->findChild<Qgs3DMapCanvasDockWidget *>( viewName + QStringLiteral( "DockObject" ) );

if ( !widget )
{
widget = QgisApp::instance()->open3DMapView( viewName );
}
Qgs3DMapCanvasDockWidget *widget = QgisApp::instance()->open3DMapView( viewName );
QgsProject::instance()->setDirty();
widget->show();

if ( widget )
{
widget->show();
QgsProject::instance()->setDirty();
}
m3DViewsListView->selectionModel()->setCurrentIndex( m3DViewsListView->selectionModel()->currentIndex(), QItemSelectionModel::Select );
currentChanged( m3DViewsListView->selectionModel()->currentIndex(), m3DViewsListView->selectionModel()->currentIndex() );
}

@@ -85,13 +78,12 @@ void Qgs3DViewsManagerDialog::hideClicked()

QString viewName = m3DViewsListView->selectionModel()->selectedRows().at( 0 ).data( Qt::DisplayRole ).toString();

Qgs3DMapCanvasDockWidget *widget = QgisApp::instance()->findChild<Qgs3DMapCanvasDockWidget *>( viewName + QStringLiteral( "DockObject" ) );
if ( widget )
{
widget->close();
}
Qgs3DMapCanvasDockWidget *widget = QgisApp::instance()->get3DMapViewDock( viewName );
widget->close();

QgsProject::instance()->setDirty();

m3DViewsListView->selectionModel()->setCurrentIndex( m3DViewsListView->selectionModel()->currentIndex(), QItemSelectionModel::Select );
currentChanged( m3DViewsListView->selectionModel()->currentIndex(), m3DViewsListView->selectionModel()->currentIndex() );
}

@@ -124,11 +116,12 @@ void Qgs3DViewsManagerDialog::removeClicked()

QString viewName = m3DViewsListView->selectionModel()->selectedRows().at( 0 ).data( Qt::DisplayRole ).toString();

QgsProject::instance()->views3DManager()->remove3DView( viewName );
if ( Qgs3DMapCanvasDockWidget *w = QgisApp::instance()->findChild<Qgs3DMapCanvasDockWidget *>( viewName + QStringLiteral( "DockObject" ) ) )
QgsProject::instance()->get3DViewsManager()->removeView( viewName );
if ( Qgs3DMapCanvasDockWidget *w = QgisApp::instance()->get3DMapViewDock( viewName ) )
{
w->close();

QgsProject::instance()->setDirty();
QgsProject::instance()->setDirty();
}
}

void Qgs3DViewsManagerDialog::renameClicked()
@@ -142,12 +135,11 @@ void Qgs3DViewsManagerDialog::renameClicked()
if ( newTitle.isEmpty() )
return;

QgsProject::instance()->views3DManager()->rename3DView( oldTitle, newTitle );
QgsProject::instance()->get3DViewsManager()->renameView( oldTitle, newTitle );

if ( Qgs3DMapCanvasDockWidget *widget = QgisApp::instance()->findChild<Qgs3DMapCanvasDockWidget *>( oldTitle + QStringLiteral( "DockObject" ) ) )
if ( Qgs3DMapCanvasDockWidget *widget = QgisApp::instance()->get3DMapViewDock( oldTitle ) )
{
widget->setWindowTitle( newTitle );
widget->setObjectName( newTitle + QStringLiteral( "DockObject" ) );
widget->mapCanvas3D()->setObjectName( newTitle );
}

@@ -169,14 +161,15 @@ void Qgs3DViewsManagerDialog::currentChanged( const QModelIndex &current, const
}

QString viewName = current.data( Qt::DisplayRole ).toString();
bool isOpen = QgsProject::instance()->views3DManager()->get3DViewSettings( viewName ).attribute( QStringLiteral( "isOpen" ), QStringLiteral( "0" ) ).toInt() == 1;
bool isOpen = QgsProject::instance()->get3DViewsManager()->isViewOpen( viewName );
mShowButton->setEnabled( !isOpen );
mHideButton->setEnabled( isOpen );
}

void Qgs3DViewsManagerDialog::reload()
{
QStringList names = QgsProject::instance()->views3DManager()->get3DViewsNames();
QStringList names = QgsProject::instance()->get3DViewsManager()->getViewsNames();
qDebug() << __PRETTY_FUNCTION__ << " " << names;
mListModel->setStringList( names );
}

0 comments on commit f54136e

Please sign in to comment.