Skip to content

Commit

Permalink
Remove all interface methods and UI for creating new composers
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 7, 2018
1 parent aef9df8 commit f287d40
Show file tree
Hide file tree
Showing 15 changed files with 90 additions and 924 deletions.
74 changes: 10 additions & 64 deletions python/gui/qgisinterface.sip
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,6 @@ Return a pointer to the main window (instance of QgisApp in case of QGIS)
virtual QgsMessageBar *messageBar() = 0;
%Docstring
Return the message bar of the main app
%End

virtual QList<QgsComposerInterface *> openComposers() = 0;
%Docstring
Returns all currently open composer windows.

.. versionadded:: 3.0
%End

virtual QList<QgsLayoutDesignerInterface *> openLayoutDesigners() = 0;
Expand Down Expand Up @@ -212,8 +205,16 @@ Advanced digitizing dock widget
virtual QAction *actionSaveProjectAs() = 0;
virtual QAction *actionSaveMapAsImage() = 0;
virtual QAction *actionProjectProperties() = 0;
virtual QAction *actionPrintComposer() = 0;
virtual QAction *actionShowComposerManager() = 0;

virtual QAction *actionCreatePrintLayout() = 0;
%Docstring
Create new print layout action
%End

virtual QAction *actionShowLayoutManager() = 0;
%Docstring
Show layout manager action
%End
virtual QAction *actionExit() = 0;

virtual QAction *actionCutFeatures() = 0;
Expand Down Expand Up @@ -606,27 +607,6 @@ Open the message log dock widget *
virtual void addUserInputWidget( QWidget *widget ) = 0;
%Docstring
Adds a widget to the user input tool bar.
%End

virtual QgsComposerInterface *openComposer( QgsComposition *composition ) = 0;
%Docstring
Opens a new composer window for the specified ``composition``, or
brings an already open composer window to the foreground if one
is already created for the composition.

.. versionadded:: 3.0

.. seealso:: :py:func:`closeComposer()`
%End

virtual void closeComposer( QgsComposition *composition ) = 0;
%Docstring
Closes an open composer window showing the specified ``composition``.
The composition remains unaffected.

.. versionadded:: 3.0

.. seealso:: :py:func:`openComposer()`
%End

virtual void showLayoutManager() = 0;
Expand All @@ -643,8 +623,6 @@ brings an already open designer window to the foreground if one
is already created for the layout.

.. versionadded:: 3.0

.. seealso:: :py:func:`closeComposer()`
%End

virtual void showOptionsDialog( QWidget *parent = 0, const QString &currentPage = QString() ) = 0;
Expand Down Expand Up @@ -960,38 +938,6 @@ Signal emitted when the current ``theme`` is changed so plugins
can change their tool button icons.

.. versionadded:: 3.0
%End

void composerOpened( QgsComposerInterface *composer );
%Docstring
This signal is emitted when a new composer window has been opened.

.. versionadded:: 3.0

.. seealso:: :py:func:`composerWillBeClosed()`
%End

void composerWillBeClosed( QgsComposerInterface *composer );
%Docstring
This signal is emitted before a composer window is going to be closed
and deleted.

.. versionadded:: 3.0

.. seealso:: :py:func:`composerClosed()`

.. seealso:: :py:func:`composerOpened()`
%End

void composerClosed( QgsComposerInterface *composer );
%Docstring
This signal is emitted after a composer window is closed.

.. versionadded:: 3.0

.. seealso:: :py:func:`composerWillBeClosed()`

.. seealso:: :py:func:`composerOpened()`
%End

void layoutDesignerOpened( QgsLayoutDesignerInterface *designer );
Expand Down
42 changes: 0 additions & 42 deletions src/app/composer/qgscomposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ QgsComposer::QgsComposer( QgsComposition *composition )
connect( mActionAddAttributeTable, &QAction::triggered, this, &QgsComposer::mActionAddAttributeTable_triggered );
connect( mActionAddHtml, &QAction::triggered, this, &QgsComposer::mActionAddHtml_triggered );
connect( mActionSaveProject, &QAction::triggered, this, &QgsComposer::mActionSaveProject_triggered );
connect( mActionNewComposer, &QAction::triggered, this, &QgsComposer::mActionNewComposer_triggered );
connect( mActionDuplicateComposer, &QAction::triggered, this, &QgsComposer::mActionDuplicateComposer_triggered );
connect( mActionComposerManager, &QAction::triggered, this, &QgsComposer::mActionComposerManager_triggered );
connect( mActionSaveAsTemplate, &QAction::triggered, this, &QgsComposer::mActionSaveAsTemplate_triggered );
connect( mActionLoadFromTemplate, &QAction::triggered, this, &QgsComposer::mActionLoadFromTemplate_triggered );
Expand Down Expand Up @@ -302,8 +300,6 @@ QgsComposer::QgsComposer( QgsComposition *composition )
QMenu *composerMenu = menuBar()->addMenu( tr( "&Composer" ) );
composerMenu->addAction( mActionSaveProject );
composerMenu->addSeparator();
composerMenu->addAction( mActionNewComposer );
composerMenu->addAction( mActionDuplicateComposer );
composerMenu->addAction( mActionComposerManager );

mPrintComposersMenu = new QMenu( tr( "Print &Composers" ), this );
Expand Down Expand Up @@ -760,8 +756,6 @@ void QgsComposer::setupTheme()
//missing from active theme
mActionQuit->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionFileExit.png" ) ) );
mActionSaveProject->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionFileSave.svg" ) ) );
mActionNewComposer->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionNewComposer.svg" ) ) );
mActionDuplicateComposer->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDuplicateComposer.svg" ) ) );
mActionComposerManager->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionComposerManager.svg" ) ) );
mActionLoadFromTemplate->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionFileOpen.svg" ) ) );
mActionSaveAsTemplate->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionFileSaveAs.svg" ) ) );
Expand Down Expand Up @@ -3016,42 +3010,6 @@ void QgsComposer::mActionSaveProject_triggered()
mQgis->actionSaveProject()->trigger();
}

void QgsComposer::mActionNewComposer_triggered()
{
QString title;
if ( !mQgis->uniqueComposerTitle( this, title, true ) )
{
return;
}
mQgis->createNewComposer( title );
}

void QgsComposer::mActionDuplicateComposer_triggered()
{
QString newTitle;
if ( !mQgis->uniqueComposerTitle( this, newTitle, false, mComposition->name() + tr( " copy" ) ) )
{
return;
}

// provide feedback, since loading of template into duplicate composer will be hidden
QDialog *dlg = new QgsBusyIndicatorDialog( tr( "Duplicating composer..." ) );
dlg->setStyleSheet( mQgis->styleSheet() );
dlg->show();

QgsComposer *newComposer = mQgis->duplicateComposer( this, newTitle );

dlg->close();
delete dlg;
dlg = nullptr;

if ( !newComposer )
{
QMessageBox::warning( this, tr( "Duplicate Composer" ),
tr( "Composer duplication failed." ) );
}
}

void QgsComposer::mActionComposerManager_triggered()
{
// NOTE: Avoid crash where composer that spawned modal manager from toolbar ends up
Expand Down
6 changes: 0 additions & 6 deletions src/app/composer/qgscomposer.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,6 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
//! Save parent project
void mActionSaveProject_triggered();

//! Create new composer
void mActionNewComposer_triggered();

//! Duplicate current composer
void mActionDuplicateComposer_triggered();

//! Show composer manager

void mActionComposerManager_triggered();
Expand Down
Loading

0 comments on commit f287d40

Please sign in to comment.