Example #1
0
//! Set icons to the current theme
void QgsCompassPlugin::setCurrentTheme( QString )
{
  if ( mActionRunCompass && mActionAboutCompass )
  {
    mActionRunCompass->setIcon( getThemeIcon( "/mCompassRun.png" ) );
    mActionAboutCompass->setIcon( getThemeIcon( "/mActionAbout.png" ) );
  }
}
Example #2
0
void QgsCompassPlugin::about()
{
  QString title = QString( "About Internal Compass" );
  // sort by date of contribution
  QString text = QString( "<center><b>Internal Compass</b></center>"
                          "<center>%1</center>"
                          "<p>Shows reading of an internal compass using QtSensors<br/>"
                          "<b>Developer:</b>"
                          "<ol type=disc>"
                          "<li>Marco Bernasocchi"
                          "</ol>"
                          "<p><b>Homepage:</b><br>"
                          "<a href=\"http://opengis.ch\">http://opengis.ch</a></p>"
                          "<p><b>Compass calibration:</b><br/>"
                          "To calibrate the compass slowly rotate the device three times around each axis or "
                          "rotate it like a on a Mobius strip.<br/>"
                          "This <a href='http://www.youtube.com/watch?v=oNJJPeoG8lQ'>Video</a> demonstrates the process "
                          "(this can be done from within QGIS as well).</p>"
                        ).arg( sPluginVersion );

  // create dynamicaly because on Mac this dialog is modeless
  QWidget *w = new QWidget;
  w->setAttribute( Qt::WA_DeleteOnClose );
  w->setWindowIcon( getThemeIcon( "/compass.png" ) );
  QMessageBox::about( w, title, text );
}
Example #3
0
File: on.cpp Project: luisivan/on
QStringList On::placesBookmarks() {

    QFile file(QDir::homePath()+"/.gtk-bookmarks");
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream in(&file);
        QStringList bookmarks;
        QString line;
	in.setCodec("UTF-8");
        while (!in.atEnd()) {
            QString line = in.readLine();
            GFile *file = g_file_new_for_uri(line.toLocal8Bit());
            GFileInfo *fileInfo = g_file_query_info(file, "standard::*", 0, NULL, NULL);
            QString icon = g_icon_to_string(g_file_info_get_icon(fileInfo));
            if (icon != NULL) {
                if (icon.contains(" "))
                    icon = icon.split(" ")[2];
                bookmarks.append(line);
                bookmarks.append(QUrl::fromPercentEncoding(QFileInfo(line).fileName().toLocal8Bit()));
                bookmarks.append(getThemeIcon(icon));
            }
        }
        file.close();
        return bookmarks;
    }
    return QStringList();
}
// Set icons to the current theme
void QgsGrassPlugin::setCurrentTheme( QString theThemeName )
{
  mOpenMapsetAction->setIcon( getThemeIcon( "grass_open_mapset.png" ) );
  mNewMapsetAction->setIcon( getThemeIcon( "grass_new_mapset.png" ) );
  mCloseMapsetAction->setIcon( getThemeIcon( "grass_close_mapset.png" ) );

  mAddVectorAction->setIcon( getThemeIcon( "grass_add_vector.png" ) );
  mAddRasterAction->setIcon( getThemeIcon( "grass_add_raster.png" ) );
  mOpenToolsAction->setIcon( getThemeIcon( "grass_tools.png" ) );

  mRegionAction->setIcon( getThemeIcon( "grass_region.png" ) );

  mEditRegionAction->setIcon( getThemeIcon( "grass_region_edit.png" ) );
  mEditAction->setIcon( getThemeIcon( "grass_edit.png" ) );
  mNewVectorAction->setIcon( getThemeIcon( "grass_new_vector_layer.png" ) );
}
void QgsGeorefPlugin::about( )
{
  QString title = QString( "About Georeferencer" );
  // sort by date of contribution
  QString text = QString( "<center><b>Georeferencer GDAL</b></center>"
                          "<center>%1</center>"
                          "<p>Adding projection info to rasters using GDAL<br>"
                          "<b>Developers:</b>"
                          "<ol type=disc>"
                          "<li>Jack R"
                          "<li>Maxim Dubinin"
                          "<li>Manuel Massing"
                          "<li>Lars Luthman"
                          "</ol>"
                          "<p><b>Homepage:</b><br>"
                          "<a href=\"http://gis-lab.info/qa/qgis-georef-new-eng.html\">http://gis-lab.info/qa/qgis-georef-new-eng.html</a>" ).arg( sPluginVersion );

  // this is required for adding georef icon in to left side of dialog
  // create dynamicaly because on Mac this dialog is modeless
  QWidget *w = new QWidget;
  w->setAttribute( Qt::WA_DeleteOnClose );
  w->setWindowIcon( getThemeIcon( "/mGeorefRun.png" ) );
  QMessageBox::about( w, title, text );
}
Example #6
0
//! Set icons to the current theme
void QgsGeorefPlugin::setCurrentTheme( QString )
{
  if ( mActionRunGeoref )
    mActionRunGeoref->setIcon( getThemeIcon( "/mGeorefRun.png" ) );
}
//! Set icons to the current theme
void QgsGeorefPlugin::setCurrentTheme( QString )
{
  mActionRunGeoref->setIcon( getThemeIcon( "/mGeorefRun.png" ) );
  mActionAbout->setIcon( getThemeIcon( "/mActionAbout.png" ) );
}
Example #8
0
/*
 * Initialize the GUI interface for the plugin
 */
void QgsGrassPlugin::initGui()
{
  mToolBarPointer = 0;
  mTools = 0;
  mNewMapset = 0;

  mCanvas = qGisInterface->mapCanvas();

  // Create region rubber band
  mRegionBand = new QgsRubberBand( mCanvas, QGis::Polygon );
  mRegionBand->setZValue( 20 );

  // Create the action for tool (the icons are set later by calling setCurrentTheme)
  mOpenMapsetAction = new QAction( QIcon(), tr( "Open Mapset" ), this );
  mOpenMapsetAction->setObjectName( "mOpenMapsetAction" );
  mNewMapsetAction = new QAction( QIcon(), tr( "New Mapset" ), this );
  mNewMapsetAction->setObjectName( "mNewMapsetAction" );
  mCloseMapsetAction = new QAction( QIcon(), tr( "Close Mapset" ), this );
  mCloseMapsetAction->setObjectName( "mCloseMapsetAction" );

  mOpenToolsAction = new QAction( QIcon(), tr( "Open GRASS Tools" ), this );
  mOpenToolsAction->setObjectName( "mAddPolygonActionmOpenToolsAction" );
  mOpenToolsAction->setWhatsThis( tr( "Open GRASS tools" ) );

  mRegionAction = new QAction( QIcon(), tr( "Display Current Grass Region" ), this );
  mRegionAction->setObjectName( "mRegionAction" );
  mRegionAction->setWhatsThis( tr( "Displays the current GRASS region as a rectangle on the map canvas" ) );
  mRegionAction->setCheckable( true );

  mOptionsAction = new QAction( QIcon(), tr( "GRASS Options" ), this );
  mOptionsAction->setObjectName( "mOptionsAction" );

  // Connect the actions
  connect( mOpenMapsetAction, SIGNAL( triggered() ), this, SLOT( openMapset() ) );
  connect( mNewMapsetAction, SIGNAL( triggered() ), this, SLOT( newMapset() ) );
  connect( mCloseMapsetAction, SIGNAL( triggered() ), SLOT( closeMapset() ) );
  connect( mOpenToolsAction, SIGNAL( triggered() ), this, SLOT( openTools() ) );
  connect( mRegionAction, SIGNAL( toggled( bool ) ), this, SLOT( switchRegion( bool ) ) );
  connect( mOptionsAction, SIGNAL( triggered() ), QgsGrass::instance(), SLOT( openOptions() ) );

  // Add actions to a GRASS plugin menu
  QString menu = tr( "&GRASS" );
  qGisInterface->addPluginToMenu( menu, mOpenMapsetAction );
  qGisInterface->addPluginToMenu( menu, mNewMapsetAction );
  qGisInterface->addPluginToMenu( menu, mCloseMapsetAction );
  qGisInterface->addPluginToMenu( menu, mOpenToolsAction );
  qGisInterface->addPluginToMenu( menu, mRegionAction );
  qGisInterface->addPluginToMenu( menu, mOptionsAction );

  // Add the toolbar to the main window
  mToolBarPointer = qGisInterface->addToolBar( tr( "GRASS" ) );
  mToolBarPointer->setObjectName( "GRASS" );

  // Add to the toolbar
#if 0
  mToolBarPointer->addAction( mOpenMapsetAction );
  mToolBarPointer->addAction( mNewMapsetAction );
  mToolBarPointer->addAction( mCloseMapsetAction );
  mToolBarPointer->addSeparator();
#endif
  mToolBarPointer->addAction( mOpenToolsAction );
  mToolBarPointer->addAction( mRegionAction );

  // Editing
  mAddPointAction = new QAction( QgsApplication::getThemeIcon( "/mActionCapturePoint.png" ), tr( "Add Point" ), this );
  mAddPointAction->setObjectName( "mAddPointAction" );
  mAddPointAction->setCheckable( true );

  mAddLineAction = new QAction( QgsApplication::getThemeIcon( "/mActionCaptureLine.png" ), tr( "Add Line" ), this );
  mAddLineAction->setObjectName( "mAddLineAction" );
  mAddLineAction->setCheckable( true );

  mAddBoundaryAction = new QAction( getThemeIcon( "mActionCaptureBoundary.png" ), tr( "Add Boundary" ), this );
  mAddBoundaryAction->setObjectName( "mAddBoundaryAction" );
  mAddBoundaryAction->setCheckable( true );

  mAddCentroidAction = new QAction( getThemeIcon( "mActionCaptureCentroid.png" ), tr( "Add Centroid" ), this );
  mAddCentroidAction->setObjectName( "mAddCentroidAction" );
  mAddCentroidAction->setCheckable( true );

  mAddAreaAction = new QAction( QgsApplication::getThemeIcon( "/mActionCapturePolygon.png" ), tr( "Add Area" ), this );
  mAddAreaAction->setObjectName( "mAddAreaAction" );
  mAddAreaAction->setCheckable( true );

  connect( mAddPointAction, SIGNAL( triggered() ), SLOT( addFeature() ) );
  connect( mAddLineAction, SIGNAL( triggered() ), SLOT( addFeature() ) );
  connect( mAddBoundaryAction, SIGNAL( triggered() ), SLOT( addFeature() ) );
  connect( mAddCentroidAction, SIGNAL( triggered() ), SLOT( addFeature() ) );
  connect( mAddAreaAction, SIGNAL( triggered() ), SLOT( addFeature() ) );

  mAddFeatureAction = qGisInterface->actionAddFeature();

  mAddFeatureAction->actionGroup()->addAction( mAddPointAction );
  mAddFeatureAction->actionGroup()->addAction( mAddLineAction );
  mAddFeatureAction->actionGroup()->addAction( mAddBoundaryAction );
  mAddFeatureAction->actionGroup()->addAction( mAddCentroidAction );
  mAddFeatureAction->actionGroup()->addAction( mAddAreaAction );

  qGisInterface->digitizeToolBar()->insertAction( mAddFeatureAction, mAddPointAction );
  qGisInterface->digitizeToolBar()->insertAction( mAddFeatureAction, mAddLineAction );
  qGisInterface->digitizeToolBar()->insertAction( mAddFeatureAction, mAddBoundaryAction );
  qGisInterface->digitizeToolBar()->insertAction( mAddFeatureAction, mAddCentroidAction );
  qGisInterface->digitizeToolBar()->insertAction( mAddFeatureAction, mAddAreaAction );

  resetEditActions();

  mAddPoint = new QgsGrassAddFeature( qGisInterface->mapCanvas(), QgsMapToolAdvancedDigitizing::CapturePoint );
  mAddPoint->setAction( mAddPointAction );
  mAddLine = new QgsGrassAddFeature( qGisInterface->mapCanvas(), QgsMapToolAdvancedDigitizing::CaptureLine );
  mAddLine->setAction( mAddLineAction );
  mAddBoundary = new QgsGrassAddFeature( qGisInterface->mapCanvas(), QgsMapToolAdvancedDigitizing::CaptureLine );
  mAddBoundary->setAction( mAddBoundaryAction );
  mAddCentroid = new QgsGrassAddFeature( qGisInterface->mapCanvas(), QgsMapToolAdvancedDigitizing::CapturePoint );
  mAddCentroid->setAction( mAddCentroidAction );
  mAddArea = new QgsGrassAddFeature( qGisInterface->mapCanvas(), QgsMapToolAdvancedDigitizing::CapturePolygon );
  mAddArea->setAction( mAddAreaAction );

  // Connect project
  QWidget* qgis = qGisInterface->mainWindow();
  connect( qgis, SIGNAL( projectRead() ), this, SLOT( projectRead() ) );
  connect( qgis, SIGNAL( newProject() ), this, SLOT( newProject() ) );

  // Set icons to current theme
  setCurrentTheme( "" );
  // Connect theme change signal
  connect( qGisInterface, SIGNAL( currentThemeChanged( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );

  connect( mCanvas, SIGNAL( destinationCrsChanged() ), this, SLOT( setTransform() ) );

  // Connect display region
  connect( mCanvas, SIGNAL( renderComplete( QPainter * ) ), this, SLOT( postRender( QPainter * ) ) );

  connect( QgsGrass::instance(), SIGNAL( gisbaseChanged() ), SLOT( onGisbaseChanged() ) );
  connect( QgsGrass::instance(), SIGNAL( mapsetChanged() ), SLOT( mapsetChanged() ) );
  connect( QgsGrass::instance(), SIGNAL( regionChanged() ), SLOT( displayRegion() ) );
  connect( QgsGrass::instance(), SIGNAL( regionPenChanged() ), SLOT( displayRegion() ) );
  connect( QgsGrass::instance(), SIGNAL( newLayer( QString, QString ) ), SLOT( onNewLayer( QString, QString ) ) );

  // Connect start/stop editing
  connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ), this, SLOT( onLayerWasAdded( QgsMapLayer* ) ) );

  connect( qGisInterface->layerTreeView(), SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
           SLOT( onCurrentLayerChanged( QgsMapLayer* ) ) );

  // open tools when plugin is loaded so that main app restores tools dock widget state
  mTools = new QgsGrassTools( qGisInterface, qGisInterface->mainWindow() );
  qGisInterface->addDockWidget( Qt::RightDockWidgetArea, mTools );

  onGisbaseChanged();
  mapsetChanged();
}
//! Set icons to the current theme
void QgsSpatialQueryPlugin::setCurrentTheme( QString )
{
    mSpatialQueryAction->setIcon( getThemeIcon( "/spatialquery.png" ) );
}
Example #10
0
//! Set icons to the current theme
void QgsGeorefPlugin::setCurrentTheme( const QString& )
{
  if ( mActionRunGeoref )
    mActionRunGeoref->setIcon( getThemeIcon( QStringLiteral( "/mGeorefRun.png" ) ) );
}
Example #11
0
//! Set icons to the current theme
void QgsSpatialQueryPlugin::setCurrentTheme( const QString& )
{
  if ( mSpatialQueryAction )
    mSpatialQueryAction->setIcon( getThemeIcon( "/spatialquery.png" ) );
}