Ejemplo n.º 1
0
QgsComposerManager::QgsComposerManager( QWidget * parent, Qt::WindowFlags f ): QDialog( parent, f )
{
  QPushButton *pb;

  setupUi( this );

  QSettings settings;
  restoreGeometry( settings.value( "/Windows/ComposerManager/geometry" ).toByteArray() );

  connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( close() ) );

  pb = new QPushButton( tr( "&Show" ) );
  mButtonBox->addButton( pb, QDialogButtonBox::ActionRole );
  connect( pb, SIGNAL( clicked() ), this, SLOT( show_clicked() ) );

  pb = new QPushButton( tr( "&Duplicate" ) );
  mButtonBox->addButton( pb, QDialogButtonBox::ActionRole );
  connect( pb, SIGNAL( clicked() ), this, SLOT( duplicate_clicked() ) );

  pb = new QPushButton( tr( "&Remove" ) );
  mButtonBox->addButton( pb, QDialogButtonBox::ActionRole );
  connect( pb, SIGNAL( clicked() ), this, SLOT( remove_clicked() ) );

  pb = new QPushButton( tr( "Re&name" ) );
  mButtonBox->addButton( pb, QDialogButtonBox::ActionRole );
  connect( pb, SIGNAL( clicked() ), this, SLOT( rename_clicked() ) );

  initialize();
}
Ejemplo n.º 2
0
QgsComposerManager::QgsComposerManager( QWidget * parent, Qt::WindowFlags f ): QDialog( parent, f )
{
  QPushButton *pb;

  setupUi( this );

  QSettings settings;
  restoreGeometry( settings.value( "/Windows/ComposerManager/geometry" ).toByteArray() );

  connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( close() ) );
  connect( QgisApp::instance(), SIGNAL( composerAdded( QgsComposerView* ) ), this, SLOT( refreshComposers() ) );
  connect( QgisApp::instance(), SIGNAL( composerRemoved( QgsComposerView* ) ), this, SLOT( refreshComposers() ) );

  pb = new QPushButton( tr( "&Show" ) );
  mButtonBox->addButton( pb, QDialogButtonBox::ActionRole );
  connect( pb, SIGNAL( clicked() ), this, SLOT( show_clicked() ) );

  pb = new QPushButton( tr( "&Duplicate" ) );
  mButtonBox->addButton( pb, QDialogButtonBox::ActionRole );
  connect( pb, SIGNAL( clicked() ), this, SLOT( duplicate_clicked() ) );

  pb = new QPushButton( tr( "&Remove" ) );
  mButtonBox->addButton( pb, QDialogButtonBox::ActionRole );
  connect( pb, SIGNAL( clicked() ), this, SLOT( remove_clicked() ) );

  pb = new QPushButton( tr( "Re&name" ) );
  mButtonBox->addButton( pb, QDialogButtonBox::ActionRole );
  connect( pb, SIGNAL( clicked() ), this, SLOT( rename_clicked() ) );

#ifdef Q_WS_MAC
  // Create action to select this window
  mWindowAction = new QAction( windowTitle(), this );
  connect( mWindowAction, SIGNAL( triggered() ), this, SLOT( activate() ) );
#endif

  mTemplate->addItem( tr( "Empty composer" ) );
  mTemplate->addItem( tr( "Specific" ) );

  mUserTemplatesDir = QgsApplication::qgisSettingsDirPath() + "/composer_templates";
  QMap<QString, QString> userTemplateMap = defaultTemplates( true );
  if ( userTemplateMap.size() > 0 )
  {
    mTemplate->insertSeparator( mTemplate->count() );
    QMap<QString, QString>::const_iterator templateIt = userTemplateMap.constBegin();
    for ( ; templateIt != userTemplateMap.constEnd(); ++templateIt )
    {
      mTemplate->addItem( templateIt.key(), templateIt.value() );
    }
  }

  mDefaultTemplatesDir = QgsApplication::pkgDataPath() + "/composer_templates";
  QMap<QString, QString> defaultTemplateMap = defaultTemplates( false );
  if ( defaultTemplateMap.size() > 0 )
  {
    mTemplate->insertSeparator( mTemplate->count() );
    QMap<QString, QString>::const_iterator templateIt = defaultTemplateMap.constBegin();
    for ( ; templateIt != defaultTemplateMap.constEnd(); ++templateIt )
    {
      mTemplate->addItem( templateIt.key(), templateIt.value() );
    }
  }

  mTemplatePathLineEdit->setText( settings.value( "/UI/ComposerManager/templatePath", QString( "" ) ).toString() );

  refreshComposers();
}