Skip to content

Commit

Permalink
Changes to QgsMessageBar icons and Enable macros action
Browse files Browse the repository at this point in the history
  • Loading branch information
dakcarto authored and brushtyler committed Aug 31, 2012
1 parent 54275e0 commit 8be777b
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 18 deletions.
3 changes: 3 additions & 0 deletions images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
<file>themes/default/mActionZoomOut.png</file>
<file>themes/default/mActionZoomToLayer.png</file>
<file>themes/default/mActionZoomToSelected.png</file>
<file>themes/default/mIconClose.png</file>
<file>themes/default/mIconConnect.png</file>
<file>themes/default/mIconDbSchema.png</file>
<file>themes/default/mIconDelete.png</file>
Expand Down Expand Up @@ -369,6 +370,7 @@
<file>themes/gis/mActionZoomOut.png</file>
<file>themes/gis/mActionZoomToLayer.png</file>
<file>themes/gis/mActionZoomToSelected.png</file>
<file>themes/gis/mIconClose.png</file>
<file>themes/gis/mIconEditable.png</file>
<file>themes/gis/mIconLineLayer.png</file>
<file>themes/gis/mIconPointLayer.png</file>
Expand Down Expand Up @@ -400,6 +402,7 @@
<file>themes/gis/mIconWcs.png</file>
<file>themes/gis/mIconWms.png</file>
<file>themes/gis/mIconWfs.png</file>
<file>themes/gis/mIconWarn.png</file>
<file>themes/gis/mIconSpatialite.png</file>
<file>themes/gis/mIconRaster.png</file>
<file>themes/gis/mIconPostgis.png</file>
Expand Down
Binary file added images/themes/default/mIconClose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/themes/default/mIconWarn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes/gis/mIconClose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes/gis/mIconWarn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 18 additions & 16 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,22 +477,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
//set the focus to the map canvas
mMapCanvas->setFocus();

// a bar to warn the user with non-blocking messages
mInfoBar = new QgsMessageBar( centralWidget );
mInfoBar->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
centralLayout->addWidget( mInfoBar, 0, 0, 1, 1 );

mMacrosWarn = QgsMessageBar::createMessage( tr( "Security warning:" ),
tr( "macros have been disabled." ),
QgsApplication::getThemeIcon( "/mIconWarn.png" ),
mInfoBar );

QToolButton *btnEnableMacros = new QToolButton( mMacrosWarn );
btnEnableMacros->setText( tr( "Enable" ) );
connect( btnEnableMacros, SIGNAL( clicked() ), mInfoBar, SLOT( popWidget() ) );
connect( btnEnableMacros, SIGNAL( clicked() ), this, SLOT( enableProjectMacros() ) );
mMacrosWarn->layout()->addWidget( btnEnableMacros );

// "theMapLegend" used to find this canonical instance later
mMapLegend = new QgsLegend( mMapCanvas, this, "theMapLegend" );

Expand All @@ -518,6 +502,24 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
updateProjectFromTemplates();
activateDeactivateLayerRelatedActions( NULL );

// a bar to warn the user with non-blocking messages
mInfoBar = new QgsMessageBar( centralWidget );
mInfoBar->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
centralLayout->addWidget( mInfoBar, 0, 0, 1, 1 );

mMacrosWarn = QgsMessageBar::createMessage( tr( "Security warning:" ),
tr( "macros have been disabled." ),
QgsApplication::getThemeIcon( "/mIconWarn.png" ),
mInfoBar );

QToolButton *btnEnableMacros = new QToolButton( mMacrosWarn );
btnEnableMacros->setText( tr( "Enable" ) );
btnEnableMacros->setStyleSheet( "background-color: rgba(255, 255, 255, 0);text-decoration: underline;" );
btnEnableMacros->setCursor( Qt::PointingHandCursor );
connect( btnEnableMacros, SIGNAL( clicked() ), mInfoBar, SLOT( popWidget() ) );
connect( btnEnableMacros, SIGNAL( clicked() ), this, SLOT( enableProjectMacros() ) );
mMacrosWarn->layout()->addWidget( btnEnableMacros );

addDockWidget( Qt::LeftDockWidgetArea, mUndoWidget );
mUndoWidget->hide();

Expand Down
6 changes: 4 additions & 2 deletions src/app/qgsmessagebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ QgsMessageBar::QgsMessageBar( QWidget *parent )
mLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), 0, 1, 1, 1 );

mCloseBtn = new QToolButton( this );
mCloseBtn->setText( tr( "Close" ) );
mCloseBtn->setIcon( QgsApplication::getThemeIcon( "mIconClose.png" ) );
mCloseBtn->setText( tr( "" ) );
mCloseBtn->setStyleSheet( "background-color: rgba(255, 255, 255, 0);" );
mCloseBtn->setCursor( Qt::PointingHandCursor );
mCloseBtn->setIcon( QgsApplication::getThemeIcon( "/mIconClose.png" ) );
connect( mCloseBtn, SIGNAL( clicked() ), this, SLOT( popWidget() ) );
mLayout->addWidget( mCloseBtn, 0, 2, 1, 1 );

Expand Down

0 comments on commit 8be777b

Please sign in to comment.