Ejemplo n.º 1
0
Home::Home(QWidget *parent) :
	QWidget(parent), ui(new Ui::Home), b_optionDialogOpened(false), m_optionsDialog(NULL), b_serverWidgetOpened(false), m_serverWidget(NULL)
{
	ui->setupUi(this);
	QString url("http://www.runicorbs.net/ingame.php?syslang=" + QLocale::system().name()
				+ "&version=" + QString::fromUtf8(QUrl::toPercentEncoding(TRO_VERSION)));
	ui->newsWebView->setUrl(url);

	QString imageName(qApp->applicationDirPath() + "/gfx/logo.png");
	if(QFile(imageName).exists()) {
		ui->titleLabel->setPixmap(QPixmap(imageName));
	}
	else {
		ui->titleLabel->setText("The Runic Orbs");
	}

	connect(ui->soloButton, SIGNAL(clicked()), this, SLOT(soloGameLaunch()));
	connect(ui->multiButton, SIGNAL(clicked()), this, SLOT(openConnectDialog()));
	connect(ui->serverButton, SIGNAL(clicked()), this, SLOT(openServerWidget()));
	connect(ui->optionsButton, SIGNAL(clicked()), this, SLOT(openOptions()));
	connect(ui->quitButton, SIGNAL(clicked()), this, SLOT(close()));
	ui->versionLabel->setText(tr("version %1").arg(TRO_VERSION));
	// Center the window on the screen
	QDesktopWidget* desktop = QApplication::desktop();
	move( (desktop->width() - width()) / 2 , (desktop->height() - height()) / 2 - 50 );
}
Ejemplo n.º 2
0
QList<QAction*> QgsGrassItemActions::actions()
{
  QList<QAction*> lst;
  QAction* actionOptions = new QAction( tr( "GRASS Options" ), this );
  connect( actionOptions, SIGNAL( triggered() ), instance(), SLOT( openOptions() ) );
  lst.append( actionOptions );
  return lst;
}
Ejemplo n.º 3
0
QList<QAction*> QgsGrassItemActions::actions()
{
  QList<QAction*> list;

  QAction* optionsAction = new QAction( tr( "GRASS Options" ), this );
  connect( optionsAction, SIGNAL( triggered() ), QgsGrass::instance(), SLOT( openOptions() ) );
  list << optionsAction;

  bool isMapsetOwner = QgsGrass::isOwner( mGrassObject.gisdbase(), mGrassObject.location(), mGrassObject.mapset() );

  // TODO: add icons to provider
  // TODO: check ownership
  if ( mGrassObject.type() == QgsGrassObject::Location )
  {
    QAction* newMapsetAction = new QAction( QgsApplication::getThemeIcon( "grass_new_mapset.png" ), tr( "New mapset" ), this );
    connect( newMapsetAction, SIGNAL( triggered() ), SLOT( newMapset() ) );
    list << newMapsetAction;
  }

  if ( mGrassObject.type() == QgsGrassObject::Mapset && isMapsetOwner )
  {
    QAction* openMapsetAction = new QAction( QgsApplication::getThemeIcon( "grass_open_mapset.png" ), tr( "Open mapset" ), this );
    connect( openMapsetAction, SIGNAL( triggered() ), SLOT( openMapset() ) );
    list << openMapsetAction;
  }

  if (( mGrassObject.type() == QgsGrassObject::Raster || mGrassObject.type() == QgsGrassObject::Vector
        ||  mGrassObject.type() == QgsGrassObject::Group ) && isMapsetOwner )
  {
    QAction* renameAction = new QAction( tr( "Rename" ), this );
    connect( renameAction, SIGNAL( triggered() ), this, SLOT( renameGrassObject() ) );
    list << renameAction;

    QAction* deleteAction = new QAction( tr( "Delete" ), this );
    connect( deleteAction, SIGNAL( triggered() ), this, SLOT( deleteGrassObject() ) );
    list << deleteAction;
  }

  if (( mGrassObject.type() == QgsGrassObject::Mapset || mGrassObject.type() == QgsGrassObject::Vector )
      && mValid && isMapsetOwner )
  {
    // TODO: disable new layer actions on maps currently being edited
    QAction* newPointAction = new QAction( tr( "New Point Layer" ), this );
    connect( newPointAction, SIGNAL( triggered() ), SLOT( newPointLayer() ) );
    list << newPointAction;

    QAction* newLineAction = new QAction( tr( "New Line Layer" ), this );
    connect( newLineAction, SIGNAL( triggered() ), SLOT( newLineLayer() ) );
    list << newLineAction;

    QAction* newPolygonAction = new QAction( tr( "New Polygon Layer" ), this );
    connect( newPolygonAction, SIGNAL( triggered() ), SLOT( newPolygonLayer() ) );
    list << newPolygonAction;
  }

  return list;
}
Ejemplo n.º 4
0
CraftuxHome::CraftuxHome(QWidget *parent) :
	QWidget(parent), ui(new Ui::CraftuxHome), b_optionDialogOpened(false), m_optionsDialog(NULL)
{
	ui->setupUi(this);
	connect(ui->soloButton, SIGNAL(clicked()), this, SLOT(soloGameLaunch()));
	connect(ui->multiButton, SIGNAL(clicked()), this, SLOT(openConnectDialog()));
	connect(ui->serverButton, SIGNAL(clicked()), this, SLOT(openServerInterface()));
	connect(ui->optionsButton, SIGNAL(clicked()), this, SLOT(openOptions()));
	connect(ui->quitButton, SIGNAL(clicked()), this, SLOT(close()));
	ui->versionLabel->setText(tr("version %1").arg(CRAFTUX_VERSION));
	// Center the window on the screen
	QDesktopWidget* desktop = QApplication::desktop();
	move( (desktop->width() - width()) / 2 , (desktop->height() - height()) / 2 - 50 );
}
Ejemplo n.º 5
0
/*!
   If there are no exceptions to stop it, the TNxSpooler object is constructed.
   \param qwidgetParent If "qwidgetParent" is not specified, the TNxSpooler will be an independent window.
*/
TNxSpooler::TNxSpooler(QWidget *qwidgetParent)
   : QDialog(qwidgetParent)
{
   QDEBUG_METHOD_NAME;

   // "Adopt" member objects that need this
   m_settings.setParent(this);
   m_sys_tray_icon.setParent(this);
   m_timer.setParent(this);

   // Define constant values by default
   m_default_interval = 3;
   m_special_extension = ".nxspooler-open"; // A special extension for files that contain a path to be opened by NxSpooler
   m_default_formats.append("pdf");
   m_default_formats.append("ods");
   m_default_formats.append("sxc");
   m_default_shared_resource = "nxspooler$";
   m_default_folder = QDir::toNativeSeparators(QDir::homePath().append(QDir::separator()).append(".nxspooler"));

   setupUi(this);
   prepareTrayIconOrShowProgram();

   try
   {
      initializeSettings();
      prepareSharedFolder();
   }
   catch (std::exception &excep)
   {
      // If the path did not exist and the path could not be created, show the options dialog
      if (QString(excep.what()).startsWith("2805093"))
      {
         syst.showWarning(excep.what());
         show();
         openOptions();
      }
      else
      {
         throw excep;
      }
   }

   prepareTimer();
}
Ejemplo n.º 6
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();
}