Skip to content
Permalink
Browse files

Fix merge conflict

  • Loading branch information
mhugent committed Aug 8, 2012
2 parents 954bec4 + 12f521e commit e6d988057fbea22ab3b7ac1a15893700c9799b5b
Showing with 1,526 additions and 43 deletions.
  1. +1 −0 images/images.qrc
  2. BIN images/themes/default/mActionAddHtml.png
  3. +2 −0 src/app/CMakeLists.txt
  4. +32 −13 src/app/composer/qgscomposer.cpp
  5. +6 −1 src/app/composer/qgscomposer.h
  6. +113 −0 src/app/composer/qgscomposerhtmlwidget.cpp
  7. +32 −0 src/app/composer/qgscomposerhtmlwidget.h
  8. +8 −0 src/core/CMakeLists.txt
  9. +86 −0 src/core/composer/qgsaddremovemultiframecommand.cpp
  10. +54 −0 src/core/composer/qgsaddremovemultiframecommand.h
  11. +92 −0 src/core/composer/qgscomposerframe.cpp
  12. +53 −0 src/core/composer/qgscomposerframe.h
  13. +137 −0 src/core/composer/qgscomposerhtml.cpp
  14. +56 −0 src/core/composer/qgscomposerhtml.h
  15. +5 −2 src/core/composer/qgscomposeritem.cpp
  16. +8 −1 src/core/composer/qgscomposeritem.h
  17. +190 −0 src/core/composer/qgscomposermultiframe.cpp
  18. +91 −0 src/core/composer/qgscomposermultiframe.h
  19. +90 −0 src/core/composer/qgscomposermultiframecommand.cpp
  20. +55 −0 src/core/composer/qgscomposermultiframecommand.h
  21. +158 −18 src/core/composer/qgscomposition.cpp
  22. +23 −3 src/core/composer/qgscomposition.h
  23. +23 −0 src/gui/qgscomposerview.cpp
  24. +1 −0 src/gui/qgscomposerview.h
  25. +12 −0 src/ui/qgscomposerbase.ui
  26. +70 −0 src/ui/qgscomposerhtmlwidgetbase.ui
  27. +1 −0 tests/src/core/CMakeLists.txt
  28. +6 −5 tests/src/core/qgscompositionchecker.cpp
  29. +111 −0 tests/src/core/testqgscomposerhtml.cpp
  30. BIN tests/testdata/control_images/expected_composerhtml/composerhtml_table.png
  31. BIN tests/testdata/control_images/expected_composerhtml/composerhtml_table_multiframe1.png
  32. BIN tests/testdata/control_images/expected_composerhtml/composerhtml_table_multiframe2.png
  33. BIN tests/testdata/control_images/expected_composerhtml/composerhtml_table_multiframe3.png
  34. +10 −0 tests/testdata/html_table.html
@@ -247,6 +247,7 @@
<file>themes/default/tracking.png</file>
<file>themes/default/transformed.png</file>
<file>themes/default/user.png</file>
<file>themes/default/mActionAddHtml.png</file>
<file>themes/gis/mActionAddArrow.png</file>
<file>themes/gis/mActionAddBasicShape.png</file>
<file>themes/gis/mActionAddGPSLayer.png</file>
Binary file not shown.
@@ -109,6 +109,7 @@ SET(QGIS_APP_SRCS
composer/qgsattributeselectiondialog.cpp
composer/qgscomposer.cpp
composer/qgscomposerarrowwidget.cpp
composer/qgscomposerhtmlwidget.cpp
composer/qgscomposeritemwidget.cpp
composer/qgscomposerlabelwidget.cpp
composer/qgscomposerpicturewidget.cpp
@@ -249,6 +250,7 @@ SET (QGIS_APP_MOC_HDRS
composer/qgsattributeselectiondialog.h
composer/qgscomposer.h
composer/qgscomposerarrowwidget.h
composer/qgscomposerhtmlwidget.h
composer/qgscomposeritemwidget.h
composer/qgscomposerlabelwidget.h
composer/qgscomposerlegendwidget.h
@@ -23,6 +23,9 @@
#include "qgscompositionwidget.h"
#include "qgscomposerarrow.h"
#include "qgscomposerarrowwidget.h"
#include "qgscomposerframe.h"
#include "qgscomposerhtml.h"
#include "qgscomposerhtmlwidget.h"
#include "qgscomposerlabel.h"
#include "qgscomposerlabelwidget.h"
#include "qgscomposerlegend.h"
@@ -136,6 +139,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
toggleActionGroup->addAction( mActionAddEllipse );
toggleActionGroup->addAction( mActionAddArrow );
toggleActionGroup->addAction( mActionAddTable );
toggleActionGroup->addAction( mActionAddHtml );
toggleActionGroup->setExclusive( true );


@@ -295,7 +299,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )

QgsComposer::~QgsComposer()
{
deleteItems();
deleteItemWidgets();
}

void QgsComposer::setupTheme()
@@ -325,6 +329,7 @@ void QgsComposer::setupTheme()
mActionAddEllipse->setIcon( QgsApplication::getThemeIcon( "/mActionAddBasicShape.png" ) );
mActionAddArrow->setIcon( QgsApplication::getThemeIcon( "/mActionAddArrow.png" ) );
mActionAddTable->setIcon( QgsApplication::getThemeIcon( "/mActionOpenTable.png" ) );
mActionAddHtml->setIcon( QgsApplication::getThemeIcon( "/mActionAddHtml.png" ) );
mActionSelectMoveItem->setIcon( QgsApplication::getThemeIcon( "/mActionSelectPan.png" ) );
mActionMoveItemContent->setIcon( QgsApplication::getThemeIcon( "/mActionMoveItemContent.png" ) );
mActionGroupItems->setIcon( QgsApplication::getThemeIcon( "/mActionGroupItems.png" ) );
@@ -367,6 +372,7 @@ void QgsComposer::connectSlots()

connect( mComposition, SIGNAL( selectedItemChanged( QgsComposerItem* ) ), this, SLOT( showItemOptions( QgsComposerItem* ) ) );
connect( mComposition, SIGNAL( composerArrowAdded( QgsComposerArrow* ) ), this, SLOT( addComposerArrow( QgsComposerArrow* ) ) );
connect( mComposition, SIGNAL( composerHtmlFrameAdded( QgsComposerHtml*, QgsComposerFrame* ) ), this, SLOT( addComposerHtmlFrame( QgsComposerHtml*, QgsComposerFrame* ) ) );
connect( mComposition, SIGNAL( composerLabelAdded( QgsComposerLabel* ) ), this, SLOT( addComposerLabel( QgsComposerLabel* ) ) );
connect( mComposition, SIGNAL( composerMapAdded( QgsComposerMap* ) ), this, SLOT( addComposerMap( QgsComposerMap* ) ) );
connect( mComposition, SIGNAL( composerScaleBarAdded( QgsComposerScaleBar* ) ), this, SLOT( addComposerScaleBar( QgsComposerScaleBar* ) ) );
@@ -821,6 +827,14 @@ void QgsComposer::on_mActionAddTable_triggered()
}
}

void QgsComposer::on_mActionAddHtml_triggered()
{
if ( mView )
{
mView->setCurrentTool( QgsComposerView::AddHtml );
}
}

void QgsComposer::on_mActionAddArrow_triggered()
{
if ( mView )
@@ -896,7 +910,11 @@ void QgsComposer::on_mActionLoadFromTemplate_triggered()
return;
}

deleteItems();
deleteItemWidgets();
if ( mComposition )
{
mComposition->clear();
}
readXML( templateDocument );
emit composerAdded( mView );
}
@@ -1119,15 +1137,6 @@ void QgsComposer::writeXML( QDomNode& parentNode, QDomDocument& doc )
}
parentNode.appendChild( composerElem );

//store composer items:
QMap<QgsComposerItem*, QWidget*>::const_iterator itemIt = mItemWidgetMap.constBegin();
for ( ; itemIt != mItemWidgetMap.constEnd(); ++itemIt )
{
itemIt.key()->writeXML( composerElem, doc );
}

//store composer view

//store composition
if ( mComposition )
{
@@ -1220,13 +1229,12 @@ void QgsComposer::readXML( const QDomElement& composerElem, const QDomDocument&
setSelectionTool();
}

void QgsComposer::deleteItems()
void QgsComposer::deleteItemWidgets()
{
//delete all the items
QMap<QgsComposerItem*, QWidget*>::iterator it = mItemWidgetMap.begin();
for ( ; it != mItemWidgetMap.end(); ++it )
{
delete it.key();
delete it.value();
}
mItemWidgetMap.clear();
@@ -1328,6 +1336,17 @@ void QgsComposer::addComposerTable( QgsComposerAttributeTable* table )
mItemWidgetMap.insert( table, tWidget );
}

void QgsComposer::addComposerHtmlFrame( QgsComposerHtml* html, QgsComposerFrame* frame )
{
if ( !html )
{
return;
}

QgsComposerHtmlWidget* hWidget = new QgsComposerHtmlWidget( html, frame );
mItemWidgetMap.insert( frame, hWidget );
}

void QgsComposer::deleteItem( QgsComposerItem* item )
{
QMap<QgsComposerItem*, QWidget*>::iterator it = mItemWidgetMap.find( item );
@@ -167,6 +167,8 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
//! Add attribute table
void on_mActionAddTable_triggered();

void on_mActionAddHtml_triggered();

//! Save composer as template
void on_mActionSaveAsTemplate_triggered();

@@ -244,6 +246,9 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
/**Adds a composer table to the item/widget map and creates a configuration widget*/
void addComposerTable( QgsComposerAttributeTable* table );

/**Adds composer html and creates a configuration widget*/
void addComposerHtmlFrame( QgsComposerHtml* html, QgsComposerFrame* frame );

/**Removes item from the item/widget map and deletes the configuration widget. Does not delete the item itself*/
void deleteItem( QgsComposerItem* item );

@@ -284,7 +289,7 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
void writeXML( QDomNode& parentNode, QDomDocument& doc );

//! Removes all the item from the graphics scene and deletes them
void deleteItems();
void deleteItemWidgets();

//! Restores composer map preview states.
//! Initially after reading from xml, states are set to rectangle to achieve faster project loading.
@@ -0,0 +1,113 @@
#include "qgscomposerhtmlwidget.h"
#include "qgscomposerframe.h"
#include "qgscomposeritemwidget.h"
#include "qgscomposermultiframecommand.h"
#include "qgscomposerhtml.h"
#include <QFileDialog>
#include <QSettings>

QgsComposerHtmlWidget::QgsComposerHtmlWidget( QgsComposerHtml* html, QgsComposerFrame* frame ): mHtml( html ), mFrame( frame )
{
setupUi( this );

blockSignals( true );
mResizeModeComboBox->addItem( tr( "Use existing frames" ), QgsComposerMultiFrame::UseExistingFrames );
mResizeModeComboBox->addItem( tr( "Extend to next page" ), QgsComposerMultiFrame::ExtendToNextPage );
blockSignals( false );
setGuiElementValues();

if ( mHtml )
{
QObject::connect( mHtml, SIGNAL( changed() ), this, SLOT( setGuiElementValues() ) );
}

//embed widget for general options
if ( mFrame )
{
//add widget for general composer item properties
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, mFrame );
mToolBox->addItem( itemPropertiesWidget, tr( "General options" ) );
}
}

QgsComposerHtmlWidget::QgsComposerHtmlWidget()
{
}

QgsComposerHtmlWidget::~QgsComposerHtmlWidget()
{
}

void QgsComposerHtmlWidget::blockSignals( bool block )
{
mUrlLineEdit->blockSignals( block );
mFileToolButton->blockSignals( block );
mResizeModeComboBox->blockSignals( block );
}

void QgsComposerHtmlWidget::on_mUrlLineEdit_editingFinished()
{
if ( mHtml )
{
QUrl newUrl( mUrlLineEdit->text() );
if ( newUrl == mHtml->url() )
{
return;
}

QgsComposition* composition = mHtml->composition();
if ( composition )
{
composition->beginMultiFrameCommand( mHtml, tr( "Change html url" ) );
mHtml->setUrl( newUrl );
mHtml->update();
composition->endMultiFrameCommand();
}
}
}

void QgsComposerHtmlWidget::on_mFileToolButton_clicked()
{
QSettings s;
QString lastDir = s.value( "/UI/lastHtmlDir", "" ).toString();
QString file = QFileDialog::getOpenFileName( this, tr( "Select HTML document" ), lastDir, "HTML (*.html)" );
if ( !file.isEmpty() )
{
QUrl url = QUrl::fromLocalFile( file );
mUrlLineEdit->setText( url.toString() );
on_mUrlLineEdit_editingFinished();
mHtml->update();
s.setValue( "/UI/lastHtmlDir", QFileInfo( file ).absolutePath() );
}
}

void QgsComposerHtmlWidget::on_mResizeModeComboBox_currentIndexChanged( int index )
{
if ( !mHtml )
{
return;
}

QgsComposition* composition = mHtml->composition();
if ( composition )
{
composition->beginMultiFrameCommand( mHtml, tr( "Change resize mode" ) );
mHtml->setResizeMode(( QgsComposerMultiFrame::ResizeMode )mResizeModeComboBox->itemData( index ).toInt() );
composition->endMultiFrameCommand();
}
}

void QgsComposerHtmlWidget::setGuiElementValues()
{
if ( !mHtml )
{
return;
}

blockSignals( true );
mUrlLineEdit->setText( mHtml->url().toString() );
mResizeModeComboBox->setCurrentIndex( mResizeModeComboBox->findData( mHtml->resizeMode() ) );
blockSignals( false );
}


@@ -0,0 +1,32 @@
#ifndef QGSCOMPOSERHTMLWIDGET_H
#define QGSCOMPOSERHTMLWIDGET_H

#include "ui_qgscomposerhtmlwidgetbase.h"

class QgsComposerHtml;
class QgsComposerFrame;

class QgsComposerHtmlWidget: public QWidget, private Ui::QgsComposerHtmlWidgetBase
{
Q_OBJECT
public:
QgsComposerHtmlWidget( QgsComposerHtml* html, QgsComposerFrame* frame );
~QgsComposerHtmlWidget();

private slots:
void on_mUrlLineEdit_editingFinished();
void on_mFileToolButton_clicked();
void on_mResizeModeComboBox_currentIndexChanged( int index );

/**Sets the GUI elements to the values of mHtmlItem*/
void setGuiElementValues();

private:
QgsComposerHtmlWidget();
void blockSignals( bool block );

QgsComposerHtml* mHtml;
QgsComposerFrame* mFrame;
};

#endif // QGSCOMPOSERHTMLWIDGET_H
@@ -112,7 +112,10 @@ SET(QGIS_CORE_SRCS
qgsnetworkaccessmanager.cpp

composer/qgsaddremoveitemcommand.cpp
composer/qgsaddremovemultiframecommand.cpp
composer/qgscomposermultiframecommand.cpp
composer/qgscomposerarrow.cpp
composer/qgscomposerframe.cpp
composer/qgscomposeritem.cpp
composer/qgscomposeritemcommand.cpp
composer/qgscomposeritemgroup.cpp
@@ -133,6 +136,8 @@ SET(QGIS_CORE_SRCS
composer/qgsnumericscalebarstyle.cpp
composer/qgssingleboxscalebarstyle.cpp
composer/qgsticksscalebarstyle.cpp
composer/qgscomposerhtml.cpp
composer/qgscomposermultiframe.cpp
composer/qgscomposition.cpp

pal/costcalculator.cpp
@@ -286,6 +291,8 @@ SET(QGIS_CORE_MOC_HDRS
composer/qgscomposerlabel.h
composer/qgscomposershape.h
composer/qgscomposerattributetable.h
composer/qgscomposerhtml.h
composer/qgscomposermultiframe.h
composer/qgscomposition.h

composer/qgslegendmodel.h
@@ -526,6 +533,7 @@ TARGET_LINK_LIBRARIES(qgis_core
${QT_QTGUI_LIBRARY}
${QT_QTNETWORK_LIBRARY}
${QT_QTSVG_LIBRARY}
${QT_QTWEBKIT_LIBRARY}

${PROJ_LIBRARY}
${GEOS_LIBRARY}

0 comments on commit e6d9880

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