Skip to content
Permalink
Browse files

Move handling of layout manager from qgisapp -> QgsAppWindowManager

  • Loading branch information
nyalldawson committed Sep 14, 2018
1 parent cb178a7 commit 3b64c34b05ca65d8833b5b662a57b08640c7ad67
Showing with 42 additions and 12 deletions.
  1. +1 −8 src/app/qgisapp.cpp
  2. +0 −3 src/app/qgisapp.h
  3. +22 −1 src/app/qgsappwindowmanager.cpp
  4. +19 −0 src/app/qgsappwindowmanager.h
@@ -210,7 +210,6 @@ Q_GUI_EXPORT extern int qt_defaultDpiX();
#include "qgslayoutcustomdrophandler.h"
#include "qgslayoutdesignerdialog.h"
#include "qgslayoutmanager.h"
#include "qgslayoutmanagerdialog.h"
#include "qgslayoutqptdrophandler.h"
#include "qgslayoutapputils.h"
#include "qgslocatorwidget.h"
@@ -10587,13 +10586,7 @@ void QgisApp::reloadConnections()

void QgisApp::showLayoutManager()
{
if ( !mLayoutManagerDialog )
{
mLayoutManagerDialog = new QgsLayoutManagerDialog( this, Qt::Window );
mLayoutManagerDialog->setAttribute( Qt::WA_DeleteOnClose );
}
mLayoutManagerDialog->show();
mLayoutManagerDialog->activate();
static_cast< QgsAppWindowManager * >( QgsGui::windowManager() )->openApplicationDialog( QgsAppWindowManager::DialogLayoutManager );
}

QgsVectorLayer *QgisApp::addVectorLayer( const QString &vectorLayerPath, const QString &name, const QString &providerKey )
@@ -64,7 +64,6 @@ class QgsMasterLayoutInterface;
class QgsLayoutCustomDropHandler;
class QgsLayoutDesignerDialog;
class QgsLayoutDesignerInterface;
class QgsLayoutManagerDialog;
class QgsMapCanvas;
class QgsMapCanvasDockWidget;
class QgsMapLayer;
@@ -2202,8 +2201,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QgsDockWidget *mMapStylingDock = nullptr;
QgsLayerStylingWidget *mMapStyleWidget = nullptr;

QPointer< QgsLayoutManagerDialog > mLayoutManagerDialog;

//! Persistent tile scale slider
QgsTileScaleWidget *mpTileScaleWidget = nullptr;

@@ -17,12 +17,14 @@
#include "qgsstylemanagerdialog.h"
#include "qgsstyle.h"
#include "qgisapp.h"

#include "qgslayoutmanagerdialog.h"

QgsAppWindowManager::~QgsAppWindowManager()
{
if ( mStyleManagerDialog )
delete mStyleManagerDialog;
if ( mLayoutManagerDialog )
delete mLayoutManagerDialog;
}

QWidget *QgsAppWindowManager::openStandardDialog( QgsWindowManagerInterface::StandardDialog dialog )
@@ -43,3 +45,22 @@ QWidget *QgsAppWindowManager::openStandardDialog( QgsWindowManagerInterface::Sta
}
return nullptr;
}

QWidget *QgsAppWindowManager::openApplicationDialog( QgsAppWindowManager::ApplicationDialog dialog )
{
switch ( dialog )
{
case DialogLayoutManager:
{
if ( !mLayoutManagerDialog )
{
mLayoutManagerDialog = new QgsLayoutManagerDialog( QgisApp::instance(), Qt::Window );
mLayoutManagerDialog->setAttribute( Qt::WA_DeleteOnClose );
}
mLayoutManagerDialog->show();
mLayoutManagerDialog->activate();
}
return nullptr;
}
return nullptr;
}
@@ -21,6 +21,7 @@
#include <QPointer>

class QgsStyleManagerDialog;
class QgsLayoutManagerDialog;

/**
* \ingroup gui
@@ -30,13 +31,31 @@ class QgsAppWindowManager : public QgsWindowManagerInterface
{
public:

//! Application-only QGIS dialogs
enum ApplicationDialog
{
DialogLayoutManager = 0, //!< Layout manager dialog
};

QgsAppWindowManager() = default;
~QgsAppWindowManager();

QWidget *openStandardDialog( QgsWindowManagerInterface::StandardDialog dialog ) override;

/**
* Opens an instance of a application QGIS dialog. Depending on the dialog,
* this may either open a new instance of the dialog or bring an
* existing instance to the foreground.
*
* Returns the dialog if shown, or nullptr if the dialog either could not be
* created.
*/
QWidget *openApplicationDialog( ApplicationDialog dialog );

private:
QPointer< QgsStyleManagerDialog > mStyleManagerDialog;
QPointer< QgsLayoutManagerDialog > mLayoutManagerDialog;

};


0 comments on commit 3b64c34

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