Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/qgis/Quantum-GIS
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Dec 12, 2012
2 parents d401a6e + f218a39 commit 260b4a1
Show file tree
Hide file tree
Showing 28 changed files with 555 additions and 150 deletions.
241 changes: 241 additions & 0 deletions images/svg/north_arrows/north-arrow_0_qgis_decoration.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion python/core/qgsdistancearea.sip
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ class QgsDistanceArea
static QString textUnit( double value, int decimals, QGis::UnitType u, bool isArea, bool keepBaseUnit = false );

//! Helper for conversion between physical units
void convertMeasurement( double &measure, QGis::UnitType &measureUnits, QGis::UnitType displayUnits, bool isArea );
void convertMeasurement( double &measure /In,Out/, QGis::UnitType &measureUnits /In,Out/, QGis::UnitType displayUnits, bool isArea );

};
2 changes: 1 addition & 1 deletion scripts/addcopyright.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ for i in $(<files); do
author=volayaf
;;

src/app/gps/qwtpolar-*|src/app/qtmain_android.cpp|src/core/spatialite/*|src/core/spatialindex/src/*|src/core/gps/qextserialport/*|src/plugins/grass/qtermwidget/*|src/astyle/*|python/pyspatialite/*|src/providers/sqlanywhere/sqlanyconnection/*)
src/app/gps/qwtpolar-*|src/app/qtmain_android.cpp|src/core/spatialite/*|src/core/spatialindex/src/*|src/core/gps/qextserialport/*|src/astyle/*|python/pyspatialite/*|src/providers/sqlanywhere/sqlanyconnection/*)
# Skip third party files
echo $f skipped
continue
Expand Down
57 changes: 33 additions & 24 deletions src/app/qgsidentifyresults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "qgsmapcanvas.h"
#include "qgsattributeaction.h"
#include "qgsfeatureaction.h"
#include "qgslogger.h"
#include "qgsnetworkaccessmanager.h"

#include <QCloseEvent>
#include <QLabel>
Expand All @@ -46,7 +48,36 @@
#include <QDesktopServices>
#include <QMessageBox>

#include "qgslogger.h"
QgsWebView::QgsWebView( QWidget *parent ) : QWebView( parent )
{
page()->setNetworkAccessManager( QgsNetworkAccessManager::instance() );
page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
settings()->setAttribute( QWebSettings::LocalContentCanAccessRemoteUrls, true );
#ifdef QGISDEBUG
settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled, true );
#endif
}

void QgsWebView::print( void )
{
QPrinter printer;
QPrintDialog *dialog = new QPrintDialog( &printer );
if ( dialog->exec() == QDialog::Accepted )
QWebView::print( &printer );
}

void QgsWebView::contextMenuEvent( QContextMenuEvent *e )
{
QMenu *menu = page()->createStandardContextMenu();
if ( menu )
{
QAction *action = new QAction( tr( "Print" ), this );
connect( action, SIGNAL( triggered() ), this, SLOT( print() ) );
menu->addAction( action );
menu->exec( e->globalPos() );
delete menu;
}
}

class QgsIdentifyResultsDock : public QDockWidget
{
Expand Down Expand Up @@ -289,15 +320,9 @@ void QgsIdentifyResults::addFeature( QgsRasterLayer *layer,
QTreeWidgetItem *attrItem = new QTreeWidgetItem( QStringList() << attributes.begin().key() << "" );
featItem->addChild( attrItem );

QWebView *wv = new QWebView( attrItem->treeWidget() );
QgsWebView *wv = new QgsWebView( attrItem->treeWidget() );
wv->setHtml( attributes.begin().value() );
wv->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );

QAction *action = new QAction( tr( "Print" ), wv );
connect( action, SIGNAL( triggered() ), this, SLOT( print() ) );
wv->insertAction( 0, action );

wv->setContextMenuPolicy( Qt::ActionsContextMenu );
mPrintToolButton->setVisible( true );

connect( wv, SIGNAL( linkClicked( const QUrl & ) ), this, SLOT( openUrl( const QUrl & ) ) );
Expand Down Expand Up @@ -1040,22 +1065,6 @@ void QgsIdentifyResults::openUrl( const QUrl &url )
}
}

void QgsIdentifyResults::print()
{
QAction *action = qobject_cast<QAction*>( sender() );
if ( !action )
return;

QWebView *wv = qobject_cast<QWebView*>( action->parent() );
if ( !wv )
return;

QPrinter printer;
QPrintDialog *dialog = new QPrintDialog( &printer );
if ( dialog->exec() == QDialog::Accepted )
wv->print( &printer );
}

void QgsIdentifyResults::printCurrentItem()
{
QTreeWidgetItem *item = lstResults->currentItem();
Expand Down
14 changes: 13 additions & 1 deletion src/app/qgsidentifyresults.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <QWidget>
#include <QList>
#include <QWebView>

class QCloseEvent;
class QTreeWidgetItem;
Expand Down Expand Up @@ -119,7 +120,6 @@ class QgsIdentifyResults: public QDialog, private Ui::QgsIdentifyResultsBase
void on_mCollapseToolButton_clicked( bool checked ) { Q_UNUSED( checked ); collapseAll(); }

void openUrl( const QUrl &url );
void print();
void printCurrentItem();

private:
Expand Down Expand Up @@ -148,4 +148,16 @@ class QgsIdentifyResults: public QDialog, private Ui::QgsIdentifyResultsBase
QDockWidget *mDock;
};

class QgsWebView : public QWebView
{
Q_OBJECT;
public:
QgsWebView( QWidget *parent = 0 );
public slots:
void print( void );
protected:
void contextMenuEvent( QContextMenuEvent* );
};


#endif
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolidentify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
convertMeasurement( calc, area, myDisplayUnits, true ); // area and myDisplayUnits are out params
QString str = calc.textUnit( area, 3, myDisplayUnits, true );
derivedAttributes.insert( tr( "Area" ), str );
convertMeasurement( calc, perimeter, myDisplayUnits, false ); // area and myDisplayUnits are out params
convertMeasurement( calc, perimeter, myDisplayUnits, false ); // perimeter and myDisplayUnits are out params
str = calc.textUnit( perimeter, 3, myDisplayUnits, false );
derivedAttributes.insert( tr( "Perimeter" ), str );
}
Expand Down
Loading

2 comments on commit 260b4a1

@slarosa
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Victor,
Something seems gone wrong in this commit ! I cannot build anymore !
Please, could you fix it ?

Thanks !

@slarosa
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant this commit 7197a31

Please sign in to comment.