Exemplo n.º 1
0
    ButtonGroup::~ButtonGroup(){

      for( auto _iter = m_buttons.begin(); _iter != m_buttons.end(); ++_iter ){
        removeButton( _iter->second );
      }

    }
Exemplo n.º 2
0
WelcomeToolButton::WelcomeToolButton(QWidget * par)
{
	this->setParent(par);
	actionRemove = new QAction(tr("Убрать кнопку"),this);
	menu.addAction(actionRemove);
	connect(actionRemove,SIGNAL(triggered()),this,SIGNAL(removeButton()));
}
Exemplo n.º 3
0
void ChannelSelector::setNumChannels(int numChans)
{

    int difference = numChans - parameterButtons.size();

    std::cout << difference << " buttons needed." << std::endl;

    if (difference > 0)
    {
        for (int n = 0; n < difference; n++)
        {
            addButton();
        }
    }
    else if (difference < 0)
    {
        for (int n = 0; n < -difference; n++)
        {
            removeButton();
        }
    }

    refreshButtonBoundaries();

}
Exemplo n.º 4
0
/*!
    Adds the given \a button to the button box with the specified \a role.
    If the role is invalid, the button is not added.

    If the button has already been added, it is removed and added again with the
    new role.

    \sa removeButton(), clear()
*/
void QDialogButtonBox::addButton(QAbstractButton *button, ButtonRole role)
{
    Q_D(QDialogButtonBox);
    if (role <= InvalidRole || role >= NRoles) {
        qWarning("QDialogButtonBox::addButton: Invalid ButtonRole, button not added");
        return;
    }
    removeButton(button);
    button->setParent(this);
    d->addButton(button, role);
}
Exemplo n.º 5
0
void QIDialogButtonBox::retranslateUi()
{
    QPushButton *btn = QDialogButtonBox::button (QDialogButtonBox::Help);
    if (btn)
    {
        /* Use our very own help button if the user requested for one. */
        if (!mHelpButton)
            mHelpButton = new UIHelpButton;
        mHelpButton->initFrom (btn);
        removeButton (btn);
        QDialogButtonBox::addButton (mHelpButton, QDialogButtonBox::HelpRole);
    }
}
void ChannelSelector::setNumChannels(int numChans)
{
    int difference = numChans - parameterButtonsManager.getNumButtons();

    // std::cout << difference << " buttons needed." << std::endl;

    if (difference > 0)
    {
        for (int n = 0; n < difference; n++)
        {
            addButton();
        }
    }
    else if (difference < 0)
    {
        for (int n = 0; n < -difference; n++)
        {
            removeButton();
        }
    }

    const int numButtons = parameterButtonsManager.getNumButtons();
    //Reassign numbers according to the actual channels (useful for channel mapper)
    for (int n = 0; n < numButtons; ++n)
    {
        int num = ( (GenericEditor*)getParentComponent())->getChannel (n)->nodeIndex;
        static_cast<ChannelSelectorButton*> (parameterButtonsManager.getButtonAt  (n))->setChannel (n + 1, num + 1);

        if (isNotSink)
        {
            static_cast<ChannelSelectorButton*> (recordButtonsManager.getButtonAt (n))->setChannel (n + 1, num + 1);
            static_cast<ChannelSelectorButton*> (audioButtonsManager.getButtonAt  (n))->setChannel (n + 1, num + 1);
        }
    }

    refreshButtonBoundaries();
}
Exemplo n.º 7
0
void GUI::Widget::TabPanel::removeTab(const TabKeyType& key) {
	TabManager::removeTab(key);
	removeButton(key);
}
Exemplo n.º 8
0
bool AccessCert::download( bool noCard )
{
	if( noCard )
	{
		QDesktopServices::openUrl( QUrl( tr("http://www.sk.ee/toend/") ) );
		return false;
	}

	SslCertificate tempel( qApp->signer()->tokensign().cert() );
	if( tempel.type() & SslCertificate::TempelType )
	{
		setIcon( Information );
		setText( tr("For getting server access certificate to Tempel contact <a href=\"mailto:[email protected]\">[email protected]</a>") );
		return false;
	}

	setIcon( Information );
	setText(
		tr("Hereby I agree to terms and conditions of validity confirmation service and "
		   "will use the service in extent of 10 signatures per month. If you going to "
		   "exceed the limit of 10 signatures per month or/and will use the service for "
		   "commercial purposes, please refer to IT support of your company. Additional "
		   "information is available from <a href=\"%1\">%1</a> or phone 1777")
			.arg( tr("http://www.id.ee/kehtivuskinnitus") ) );
	setStandardButtons( Help );
	QPushButton *agree = addButton( tr("Agree"), AcceptRole );
	if( exec() == Help )
	{
		QDesktopServices::openUrl( QUrl( tr("http://www.id.ee/kehtivuskinnitus") ) );
		return false;
	}
	removeButton( agree );

	QSigner *s = qApp->signer();
	QPKCS11 *p = qobject_cast<QPKCS11*>(reinterpret_cast<QObject*>(s->handle()));
#ifdef Q_OS_WIN
	QCNG *c = qobject_cast<QCNG*>(reinterpret_cast<QObject*>(s->handle()));
	if( !p && !c )
		return false;
#endif

	s->lock();
	Qt::HANDLE key = 0;
	TokenData token;
	if( p )
	{
		bool retry = false;
		do
		{
			retry = false;
			token.setCard( s->tokensign().card() );
			Q_FOREACH( const TokenData &t, p->tokens() )
				if( token.card() == t.card() && SslCertificate( t.cert() ).enhancedKeyUsage().contains( SslCertificate::ClientAuth ) )
					token.setCert( t.cert() );

			QPKCS11::PinStatus status = p->login( token );
			switch( status )
			{
			case QPKCS11::PinOK: break;
			case QPKCS11::PinCanceled:
				s->unlock();
				return false;
			case QPKCS11::PinIncorrect:
				showWarning( QPKCS11::errorString( status ) );
				retry = true;
				break;
			default:
				showWarning( tr("Error downloading server access certificate!") + "\n" + QPKCS11::errorString( status ) );
				s->unlock();
				return false;
			}
		}
		while( retry );
		key = p->key();
	}
	else
	{
Exemplo n.º 9
0
void BookmarksToolbar::showBookmarkContextMenu(const QPoint &pos)
{
    Q_UNUSED(pos)

    ToolButton* button = qobject_cast<ToolButton*>(sender());
    if (!button) {
        return;
    }

    QVariant buttonPointer = qVariantFromValue((void*) button);

    QMenu menu;
    menu.addAction(IconProvider::fromTheme("go-next"), tr("Move right"), this, SLOT(moveRight()))->setData(buttonPointer);
    menu.addAction(IconProvider::fromTheme("go-previous"), tr("Move left"), this, SLOT(moveLeft()))->setData(buttonPointer);
    menu.addSeparator();
    menu.addAction(IconProvider::fromTheme("list-remove"), tr("Remove bookmark"), this, SLOT(removeButton()))->setData(buttonPointer);

    //Prevent choosing first option with double rightclick
    QPoint position = QCursor::pos();
    QPoint p(position.x(), position.y() + 1);
    menu.exec(p);
}
Exemplo n.º 10
0
void BookmarksToolbar::showBookmarkContextMenu(const QPoint &pos)
{
    Q_UNUSED(pos)

    ToolButton* button = qobject_cast<ToolButton*>(sender());
    if (!button) {
        return;
    }

    QVariant buttonPointer = QVariant::fromValue((void*) button);

    QMenu menu;
    menu.addAction(tr("Open bookmark"), this, SLOT(loadClickedBookmark()))->setData(buttonPointer);
    menu.addAction(tr("Open bookmark in new tab"), this, SLOT(loadClickedBookmarkInNewTab()))->setData(buttonPointer);
    menu.addSeparator();
    menu.addAction(qIconProvider->fromTheme("go-next"), tr("Move right"), this, SLOT(moveRight()))->setData(buttonPointer);
    menu.addAction(qIconProvider->fromTheme("go-previous"), tr("Move left"), this, SLOT(moveLeft()))->setData(buttonPointer);
    menu.addAction(tr("Edit bookmark"), this, SLOT(editBookmark()))->setData(buttonPointer);
    menu.addSeparator();
    menu.addAction(qIconProvider->fromTheme("list-remove"), tr("Remove bookmark"), this, SLOT(removeButton()))->setData(buttonPointer);

    //Prevent choosing first option with double rightclick
    QPoint position = button->mapToGlobal(pos);
    QPoint p(position.x(), position.y() + 1);
    menu.exec(p);
}
Exemplo n.º 11
0
ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name )
  : QWidget(parent, name)
{ 
  const int GRIDROWS = 3;

  QGridLayout *tl = new QGridLayout(this, GRIDROWS, 3, 10, 10);
  tl->addRowSpacing(0, fontMetrics().lineSpacing() - 10);
  box = new QGroupBox(this);
  box->setTitle(i18n("Edit Script"));
  tl->addMultiCellWidget(box, 0, GRIDROWS-1, 0, 2);

  QVBoxLayout *l1 = new QVBoxLayout;
  tl->addLayout(l1, 1, 1);

  se = new ScriptEdit(this);
  connect(se, SIGNAL(returnPressed()), SLOT(addButton()));
  l1->addWidget(se);

  add = new QPushButton(i18n("Add"), this);
  connect(add, SIGNAL(clicked()), SLOT(addButton()));
  FIXED_HEIGHT(add);
  int width = add->sizeHint().width();
  width = QMAX(width,60);
  add->setMinimumWidth(width);


  insert = new QPushButton(i18n("Insert"), this);
  connect(insert, SIGNAL(clicked()), SLOT(insertButton()));
  FIXED_HEIGHT(insert);
  width = insert->sizeHint().width();
  width = QMAX(width,60);
  insert->setMinimumWidth(width);

  remove = new QPushButton(i18n("Remove"), this);
  connect(remove, SIGNAL(clicked()), SLOT(removeButton()));
  FIXED_HEIGHT(remove);
  width = remove->sizeHint().width();
  width = QMAX(width,60);
  remove->setMinimumWidth(width);

  QHBoxLayout *l11 = new QHBoxLayout;
  l1->addLayout(l11);
  l11->addWidget(add);
  l11->addStretch(1);
  l11->addWidget(insert);
  l11->addStretch(1);
  l11->addWidget(remove);
  
  QHBoxLayout *l12 = new QHBoxLayout(0);
  l1->addLayout(l12);
  stl = new QListBox(this);
  stl->setSmoothScrolling(false);
  stl->setAutoScrollBar(false);
  connect(stl, SIGNAL(highlighted(int)), SLOT(stlhighlighted(int)));
  stl->setMinimumSize(QSize(70, 140));

  sl = new QListBox(this);
  sl->setSmoothScrolling(false);
  sl->setAutoScrollBar(false);
  connect(sl, SIGNAL(highlighted(int)), SLOT(slhighlighted(int)));
  sl->setMinimumSize(QSize(150, 140));

  slb = new QScrollBar(this);
  slb->setFixedWidth(slb->sizeHint().width());
  connect(slb, SIGNAL(valueChanged(int)), SLOT(scrolling(int)));

  l12->addWidget(stl, 1);
  l12->addWidget(sl, 3);
  l12->addWidget(slb, 0);

  //load data from gpppdata
  if(!isnewaccount) {
    QStrList &comlist = gpppdata.scriptType();
    QStrList &arglist = gpppdata.script();
    for(char *com = comlist.first(), *arg = arglist.first();
        com && arg; com = comlist.next(), arg = arglist.next()) {
      stl->insertItem(com);
      sl->insertItem(arg);
    }
  }

  remove->setEnabled(false);
  insert->setEnabled(false);
  adjustScrollBar();

  tl->activate();
}
Exemplo n.º 12
0
void SeasonScreen::addMatchPlan()
{
	for(auto l : mMatchPlanLabels) {
		removeButton(l);
	}
	mMatchPlanLabels.clear();

	if(mPlanPos == 0)
		mScrollUpButton->hide();
	else
		mScrollUpButton->show();

	float x = 0.75f;
	float y = 0.10f;
	for(unsigned int i = mPlanPos; i < mSeason->getSchedule().size(); i++) {
		RoundTuple ctr = getRound(i);
		std::stringstream ss;
		switch(std::get<0>(ctr)) {
			case CompetitionType::League:
			{
				ss << "League Round " << (std::get<1>(ctr) + 1);
			}
			break;

			case CompetitionType::Cup:
			{
				ss << "Cup Round " << (std::get<1>(ctr) + 1);
			}
			break;

			case CompetitionType::Tournament:
			{
				ss << "Tournament Round " << (std::get<1>(ctr) + 1);
			}
			break;
		}

		/* r might be a null pointer if the participants aren't clear yet (cup) */
		if(std::get<2>(ctr)) {
			for(auto m : std::get<2>(ctr)->getMatches()) {
				if(m->getTeam(0) == mSeason->getTeam() ||
						m->getTeam(1) == mSeason->getTeam()) {
					CompetitionScreen::addMatchLabels(*m, x, y, 0.6f,
							*this, mMatchPlanLabels, false);
					break;
				}
			}
		}

		mMatchPlanLabels.push_back(addLabel(ss.str().c_str(), x - 0.45f, y,
					TextAlignment::MiddleLeft, 0.6f, Common::Color::White));
		y += 0.03f;
		if(y >= 0.80f) {
			if(i != mSeason->getSchedule().size() - 1) {
				mScrollDownButton->show();
			} else {
				mScrollDownButton->hide();
			}
			return;
		}
	}
	mScrollDownButton->hide();
}