コード例 #1
0
ファイル: IdDetailsDialog.cpp プロジェクト: N00D13/RetroShare
/** Default constructor */
IdDetailsDialog::IdDetailsDialog(const RsGxsGroupId& id, QWidget *parent) :
    QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
    mId(id),
    ui(new Ui::IdDetailsDialog)
{
	/* Invoke Qt Designer generated QObject setup routine */
	ui->setupUi(this);

	setAttribute (Qt::WA_DeleteOnClose,true);

	/* Setup UI helper */
	mStateHelper = new UIStateHelper(this);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Nickname);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_KeyId);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgId);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgName);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Type);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->toolButton_Reputation);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingOverall);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingImplicit);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingOwn);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingPeers);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->repModButton);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->repMod_Accept);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->repMod_Ban);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->repMod_Negative);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->repMod_Positive);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->repMod_Custom);
	mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->repMod_spinBox);

	mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Nickname);
	mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgName);
	mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_KeyId);
	mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgId);
	mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Type);
	mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgName);
	mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingOverall);
	mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingImplicit);
	mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingOwn);
	mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingPeers);

	mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Nickname);
	mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_KeyId);
	mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgId);
	mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Type);
	mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgName);
	mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingOverall);
	mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingImplicit);
	mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingOwn);
	mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingPeers);

	/* Create token queue */
	mIdQueue = new TokenQueue(rsIdentity->getTokenService(), this);

	Settings->loadWidgetInformation(this);

	ui->headerFrame->setHeaderImage(QPixmap(":/images/identity/identity_64.png"));
	ui->headerFrame->setHeaderText(tr("Person Details"));

	//connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(changeGroup()));
	connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
	
	// Hiding Rep Btn until that part is finished.
	ui->toolButton_Reputation->setVisible(false);
	
	requestIdDetails();
}
コード例 #2
0
QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *parent, Qt::WFlags fl )
    : QDialog( parent, fl )
    , mMapCanvas( mapCanvas )
{
  setupUi( this );
  connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
  connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
  connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
  connect( this, SIGNAL( accepted() ), this, SLOT( apply() ) );
  connect( projectionSelector, SIGNAL( sridSelected( QString ) ), this, SLOT( setMapUnitsToCurrentProjection() ) );

  ///////////////////////////////////////////////////////////
  // Properties stored in map canvas's QgsMapRenderer
  // these ones are propagated to QgsProject by a signal

  QgsMapRenderer* myRenderer = mMapCanvas->mapRenderer();
  QGis::UnitType myUnit = myRenderer->mapUnits();
  setMapUnits( myUnit );

  // we need to initialize it, since the on_cbxProjectionEnabled_stateChanged()
  // callback triggered by setChecked() might use it.
  mProjectSrsId = myRenderer->destinationCrs().srsid();

  //see if the user wants on the fly projection enabled
  bool myProjectionEnabled = myRenderer->hasCrsTransformEnabled();
  cbxProjectionEnabled->setChecked( myProjectionEnabled );

  QgsDebugMsg( "Read project CRSID: " + QString::number( mProjectSrsId ) );
  projectionSelector->setSelectedCrsId( mProjectSrsId );
  projectionSelector->setEnabled( myProjectionEnabled );

  ///////////////////////////////////////////////////////////
  // Properties stored in QgsProject

  title( QgsProject::instance()->title() );

  // get the manner in which the number of decimal places in the mouse
  // position display is set (manual or automatic)
  bool automaticPrecision = QgsProject::instance()->readBoolEntry( "PositionPrecision", "/Automatic" );
  if ( automaticPrecision )
  {
    radAutomatic->setChecked( true );
    spinBoxDP->setDisabled( true );
    labelDP->setDisabled( true );
  }
  else
  {
    radManual->setChecked( true );
  }

  cbxAbsolutePath->setCurrentIndex( QgsProject::instance()->readBoolEntry( "Paths", "/Absolute", true ) ? 0 : 1 );

  int dp = QgsProject::instance()->readNumEntry( "PositionPrecision", "/DecimalPlaces" );
  spinBoxDP->setValue( dp );

  QString format = QgsProject::instance()->readEntry( "PositionPrecision", "/DegreeFormat", "D" );
  if ( format == "DM" )
    radDM->setChecked( true );
  else if ( format == "DMS" )
    radDMS->setChecked( true );
  else
    radD->setChecked( true );

  //get the color selections and set the button color accordingly
  int myRedInt = QgsProject::instance()->readNumEntry( "Gui", "/SelectionColorRedPart", 255 );
  int myGreenInt = QgsProject::instance()->readNumEntry( "Gui", "/SelectionColorGreenPart", 255 );
  int myBlueInt = QgsProject::instance()->readNumEntry( "Gui", "/SelectionColorBluePart", 0 );
  int myAlphaInt = QgsProject::instance()->readNumEntry( "Gui", "/SelectionColorAlphaPart", 255 );
  QColor myColor = QColor( myRedInt, myGreenInt, myBlueInt, myAlphaInt );
  pbnSelectionColor->setColor( myColor );

  //get the color for map canvas background and set button color accordingly (default white)
  myRedInt = QgsProject::instance()->readNumEntry( "Gui", "/CanvasColorRedPart", 255 );
  myGreenInt = QgsProject::instance()->readNumEntry( "Gui", "/CanvasColorGreenPart", 255 );
  myBlueInt = QgsProject::instance()->readNumEntry( "Gui", "/CanvasColorBluePart", 255 );
  myColor = QColor( myRedInt, myGreenInt, myBlueInt );
  pbnCanvasColor->setColor( myColor );

  //get project scales
  QStringList myScales = QgsProject::instance()->readListEntry( "Scales", "/ScalesList" );
  if ( !myScales.isEmpty() )
  {
    QStringList::const_iterator scaleIt = myScales.constBegin();
    for ( ; scaleIt != myScales.constEnd(); ++scaleIt )
    {
      QListWidgetItem* newItem = new QListWidgetItem( lstScales );
      newItem->setText( *scaleIt );
      newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
      lstScales->addItem( newItem );
    }
  }

  grpProjectScales->setChecked( QgsProject::instance()->readBoolEntry( "Scales", "/useProjectScales" ) );

  QgsMapLayer* currentLayer = 0;

  QStringList noIdentifyLayerIdList = QgsProject::instance()->readListEntry( "Identify", "/disabledLayers" );

  const QMap<QString, QgsMapLayer*> &mapLayers = QgsMapLayerRegistry::instance()->mapLayers();

  if ( mMapCanvas->currentLayer() )
  {
    mLayerSrsId = mMapCanvas->currentLayer()->crs().srsid();
  }
  else if ( mapLayers.size() > 0 )
  {
    mLayerSrsId = mapLayers.begin().value()->crs().srsid();
  }
  else
  {
    mLayerSrsId = mProjectSrsId;
  }

  twIdentifyLayers->setColumnCount( 3 );
  twIdentifyLayers->horizontalHeader()->setVisible( true );
  twIdentifyLayers->setHorizontalHeaderItem( 0, new QTableWidgetItem( tr( "Layer" ) ) );
  twIdentifyLayers->setHorizontalHeaderItem( 1, new QTableWidgetItem( tr( "Type" ) ) );
  twIdentifyLayers->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr( "Identifiable" ) ) );
  twIdentifyLayers->setRowCount( mapLayers.size() );
  twIdentifyLayers->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents );

  int i = 0;
  for ( QMap<QString, QgsMapLayer*>::const_iterator it = mapLayers.constBegin(); it != mapLayers.constEnd(); it++, i++ )
  {
    currentLayer = it.value();

    QTableWidgetItem *twi = new QTableWidgetItem( QString::number( i ) );
    twIdentifyLayers->setVerticalHeaderItem( i, twi );

    twi = new QTableWidgetItem( currentLayer->name() );
    twi->setData( Qt::UserRole, it.key() );
    twi->setFlags( twi->flags() & ~Qt::ItemIsEditable );
    twIdentifyLayers->setItem( i, 0, twi );

    QString type;
    if ( currentLayer->type() == QgsMapLayer::VectorLayer )
    {
      type = tr( "Vector" );
    }
    else if ( currentLayer->type() == QgsMapLayer::RasterLayer )
    {
      QgsRasterLayer *rl = qobject_cast<QgsRasterLayer *>( currentLayer );

      if ( rl && rl->providerType() == "wms" )
      {
        type = tr( "WMS" );
      }
      else
      {
        type = tr( "Raster" );
      }
    }

    twi = new QTableWidgetItem( type );
    twi->setFlags( twi->flags() & ~Qt::ItemIsEditable );
    twIdentifyLayers->setItem( i, 1, twi );

    QCheckBox *cb = new QCheckBox();
    cb->setChecked( !noIdentifyLayerIdList.contains( currentLayer->id() ) );
    twIdentifyLayers->setCellWidget( i, 2, cb );
  }

  grpOWSServiceCapabilities->setChecked( QgsProject::instance()->readBoolEntry( "WMSServiceCapabilities", "/", false ) );
  mWMSTitle->setText( QgsProject::instance()->readEntry( "WMSServiceTitle", "/" ) );
  mWMSContactOrganization->setText( QgsProject::instance()->readEntry( "WMSContactOrganization", "/", "" ) );
  mWMSContactPerson->setText( QgsProject::instance()->readEntry( "WMSContactPerson", "/", "" ) );
  mWMSContactMail->setText( QgsProject::instance()->readEntry( "WMSContactMail", "/", "" ) );
  mWMSContactPhone->setText( QgsProject::instance()->readEntry( "WMSContactPhone", "/", "" ) );
  mWMSAbstract->setPlainText( QgsProject::instance()->readEntry( "WMSServiceAbstract", "/", "" ) );
  mWMSOnlineResourceLineEdit->setText( QgsProject::instance()->readEntry( "WMSOnlineResource", "/", "" ) );
  mWMSUrlLineEdit->setText( QgsProject::instance()->readEntry( "WMSUrl", "/", "" ) );

  bool ok;
  QStringList values;

  mWMSExtMinX->setValidator( new QDoubleValidator( mWMSExtMinX ) );
  mWMSExtMinY->setValidator( new QDoubleValidator( mWMSExtMinY ) );
  mWMSExtMaxX->setValidator( new QDoubleValidator( mWMSExtMaxX ) );
  mWMSExtMaxY->setValidator( new QDoubleValidator( mWMSExtMaxY ) );

  values = QgsProject::instance()->readListEntry( "WMSExtent", "/", &ok );
  grpWMSExt->setChecked( ok && values.size() == 4 );
  if ( grpWMSExt->isChecked() )
  {
    mWMSExtMinX->setText( values[0] );
    mWMSExtMinY->setText( values[1] );
    mWMSExtMaxX->setText( values[2] );
    mWMSExtMaxY->setText( values[3] );
  }

  values = QgsProject::instance()->readListEntry( "WMSCrsList", "/", &ok );
  grpWMSList->setChecked( ok && values.size() > 0 );
  if ( grpWMSList->isChecked() )
  {
    mWMSList->addItems( values );
  }
  else
  {
    values = QgsProject::instance()->readListEntry( "WMSEpsgList", "/", &ok );
    grpWMSList->setChecked( ok && values.size() > 0 );
    if ( grpWMSList->isChecked() )
    {
      QStringList list;
      foreach ( QString value, values )
      {
        list << QString( "EPSG:%1" ).arg( value );
      }

      mWMSList->addItems( list );
    }
コード例 #3
0
//
// user_edit_dialog
//
user_edit_dialog::user_edit_dialog(int role_oid)
{
  m_role_oid = role_oid;
  setWindowTitle(role_oid==0?tr("Add a database user"):tr("Edit a database user"));
  m_mode = (role_oid==0)?new_user:existing_user;

  user u;
  if (m_mode == existing_user)
    u.fetch_by_oid(role_oid);

  QVBoxLayout* top_layout = new QVBoxLayout;

  db_cnx db;
  QString dbname=QString(tr("Current database: <b>%1</b>")).arg(db.dbname().toHtmlEscaped());
  QLabel* ldb = new QLabel(dbname);
  ldb->setTextFormat(Qt::RichText);
  top_layout->addWidget(ldb, 0, Qt::AlignHCenter);

  QFormLayout* layout = new QFormLayout;
  m_fullname = new QLineEdit;
#ifdef PERM_LOGIN
  m_perm_login = new QCheckBox;
#endif
  m_perm_connect = new QCheckBox;
  m_registered = new QCheckBox;

  m_email = new QLineEdit;

  /* m_login, m_password and m_password2 should keep the same width
     even though m_password is part of a QHBoxLayout and the others
     are not (as they're tied to the outer QFormLayout). This is why
     they're implemented as instance of the "field_follow_size" class */

  m_login = new field_follow_size; //QLineEdit;
  m_login->setMaxLength(name_maxlength);
  m_password = new field_follow_size;
  m_password2 = new field_follow_size;
  connect(m_password, SIGNAL(resized(const QSize)),
	  m_password2, SLOT(follow_resize(const QSize)));
  connect(m_password, SIGNAL(resized(const QSize)),
	  m_login, SLOT(follow_resize(const QSize)));
  m_change_password_btn = new QCheckBox(tr("Change"));
  m_password->setEchoMode(QLineEdit::Password);
  m_password2->setEchoMode(QLineEdit::Password);
  m_password->setMaxLength(name_maxlength);
  m_password2->setMaxLength(name_maxlength);

  QHBoxLayout* vlpassw = new QHBoxLayout;
  vlpassw->addWidget(m_password);
  vlpassw->addWidget(m_change_password_btn);
  if (m_mode==existing_user) {
    m_password->setEnabled(false);
    m_password2->setEnabled(false);
    m_change_password_btn->setEnabled(true);
    connect(m_change_password_btn, SIGNAL(clicked()),
	    this, SLOT(enable_alter_user()));
  }
  else {
    m_change_password_btn->setEnabled(false);
  }

  m_qlist_roles = new QListWidget;

  QList<user> roles_list = users_repository::get_list();

  QList<QString> assigned_roles = user::granted_roles(m_role_oid);

  for (int ri=0; ri<roles_list.size(); ri++) {
    const user& u = roles_list.at(ri);
    if (!u.m_can_login && u.m_role_oid>0) {
      // keep only entries from pg_roles without the LOGIN privilege
      // they're supposed to be roles to assign rather than users
      QListWidgetItem* item = new QListWidgetItem(u.m_db_login, m_qlist_roles);
      item->setFlags(Qt::ItemIsUserCheckable|/*Qt::ItemIsSelectable|*/Qt::ItemIsEnabled);
      item->setCheckState(assigned_roles.indexOf(u.m_db_login) >= 0 ?
			  Qt::Checked : Qt::Unchecked);
    }
  }
  //  m_case_sensitive = new QCheckBox;
  m_custom1 = new custom_user_field;
  m_custom2 = new custom_user_field;
  m_custom3 = new custom_user_field;

  if (u.m_is_superuser) {
    QLabel* label = new QLabel(tr("<b>Superuser account: unrestricted permissions.</b>"));
    layout->addRow(QString(), label);
  }

  layout->addRow(tr("Login <sup>(*)</sup>:"), m_login);

  layout->addRow(tr("Password <sup>(*)</sup>:"), /*m_password*/ vlpassw);
  layout->addRow(tr("Retype password <sup>(*)</sup>:"), m_password2);
  /*
  m_password2->resize(QSize(m_password->width(), m_password2->height()));
  m_password2->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
  */
#ifdef PERM_LOGIN
  add_field_with_help(layout,
		       tr("Active <sup>(*)</sup>:"),
		       m_perm_login,
		       tr("The database role has the LOGIN capability."));
#endif

  add_field_with_help(layout,
		      tr("Can connect <sup>(**)</sup>:"),
		      m_perm_connect,
		      tr("The login has CONNECT permission on this database."));

  add_field_with_help(layout,
		      tr("Registered <sup>(**)</sup>:"),
		      m_registered,
		      tr("The user account corresponds to an operator in this database."));

  layout->addRow(tr("Operator name <sup>(*)</sup>:"), m_fullname);

  layout->addRow(tr("Groups <sup>(*)</sup>:"), m_qlist_roles);

  layout->addRow(tr("Custom field #1 <sup>(**)</sup>:"), m_custom1);
  layout->addRow(tr("Custom field #2 <sup>(**)</sup>:"), m_custom2);
  layout->addRow(tr("Custom field #3 <sup>(**)</sup>:"), m_custom3);

  top_layout->addLayout(layout);

  QLabel* lremark = new QLabel(tr("(*)  Fields marked with <sup>(*)</sup> apply across all databases of this server.<br>(**) Fields marked with <sup>(**)</sup> apply only to the current database: <b>%1</b>.").arg(db.dbname().toHtmlEscaped()));
  QFont smf = lremark->font();
  smf.setPointSize((smf.pointSize()*8)/10);
  lremark->setFont(smf);
  top_layout->addWidget(lremark);

  m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok |
				   QDialogButtonBox::Cancel);
  top_layout->addWidget(m_buttons);
  connect(m_buttons, SIGNAL(accepted()), this, SLOT(accept()));
  connect(m_buttons, SIGNAL(rejected()), this, SLOT(reject()));

  setLayout(top_layout);

  m_user_id = 0;

  if (role_oid!=0) {
    /* set readOnly but not disabled because disabled is hard to read
       and the login is the major information */
    m_login->setReadOnly(true); //m_login->setEnabled(false);

    // u is loaded (for an existing role) at the top of the function
    m_user_id = u.m_user_id;
    m_fullname->setText(u.m_fullname);
    m_login->setText(u.m_login);
    m_initial_login = u.m_login;
    m_custom1->setPlainText(u.m_custom_field1);
    m_custom2->setPlainText(u.m_custom_field2);
    m_custom3->setPlainText(u.m_custom_field3);
#ifdef PERM_LOGIN
    m_perm_login->setChecked(u.m_can_login);
#endif
    m_perm_connect->setChecked(u.m_can_connect);
    m_registered->setChecked(u.m_user_id!=0);
  }

  connect(m_registered, SIGNAL(clicked()), this, SLOT(enable_fields()));
  enable_fields();
}
コード例 #4
0
ファイル: dlg_edit_tokens.cpp プロジェクト: JFLEKY/Cockatrice
DlgEditTokens::DlgEditTokens(CardDatabaseModel *_cardDatabaseModel, QWidget *parent)
    : QDialog(parent), currentCard(0), cardDatabaseModel(_cardDatabaseModel)
{
    nameLabel = new QLabel(tr("&Name:"));
    nameEdit = new QLineEdit;
    nameEdit->setEnabled(false);
    nameLabel->setBuddy(nameEdit);
    
    colorLabel = new QLabel(tr("C&olor:"));
    colorEdit = new QComboBox;
    colorEdit->addItem(tr("white"), "w");
    colorEdit->addItem(tr("blue"), "u");
    colorEdit->addItem(tr("black"), "b");
    colorEdit->addItem(tr("red"), "r");
    colorEdit->addItem(tr("green"), "g");
    colorEdit->addItem(tr("multicolor"), "m");
    colorEdit->addItem(tr("colorless"), QString());
    colorLabel->setBuddy(colorEdit);
    connect(colorEdit, SIGNAL(currentIndexChanged(int)), this, SLOT(colorChanged(int)));
    
    ptLabel = new QLabel(tr("&P/T:"));
    ptEdit = new QLineEdit;
    ptLabel->setBuddy(ptEdit);
    connect(ptEdit, SIGNAL(textChanged(QString)), this, SLOT(ptChanged(QString)));
    
    annotationLabel = new QLabel(tr("&Annotation:"));
    annotationEdit = new QLineEdit;
    annotationLabel->setBuddy(annotationEdit);
    connect(annotationEdit, SIGNAL(textChanged(QString)), this, SLOT(annotationChanged(QString)));
    
    QGridLayout *grid = new QGridLayout;
    grid->addWidget(nameLabel, 0, 0);
    grid->addWidget(nameEdit, 0, 1);
    grid->addWidget(colorLabel, 1, 0);
    grid->addWidget(colorEdit, 1, 1);
    grid->addWidget(ptLabel, 2, 0);
    grid->addWidget(ptEdit, 2, 1);
    grid->addWidget(annotationLabel, 3, 0);
    grid->addWidget(annotationEdit, 3, 1);
    
    QGroupBox *tokenDataGroupBox = new QGroupBox(tr("Token data"));
    tokenDataGroupBox->setLayout(grid);
    
    cardDatabaseDisplayModel = new CardDatabaseDisplayModel(this);
    cardDatabaseDisplayModel->setSourceModel(cardDatabaseModel);
    cardDatabaseDisplayModel->setIsToken(CardDatabaseDisplayModel::ShowTrue);
    
    chooseTokenView = new QTreeView;
    chooseTokenView->setModel(cardDatabaseDisplayModel);
    chooseTokenView->setUniformRowHeights(true);
    chooseTokenView->setRootIsDecorated(false);
    chooseTokenView->setAlternatingRowColors(true);
    chooseTokenView->setSortingEnabled(true);
    chooseTokenView->sortByColumn(0, Qt::AscendingOrder);
    chooseTokenView->resizeColumnToContents(0);
    chooseTokenView->header()->setStretchLastSection(false);
    chooseTokenView->header()->hideSection(1);
    chooseTokenView->header()->hideSection(2);
#if QT_VERSION < 0x050000
    chooseTokenView->header()->setResizeMode(3, QHeaderView::ResizeToContents);
    chooseTokenView->header()->setResizeMode(4, QHeaderView::ResizeToContents);
#else
    chooseTokenView->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
    chooseTokenView->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents);
#endif
    connect(chooseTokenView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, SLOT(tokenSelectionChanged(QModelIndex, QModelIndex)));
    
    QAction *aAddToken = new QAction(tr("Add token"), this);
    aAddToken->setIcon(QPixmap("theme:icons/increment"));
    connect(aAddToken, SIGNAL(triggered()), this, SLOT(actAddToken()));
    QAction *aRemoveToken = new QAction(tr("Remove token"), this);
    aRemoveToken->setIcon(QPixmap("theme:icons/decrement"));
    connect(aRemoveToken, SIGNAL(triggered()), this, SLOT(actRemoveToken()));
    
    QToolBar *databaseToolBar = new QToolBar;
    databaseToolBar->addAction(aAddToken);
    databaseToolBar->addAction(aRemoveToken);
    
    QVBoxLayout *leftVBox = new QVBoxLayout;
    leftVBox->addWidget(chooseTokenView);
    leftVBox->addWidget(databaseToolBar);
    
    QHBoxLayout *hbox = new QHBoxLayout;
    hbox->addLayout(leftVBox);
    hbox->addWidget(tokenDataGroupBox);
    
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addLayout(hbox);
    mainLayout->addWidget(buttonBox);

    setLayout(mainLayout);
    setWindowTitle(tr("Edit tokens"));
}
コード例 #5
0
PinEntryDialog::PinEntryDialog( QWidget* parent, const char* name, 
                                bool modal, bool enable_quality_bar )
  : QDialog( parent, name, modal, Qt::WStyle_StaysOnTop ), _grabbed( false )
{
  QBoxLayout* top = new QVBoxLayout( this, 6 );
  QBoxLayout* upperLayout = new QHBoxLayout( top );

  _icon = new QLabel( this );
  _icon->setPixmap( QMessageBox::standardIcon( QMessageBox::Information ) );
  upperLayout->addWidget( _icon );

  QBoxLayout* labelLayout = new QVBoxLayout( upperLayout );

  _error = new QLabel( this );
  labelLayout->addWidget( _error );

  _desc = new QLabel( this );
  labelLayout->addWidget( _desc );

  QGridLayout* grid = new QGridLayout( labelLayout );

  _prompt = new QLabel( this );
  _prompt->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
  grid->addWidget( _prompt, 0, 0 );
  _edit = new SecQLineEdit( this );
  _edit->setMaxLength( 256 );
  _edit->setEchoMode( SecQLineEdit::Password );
  grid->addWidget( _edit, 0, 1 );

  if (enable_quality_bar)
    {
      _quality_bar_label = new QLabel( this );
      _quality_bar_label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
      grid->addWidget ( _quality_bar_label, 1, 0 );
      _quality_bar = new QProgressBar( this );
      _quality_bar->setCenterIndicator( true );
      grid->addWidget( _quality_bar, 1, 1 );
      _have_quality_bar = true;
    }
  else
    _have_quality_bar = false;

  QBoxLayout* l = new QHBoxLayout( top );

  _ok = new QPushButton( tr("OK"), this );
  _cancel = new QPushButton( tr("Cancel"), this );

  l->addWidget( _ok );
  l->addStretch();
  l->addWidget( _cancel );

  _ok->setDefault(true);

  connect( _ok, SIGNAL( clicked() ),
	   this, SIGNAL( accepted() ) );
  connect( _cancel, SIGNAL( clicked() ),
	   this, SIGNAL( rejected() ) );
  connect( _edit, SIGNAL( textModified(const SecQString&) ),
	   this, SLOT( updateQuality(const SecQString&) ) );
  connect (this, SIGNAL (accepted ()),
	   this, SLOT (accept ()));
  connect (this, SIGNAL (rejected ()),
	   this, SLOT (reject ()));
  _edit->setFocus();
}
コード例 #6
0
CreateTxDialog::CreateTxDialog(const QString& accountName, const PaymentRequest& paymentRequest, QWidget* parent)
    : QDialog(parent), status(SAVE_ONLY)
{
    // Buttons
    signAndSendButton = new QPushButton(tr("Sign and Send"));
    signAndSaveButton = new QPushButton(tr("Sign and Save"));
    saveButton = new QPushButton(tr("Save Unsigned"));
    cancelButton = new QPushButton(tr("Cancel"));
    cancelButton->setDefault(true);
/*
    QDialogButtonBox* buttonBox = new QDialogButtonBox(
                                        QDialogButtonBox::Ok |
                                        QDialogButtonBox::Cancel);

*/
    QDialogButtonBox* buttonBox = new QDialogButtonBox;
    buttonBox->addButton(signAndSendButton, QDialogButtonBox::ActionRole);
    buttonBox->addButton(signAndSaveButton, QDialogButtonBox::ActionRole);
    buttonBox->addButton(saveButton, QDialogButtonBox::AcceptRole);
    buttonBox->addButton(cancelButton, QDialogButtonBox::RejectRole);

    connect(signAndSendButton, &QPushButton::clicked, [this]() { status = SIGN_AND_SEND; accept(); });
    connect(signAndSaveButton, &QPushButton::clicked, [this]() { status = SIGN_AND_SAVE; accept(); });
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    // Prompt
    QLabel* promptLabel = new QLabel(tr("Add Outputs:"));

    // Account
    QLabel* accountLabel = new QLabel(tr("Account:"));
    accountComboBox = new QComboBox();
    accountComboBox->insertItem(0, accountName);

    QHBoxLayout* accountLayout = new QHBoxLayout();
    accountLayout->addWidget(accountLabel);
    accountLayout->addWidget(accountComboBox);

    // Fee
    QLabel* feeLabel = new QLabel(tr("Fee:"));
    feeEdit = new QLineEdit();
    feeEdit->setValidator(new QRegExpValidator(AMOUNT_REGEXP));
    feeEdit->setText("0.0005"); // TODO: suggest more intelligently

    QHBoxLayout* feeLayout = new QHBoxLayout();
    feeLayout->addWidget(feeLabel);
    feeLayout->addWidget(feeEdit);

    // TxOuts
    txOutVBoxLayout = new QVBoxLayout();
    txOutVBoxLayout->setSizeConstraint(QLayout::SetMinimumSize);
    addTxOut(paymentRequest);

    // Add Output Button
    QPushButton* addTxOutButton = new QPushButton(tr("Add Output"));
    connect(addTxOutButton, SIGNAL(clicked()), this, SLOT(addTxOut()));

    mainLayout = new QVBoxLayout(this);
    mainLayout->addWidget(promptLabel);
    mainLayout->addLayout(accountLayout);
    mainLayout->addLayout(feeLayout);
    mainLayout->addLayout(txOutVBoxLayout);
    mainLayout->addWidget(addTxOutButton);
    mainLayout->addWidget(buttonBox);
    setLayout(mainLayout);
}
コード例 #7
0
itemSource::itemSource(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : XDialog(parent, name, modal, fl)
{
  XSqlQuery itemitemSource;
  setupUi(this);

  connect(_add,                SIGNAL(clicked()), this, SLOT(sAdd()));
  connect(_close,              SIGNAL(clicked()), this, SLOT(reject()));
  connect(_delete,             SIGNAL(clicked()), this, SLOT(sDelete()));
  connect(_edit,               SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_itemsrcp,SIGNAL(populateMenu(QMenu*, XTreeWidgetItem*)), this, SLOT(sPopulateMenu(QMenu*)));
  connect(_save,               SIGNAL(clicked()), this, SLOT(sSaveClicked()));
  connect(_vendor,             SIGNAL(newId(int)), this, SLOT(sVendorChanged(int)));
  connect(_vendorCurrency,     SIGNAL(newID(int)), this, SLOT(sFillPriceList()));
  connect(_contract,           SIGNAL(newID(int)), this, SLOT(sContractChanged(int)));
  connect(this,                SIGNAL(rejected()), this, SLOT(sRejected()));

//  TODO method doesn't exist?
//  connect(_vendorUOM, SIGNAL(textChanged()), this, SLOT(sClearVendorUOM()));
//  connect(_invVendorUOMRatio, SIGNAL(textChanged(QString)), this, SLOT(sClearVendorUOM()));

  _vendorUOM->setType(XComboBox::UOMs);

  _item->setType(ItemLineEdit::cGeneralPurchased | ItemLineEdit::cGeneralManufactured | ItemLineEdit::cTooling);
  _item->setDefaultType(ItemLineEdit::cGeneralPurchased);

  _dates->setStartNull(tr("Always"), omfgThis->startOfTime(), TRUE);
  _dates->setStartCaption(tr("Effective"));
  _dates->setEndNull(tr("Never"), omfgThis->endOfTime(), TRUE);
  _dates->setEndCaption(tr("Expires"));

  _captive = false;
  _new = false;
  
  QString base;
  itemitemSource.exec("SELECT currConcat(baseCurrID()) AS base;");
  if (itemitemSource.first())
    base = itemitemSource.value("base").toString();
  else
    base = tr("Base");

  if (_metrics->boolean("MultiWhs"))
  {
    _itemsrcp->addColumn(tr("Site"),                      _qtyColumn, Qt::AlignCenter,true, "warehous_code");
    _itemsrcp->addColumn(tr("Order Type"),                        -1, Qt::AlignCenter,true, "itemsrcp_dropship");
  }
  _itemsrcp->addColumn(tr("Qty Break"),                   _qtyColumn, Qt::AlignRight, true, "itemsrcp_qtybreak");
  _itemsrcp->addColumn(tr("Unit Price"),                          -1, Qt::AlignRight, true, "itemsrcp_price");
  _itemsrcp->addColumn(tr("Currency"),               _currencyColumn, Qt::AlignLeft,  true, "item_curr");
  _itemsrcp->addColumn(tr("Discount Percent"),                    -1, Qt::AlignRight, true, "itemsrcp_discntprcnt" );
  _itemsrcp->addColumn(tr("Discount Fixed Amt."),                 -1, Qt::AlignRight, true, "itemsrcp_fixedamtdiscount" );
  _itemsrcp->addColumn(tr("Unit Price\n(%1)").arg(base),_moneyColumn, Qt::AlignRight, true, "price_base");
  _itemsrcp->addColumn(tr("Type"),                      _orderColumn, Qt::AlignLeft,  true, "type" );
  _itemsrcp->addColumn(tr("Method"),                    _orderColumn, Qt::AlignLeft,  true, "method" );

  if (omfgThis->singleCurrency())
  {
    _itemsrcp->hideColumn(1);
    _itemsrcp->hideColumn(2);
    _itemsrcp->headerItem()->setText(3, tr("Unit Price"));
  }

  _invVendorUOMRatio->setValidator(omfgThis->ratioVal());
  _minOrderQty->setValidator(omfgThis->qtyVal());
  _multOrderQty->setValidator(omfgThis->qtyVal());

  _vendorCurrency->setType(XComboBox::Currencies);
  _vendorCurrency->setLabel(_vendorCurrencyLit);
  
  itemitemSource.exec("SELECT MAX(itemsrc_id),itemsrc_manuf_name, itemsrc_manuf_name FROM itemsrc GROUP BY itemsrc_manuf_name;");
  _manufName->populate(itemitemSource);
  _manufName->setCurrentIndex(0);
}
コード例 #8
0
QgsVectorLayerProperties::QgsVectorLayerProperties(
  QgsVectorLayer *lyr,
  QWidget * parent,
  Qt::WindowFlags fl
)
    : QgsOptionsDialogBase( "VectorLayerProperties", parent, fl )
    , mLayer( lyr )
    , mMetadataFilled( false )
    , mOriginalSubsetSQL( lyr->subsetString() )
    , mSaveAsMenu( nullptr )
    , mLoadStyleMenu( nullptr )
    , mRendererDialog( nullptr )
    , labelingDialog( nullptr )
    , labelDialog( nullptr )
    , mActionDialog( nullptr )
    , diagramPropertiesDialog( nullptr )
    , mFieldsPropertiesDialog( nullptr )
{
  setupUi( this );
  // QgsOptionsDialogBase handles saving/restoring of geometry, splitter and current tab states,
  // switching vertical tabs between icon/text to icon-only modes (splitter collapsed to left),
  // and connecting QDialogButtonBox's accepted/rejected signals to dialog's accept/reject slots
  initOptionsBase( false );

  QPushButton* b = new QPushButton( tr( "Style" ) );
  QMenu* m = new QMenu( this );
  mActionLoadStyle = m->addAction( tr( "Load Style" ), this, SLOT( loadStyle_clicked() ) );
  mActionSaveStyleAs = m->addAction( tr( "Save Style" ), this, SLOT( saveStyleAs_clicked() ) );
  m->addSeparator();
  m->addAction( tr( "Save as Default" ), this, SLOT( saveDefaultStyle_clicked() ) );
  m->addAction( tr( "Restore Default" ), this, SLOT( loadDefaultStyle_clicked() ) );
  b->setMenu( m );
  connect( m, SIGNAL( aboutToShow() ), this, SLOT( aboutToShowStyleMenu() ) );
  buttonBox->addButton( b, QDialogButtonBox::ResetRole );

  connect( lyr->styleManager(), SIGNAL( currentStyleChanged( QString ) ), this, SLOT( syncToLayer() ) );

  connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
  connect( this, SIGNAL( accepted() ), this, SLOT( apply() ) );
  connect( this, SIGNAL( rejected() ), this, SLOT( onCancel() ) );

  connect( mOptionsStackedWidget, SIGNAL( currentChanged( int ) ), this, SLOT( mOptionsStackedWidget_CurrentChanged( int ) ) );

  fieldComboBox->setLayer( lyr );
  displayFieldComboBox->setLayer( lyr );
  connect( insertFieldButton, SIGNAL( clicked() ), this, SLOT( insertField() ) );
  connect( insertExpressionButton, SIGNAL( clicked() ), this, SLOT( insertExpression() ) );

  // connections for Map Tip display
  connect( htmlRadio, SIGNAL( toggled( bool ) ), htmlMapTip, SLOT( setEnabled( bool ) ) );
  connect( htmlRadio, SIGNAL( toggled( bool ) ), insertFieldButton, SLOT( setEnabled( bool ) ) );
  connect( htmlRadio, SIGNAL( toggled( bool ) ), fieldComboBox, SLOT( setEnabled( bool ) ) );
  connect( htmlRadio, SIGNAL( toggled( bool ) ), insertExpressionButton, SLOT( setEnabled( bool ) ) );
  connect( fieldComboRadio, SIGNAL( toggled( bool ) ), displayFieldComboBox, SLOT( setEnabled( bool ) ) );

  if ( !mLayer )
    return;

  QVBoxLayout *layout;

  if ( mLayer->hasGeometryType() )
  {
    // Create the Labeling dialog tab
    layout = new QVBoxLayout( labelingFrame );
    layout->setMargin( 0 );
    labelingDialog = new QgsLabelingWidget( mLayer, QgisApp::instance()->mapCanvas(), labelingFrame );
    labelingDialog->layout()->setContentsMargins( -1, 0, -1, 0 );
    layout->addWidget( labelingDialog );
    labelingFrame->setLayout( layout );

    // Create the Labeling (deprecated) dialog tab
    layout = new QVBoxLayout( labelOptionsFrame );
    layout->setMargin( 0 );
    labelDialog = new QgsLabelDialog( mLayer->label(), labelOptionsFrame );
    labelDialog->layout()->setMargin( 0 );
    layout->addWidget( labelDialog );
    labelOptionsFrame->setLayout( layout );
    connect( labelDialog, SIGNAL( labelSourceSet() ), this, SLOT( setLabelCheckBox() ) );
  }
  else
  {
    labelingDialog = nullptr;
    labelDialog = nullptr;
    mOptsPage_Labels->setEnabled( false ); // disable labeling item
    mOptsPage_LabelsOld->setEnabled( false ); // disable labeling (deprecated) item
  }

  // Create the Actions dialog tab
  QVBoxLayout *actionLayout = new QVBoxLayout( actionOptionsFrame );
  actionLayout->setMargin( 0 );
  mActionDialog = new QgsAttributeActionDialog( *mLayer->actions(), actionOptionsFrame );
  mActionDialog->layout()->setMargin( 0 );
  actionLayout->addWidget( mActionDialog );

  // Create the menu for the save style button to choose the output format
  mSaveAsMenu = new QMenu( this );
  mSaveAsMenu->addAction( tr( "QGIS Layer Style File..." ) );
  mSaveAsMenu->addAction( tr( "SLD File..." ) );

  //Only if the provider support loading & saving styles to db add new choices
  if ( mLayer->dataProvider()->isSaveAndLoadStyleToDBSupported() )
  {
    //for loading
    mLoadStyleMenu = new QMenu( this );
    mLoadStyleMenu->addAction( tr( "Load from file..." ) );
    mLoadStyleMenu->addAction( tr( "Load from database" ) );
    //mActionLoadStyle->setContextMenuPolicy( Qt::PreventContextMenu );
    mActionLoadStyle->setMenu( mLoadStyleMenu );

    QObject::connect( mLoadStyleMenu, SIGNAL( triggered( QAction * ) ),
                      this, SLOT( loadStyleMenuTriggered( QAction * ) ) );

    //for saving
    mSaveAsMenu->addAction( tr( "Save in database (%1)" ).arg( mLayer->providerType() ) );
  }
コード例 #9
0
ファイル: qgsgrassselect.cpp プロジェクト: 3liz/Quantum-GIS
QgsGrassSelect::QgsGrassSelect( QWidget *parent, int type )
    : QDialog( parent )
    , QgsGrassSelectBase()
    , selectedType( 0 )
{
  QgsDebugMsg( QString( "QgsGrassSelect() type = %1" ).arg( type ) );

  setupUi( this );
  connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
  connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );

  if ( first )
  {
    if ( QgsGrass::activeMode() )
    {
      lastGisdbase = QgsGrass::getDefaultGisdbase();
      lastLocation = QgsGrass::getDefaultLocation();
      lastMapset = QgsGrass::getDefaultMapset();
    }
    else
    {
      QSettings settings;
      lastGisdbase = settings.value( QStringLiteral( "/GRASS/lastGisdbase" ) ).toString();
      //check we got something from qsettings otherwise default to users home dir
      if ( lastGisdbase.isEmpty() )
      {
        QDir home = QDir::home();
        lastGisdbase = QString( home.path() );
      }
      lastMapset = settings.value( QStringLiteral( "/GRASS/lastMapset" ) ).toString();
    }
    first = false;
  }
  QgsGrassSelect::type = type;

  switch ( type )
  {
    case QgsGrassSelect::VECTOR:
      setWindowTitle( tr( "Select GRASS Vector Layer" ) );
      break;

    case QgsGrassSelect::RASTER:
      /* Remove layer combo box */
      Layer->hide();
      elayer->hide();
      setWindowTitle( tr( "Select GRASS Raster Layer" ) );
      break;

    case QgsGrassSelect::MAPCALC:
      /* Remove layer combo box */
      Layer->hide();
      elayer->hide();
      setWindowTitle( tr( "Select GRASS mapcalc schema" ) );
      break;

    case QgsGrassSelect::MAPSET:
      Layer->hide();
      elayer->hide();
      MapName->hide();
      emap->hide();
      setWindowTitle( tr( "Select GRASS Mapset" ) );
      break;
  }

  egisdbase->setText( lastGisdbase );

  setLocations();
  adjustSize();
}
コード例 #10
0
ファイル: diskusagegui.cpp プロジェクト: KDE/krusader
DiskUsageGUI::DiskUsageGUI(QUrl openDir, QWidget* parent)
        : QDialog(parent), exitAtFailure(true)
{
    setWindowTitle(i18n("Krusader::Disk Usage"));

    baseDirectory = openDir;
    if (!newSearch())
        return;

    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);

    QGridLayout *duGrid = new QGridLayout();
    duGrid->setSpacing(6);
    duGrid->setContentsMargins(11, 11, 11, 11);

    QWidget *duTools = new QWidget(this);
    QHBoxLayout *duHBox = new QHBoxLayout(duTools);
    duHBox->setContentsMargins(0, 0, 0, 0);
    duTools->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    btnNewSearch = new QToolButton(duTools);
    btnNewSearch->setIcon(QIcon(krLoader->loadIcon("document-open", KIconLoader::Desktop)));
    duHBox->addWidget(btnNewSearch);
    btnNewSearch->setToolTip(i18n("Start new disk usage search"));

    btnRefresh = new QToolButton(duTools);
    btnRefresh->setIcon(QIcon(krLoader->loadIcon("view-refresh", KIconLoader::Desktop)));
    duHBox->addWidget(btnRefresh);
    btnRefresh->setToolTip(i18n("Refresh"));

    btnDirUp = new QToolButton(duTools);
    btnDirUp->setIcon(QIcon(krLoader->loadIcon("go-up", KIconLoader::Desktop)));
    duHBox->addWidget(btnDirUp);
    btnDirUp->setToolTip(i18n("Parent folder"));

    QWidget * separatorWidget = new QWidget(duTools);
    separatorWidget->setMinimumWidth(10);
    duHBox->addWidget(separatorWidget);

    btnLines = new QToolButton(duTools);
    btnLines->setIcon(QIcon(krLoader->loadIcon("view-list-details", KIconLoader::Desktop)));
    btnLines->setCheckable(true);
    duHBox->addWidget(btnLines);
    btnLines->setToolTip(i18n("Line view"));

    btnDetailed = new QToolButton(duTools);
    btnDetailed->setIcon(QIcon(krLoader->loadIcon("view-list-tree", KIconLoader::Desktop)));
    btnDetailed->setCheckable(true);
    duHBox->addWidget(btnDetailed);
    btnDetailed->setToolTip(i18n("Detailed view"));

    btnFilelight = new QToolButton(duTools);
    btnFilelight->setIcon(QIcon(krLoader->loadIcon("kr_diskusage", KIconLoader::Desktop)));
    btnFilelight->setCheckable(true);
    duHBox->addWidget(btnFilelight);
    btnFilelight->setToolTip(i18n("Filelight view"));

    QWidget *spacerWidget = new QWidget(duTools);
    duHBox->addWidget(spacerWidget);
    QHBoxLayout *hboxlayout = new QHBoxLayout(spacerWidget);
    QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed);
    hboxlayout->addItem(spacer);

    duGrid->addWidget(duTools, 0, 0);

    diskUsage = new DiskUsage("DiskUsage", this);
    duGrid->addWidget(diskUsage, 1, 0);

    status = new KSqueezedTextLabel(this);
    duGrid->addWidget(status, 2, 0);

    mainLayout->addLayout(duGrid);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
    mainLayout->addWidget(buttonBox);

    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    connect(diskUsage, SIGNAL(status(QString)), this, SLOT(setStatus(QString)));
    connect(diskUsage, SIGNAL(viewChanged(int)), this, SLOT(slotViewChanged(int)));
    connect(diskUsage, SIGNAL(newSearch()), this,  SLOT(newSearch()));
    connect(diskUsage, SIGNAL(loadFinished(bool)), this,  SLOT(slotLoadFinished(bool)));
    connect(btnNewSearch, SIGNAL(clicked()), this, SLOT(newSearch()));
    connect(btnRefresh, SIGNAL(clicked()), this, SLOT(loadUsageInfo()));
    connect(btnDirUp, SIGNAL(clicked()), diskUsage, SLOT(dirUp()));
    connect(btnLines, SIGNAL(clicked()), this, SLOT(selectLinesView()));
    connect(btnDetailed, SIGNAL(clicked()), this, SLOT(selectListView()));
    connect(btnFilelight, SIGNAL(clicked()), this, SLOT(selectFilelightView()));

    KConfigGroup group(krConfig, "DiskUsage");

    int view = group.readEntry("View",  VIEW_LINES);
    if (view < VIEW_LINES || view > VIEW_FILELIGHT)
        view = VIEW_LINES;
    diskUsage->setView(view);

    sizeX = group.readEntry("Window Width",  QFontMetrics(font()).width("W") * 70);
    sizeY = group.readEntry("Window Height", QFontMetrics(font()).height() * 25);
    resize(sizeX, sizeY);

    if (group.readEntry("Window Maximized",  false))
        showMaximized();
    else
        show();

    exec();
}
コード例 #11
0
BackgroundWidget::BackgroundWidget( MasterConfiguration& configuration,
                                    QWidget* parent_ )
    : QDialog( parent_ )
    , configuration_( configuration )
    , backgroundFolder_( configuration.getDockStartDir( ))
{
    setWindowTitle( tr( "Background settings" ));

    const int frameStyle = QFrame::Sunken | QFrame::Panel;

    // Get current variables

    previousColor_ = configuration_.getBackgroundColor();
    previousBackgroundURI_ = configuration_.getBackgroundUri();

    // Color chooser

    colorLabel_ = new QLabel( previousColor_.name( ));
    colorLabel_->setFrameStyle( frameStyle );
    colorLabel_->setPalette( QPalette( previousColor_ ));
    colorLabel_->setAutoFillBackground( true );

    QPushButton* colorButton = new QPushButton(
                                   tr( "Choose background color..." ));
    connect( colorButton, SIGNAL( clicked( )), this, SLOT( chooseColor( )));


    // Background chooser

    backgroundLabel_ = new QLabel( previousBackgroundURI_ );
    backgroundLabel_->setFrameStyle( frameStyle );
    QPushButton* backgroundButton = new QPushButton(
                                        tr( "Choose background content..." ));
    connect( backgroundButton, SIGNAL( clicked( )),
             this, SLOT( openBackgroundContent( )));

    QPushButton* backgroundClearButton = new QPushButton(
                                             tr( "Remove background" ));
    connect( backgroundClearButton, SIGNAL( clicked( )),
             this, SLOT( removeBackground( )));


    // Standard buttons

    typedef QDialogButtonBox::StandardButton button;
    QDialogButtonBox* buttonBox = new QDialogButtonBox( button::Ok |
                                                        button::Cancel,
                                                        Qt::Horizontal, this );

    connect( buttonBox, SIGNAL( accepted( )), this, SLOT( accept( )));
    connect( buttonBox, SIGNAL( rejected( )), this, SLOT( reject( )));


    // Layout

    QGridLayout* gridLayout = new QGridLayout;
    gridLayout->setColumnStretch( 1, 1 );
    gridLayout->setColumnMinimumWidth( 1, 250 );
    setLayout( gridLayout );

    gridLayout->addWidget( colorButton, 0, 0 );
    gridLayout->addWidget( colorLabel_, 0, 1 );
    gridLayout->addWidget( backgroundButton, 1, 0 );
    gridLayout->addWidget( backgroundLabel_, 1, 1 );
    gridLayout->addWidget( backgroundClearButton, 2, 0 );
    gridLayout->addWidget( buttonBox, 2, 1 );
}
コード例 #12
0
ファイル: VisDijkstra.cpp プロジェクト: eduardoacye/GrafoVis
    ui_select_ending = new QComboBox;
    foreach(int id, ids){
        ui_select_ending->addItem(QString::number(id));
    }
    ui_select_ending_label = new QLabel("End vertex:");
    ui_select_ending_label->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
    ui_select_ending_layout = new QHBoxLayout;
    ui_select_ending_layout->addWidget(ui_select_ending_label);
    ui_select_ending_layout->addWidget(ui_select_ending);


    ui_buttons = new QDialogButtonBox(QDialogButtonBox::Ok |
                                      QDialogButtonBox::Cancel);

    connect(ui_buttons, SIGNAL(accepted()), this, SLOT(accept()));
    connect(ui_buttons, SIGNAL(rejected()), this, SLOT(reject()));

    ui_layout = new QVBoxLayout;
    ui_layout->addWidget(ui_description);
    ui_layout->addStretch();
    ui_layout->addLayout(ui_select_starting_layout);
    ui_layout->addLayout(ui_select_ending_layout);
    ui_layout->addWidget(ui_buttons);

    setLayout(ui_layout);

    starting_vertex = -1;
    ending_vertex = -1;
}

VisDijkstra::~VisDijkstra()
コード例 #13
0
GuitarChordSelectorDialog::GuitarChordSelectorDialog(QWidget *parent)
    : QDialog(parent)
{
    QString localStyle = "QListView {background-color: #FFFFFF; alternate-background-color: #EEEEFF; color: #000000; selection-background-color: #80AFFF; selection-color: #FFFFFF;}";
    // we'll use "localStyle" as a future search point, but switch over to a
    // more meaningful variable name for the actual style assignment
    //
    // Note that I'm just slapping another local stylesheet on these damn
    // QListView objects, because they're stubbornly refusing to be touched from
    // the external stylesheet, and I'm beyond losing patience with dicking
    // around to solve problems like this.  Our stylesheet and style code are a
    // complete mess, and I will probably have to rewrite all of this one day,
    // but not before Thorn/Abraham Darby releases.
    QString listStyle = localStyle;

    setModal(true);
    setWindowTitle(tr("Guitar Chord Selector"));
    setWindowIcon(IconLoader().loadPixmap("window-guitar"));

    QGridLayout *metagrid = new QGridLayout;
    setLayout(metagrid);
    QGroupBox *page = new QGroupBox(this);
    QGridLayout *topLayout = new QGridLayout(page);
    metagrid->addWidget(page, 0, 0);
    
    topLayout->addWidget(new QLabel(tr("Root"), page), 0, 0);
    m_rootNotesList = new QListWidget(page);
    m_rootNotesList->setStyleSheet(listStyle);
    topLayout->addWidget(m_rootNotesList, 1, 0);
    
    topLayout->addWidget(new QLabel(tr("Extension"), page), 0, 1);
    m_chordExtList = new QListWidget(page);
    m_chordExtList->setStyleSheet(listStyle);
    topLayout->addWidget(m_chordExtList, 1, 1);
    
    m_newFingeringButton = new QPushButton(tr("New"), page);
    m_deleteFingeringButton = new QPushButton(tr("Delete"), page);
    m_editFingeringButton = new QPushButton(tr("Edit"), page);
    
    m_chordComplexityCombo = new QComboBox(page);
    m_chordComplexityCombo->addItem(tr("beginner"));
    m_chordComplexityCombo->addItem(tr("common"));
    m_chordComplexityCombo->addItem(tr("all"));
    //m_chordComplexityCombo->setMinimumContentsLength(20);
    
    connect(m_chordComplexityCombo, SIGNAL(activated(int)),
            this, SLOT(slotComplexityChanged(int)));

    page->setContentsMargins(5, 5, 5, 5);
    QVBoxLayout* vboxLayout = new QVBoxLayout();
    //topLayout->addLayout(vboxLayout, 1, 2, 3, 1);
    topLayout->addLayout(vboxLayout, 2, 1);
    vboxLayout->addWidget(m_chordComplexityCombo);
    vboxLayout->addStretch(10);
    vboxLayout->addWidget(m_newFingeringButton); 
    vboxLayout->addWidget(m_deleteFingeringButton); 
    vboxLayout->addWidget(m_editFingeringButton); 
    
    connect(m_newFingeringButton, SIGNAL(clicked()),
            this, SLOT(slotNewFingering()));
    connect(m_deleteFingeringButton, SIGNAL(clicked()),
            this, SLOT(slotDeleteFingering()));
    connect(m_editFingeringButton, SIGNAL(clicked()),
            this, SLOT(slotEditFingering()));
    
    topLayout->addWidget(new QLabel(tr("Fingerings"), page), 0, 3);
    m_fingeringsList = new QListWidget(page);
    m_fingeringsList->setStyleSheet(listStyle);

    // try setting size to something 200 can be divided into evenly, in the hope
    // of avoiding fuzzy half pixel scaling problems (50 was no good, but 100
    // works well for grid lines here; dots still look awful, but who cares)
    m_fingeringsList->setIconSize(QSize(100, 100));

    topLayout->addWidget(m_fingeringsList, 1, 3, 2, 1);
    
    m_fingeringBox = new FingeringBox(false, page, true);
    topLayout->addWidget(m_fingeringBox, 2, 0, 1, 2);
    
    connect(m_rootNotesList, SIGNAL(currentRowChanged(int)),
            this, SLOT(slotRootHighlighted(int)));
    connect(m_chordExtList, SIGNAL(currentRowChanged(int)),
            this, SLOT(slotChordExtHighlighted(int)));

    // connect itemClicked() so it will fire if a user clicks directly on the
    // fingering list doodad thingummy (and comments like "fingering list doodad
    // thingummy" are what you get when you abandon half-finished code the core
    // developers don't really understand, and expect them to keep it alive for
    // you in perpetuity)
    //
    connect(m_fingeringsList, SIGNAL(itemClicked(QListWidgetItem*)),
            this, SLOT(slotFingeringHighlighted(QListWidgetItem*)));

    // connect currentRowChanged() so this can be fired when other widgets are
    // manipulated, which will cause this one to pop back up to the top.  This
    // slot triggers other updates in a leg bone connected to the thigh bone
    // fashion, so we have to wire it to some input to get those updates to
    // happen, and overloading this to fire two different ways was quick and
    // cheap
    //
    connect(m_fingeringsList, SIGNAL(currentRowChanged(int)),
            this, SLOT(slotFingeringHighlighted(int)));

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok |
                                                       QDialogButtonBox::Cancel);
    metagrid->addWidget(buttonBox, 1, 0);
    metagrid->setRowStretch(0, 10);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
コード例 #14
0
MergeContactsDialog::MergeContactsDialog(IMetaContacts *AMetaContacts, IMetaRoster *AMetaRoster, const QList<QString> AMetaIds, QWidget *AParent) : QDialog(AParent)
{
	ui.setupUi(this);
	StyleStorage::staticStorage(RSR_STORAGE_STYLESHEETS)->insertAutoStyle(this,STS_METACONTACTS_MERGECONTACTSDIALOG);
	GraphicsEffectsStorage::staticStorage(RSR_STORAGE_GRAPHICSEFFECTS)->installGraphicsEffect(this, GFX_LABELS);

	FBorder = CustomBorderStorage::staticStorage(RSR_STORAGE_CUSTOMBORDER)->addBorder(this, CBS_DIALOG);
	if (FBorder)
	{
		FBorder->setResizable(false);
		FBorder->setMinimizeButtonVisible(false);
		FBorder->setMaximizeButtonVisible(false);
		FBorder->setAttribute(Qt::WA_DeleteOnClose,true);
		FBorder->setWindowTitle(ui.lblCaption->text());
		connect(this, SIGNAL(accepted()), FBorder, SLOT(closeWidget()));
		connect(this, SIGNAL(rejected()), FBorder, SLOT(closeWidget()));
		connect(FBorder, SIGNAL(closeClicked()), SLOT(reject()));
		setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
	}
	else
	{
		ui.lblCaption->setVisible(false);
		setAttribute(Qt::WA_DeleteOnClose,true);
	}

#ifdef Q_WS_MAC
	ui.buttonsLayout->setSpacing(16);
	ui.buttonsLayout->addWidget(ui.pbtMerge);
	setWindowGrowButtonEnabled(this->window(), false);
#endif

	ui.lneName->setAttribute(Qt::WA_MacShowFocusRect, false);

	FMetaRoster = AMetaRoster;
	FMetaContacts = AMetaContacts;
	FMetaIds = AMetaIds;

	ui.lblNotice->setText(tr("These %n contacts will be merged into one:","",AMetaIds.count()));

	QString name;
	int nameCapCount = 0;
	QRegExp nameRegExp(tr("([a-z])","From first letter to last of alphabet"),Qt::CaseInsensitive);

	QSet<Jid> items;
	ui.ltContacts->addStretch();
	foreach(QString metaId, FMetaIds)
	{
		IMetaContact contact = FMetaRoster->metaContact(metaId);
		items += contact.items;

		QImage avatar = FMetaRoster->metaAvatarImage(metaId,false,false).scaled(24, 24, Qt::KeepAspectRatio,Qt::SmoothTransformation);
		QString itemName = FMetaContacts->metaContactName(contact);

		int pos = 0;
		int itemNameCapCount = 0;
		while ((pos = nameRegExp.indexIn(itemName, pos)) != -1) 
		{
			itemNameCapCount++;
			pos += nameRegExp.matchedLength();
		}
		if (nameCapCount < itemNameCapCount)
		{
			name = itemName;
			nameCapCount = itemNameCapCount;
		}
		else if (name.isEmpty())
		{
			name = itemName.trimmed();
		}

		QHBoxLayout *itemLayout = new QHBoxLayout();
		itemLayout->setContentsMargins(0, 0, 0, 0);
		itemLayout->setSpacing(8);

		QLabel *avatarLabel = new QLabel(this);
		avatarLabel->setFixedSize(24, 24);
		avatarLabel->setPixmap(QPixmap::fromImage(avatar));
		avatarLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
		itemLayout->addWidget(avatarLabel);

		QLabel *nameLabel = new QLabel(this);
		nameLabel->setText(itemName);
		itemLayout->addWidget(nameLabel);

		ui.ltContacts->addItem(itemLayout);
	}
コード例 #15
0
SettingsDialog::SettingsDialog(QWidget *parent)
    : QDialog(parent)
{
    setWindowTitle(tr("Settings"));


    m_saveChangesOnExitCheckBox = new QCheckBox(this);
    m_saveChangesOnExitCheckBox->setText(
        tr("Automatically save the changes before exiting"));

    m_saveChangesPeriodicallyCheckBox = new QCheckBox(this);
    m_saveChangesPeriodicallyCheckBox->setText(
        tr("Automatically save the changes every"));

    m_saveChangesIntervalSpinBox = new QSpinBox(this);
    m_saveChangesIntervalSpinBox->setMinimum(1);
    m_saveChangesIntervalSpinBox->setMaximum(99999);
    m_saveChangesIntervalSpinBox->setValue(5);
    m_saveChangesIntervalSpinBox->setSuffix(tr(" minutes"));
    m_saveChangesIntervalSpinBox->setEnabled(false);
    connect(m_saveChangesPeriodicallyCheckBox, SIGNAL(toggled(bool)),
            m_saveChangesIntervalSpinBox, SLOT(setEnabled(bool)));

    m_workingFinishedTrayNotifyCheckBox = new QCheckBox(this);
    m_workingFinishedTrayNotifyCheckBox->setText(
        tr("Show a notification when the working time is over"));

    m_restingFinishedTrayNotifyCheckBox = new QCheckBox(this);
    m_restingFinishedTrayNotifyCheckBox->setText(
        tr("Show a notification when the resting time is over"));


    m_playWorkingFinishedSoundCheckBox = new QCheckBox(this);
    m_playWorkingFinishedSoundCheckBox->setText(
        tr("Play a sound when the working time is over"));

    m_playRestingFinishedSoundCheckBox = new QCheckBox(this);
    m_playRestingFinishedSoundCheckBox->setText(
        tr("Play a sound when the resting time is over"));


    m_workingFinishedSoundWidget = new GetOpenFileNameWidget(this);
    m_workingFinishedSoundWidget->setFileMask(tr("Audio files (*.wav)"));
    m_workingFinishedSoundWidget->setSettingsKey(SettingsWorkingFinishedSoundFile);
    m_workingFinishedSoundWidget->setEnabled(false);
    connect(m_playWorkingFinishedSoundCheckBox, SIGNAL(toggled(bool)),
            m_workingFinishedSoundWidget, SLOT(setEnabled(bool)));

    m_restingFinishedSoundWidget = new GetOpenFileNameWidget(this);
    m_restingFinishedSoundWidget->setFileMask(tr("Audio files (*.wav)"));
    m_restingFinishedSoundWidget->setSettingsKey(SettingsRestingFinishedSoundFile);
    m_restingFinishedSoundWidget->setEnabled(false);
    connect(m_playRestingFinishedSoundCheckBox, SIGNAL(toggled(bool)),
            m_restingFinishedSoundWidget, SLOT(setEnabled(bool)));


    QGroupBox *trayIconNotifyGroupBox = new QGroupBox(this);
    trayIconNotifyGroupBox->setTitle(tr("Tray notification options"));
    trayIconNotifyGroupBox->setLayout(new QVBoxLayout);
    trayIconNotifyGroupBox->layout()->addWidget(m_workingFinishedTrayNotifyCheckBox);
    trayIconNotifyGroupBox->layout()->addWidget(m_restingFinishedTrayNotifyCheckBox);

    QGroupBox *soundNotifyGroupBox = new QGroupBox(this);
    soundNotifyGroupBox->setTitle(tr("Sound notification options"));
    soundNotifyGroupBox->setLayout(new QVBoxLayout);
    soundNotifyGroupBox->layout()->addWidget(m_playWorkingFinishedSoundCheckBox);
    soundNotifyGroupBox->layout()->addWidget(m_workingFinishedSoundWidget);
    soundNotifyGroupBox->layout()->addWidget(m_playRestingFinishedSoundCheckBox);
    soundNotifyGroupBox->layout()->addWidget(m_restingFinishedSoundWidget);

    QHBoxLayout *saveChangesEveryMinutesHBox = new QHBoxLayout;
    saveChangesEveryMinutesHBox->addWidget(m_saveChangesPeriodicallyCheckBox);
    saveChangesEveryMinutesHBox->addWidget(m_saveChangesIntervalSpinBox);

    QGroupBox *savingGroupBox = new QGroupBox(this);
    savingGroupBox->setTitle(tr("Save options"));
    savingGroupBox->setLayout(new QVBoxLayout);
    savingGroupBox->layout()->addWidget(m_saveChangesOnExitCheckBox);
    static_cast<QVBoxLayout *>(savingGroupBox->layout())->addLayout(saveChangesEveryMinutesHBox);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
    buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    QVBoxLayout *vbox = new QVBoxLayout;
    vbox->addWidget(savingGroupBox);
    vbox->addWidget(trayIconNotifyGroupBox);
    vbox->addWidget(soundNotifyGroupBox);
    vbox->addItem(new QSpacerItem(10, 10, QSizePolicy::Expanding, QSizePolicy::Expanding));
    vbox->addWidget(buttonBox);
    setLayout(vbox);
}
コード例 #16
0
ファイル: execute.cpp プロジェクト: KDE/kstars
Execute::Execute() {
    QWidget *w = new QWidget;
    ui.setupUi( w );
#ifdef Q_OS_OSX
        setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(w);
    setLayout(mainLayout);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
    mainLayout->addWidget(buttonBox);
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    QPushButton *execB = new QPushButton(i18n("End Session"));
    QPushButton *addObs = new QPushButton(i18n("Manage Observers"));
    execB->setToolTip(i18n("Save and End the current session"));
    buttonBox->addButton(execB, QDialogButtonBox::ActionRole);
    buttonBox->addButton(addObs, QDialogButtonBox::ActionRole);
    connect(execB, SIGNAL(clicked()), this, SLOT(slotEndSession()));
    connect(addObs,SIGNAL(clicked()),this,SLOT(slotObserverAdd()));

    setWindowTitle( i18n( "Execute Session" ) );

    currentTarget = NULL;
    currentObserver = NULL;
    currentScope = NULL;
    currentEyepiece = NULL;
    currentLens = NULL;
    currentFilter = NULL;
    currentSession = NULL;
    nextSession = 0;
    nextObservation = 0;
    nextSite = 0;

    //initialize the global logObject
    logObject = KStarsData::Instance()->logObject();

    //initialize the lists and parameters
    init();
    ui.Target->hide();
    ui.AddObject->hide();
    ui.RemoveObject->hide();
    ui.NextButton->hide();
    ui.NextButton->setEnabled( false );
    ui.Slew->setEnabled( false );

    //make connections
    connect( ui.NextButton, SIGNAL( clicked() ),
             this, SLOT( slotNext() ) );
    connect( ui.Slew, SIGNAL( clicked() ),
             this, SLOT( slotSlew() ) );
    connect( ui.Location, SIGNAL( clicked() ),
             this, SLOT( slotLocation() ) );
    connect( ui.Target, SIGNAL( currentTextChanged(const QString) ),
             this, SLOT( slotSetTarget(QString) ) );
    connect( ui.SessionURL, SIGNAL( leftClickedUrl() ),
             this, SLOT( slotShowSession() ) );
    connect( ui.ObservationsURL, SIGNAL( leftClickedUrl() ),
             this, SLOT( slotShowTargets() ) );
    connect( ui.AddObject, SIGNAL( leftClickedUrl() ),
             this, SLOT( slotAddObject() ) );
    connect( ui.RemoveObject, SIGNAL( leftClickedUrl() ),
             this, SLOT( slotRemoveObject() ) );
}
コード例 #17
0
ファイル: UIVMCloseDialog.cpp プロジェクト: miguelinux/vbox
void UIVMCloseDialog::prepare()
{
    /* Prepare 'main' layout: */
    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
    {
        /* Prepare 'top' layout: */
        QHBoxLayout *pTopLayout = new QHBoxLayout;
        {
            /* Prepare 'top-left' layout: */
            QVBoxLayout *pTopLeftLayout = new QVBoxLayout;
            {
                /* Prepare 'icon': */
                m_pIcon = new QLabel(this);
                {
                    /* Configure icon: */
                    m_pIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
                    m_pIcon->setPixmap(QPixmap(":/os_unknown.png"));
                }
                /* Configure layout: */
                pTopLeftLayout->setSpacing(0);
                pTopLeftLayout->setContentsMargins(0, 0, 0, 0);
                pTopLeftLayout->addWidget(m_pIcon);
                pTopLeftLayout->addStretch();
            }
            /* Prepare 'top-right' layout: */
            QVBoxLayout *pTopRightLayout = new QVBoxLayout;
            {
                /* Prepare 'text' label: */
                m_pLabel = new QLabel(this);
                /* Prepare 'choice' layout: */
                QGridLayout *pChoiceLayout = new QGridLayout;
                {
                    /* Prepare 'detach' icon: */
                    m_pDetachIcon = new QLabel(this);
                    {
                        /* Configure icon: */
                        m_pDetachIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
                        m_pDetachIcon->setPixmap(QPixmap(":/vm_create_shortcut_16px.png"));
                    }
                    /* Prepare 'detach' radio-button: */
                    m_pDetachRadio = new QRadioButton(this);
                    {
                        /* Configure button: */
                        m_pDetachRadio->installEventFilter(this);
                        connect(m_pDetachRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability()));
                    }
                    /* Prepare 'save' icon: */
                    m_pSaveIcon = new QLabel(this);
                    {
                        /* Configure icon: */
                        m_pSaveIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
                        m_pSaveIcon->setPixmap(QPixmap(":/vm_save_state_16px.png"));
                    }
                    /* Prepare 'save' radio-button: */
                    m_pSaveRadio = new QRadioButton(this);
                    {
                        /* Configure button: */
                        m_pSaveRadio->installEventFilter(this);
                        connect(m_pSaveRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability()));
                    }
                    /* Prepare 'shutdown' icon: */
                    m_pShutdownIcon = new QLabel(this);
                    {
                        /* Configure icon: */
                        m_pShutdownIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
                        m_pShutdownIcon->setPixmap(QPixmap(":/vm_shutdown_16px.png"));
                    }
                    /* Prepare 'shutdown' radio-button: */
                    m_pShutdownRadio = new QRadioButton(this);
                    {
                        /* Configure button: */
                        m_pShutdownRadio->installEventFilter(this);
                        connect(m_pShutdownRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability()));
                    }
                    /* Prepare 'power-off' icon: */
                    m_pPowerOffIcon = new QLabel(this);
                    {
                        /* Configure icon: */
                        m_pPowerOffIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
                        m_pPowerOffIcon->setPixmap(QPixmap(":/vm_poweroff_16px.png"));
                    }
                    /* Prepare 'shutdown' radio-button: */
                    m_pPowerOffRadio = new QRadioButton(this);
                    {
                        /* Configure button: */
                        m_pPowerOffRadio->installEventFilter(this);
                        connect(m_pPowerOffRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability()));
                    }
                    /* Prepare 'discard' check-box: */
                    m_pDiscardCheckBox = new QCheckBox(this);
                    /* Configure layout: */
#ifdef VBOX_WS_MAC
                    pChoiceLayout->setSpacing(15);
#else /* VBOX_WS_MAC */
                    pChoiceLayout->setSpacing(6);
#endif /* !VBOX_WS_MAC */
                    pChoiceLayout->setContentsMargins(0, 0, 0, 0);
                    pChoiceLayout->addWidget(m_pDetachIcon, 0, 0);
                    pChoiceLayout->addWidget(m_pDetachRadio, 0, 1);
                    pChoiceLayout->addWidget(m_pSaveIcon, 1, 0);
                    pChoiceLayout->addWidget(m_pSaveRadio, 1, 1);
                    pChoiceLayout->addWidget(m_pShutdownIcon, 2, 0);
                    pChoiceLayout->addWidget(m_pShutdownRadio, 2, 1);
                    pChoiceLayout->addWidget(m_pPowerOffIcon, 3, 0);
                    pChoiceLayout->addWidget(m_pPowerOffRadio, 3, 1);
                    pChoiceLayout->addWidget(m_pDiscardCheckBox, 4, 1);
                }
                /* Configure layout: */
#ifdef VBOX_WS_MAC
                pTopRightLayout->setSpacing(15);
#else /* VBOX_WS_MAC */
                pTopRightLayout->setSpacing(6);
#endif /* !VBOX_WS_MAC */
                pTopRightLayout->setContentsMargins(0, 0, 0, 0);
                pTopRightLayout->addWidget(m_pLabel);
                pTopRightLayout->addItem(pChoiceLayout);
            }
            /* Configure layout: */
            pTopLayout->setSpacing(20);
            pTopLayout->setContentsMargins(0, 0, 0, 0);
            pTopLayout->addItem(pTopLeftLayout);
            pTopLayout->addItem(pTopRightLayout);
        }
        /* Prepare button-box: */
        QIDialogButtonBox *pButtonBox = new QIDialogButtonBox(this);
        {
            /* Configure button-box: */
            pButtonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::NoButton | QDialogButtonBox::Ok);
            connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
            connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
            connect(pButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog()));
        }
        /* Configure layout: */
        pMainLayout->setSpacing(20);
#ifdef VBOX_WS_MAC
        pMainLayout->setContentsMargins(40, 20, 40, 20);
#endif /* VBOX_WS_MAC */
        pMainLayout->addItem(pTopLayout);
        pMainLayout->addWidget(pButtonBox);
    }
    /* Prepare size-grip token: */
    setSizeGripEnabled(false);
}
コード例 #18
0
    PreferencesDialog::PreferencesDialog(QWidget *parent)
        : BaseClass(parent)
    {
        setWindowIcon(GuiRegistry::instance().mainWindowIcon());

        setWindowTitle("Preferences " PROJECT_NAME_TITLE);
        setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
        setFixedSize(height,width);

        QVBoxLayout *layout = new QVBoxLayout(this);

        QHBoxLayout *defLayout = new QHBoxLayout(this);
        QLabel *defDisplayModeLabel = new QLabel("Default display mode:");
        defLayout->addWidget(defDisplayModeLabel);
        _defDisplayModeComboBox = new QComboBox();
        QStringList modes;
        for (int i = Text;i<=Custom;++i)
        {
            modes.append(convertViewModeToString(static_cast<ViewMode>(i)));
        }
        _defDisplayModeComboBox->addItems(modes);
        defLayout->addWidget(_defDisplayModeComboBox);
        layout->addLayout(defLayout);

        QHBoxLayout *timeZoneLayout = new QHBoxLayout(this);
        QLabel *timeZoneLabel = new QLabel("Display Dates in:");
        timeZoneLayout->addWidget(timeZoneLabel);
        _timeZoneComboBox = new QComboBox();
        QStringList times;
        for (int i = Utc;i<=LocalTime;++i)
        {
            times.append(convertTimesToString(static_cast<SupportedTimes>(i)));
        }
        _timeZoneComboBox->addItems(times);
        timeZoneLayout->addWidget(_timeZoneComboBox);
        layout->addLayout(timeZoneLayout);

        QHBoxLayout *uuidEncodingLayout = new QHBoxLayout(this);
        QLabel *uuidEncodingLabel = new QLabel("Legacy UUID Encoding:");
        uuidEncodingLayout->addWidget(uuidEncodingLabel);
        _uuidEncodingComboBox = new QComboBox();
        QStringList uuids;
        for (int i = DefaultEncoding;i<=PythonLegacy;++i)
        {
            uuids.append(convertUUIDEncodingToString(static_cast<UUIDEncoding>(i)));
        }
        _uuidEncodingComboBox->addItems(uuids);
        uuidEncodingLayout->addWidget(_uuidEncodingComboBox);
        layout->addLayout(uuidEncodingLayout);        

        _loadMongoRcJsCheckBox = new QCheckBox("Load .mongorc.js");
        layout->addWidget(_loadMongoRcJsCheckBox);

        _disabelConnectionShortcutsCheckBox = new QCheckBox("Disable connection shortcuts");
        layout->addWidget(_disabelConnectionShortcutsCheckBox);

        QHBoxLayout *stylesLayout = new QHBoxLayout(this);
        QLabel *stylesLabel = new QLabel("Styles:");
        stylesLayout->addWidget(stylesLabel);
        _stylesComboBox = new QComboBox();
        _stylesComboBox->addItems(detail::getSupportedStyles());
        stylesLayout->addWidget(_stylesComboBox);
        layout->addLayout(stylesLayout);   

        QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
        buttonBox->setOrientation(Qt::Horizontal);
        buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save);
        VERIFY(connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())));
        VERIFY(connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())));
        layout->addWidget(buttonBox);
        setLayout(layout);

        syncWithSettings();
    }
コード例 #19
0
    /**
     * @brief Creates dialog
     */
    ConnectionsDialog::ConnectionsDialog(SettingsManager *settingsManager) : QDialog()
    {
        setWindowIcon(GuiRegistry::instance().connectIcon());
        setWindowTitle("MongoDB Connections");

        // Remove help button (?)
        setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);

        _settingsManager = settingsManager;
        connect(_settingsManager, SIGNAL(connectionAdded(ConnectionSettings *)), this, SLOT(add(ConnectionSettings*)));
        connect(_settingsManager, SIGNAL(connectionUpdated(ConnectionSettings *)), this, SLOT(update(ConnectionSettings*)));
        connect(_settingsManager, SIGNAL(connectionRemoved(ConnectionSettings *)), this, SLOT(remove(ConnectionSettings*)));

        QAction *addAction = new QAction("&Add", this);
        connect(addAction, SIGNAL(triggered()), this, SLOT(add()));

        QAction *editAction = new QAction("&Edit", this);
        connect(editAction, SIGNAL(triggered()), this, SLOT(edit()));

        QAction *cloneAction = new QAction("&Clone", this);
        connect(cloneAction, SIGNAL(triggered()), this, SLOT(clone()));

        QAction *removeAction = new QAction("&Remove", this);
        connect(removeAction, SIGNAL(triggered()), this, SLOT(remove()));

        _listWidget = new ConnectionsTreeWidget;
        GuiRegistry::instance().setAlternatingColor(_listWidget);
        _listWidget->setIndentation(5);

        QStringList colums;
        colums << "Name" << "Address" << "Auth. Database / User";
        _listWidget->setHeaderLabels(colums);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
        _listWidget->header()->setSectionResizeMode(0, QHeaderView::Stretch);
        _listWidget->header()->setSectionResizeMode(1, QHeaderView::Stretch);
        _listWidget->header()->setSectionResizeMode(2, QHeaderView::Stretch);
#endif
        //_listWidget->setViewMode(QListView::ListMode);
        _listWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
        _listWidget->addAction(addAction);
        _listWidget->addAction(editAction);
        _listWidget->addAction(cloneAction);
        _listWidget->addAction(removeAction);
        _listWidget->setSelectionMode(QAbstractItemView::SingleSelection); // single item can be draged or droped
        _listWidget->setDragEnabled(true);
        _listWidget->setDragDropMode(QAbstractItemView::InternalMove);
        _listWidget->setMinimumHeight(300);
        _listWidget->setMinimumWidth(630);
        connect(_listWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(accept()));
        connect(_listWidget, SIGNAL(layoutChanged()), this, SLOT(listWidget_layoutChanged()));

        QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
        buttonBox->setOrientation(Qt::Horizontal);
        buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save);
        buttonBox->button(QDialogButtonBox::Save)->setIcon(GuiRegistry::instance().serverIcon());
        buttonBox->button(QDialogButtonBox::Save)->setText("C&onnect");
        connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
        connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

        QHBoxLayout *bottomLayout = new QHBoxLayout;
        bottomLayout->addWidget(buttonBox);

        QLabel *intro = new QLabel(
            "<a href='create'>Create</a>, "
            "<a href='edit'>edit</a>, <a href='remove'>remove</a>, <a href='clone'>clone</a> or reorder connections via drag'n'drop.");
        intro->setWordWrap(true);
        connect(intro, SIGNAL(linkActivated(QString)), this, SLOT(linkActivated(QString)));

        QVBoxLayout *firstColumnLayout = new QVBoxLayout;
        firstColumnLayout->addWidget(intro);
        firstColumnLayout->addWidget(_listWidget, 1);
        firstColumnLayout->addLayout(bottomLayout);

        QHBoxLayout *mainLayout = new QHBoxLayout(this);
        mainLayout->addLayout(firstColumnLayout, 1);

        // Populate list with connections
        foreach(ConnectionSettings *connectionModel, _settingsManager->connections())
            add(connectionModel);

        // Highlight first item
        if (_listWidget->topLevelItemCount() > 0)
            _listWidget->setCurrentItem(_listWidget->topLevelItem(0));

        _listWidget->setFocus();
    }
コード例 #20
0
ファイル: ksplittransactiondlg.cpp プロジェクト: KDE/kmymoney
int KSplitTransactionDlg::exec()
{
    // for deposits, we invert the sign of all splits.
    // don't forget to revert when we're done ;-)
    if (m_isDeposit) {
        for (int i = 0; i < m_transaction.splits().count(); ++i) {
            MyMoneySplit split = m_transaction.splits()[i];
            split.setValue(-split.value());
            split.setShares(-split.shares());
            m_transaction.modifySplit(split);
        }
    }

    int rc;
    do {
        transactionsTable->setFocus();

        // initialize the display
        transactionsTable->setTransaction(m_transaction, m_split, m_account);
        updateSums();

        rc = KSplitTransactionDlgDecl::exec();

        if (rc == Accepted) {
            if (!diffAmount().isZero()) {
                KSplitCorrectionDlgDecl* corrDlg = new KSplitCorrectionDlgDecl(this);
                QVBoxLayout *mainLayout = new QVBoxLayout;
                corrDlg->setLayout(mainLayout);
                mainLayout->addWidget(corrDlg->findChild<QWidget*>("verticalLayout"));
                QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
                connect(buttonBox, SIGNAL(accepted()), corrDlg, SLOT(accept()));
                connect(buttonBox, SIGNAL(rejected()), corrDlg, SLOT(reject()));
                mainLayout->addWidget(buttonBox);
                corrDlg->buttonGroup->setId(corrDlg->continueBtn, 0);
                corrDlg->buttonGroup->setId(corrDlg->changeBtn, 1);
                corrDlg->buttonGroup->setId(corrDlg->distributeBtn, 2);
                corrDlg->buttonGroup->setId(corrDlg->leaveBtn, 3);

                corrDlg->setModal(true);

                MyMoneySplit split = m_transaction.splits()[0];
                QString total = (-split.value()).formatMoney("", m_precision);
                QString sums = splitsValue().formatMoney("", m_precision);
                QString diff = diffAmount().formatMoney("", m_precision);

                // now modify the text items of the dialog to contain the correct values
                QString q = i18n("The total amount of this transaction is %1 while "
                                 "the sum of the splits is %2. The remaining %3 are "
                                 "unassigned.", total, sums, diff);
                corrDlg->explanation->setText(q);

                q = i18n("Change &total amount of transaction to %1.", sums);
                corrDlg->changeBtn->setText(q);

                q = i18n("&Distribute difference of %1 among all splits.", diff);
                corrDlg->distributeBtn->setText(q);
                // FIXME remove the following line once distribution among
                //       all splits is implemented
                corrDlg->distributeBtn->hide();


                // if we have only two splits left, we don't allow leaving sth. unassigned.
                if (m_transaction.splitCount() < 3) {
                    q = i18n("&Leave total amount of transaction at %1.", total);
                } else {
                    q = i18n("&Leave %1 unassigned.", diff);
                }
                corrDlg->leaveBtn->setText(q);

                if ((rc = corrDlg->exec()) == Accepted) {
                    switch (corrDlg->buttonGroup->checkedId()) {
                    case 0:       // continue to edit
                        rc = Rejected;
                        break;

                    case 1:       // modify total
                        split.setValue(-splitsValue());
                        split.setShares(-splitsValue());
                        m_transaction.modifySplit(split);
                        break;

                    case 2:       // distribute difference
                        qDebug("distribution of difference not yet supported in KSplitTransactionDlg::slotFinishClicked()");
                        break;

                    case 3:       // leave unassigned
                        break;
                    }
                }
                delete corrDlg;
            }
        } else
            break;

    } while (rc != Accepted);

    // for deposits, we inverted the sign of all splits.
    // now we revert it back, so that things are left correct
    if (m_isDeposit) {
        for (int i = 0; i < m_transaction.splits().count(); ++i) {
            MyMoneySplit split = m_transaction.splits()[i];
            split.setValue(-split.value());
            split.setShares(-split.shares());
            m_transaction.modifySplit(split);
        }
    }

    return rc;
}
コード例 #21
0
ファイル: rpc_prot.c プロジェクト: hkoehler/ntirpc
/*
 * given a reply message, fills in the error
 */
void
_seterr_reply(struct rpc_msg *msg, struct rpc_err *error)
{
	assert(msg != NULL);
	assert(error != NULL);

	/* optimized for normal, SUCCESSful case */
	switch (msg->rm_reply.rp_stat) {

	case MSG_ACCEPTED:
		if (msg->acpted_rply.ar_stat == SUCCESS) {
			error->re_status = RPC_SUCCESS;
			return;
		}
		accepted(msg->acpted_rply.ar_stat, error);
		break;

	case MSG_DENIED:
		rejected(msg->rjcted_rply.rj_stat, error);
		break;

	default:
		error->re_status = RPC_FAILED;
		error->re_lb.s1 = (int32_t) (msg->rm_reply.rp_stat);
		break;
	}
	switch (error->re_status) {

	case RPC_VERSMISMATCH:
		error->re_vers.low = msg->rjcted_rply.rj_vers.low;
		error->re_vers.high = msg->rjcted_rply.rj_vers.high;
		break;

	case RPC_AUTHERROR:
		error->re_why = msg->rjcted_rply.rj_why;
		break;

	case RPC_PROGVERSMISMATCH:
		error->re_vers.low = msg->acpted_rply.ar_vers.low;
		error->re_vers.high = msg->acpted_rply.ar_vers.high;
		break;

	case RPC_FAILED:
	case RPC_SUCCESS:
	case RPC_PROGNOTREGISTERED:
	case RPC_PMAPFAILURE:
	case RPC_UNKNOWNPROTO:
	case RPC_UNKNOWNHOST:
	case RPC_SYSTEMERROR:
	case RPC_CANTDECODEARGS:
	case RPC_PROCUNAVAIL:
	case RPC_PROGUNAVAIL:
	case RPC_TIMEDOUT:
	case RPC_CANTRECV:
	case RPC_CANTSEND:
	case RPC_CANTDECODERES:
	case RPC_CANTENCODEARGS:
	default:
		break;
	}
}
コード例 #22
0
ファイル: ksplittransactiondlg.cpp プロジェクト: KDE/kmymoney
KSplitTransactionDlg::KSplitTransactionDlg(const MyMoneyTransaction& t,
        const MyMoneySplit& s,
        const MyMoneyAccount& acc,
        const bool amountValid,
        const bool deposit,
        const MyMoneyMoney& calculatedValue,
        const QMap<QString, MyMoneyMoney>& priceInfo,
        QWidget* parent) :
    KSplitTransactionDlgDecl(parent),
    m_account(acc),
    m_split(s),
    m_precision(2),
    m_amountValid(amountValid),
    m_isDeposit(deposit),
    m_calculatedValue(calculatedValue)
{
    setModal(true);

    QHBoxLayout *mainLayout = new QHBoxLayout;
    setLayout(mainLayout);
    mainLayout->addWidget(horizontalLayoutWidget);

    m_buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
    QPushButton *okButton = m_buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    QPushButton *user1Button = new QPushButton;
    m_buttonBox->addButton(user1Button, QDialogButtonBox::ActionRole);
    QPushButton *user2Button = new QPushButton;
    m_buttonBox->addButton(user2Button, QDialogButtonBox::ActionRole);
    QPushButton *user3Button = new QPushButton;
    m_buttonBox->addButton(user3Button, QDialogButtonBox::ActionRole);
    connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    m_buttonBox->setOrientation(Qt::Vertical);
    mainLayout->addWidget(m_buttonBox);

    //set custom buttons
    //clearAll button
    user1Button->setText(i18n("Clear &All"));
    user1Button->setToolTip(i18n("Clear all splits"));
    user1Button->setWhatsThis(i18n("Use this to clear all splits of this transaction"));
    user1Button->setIcon(QIcon::fromTheme("edit-clear"));

    //clearZero button
    user2Button->setText(i18n("Clear &Zero"));
    user2Button->setToolTip(i18n("Removes all splits that have a value of zero"));
    user2Button->setIcon(QIcon::fromTheme("edit-clear"));

    //merge button
    user3Button->setText(i18n("&Merge"));
    user3Button->setToolTip(i18n("Merges splits with the same category to one split"));
    user3Button->setWhatsThis(i18n("In case you have multiple split entries to the same category and you like to keep them as a single split"));

    // make finish the default
    m_buttonBox->button(QDialogButtonBox::Cancel)->setDefault(true);

    // setup the focus
    m_buttonBox->button(QDialogButtonBox::Cancel)->setFocusPolicy(Qt::NoFocus);
    okButton->setFocusPolicy(Qt::NoFocus);
    user1Button->setFocusPolicy(Qt::NoFocus);

    // connect signals with slots
    connect(transactionsTable, SIGNAL(transactionChanged(MyMoneyTransaction)),
            this, SLOT(slotSetTransaction(MyMoneyTransaction)));
    connect(transactionsTable, SIGNAL(createCategory(QString,QString&)), this, SLOT(slotCreateCategory(QString,QString&)));
    connect(transactionsTable, SIGNAL(objectCreation(bool)), this, SIGNAL(objectCreation(bool)));

    connect(transactionsTable, SIGNAL(returnPressed()), this, SLOT(accept()));
    connect(transactionsTable, SIGNAL(escapePressed()), this, SLOT(reject()));
    connect(transactionsTable, SIGNAL(editStarted()), this, SLOT(slotEditStarted()));
    connect(transactionsTable, SIGNAL(editFinished()), this, SLOT(slotUpdateButtons()));

    connect(m_buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));
    connect(m_buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(accept()));
    connect(user1Button, SIGNAL(clicked()), this, SLOT(slotClearAllSplits()));
    connect(user3Button, SIGNAL(clicked()), this, SLOT(slotMergeSplits()));
    connect(user2Button, SIGNAL(clicked()), this, SLOT(slotClearUnusedSplits()));

    // setup the precision
    try {
        MyMoneySecurity currency = MyMoneyFile::instance()->currency(t.commodity());
        m_precision = MyMoneyMoney::denomToPrec(m_account.fraction(currency));
    } catch (const MyMoneyException &) {
    }

    slotSetTransaction(t);

    // pass on those vars
    transactionsTable->setup(priceInfo, m_precision);

    QSize size(width(), height());
    KConfigGroup grp = KSharedConfig::openConfig()->group("SplitTransactionEditor");
    size = grp.readEntry("Geometry", size);
    size.setHeight(size.height() - 1);
    QDialog::resize(size.expandedTo(minimumSizeHint()));

    // Trick: it seems, that the initial sizing of the dialog does
    // not work correctly. At least, the columns do not get displayed
    // correct. Reason: the return value of transactionsTable->visibleWidth()
    // is incorrect. If the widget is visible, resizing works correctly.
    // So, we let the dialog show up and resize it then. It's not really
    // clean, but the only way I got the damned thing working.
    QTimer::singleShot(10, this, SLOT(initSize()));
}
コード例 #23
0
ConnectionDialog::ConnectionDialog (QWidget *parent)
	: QDialog (parent)
{
	fSettings settings;

	uriLabel = new QLabel (tr ("IRC URI"), this);
	uriLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);

	uriEdit = new QLineEdit (this);
	connect (uriEdit, SIGNAL (textChanged (QString)), this, SLOT (uriChanged (QString)));

	serverLabel = new QLabel (tr ("IRC server"), this);
	serverLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);

	serverEdit = new QComboBox (this);
	serverEdit->setEditable (true);
	serverEdit->addItems(settings.value("Connection/Servers", QStringList()).toStringList());
	serverEdit->setCurrentIndex (-1);
	connect (serverEdit, SIGNAL (editTextChanged (QString)), this, SLOT (serverChanged ()));
	connect (serverEdit, SIGNAL (editTextChanged (QString)), this, SLOT (updateUri ()));

	roomLabel = new QLabel (tr ("Room"), this);
	roomLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);

	roomEdit = new QComboBox (this);
	roomEdit->setEditable (true);
	roomEdit->setEnabled (false);
	connect (roomEdit, SIGNAL (editTextChanged (QString)), this, SLOT (updateUri ()));

	nickLabel = new QLabel (tr ("Nick"), this);
	nickLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);

	nickEdit = new QComboBox (this);
	nickEdit->setEditable (true);
	nickEdit->setEnabled (false);

	encodingLabel = new QLabel (tr ("Encoding"), this);
	encodingLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);

	encodingEdit = new QComboBox (this);
	encodingEdit->setEditable (false);

	{
		QList<int> textCodecs = QTextCodec::availableMibs();

		for (QList<int>::iterator it = textCodecs.begin (), end = textCodecs.end (); it != end; it++) {
			encodingEdit->addItem (QTextCodec::codecForMib(*it)->name());
		}
		encodingEdit->setCurrentIndex (encodingEdit->findText ("UTF-8"));
	}

	QGridLayout *layout = new QGridLayout ();
	layout->addWidget (uriLabel, 0, 0);
	layout->addWidget (uriEdit, 0, 1);
	layout->addWidget (serverLabel, 1, 0);
	layout->addWidget (serverEdit, 1, 1);
	layout->addWidget (roomLabel, 2, 0);
	layout->addWidget (roomEdit, 2, 1);
	layout->addWidget (nickLabel, 3, 0);
	layout->addWidget (nickEdit, 3, 1);
	layout->addWidget (encodingLabel, 4, 0);
	layout->addWidget (encodingEdit, 4, 1);

	QDialogButtonBox *buttonBox = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
				Qt::Horizontal,
				this);
	connect (buttonBox, SIGNAL (accepted ()), this, SLOT (saveAndAccept ()));
	connect (buttonBox, SIGNAL (rejected ()), this, SLOT (reject ()));

	QVBoxLayout *mainLayout = new QVBoxLayout ();
	mainLayout->addLayout (layout);
	mainLayout->addWidget (buttonBox);

	setLayout (mainLayout);

	serverEdit->setCurrentIndex(settings.value("Connection/LastServer", -1).toInt ());
}
コード例 #24
0
PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
{
	// check if the options were previously stored in the settings; if not use some defaults.
	QSettings s;
	bool stored = s.childGroups().contains(SETTINGS_GROUP);
	if (!stored) {
		printOptions.print_selected = true;
		printOptions.color_selected = true;
		printOptions.landscape = false;
	} else {
		s.beginGroup(SETTINGS_GROUP);
		printOptions.type = (print_options::print_type)s.value("type").toInt();
		printOptions.print_selected = s.value("print_selected").toBool();
		printOptions.color_selected = s.value("color_selected").toBool();
		printOptions.landscape = s.value("landscape").toBool();
		qprinter.setOrientation((QPrinter::Orientation)printOptions.landscape);
	}

	// create a print options object and pass our options struct
	optionsWidget = new PrintOptions(this, &printOptions);

	// create a new printer object
	printer = new Printer(&qprinter);

	QVBoxLayout *layout = new QVBoxLayout(this);
	setLayout(layout);

	layout->addWidget(optionsWidget);

	progressBar = new QProgressBar();
	progressBar->setMinimum(0);
	progressBar->setMaximum(100);
	progressBar->setValue(0);
	progressBar->setTextVisible(false);
	layout->addWidget(progressBar);

	QHBoxLayout *hLayout = new QHBoxLayout();
	layout->addLayout(hLayout);

	QPushButton *printButton = new QPushButton(tr("P&rint"));
	connect(printButton, SIGNAL(clicked(bool)), this, SLOT(printClicked()));

	QPushButton *previewButton = new QPushButton(tr("&Preview"));
	connect(previewButton, SIGNAL(clicked(bool)), this, SLOT(previewClicked()));

	QDialogButtonBox *buttonBox = new QDialogButtonBox;
	buttonBox->addButton(QDialogButtonBox::Cancel);
	buttonBox->addButton(printButton, QDialogButtonBox::AcceptRole);
	buttonBox->addButton(previewButton, QDialogButtonBox::ActionRole);

	connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

	hLayout->addWidget(buttonBox);

	setWindowTitle(tr("Print"));
	setWindowIcon(QIcon(":subsurface-icon"));

	QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
	connect(close, SIGNAL(activated()), this, SLOT(close()));
	QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
	connect(quit, SIGNAL(activated()), parent, SLOT(close()));

	// seems to be the most reliable way to track for all sorts of dialog disposal.
	connect(this, SIGNAL(finished(int)), this, SLOT(onFinished()));
}
コード例 #25
0
bool RegisterStream::xmppStanzaIn(IXmppStream *AXmppStream, Stanza &AStanza, int AOrder)
{
	if (AXmppStream==FXmppStream && AOrder==XSHO_XMPP_FEATURE)
	{
		if (AStanza.id() == "getReg")
		{
			if (AStanza.type() == "result")
			{
				LOG_STRM_INFO(AXmppStream->streamJid(),"Account registration fileds loaded");

				QDomElement queryElem = AStanza.firstElement("query",NS_JABBER_REGISTER);
				QDomElement formElem = Stanza::findElement(queryElem,"x",NS_JABBER_DATA);
				if (FDataForms && !formElem.isNull())
				{
					IDataForm form = FDataForms->dataForm(formElem);
					if (FDataForms->isFormValid(form))
					{
						int userFiled = FDataForms->fieldIndex("username",form.fields);
						if (userFiled >= 0)
						{
							form.fields[userFiled].value = FXmppStream->streamJid().node();
							form.fields[userFiled].type = DATAFIELD_TYPE_HIDDEN;
						}

						int passFiled = FDataForms->fieldIndex("password",form.fields);
						if (passFiled >= 0)
						{
							form.fields[passFiled].value = FXmppStream->getSessionPassword();
							form.fields[passFiled].type = DATAFIELD_TYPE_HIDDEN;
						}

						FDialog = FDataForms->dialogWidget(form,NULL);
						FDialog->setAllowInvalid(false);
						FDialog->instance()->setWindowTitle(tr("Registration on %1").arg(FXmppStream->streamJid().domain()));
						connect(FDialog->instance(),SIGNAL(accepted()),SLOT(onRegisterDialogAccepred()));
						connect(FDialog->instance(),SIGNAL(rejected()),SLOT(onRegisterDialogRejected()));
						WidgetManager::showActivateRaiseWindow(FDialog->instance());
						FXmppStream->setKeepAliveTimerActive(false);

						LOG_STRM_INFO(AXmppStream->streamJid(),"Account registration form dialog shown");
					}
					else
					{
						LOG_STRM_WARNING(AXmppStream->streamJid(),"Failed to register new account on server: Invalid registration form received");
						emit error(XmppError(IERR_REGISTER_INVALID_FORM));
					}
				}
				else
				{
					Stanza submit("iq");
					submit.setType("set").setId("setReg");
					QDomElement querySubmit = submit.addElement("query",NS_JABBER_REGISTER);
					if (!queryElem.firstChildElement("username").isNull())
						querySubmit.appendChild(submit.createElement("username")).appendChild(submit.createTextNode(FXmppStream->streamJid().node()));
					if (!queryElem.firstChildElement("password").isNull())
						querySubmit.appendChild(submit.createElement("password")).appendChild(submit.createTextNode(FXmppStream->getSessionPassword()));
					if (!queryElem.firstChildElement("key").isNull())
						querySubmit.appendChild(submit.createElement("key")).appendChild(submit.createTextNode(AStanza.firstElement("query").attribute("key")));
					FXmppStream->sendStanza(submit);

					LOG_STRM_INFO(AXmppStream->streamJid(),"Account registration submit request sent");
				}
			}
			else
			{
				XmppStanzaError err(AStanza);
				LOG_STRM_WARNING(AXmppStream->streamJid(),QString("Failed to load account registration fields: %1").arg(err.condition()));
				emit error(err);
			}
			return true;
		}
		else if (AStanza.id() == "setReg")
		{
			FXmppStream->removeXmppStanzaHandler(XSHO_XMPP_FEATURE,this);
			if (AStanza.type() == "result")
			{
				REPORT_EVENT(SEVP_REGISTRATION_STREAM_SUCCESS,1);
				LOG_STRM_INFO(AXmppStream->streamJid(),"Account registration submit accepted");
				deleteLater();
				emit finished(false);
			}
			else
			{
				XmppStanzaError err(AStanza);
				LOG_STRM_WARNING(AXmppStream->streamJid(),QString("Account registration submit rejected: %1").arg(err.condition()));
				emit error(err);
			}
			return true;
		}
	}
	return false;
}
コード例 #26
0
ファイル: configdialog.cpp プロジェクト: musallub/agros2d
void ConfigDialog::createControls()
{
    logMessage("ConfigDialog::createControls()");

    lstView = new QListWidget(this);
    pages = new QStackedWidget(this);

    panMain = createMainWidget();
    panView = createViewWidget();
    panSolver = createSolverWidget();
    panColors = createColorsWidget();
    panGlobalScriptWidget = createGlobalScriptWidget();

    // List View
    lstView->setCurrentRow(0);
    lstView->setViewMode(QListView::IconMode);
    lstView->setResizeMode(QListView::Adjust);
    lstView->setMovement(QListView::Static);
    lstView->setFlow(QListView::TopToBottom);
    lstView->setIconSize(QSize(60, 60));
    lstView->setMinimumWidth(135);
    lstView->setMaximumWidth(135);
    lstView->setMinimumHeight((45+fontMetrics().height()*4)*5);
    connect(lstView, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
               this, SLOT(doCurrentItemChanged(QListWidgetItem *, QListWidgetItem *)));

    QSize sizeItem(131, 85);

    // listView items
    QListWidgetItem *itemMain = new QListWidgetItem(icon("options-main"), tr("Main"), lstView);
    itemMain->setTextAlignment(Qt::AlignHCenter);
    itemMain->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    itemMain->setSizeHint(sizeItem);

    QListWidgetItem *itemView = new QListWidgetItem(icon("options-view"), tr("View"), lstView);
    itemView->setTextAlignment(Qt::AlignHCenter);
    itemView->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    itemView->setSizeHint(sizeItem);

    QListWidgetItem *itemSolver = new QListWidgetItem(icon("options-solver"), tr("Solver"), lstView);
    itemSolver->setTextAlignment(Qt::AlignHCenter);
    itemSolver->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    itemSolver->setSizeHint(sizeItem);

    QListWidgetItem *itemColors = new QListWidgetItem(icon("options-colors"), tr("Colors"), lstView);
    itemColors->setTextAlignment(Qt::AlignHCenter);
    itemColors->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    itemColors->setSizeHint(sizeItem);

    QListWidgetItem *itemGlobalScript = new QListWidgetItem(icon("options-python"), tr("Python"), lstView);
    itemGlobalScript->setTextAlignment(Qt::AlignHCenter);
    itemGlobalScript->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    itemGlobalScript->setSizeHint(sizeItem);

    pages->addWidget(panMain);
    pages->addWidget(panView);
    pages->addWidget(panSolver);
    pages->addWidget(panColors);
    pages->addWidget(panGlobalScriptWidget);

    QHBoxLayout *layoutHorizontal = new QHBoxLayout();
    layoutHorizontal->addWidget(lstView);
    layoutHorizontal->addWidget(pages);

    // dialog buttons
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(doAccept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(doReject()));

    QVBoxLayout *layout = new QVBoxLayout();
    layout->addLayout(layoutHorizontal);
    // layout->addStretch();
    layout->addWidget(buttonBox);

    setLayout(layout);
}
コード例 #27
0
role_perms_edit_dialog::role_perms_edit_dialog(int role_oid)
{
  m_role_oid = role_oid;
  db_ctxt dbc;

  setWindowTitle(role_oid==0?tr("Add a group"):tr("Edit group permissions"));

  QVBoxLayout* top_layout = new QVBoxLayout(this);

  db_role role(m_role_oid);
  if (role_oid > 0)
    role.fetch_properties(&dbc);

  top_layout->addWidget(new QLabel(tr("Name of role:")));

  m_role_name = new QLineEdit(role.name());
  m_role_name->setMaxLength(name_maxlength);
  top_layout->addWidget(m_role_name);

  top_layout->addWidget(new QLabel(tr("Access to restricted identities:")));
  m_list_idents = new QListWidget();
  top_layout->addWidget(m_list_idents);
  identities idents;
  idents.fetch();
  m_a_ids = accessible_identities(m_role_oid, &dbc);
  identities::const_iterator iter1;
  if (!dbc.m_db->datab()->has_row_level_security()) {
    m_list_idents->addItem(tr("Row level security is unavailable on this server."));
    m_list_idents->setEnabled(false);
  }
  else for (iter1 = idents.begin(); iter1 != idents.end(); ++iter1) {
    /* Only the restricted identities are shown in the list, since
       access control through RLS policies applies only with them.
       That may disconcert users, but showing non-restricted identities
       without the possibility of unchecking them would probably
       be worst. */
    if (!iter1->second.m_is_restricted)
      continue;
    QListWidgetItem* item = new QListWidgetItem(iter1->second.m_email_addr);
    m_list_idents->addItem(item);
    item->setCheckState(m_a_ids.contains(iter1->second.m_identity_id) ?
			Qt::Checked : Qt::Unchecked);
    item->setData(Qt::UserRole, iter1->second.m_identity_id);
  }

  if (m_role_oid > 0 && role.is_superuser()) {
    QLabel* label = new QLabel(tr("<b>This role is superuser, implying all permissions on all database objects.</b>"));
    top_layout->addWidget(label);
  }
#if 0
  m_description = new QPlainTextEdit;
  top_layout->addWidget(m_description);
#endif

  top_layout->addWidget(new QLabel(tr("Permissions:")));

  m_perm_read = new QCheckBox(tr("Read messages"));
  m_perm_update = new QCheckBox(tr("Modify messages (status)"));
  m_perm_trash = new QCheckBox(tr("Trash messages"));
  m_perm_delete = new QCheckBox(tr("Delete messages"));
  m_perm_compose = new QCheckBox(tr("Write new messages"));
  m_perm_basic_management = new QCheckBox(tr("Define tags and filters"));

  QCheckBox* tab[] = {m_perm_read, m_perm_update, m_perm_trash, m_perm_delete, m_perm_compose, m_perm_basic_management};
  for (uint i=0; i<sizeof(tab)/sizeof(tab[0]); i++) {
    top_layout->addWidget(tab[i]);
    if (role.is_superuser())
      tab[i]->setEnabled(false);
  }

  m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok |
				   QDialogButtonBox::Cancel);
  top_layout->addStretch(1);
  top_layout->addWidget(m_buttons);
  connect(m_buttons, SIGNAL(accepted()), this, SLOT(accept()));
  connect(m_buttons, SIGNAL(rejected()), this, SLOT(reject()));

  set_checkboxes();
}
コード例 #28
0
ファイル: qgscomposer.cpp プロジェクト: mokerjoke/Quantum-GIS
QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
    : QMainWindow()
    , mTitle( title )
    , mUndoView( 0 )
{
  setupUi( this );
  setWindowTitle( mTitle );
  setupTheme();
  connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( close() ) );

  QSettings settings;
  int size = settings.value( "/IconSize", QGIS_ICON_SIZE ).toInt();
  setIconSize( QSize( size, size ) );

#ifndef Q_WS_MAC
  setFontSize( settings.value( "/fontPointSize", QGIS_DEFAULT_FONTSIZE ).toInt() );
#endif

  QToolButton* orderingToolButton = new QToolButton( this );
  orderingToolButton->setPopupMode( QToolButton::InstantPopup );
  orderingToolButton->setAutoRaise( true );
  orderingToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
  orderingToolButton->addAction( mActionRaiseItems );
  orderingToolButton->addAction( mActionLowerItems );
  orderingToolButton->addAction( mActionMoveItemsToTop );
  orderingToolButton->addAction( mActionMoveItemsToBottom );
  orderingToolButton->setDefaultAction( mActionRaiseItems );
  toolBar->addWidget( orderingToolButton );

  QToolButton* alignToolButton = new QToolButton( this );
  alignToolButton->setPopupMode( QToolButton::InstantPopup );
  alignToolButton->setAutoRaise( true );
  alignToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );

  alignToolButton->addAction( mActionAlignLeft );
  alignToolButton->addAction( mActionAlignHCenter );
  alignToolButton->addAction( mActionAlignRight );
  alignToolButton->addAction( mActionAlignTop );
  alignToolButton->addAction( mActionAlignVCenter );
  alignToolButton->addAction( mActionAlignBottom );
  alignToolButton->setDefaultAction( mActionAlignLeft );
  toolBar->addWidget( alignToolButton );

  QToolButton* shapeToolButton = new QToolButton( toolBar );
  shapeToolButton->setCheckable( true );
  shapeToolButton->setPopupMode( QToolButton::InstantPopup );
  shapeToolButton->setAutoRaise( true );
  shapeToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
  shapeToolButton->addAction( mActionAddRectangle );
  shapeToolButton->addAction( mActionAddTriangle );
  shapeToolButton->addAction( mActionAddEllipse );
  shapeToolButton->setDefaultAction( mActionAddEllipse );
  toolBar->insertWidget( mActionAddArrow, shapeToolButton );

  QActionGroup* toggleActionGroup = new QActionGroup( this );
  toggleActionGroup->addAction( mActionMoveItemContent );
  toggleActionGroup->addAction( mActionAddNewMap );
  toggleActionGroup->addAction( mActionAddNewLabel );
  toggleActionGroup->addAction( mActionAddNewLegend );
  toggleActionGroup->addAction( mActionAddNewScalebar );
  toggleActionGroup->addAction( mActionAddImage );
  toggleActionGroup->addAction( mActionSelectMoveItem );
  toggleActionGroup->addAction( mActionAddRectangle );
  toggleActionGroup->addAction( mActionAddTriangle );
  toggleActionGroup->addAction( mActionAddEllipse );
  toggleActionGroup->addAction( mActionAddArrow );
  toggleActionGroup->addAction( mActionAddTable );
  toggleActionGroup->addAction( mActionAddHtml );
  toggleActionGroup->setExclusive( true );


  mActionAddNewMap->setCheckable( true );
  mActionAddNewLabel->setCheckable( true );
  mActionAddNewLegend->setCheckable( true );
  mActionSelectMoveItem->setCheckable( true );
  mActionAddNewScalebar->setCheckable( true );
  mActionAddImage->setCheckable( true );
  mActionMoveItemContent->setCheckable( true );
  mActionAddArrow->setCheckable( true );

#ifdef Q_WS_MAC
  QMenu *appMenu = menuBar()->addMenu( tr( "QGIS" ) );
  appMenu->addAction( QgisApp::instance()->actionAbout() );
  appMenu->addAction( QgisApp::instance()->actionOptions() );
#endif

  QMenu *fileMenu = menuBar()->addMenu( tr( "File" ) );
  fileMenu->addAction( mActionLoadFromTemplate );
  fileMenu->addAction( mActionSaveAsTemplate );
  fileMenu->addSeparator();
  fileMenu->addAction( mActionExportAsImage );
  fileMenu->addAction( mActionExportAsPDF );
  fileMenu->addAction( mActionExportAsSVG );
  fileMenu->addSeparator();
  fileMenu->addAction( mActionPageSetup );
  fileMenu->addAction( mActionPrint );
  fileMenu->addSeparator();
  fileMenu->addAction( mActionQuit );
  QObject::connect( mActionQuit, SIGNAL( triggered() ), this, SLOT( close() ) );

  QMenu *viewMenu = menuBar()->addMenu( tr( "View" ) );
  viewMenu->addAction( mActionZoomIn );
  viewMenu->addAction( mActionZoomOut );
  viewMenu->addAction( mActionZoomAll );
  viewMenu->addSeparator();
  viewMenu->addAction( mActionRefreshView );

  // Panel and toolbar submenus
  mPanelMenu = new QMenu( tr( "Panels" ), this );
  mPanelMenu->setObjectName( "mPanelMenu" );
  mToolbarMenu = new QMenu( tr( "Toolbars" ), this );
  mToolbarMenu->setObjectName( "mToolbarMenu" );
  viewMenu->addSeparator();
  viewMenu->addMenu( mPanelMenu );
  viewMenu->addMenu( mToolbarMenu );
  // toolBar already exists, add other widgets as they are created
  mToolbarMenu->addAction( toolBar->toggleViewAction() );

  QMenu *layoutMenu = menuBar()->addMenu( tr( "Layout" ) );
  layoutMenu->addAction( mActionUndo );
  layoutMenu->addAction( mActionRedo );
  layoutMenu->addSeparator();
  layoutMenu->addAction( mActionAddNewMap );
  layoutMenu->addAction( mActionAddNewLabel );
  layoutMenu->addAction( mActionAddNewScalebar );
  layoutMenu->addAction( mActionAddNewLegend );
  layoutMenu->addAction( mActionAddImage );
  layoutMenu->addAction( mActionSelectMoveItem );
  layoutMenu->addAction( mActionMoveItemContent );

  layoutMenu->addAction( mActionAddArrow );
  layoutMenu->addAction( mActionAddTable );
  layoutMenu->addSeparator();
  layoutMenu->addAction( mActionGroupItems );
  layoutMenu->addAction( mActionUngroupItems );
  layoutMenu->addAction( mActionRaiseItems );
  layoutMenu->addAction( mActionLowerItems );
  layoutMenu->addAction( mActionMoveItemsToTop );
  layoutMenu->addAction( mActionMoveItemsToBottom );

#ifdef Q_WS_MAC
#ifndef Q_WS_MAC64 /* assertion failure in NSMenuItem setSubmenu (Qt 4.5.0-snapshot-20080830) */
  menuBar()->addMenu( QgisApp::instance()->windowMenu() );

  menuBar()->addMenu( QgisApp::instance()->helpMenu() );
#endif
#endif

  mQgis = qgis;
  mFirstTime = true;

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

  QgsDebugMsg( "entered." );

  setMouseTracking( true );
  mViewFrame->setMouseTracking( true );

  //create composer view
  mView = new QgsComposerView( mViewFrame );

  //init undo/redo buttons
  mComposition  = new QgsComposition( mQgis->mapCanvas()->mapRenderer() );

  mActionUndo->setEnabled( false );
  mActionRedo->setEnabled( false );
  if ( mComposition->undoStack() )
  {
    connect( mComposition->undoStack(), SIGNAL( canUndoChanged( bool ) ), mActionUndo, SLOT( setEnabled( bool ) ) );
    connect( mComposition->undoStack(), SIGNAL( canRedoChanged( bool ) ), mActionRedo, SLOT( setEnabled( bool ) ) );
  }
コード例 #29
0
void KSMShutdownDlg::reject()
{
    emit rejected();
}
コード例 #30
0
void SelectVisibleColumns::initConnections() {
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(buttonSave()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}