// virtual
void LLFloaterTeleportHistory::onFocusReceived()
{
    // take care to enable or disable buttons depending on the selection in the places list
    if (mPlacesList->getFirstSelected())
    {
        setButtonsEnabled(TRUE);
    }
    else
    {
        setButtonsEnabled(FALSE);
    }
    LLFloater::onFocusReceived();
}
Beispiel #2
0
void ObjectTableWidget::removeRow(void)
{
	if(table_tbw->currentRow()>=0)
	{
		Messagebox msg_box;
		unsigned 	row_idx=table_tbw->currentRow();
		QTableWidgetItem *item=table_tbw->currentItem();

		if(item->isSelected())
		{
			if(conf_exclusion)
				msg_box.show(trUtf8("Confirmation"),trUtf8("Do you really want to remove the selected item?"),
							 Messagebox::CONFIRM_ICON, Messagebox::YES_NO_BUTTONS);

			if(!conf_exclusion || (conf_exclusion && msg_box.result()==QDialog::Accepted))
			{
				setRowData(QVariant::fromValue<void *>(nullptr), row_idx);
				item->setData(Qt::UserRole, QVariant::fromValue<void *>(nullptr));
				emit s_rowRemoved(row_idx);
				table_tbw->removeRow(row_idx);
				table_tbw->setCurrentItem(nullptr);
				setButtonsEnabled();
			}
		}
	}
}
Beispiel #3
0
void ObjectTableWidget::addRow(void)
{
	this->addRow(table_tbw->rowCount());
	setButtonsEnabled();

	emit s_rowAdded(table_tbw->rowCount()-1);
}
void QuizFrame::askTerm( const Term& term ) {
    hideAnswers();
    controller->initRevealingSequence();
    setTerm( term );
    reveal();
    setButtonsEnabled( true );
}
Beispiel #5
0
void Player::onAnimationChanged(WeightedAnimation *animation)
{
  setButtonsEnabled(animation!=0);

  int oldPlayFrame = playFrame();
  //When first overall animation emerges, stretch looping to max
  if(/*DEBUG. Uncomment when LoopIn/Out set by some form. this->animation==0 &&*/ animation!=NULL)
    loopOut = animation->getNumberOfFrames()-1;

//edu: this is insidous! Disconnects ALL slots tied to that object.
//      DO NOT USE THAT!  disconnect(animation, SIGNAL(currentFrame(int)), 0, 0);
  this->animation = animation;

  if(animation)
  {
    connect(animation, SIGNAL(currentFrame(int)), this, SLOT(animationFrameChanged()));

    int framesCount = animation->getNumberOfFrames();
    if(framesCount<loopIn)
      loopIn=0;
    if(framesCount<loopOut)
      loopOut=framesCount-1;    //last animation's frame
    if(oldPlayFrame<=totalFrames())
      setPlaybackFrame(oldPlayFrame);
  }
  else
Beispiel #6
0
void ObjectTableWidget::setButtonsEnabled(void)
{
	//QTableWidgetItem *item=table_tbw->currentItem();
	setButtonsEnabled(ALL_BUTTONS, true);

	//if(item && item->row() >= 0)
	//emit s_rowSelected(item->row());
}
Beispiel #7
0
void ObjectTableWidget::addColumn(unsigned col_idx)
{
	if(col_idx >= static_cast<unsigned>(table_tbw->columnCount()))
		col_idx=table_tbw->columnCount();

	table_tbw->insertColumn(col_idx);
	table_tbw->clearSelection();
	setButtonsEnabled();

	emit s_columnAdded(col_idx);
}
Beispiel #8
0
void ObjectTableWidget::removeColumn(unsigned col_idx)
{
	if(col_idx >= static_cast<unsigned>(table_tbw->columnCount()))
		throw Exception(ERR_REF_COL_OBJTAB_INV_INDEX,__PRETTY_FUNCTION__,__FILE__,__LINE__);

	table_tbw->removeColumn(col_idx);
	table_tbw->clearSelection();
	setButtonsEnabled();

	emit s_columnRemoved(col_idx);
}
void GamepadForm::onButtonPressed(const QString &action)
{
	// Checking that we are still connected, just in case.
	if (mSocket.state() != QTcpSocket::ConnectedState) {
		return;
	}

	// Sending command matching protocol (according extra button or pad button pressed) to robot.
	if (mSocket.write((action + "\n").toLatin1()) == -1) {
		setButtonsEnabled(false);
	}
}
Beispiel #10
0
void ObjectTableWidget::selectRow(int lin_idx)
{
	QTableWidgetItem *item=nullptr;

	item=table_tbw->item(0,lin_idx);

	if(item)
	{
		item=table_tbw->item(lin_idx,0);
		item->setSelected(true);
		table_tbw->setCurrentItem(item);
		setButtonsEnabled();
	}
}
void LLFloaterTeleportHistory::addEntry(std::string parcelName)
{
    if (mPendingRegionName.empty())
    {
        return;
    }

    // only if the cached scroll list pointer is valid
    if (mPlacesList)
    {
        // build the list entry
        LLSD value;
        value["id"] = mID;
        value["columns"][LIST_PARCEL]["column"] = "parcel";
        value["columns"][LIST_PARCEL]["value"] = parcelName;
        value["columns"][LIST_REGION]["column"] = "region";
        value["columns"][LIST_REGION]["value"] = mPendingRegionName;
        value["columns"][LIST_POSITION]["column"] = "position";
        value["columns"][LIST_POSITION]["value"] = mPendingPosition;
        value["columns"][LIST_VISITED]["column"] = "visited";
        value["columns"][LIST_VISITED]["value"] = mPendingTimeString;

        // these columns are hidden and serve as data storage for simstring and SLURL
        value["columns"][LIST_SLURL]["column"] = "slurl";
        value["columns"][LIST_SLURL]["value"] = mPendingSLURL;
        value["columns"][LIST_SIMSTRING]["column"] = "simstring";
        value["columns"][LIST_SIMSTRING]["value"] = mPendingSimString;

        // add the new list entry on top of the list, deselect all and disable the buttons
        const S32 max_entries = gSavedSettings.getS32("TeleportHistoryMaxEntries");
        S32 num_entries = mPlacesList->getItemCount();
        while(num_entries >= max_entries)
        {
            mPlacesList->deleteItems(LLSD(mID - num_entries--));
        }

        mPlacesList->addElement(value, ADD_TOP);
        mPlacesList->deselectAllItems(TRUE);
        setButtonsEnabled(FALSE);
        mID++;
        saveFile("teleport_history.xml");	//Comment out to disable saving after every teleport.
    }
    else
    {
        LL_WARNS() << "pointer to places list is NULL" << LL_ENDL;
    }

    mPendingRegionName.clear();
}
GamepadForm::GamepadForm()
	: QWidget()
	, ui(new Ui::GamepadForm())
{
	// Here all GUI widgets are created and initialized.
	ui->setupUi(this);

	// Disabling buttons since we are not connected to robot yet and can not send any commands.
	setButtonsEnabled(false);

	// Some script constants, matching protocol (extra buttons commands)
	const QString smileScript = "21:direct:brick.smile();";
	const QString sayHiScript = "24:direct:brick.say(\"Hi!\");";

	// Setting actions to extra buttons pressed.
	mButtonsMapper.setMapping(ui->buttonSmile, smileScript);
	mButtonsMapper.setMapping(ui->buttonSayHi, sayHiScript);

	// Connecting mapper to a slot which will process all extra button presses.
	connect(&mButtonsMapper, SIGNAL(mapped(QString)), this, SLOT(onButtonPressed(QString)));

	// Connecting buttons with mapper.
	connect(ui->buttonSmile, SIGNAL(clicked()), &mButtonsMapper, SLOT(map()));
	connect(ui->buttonSayHi, SIGNAL(clicked()), &mButtonsMapper, SLOT(map()));

	// Some script constants, matching protocol (up, down, left, right commands)
	const QString forwardScript = "67:direct:brick.motor(M3).setPower(100);brick.motor(M4).setPower(100);";
	const QString backScript = "73:direct:brick.motor(M3).setPower(-(100));brick.motor(M4).setPower(-(100));";
	const QString leftScript = "70:direct:brick.motor(M3).setPower(-(100));brick.motor(M4).setPower(100);";
	const QString rightScript = "70:direct:brick.motor(M3).setPower(100);brick.motor(M4).setPower(-(100));";
	const QString stopScript = "20:direct:brick.stop();";

	// Setting up mapper for pad buttons, "pressed" signal.
	// Here we provide a command to be sent to a robot instead of id.
	mPadsMapper.setMapping(ui->buttonPadUp, forwardScript);
	mPadsMapper.setMapping(ui->buttonPadDown, backScript);
	mPadsMapper.setMapping(ui->buttonPadLeft, leftScript);
	mPadsMapper.setMapping(ui->buttonPadRight, rightScript);
	mPadsMapper.setMapping(ui->buttonStop, stopScript);

	connect(&mPadsMapper, SIGNAL(mapped(QString)), this, SLOT(onButtonPressed(QString)));

	connect(ui->buttonPadUp, SIGNAL(pressed()), &mPadsMapper, SLOT(map()));
	connect(ui->buttonPadDown, SIGNAL(pressed()), &mPadsMapper, SLOT(map()));
	connect(ui->buttonPadLeft, SIGNAL(pressed()), &mPadsMapper, SLOT(map()));
	connect(ui->buttonPadRight, SIGNAL(pressed()), &mPadsMapper, SLOT(map()));
	connect(ui->buttonStop, SIGNAL(pressed()), &mPadsMapper, SLOT(map()));
}
void GamepadForm::on_connectButton_clicked()
{
	// Getting IP address of a robot.
	const auto ip = ui->robotIpLineEdit->text();

	// Connecting. 8888 is hardcoded here since it is default port on TRIK.
	mSocket.connectToHost(ip, 8888);

	// Waiting for opened connection and checking that connection is actually established.
	if (!mSocket.waitForConnected(3000)) {
		// If not, quitting, to keep things simple.
		QMessageBox::warning(this, "Connection failed", "Failed to connect to robot, will now quit");
		QApplication::quit();
	}

	// Ok, connection is established, now we can enable all buttons.
	setButtonsEnabled(true);
}
Beispiel #14
0
Player::Player(QWidget *parent) : QWidget(parent), ui(new Ui::Player)
{
  ui->setupUi(this);
  pauseIcon.addFile(QString::fromUtf8(":/icons/player/icons/player/PlayerPause.png"), QSize(),
                    QIcon::Normal, QIcon::Off);
  playIcon.addFile(QString::fromUtf8(":/icons/player/icons/player/PlayerPlay.png"), QSize(),
                   QIcon::Normal, QIcon::Off);

  animation = NULL;
  _state = PLAYSTATE_STOPPED;
  ui->playButton->setIcon(playIcon);
  loopIn = 0;
  loopOut = 0;
  _loop = true;

  setButtonsEnabled(false);
  updateLabel();
  connect(&timer,SIGNAL(timeout()),this,SLOT(timerTimeout()));
}
Beispiel #15
0
void WInPlaceEdit::create()
{
  setImplementation(impl_ = new WContainerWidget());
  setInline(true);

  text_ = new WText(WString::Empty, PlainText, impl_);
  text_->decorationStyle().setCursor(ArrowCursor);

  editing_ = new WContainerWidget(impl_);
  editing_->setInline(true);
  editing_->hide();

  edit_ = new WLineEdit(editing_);
  edit_->setTextSize(20);
  save_ = 0;
  cancel_ = 0;

  /*
   * This is stateless implementation heaven
   */
  text_->clicked().connect(text_, &WWidget::hide);
  text_->clicked().connect(editing_, &WWidget::show);
  text_->clicked().connect(edit_, &WFormWidget::setFocus);

  edit_->enterPressed().connect(edit_, &WFormWidget::disable);
  edit_->enterPressed().connect(this, &WInPlaceEdit::save);
  edit_->enterPressed().preventPropagation();

  edit_->escapePressed().connect(editing_, &WWidget::hide);
  edit_->escapePressed().connect(text_, &WWidget::show);
  edit_->escapePressed().connect(this, &WInPlaceEdit::cancel);
  edit_->escapePressed().preventPropagation();

  buttons_ = new WContainerWidget(editing_);
  buttons_->setInline(true);
  buttons_->addStyleClass("input-group-btn"); // FIXME !!!!

  setButtonsEnabled();
}
Beispiel #16
0
void ObjectTableWidget::removeRows(void)
{
	if(table_tbw->rowCount() > 0)
	{
		QObject *sender_obj=sender();
		Messagebox msg_box;

		/* Only shows the confirmation message if the conf_exclusion is set and the user called the method
			 activating the 'remove_all_tb' button */
		if(conf_exclusion && sender_obj==remove_all_tb)
			msg_box.show(trUtf8("Confirmation"),trUtf8("Do you really want to remove all the items?"),
						 Messagebox::CONFIRM_ICON, Messagebox::YES_NO_BUTTONS);

		if(!conf_exclusion || (conf_exclusion && sender_obj!=remove_all_tb) ||
				(conf_exclusion &&  sender_obj==remove_all_tb && msg_box.result()==QDialog::Accepted))
		{
			table_tbw->clearContents();
			table_tbw->setRowCount(0);
			setButtonsEnabled();
			emit s_rowsRemoved();
		}
	}
}
Beispiel #17
0
void ObjectTableWidget::clearSelection(void)
{
	table_tbw->clearSelection();
	table_tbw->setCurrentItem(nullptr);
	setButtonsEnabled();
}
Beispiel #18
0
KActionSelector::KActionSelector( QWidget *parent )
  : QWidget( parent )
  , d( new KActionSelectorPrivate(this) )
{
  d->moveOnDoubleClick = true;
  d->keyboardEnabled = true;
  d->addIcon = QApplication::isRightToLeft()? "go-previous" : "go-next";
  d->removeIcon = QApplication::isRightToLeft()? "go-next" : "go-previous";
  d->upIcon = "go-up";
  d->downIcon = "go-down";
  d->availableInsertionPolicy = Sorted;
  d->selectedInsertionPolicy = BelowCurrent;
  d->showUpDownButtons = true;

  QHBoxLayout *lo = new QHBoxLayout( this );

  QVBoxLayout *loAv = new QVBoxLayout();
  lo->addLayout( loAv );
  d->lAvailable = new QLabel( i18n("&Available:"), this );
  loAv->addWidget( d->lAvailable );
  d->availableListWidget = new QListWidget( this );
  loAv->addWidget( d->availableListWidget );
  d->lAvailable->setBuddy( d->availableListWidget );

  QVBoxLayout *loHBtns = new QVBoxLayout();
  lo->addLayout( loHBtns );
  loHBtns->addStretch( 1 );
  d->btnAdd = new QToolButton( this );
  loHBtns->addWidget( d->btnAdd );
  d->btnRemove = new QToolButton( this );
  loHBtns->addWidget( d->btnRemove );
  loHBtns->addStretch( 1 );

  QVBoxLayout *loS = new QVBoxLayout();
  lo->addLayout( loS );
  d->lSelected = new QLabel( i18n("&Selected:"), this );
  loS->addWidget( d->lSelected );
  d->selectedListWidget = new QListWidget( this );
  loS->addWidget( d->selectedListWidget );
  d->lSelected->setBuddy( d->selectedListWidget );

  QVBoxLayout *loVBtns = new QVBoxLayout();
  lo->addLayout( loVBtns );
  loVBtns->addStretch( 1 );
  d->btnUp = new QToolButton( this );
  d->btnUp->setAutoRepeat( true );
  loVBtns->addWidget( d->btnUp );
  d->btnDown = new QToolButton( this );
  d->btnDown->setAutoRepeat( true );
  loVBtns->addWidget( d->btnDown );
  loVBtns->addStretch( 1 );

  d->loadIcons();

  connect( d->btnAdd, SIGNAL(clicked()), this, SLOT(buttonAddClicked()) );
  connect( d->btnRemove, SIGNAL(clicked()), this, SLOT(buttonRemoveClicked()) );
  connect( d->btnUp, SIGNAL(clicked()), this, SLOT(buttonUpClicked()) );
  connect( d->btnDown, SIGNAL(clicked()), this, SLOT(buttonDownClicked()) );
  connect( d->availableListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
           this, SLOT(itemDoubleClicked(QListWidgetItem*)) );
  connect( d->selectedListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
           this, SLOT(itemDoubleClicked(QListWidgetItem*)) );
  connect( d->availableListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(polish()) );
  connect( d->selectedListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(polish()) );

  d->availableListWidget->installEventFilter( this );
  d->selectedListWidget->installEventFilter( this );
  setButtonsEnabled();
}
Beispiel #19
0
void KActionSelector::polish()
{
  setButtonsEnabled();
}
void QuizFrame::concludeQuiz() {
    setButtonsEnabled( false );
    QMessageBox::information( this, QObject::tr( "Information" ), tr( "WellDone" ).arg( controller->getInitialTermCount() ) );
    emit( quizConcluded() );
}
Beispiel #21
0
void ObjectTableWidget::moveRows(void)
{
	QObject *sender_obj=sender();
	QTableWidgetItem *item=nullptr, *item1=nullptr;
	int row=-1, row1=-1;
	unsigned col, col_count=table_tbw->columnCount();
	QVariant aux_data;

	//Get the current selected row. Based upon this index that rows are swaped
	row=table_tbw->currentRow();

	//If the user click "move down" swap the selected row with the row imediately below
	if(sender_obj==move_down_tb)
		row1=row+1;
	//If the user click "move up" swap the selected row with the row imediately above
	else if(sender_obj==move_up_tb)
		row1=row-1;
	//If the user click "move first" swap the selected row with the first row
	else if(sender_obj==move_first_tb)
	{
		//Add a blank line to swap the data later
		this->addRow(0);
		row1=0;
		row++;
	}
	//If the user click "move last" swap the selected row with the last row
	else if(sender_obj==move_last_tb)
	{
		//Add a row at the end of the table
		this->addRow(table_tbw->rowCount());
		row1=table_tbw->rowCount()-1;
	}

	//Checking if the row indexes are valid
	if(row >= 0 && row < table_tbw->rowCount() &&
			row1 >= 0 && row1 < table_tbw->rowCount() &&
			row != row1)
	{
		//To swap the rows is necessary to swap all columns one by one
		for(col=0; col < col_count; col++)
		{
			item=table_tbw->item(row, col);
			table_tbw->takeItem(row, col);

			item1=table_tbw->item(row1, col);
			table_tbw->takeItem(row1, col);

			table_tbw->setItem(row, col, item1);
			table_tbw->setItem(row1, col, item);

			item1->setSelected(false);
			item->setSelected(true);
		}

		table_tbw->setCurrentItem(item);

		//Swapping the row data
		item=table_tbw->verticalHeaderItem(row);
		item1=table_tbw->verticalHeaderItem(row1);

		if(item && item1)
		{
			aux_data=item->data(Qt::UserRole);
			item->setData(Qt::UserRole, item1->data(Qt::UserRole));
			item1->setData(Qt::UserRole, aux_data);
		}

		//Special case for "move last" and "move first"
		if(sender_obj==move_last_tb || sender_obj==move_first_tb)
		{
			table_tbw->removeRow(row);

			if(sender_obj==move_first_tb)
			{
				row1=row-1;
				row=table_tbw->rowCount();
			}
		}

		setButtonsEnabled();
		emit s_rowsMoved(row, row1);
	}
}
Beispiel #22
0
void AnimationList::onSelectionChanged()
{
  bool selected = (ui->availableAnimsListView->selectionModel()->selectedRows(0).count() > 0);
  setButtonsEnabled(selected);
}
void QuizFrame::restartQuiz() {
    setButtonsEnabled( false );
    updateLanguageLabels();
    updateFonts();
    askNextTerm();
}