Exemplo n.º 1
0
void doIMU() {
  // Accel (degrees)
  IntToStr((int)(MPU9150A.out_accel.x * 90.0f),txt);
  updateLabel(&accelX, ltrim(txt));
  IntToStr((int)(MPU9150A.out_accel.y * 90.0f),txt);
  updateLabel(&accelY, ltrim(txt));
  IntToStr((int)(MPU9150A.out_accel.z * 90.0f),txt);
  updateLabel(&accelZ, ltrim(txt));
  // Gyro (degrees/second)
  IntToStr((int)(MPU9150A.out_gyro.x * 1000.0f / MPU9150A.gdt),txt);
  updateLabel(&gyroX, ltrim(txt));
  IntToStr((int)(MPU9150A.out_gyro.y * 1000.0f / MPU9150A.gdt),txt);
  updateLabel(&gyroY, ltrim(txt));
  IntToStr((int)(MPU9150A.out_gyro.z * 1000.0f / MPU9150A.gdt),txt);
  updateLabel(&gyroZ, ltrim(txt));
  // Mag
  WordToStr((int)(MPU9150A.mag.x),txt);
  updateLabel(&magX, ltrim(txt));
  IntToStr((int)(MPU9150A.mag.y),txt);
  updateLabel(&magY, ltrim(txt));
  IntToStr((int)(MPU9150A.mag.z),txt);
  updateLabel(&magZ, ltrim(txt));
  //temperature (celsius)
  sprintf(txt, "%.2f", MPU9150A.temp);
  strcat (txt, " °C");
  updateLabel(&lblTemp, ltrim(txt));
}
Exemplo n.º 2
0
/**
 * Called when a widget wishes to display its documentation in the
 * doc window.  If there was already documentation there, that will
 * be updated before being removed from the view.
 *
 * Also call this function if you update the documentation in another
 * place, such as a properties dialog. Just set overwrite to true.
 *
 * Overwrite is used when you believe that the documentation window
 * is already displaying documentation for the widget you wish to
 * display.
 * Overwrite just determines whose version is more up to date.
 */
void DocWindow::showDocumentation(UMLObject * object, bool overwrite)
{
    if (!object) {
        reset();
        return;
    }

    if (m_Showing == st_UMLObject && object == m_pUMLObject) {
        if (!overwrite) {
            return;
        }
    }
    else if (m_Showing == st_UMLWidget && object == m_pUMLWidget->umlObject()) {
        if (!overwrite) {
            updateDocumentation();
        }
    }
    else {
        updateDocumentation(true);
    }

    m_Showing = st_UMLObject;
    m_pUMLObject = object;
    m_docTE->setText(m_pUMLObject->doc());
    if (m_pUMLObject->baseType() == UMLObject::ot_Folder) {
        UMLFolder *folder = m_pUMLObject->asUMLFolder();
        updateLabel(folder->localName());
    }
    else
        updateLabel(m_pUMLObject->name());
    toForeground();
}
Exemplo n.º 3
0
void LLPreviewGesture::initDefaultGesture()
{
	LLScrollListItem* item;
	item = addStep("Animation");
	LLGestureStepAnimation* anim = (LLGestureStepAnimation*)item->getUserdata();
	anim->mAnimAssetID = ANIM_AGENT_HELLO;
	anim->mAnimName = "Wave";
	updateLabel(item);

	item = addStep("Wait");
	LLGestureStepWait* wait = (LLGestureStepWait*)item->getUserdata();
	wait->mFlags = WAIT_FLAG_ALL_ANIM;
	updateLabel(item);

	item = addStep("Chat");
	LLGestureStepChat* chat_step = (LLGestureStepChat*)item->getUserdata();
	chat_step->mChatText = "Hello, avatar!";
	updateLabel(item);

	// Start with item list selected
	mStepList->selectFirstItem();

	// this is *new* content, so we are dirty
	mDirty = TRUE;
}
Exemplo n.º 4
0
void ImageWidget::execPrg(QAction *action) {
	QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));

	QString actionText = action->text();

	if (actionText.startsWith("Set label")) {
		int no = sizeof("Set label to ");
		QString labelText = actionText.mid(no -1);
		if (labelText == "None")
			updateLabel("");
		else 
			updateLabel(labelText);
qDebug() << "Setting label to " + labelText;
	} else {
		int space = actionText.indexOf(" ");
		int no = actionText.left(space).toInt() -1;

		InterlaceConfig* conf = InterlaceConfig::getInstance();

		QString confCommand = conf->getPrgCommand(no);
		QString file = QDir::toNativeSeparators(imageAbsoluteName);
		QString command = confCommand.replace("${file}", file);

		QProcess *proc = new QProcess();
		connect(proc, SIGNAL( finished ( int , QProcess::ExitStatus)), proc, SLOT(deleteLater()));
		proc->start(command);
		proc->waitForStarted(-1);
	}

	QApplication::restoreOverrideCursor();
}
Exemplo n.º 5
0
KisMouseInputEditor::KisMouseInputEditor(QWidget *parent)
    : KPushButton(parent), d(new Private)
{
    QWidget *popup = new QWidget();

    d->ui = new Ui::KisMouseInputEditor;
    d->ui->setupUi(popup);
    d->ui->mouseButton->setType(KisInputButton::MouseType);

    d->ui->clearModifiersButton->setIcon(KisIconUtils::loadIcon("edit-clear"));
    d->ui->clearMouseButton->setIcon(KisIconUtils::loadIcon("edit-clear"));

    QWidgetAction *action = new QWidgetAction(this);
    action->setDefaultWidget(popup);

    QMenu *menu = new QMenu(this);
    menu->addAction(action);
    setMenu(menu);

    QTimer::singleShot(0, this, SLOT(showMenu()));

    connect(d->ui->mouseButton, SIGNAL(dataChanged()), SLOT(updateLabel()));
    connect(d->ui->modifiersButton, SIGNAL(dataChanged()), SLOT(updateLabel()));
    connect(d->ui->clearMouseButton, SIGNAL(clicked(bool)), d->ui->mouseButton, SLOT(clear()));
    connect(d->ui->clearModifiersButton, SIGNAL(clicked(bool)), d->ui->modifiersButton, SLOT(clear()));
}
Exemplo n.º 6
0
void Annotator::pickLabel(void)
{
    uint64_t index = 0;
    bool picked = false;
    int label = -1;
    for(std::vector<QWidget*>::iterator iter=inputs_.begin();iter!=inputs_.end();++iter)
    {
        MeshPairViewerWidget* w = (MeshPairViewerWidget*)(*iter);
        if(picked)w->first_selected().clear();
        else {
            if(!w->first_selected().empty())
            {
                label = labels_[index](w->first_selected().back());
                picked = true;
                w->first_selected().clear();
            }
        }
        QApplication::processEvents();
        ++index;
    }
    if( label >= 0 )
    {
        updateLabel(label);
    }
}
Exemplo n.º 7
0
void ofxUIMinimalSlider::setParent(ofxUIWidget *_parent)
{
    parent = _parent;         
    ofxUIRectangle *labelrect = label->getRect(); 
    while(labelrect->width > rect->width)
    {
        string labelstring = label->getLabel();
        string::iterator it;
        it=labelstring.end();
        it--; 
        labelstring.erase (it); 
        label->setLabel(labelstring);
    }            
    if(autoSize || rect->height < label->getPaddingRect()->height)
    {
        rect->height = label->getPaddingRect()->height;                 
    }
    
    float h = labelrect->getHeight(); 
    float ph = rect->getHeight(); 	
    
    labelrect->y = (int)(ph*.5 - h*.5); 
    labelrect->x = padding; 
    paddedRect->height = rect->height+padding*2.0;  
    paddedRect->width = rect->width+padding*2.0;  

    updateLabel(); 
}	
Exemplo n.º 8
0
    //@{
    void addClicked()
    {
        QTreeWidgetItem *newRow = 0;
        QList<QTreeWidgetItem*> selectedPaths = m_treeView->selectedItems();

        if(selectedPaths.empty())
        {
            newRow = new QTreeWidgetItem( m_treeView );
        }
        else
        {
            newRow = new QTreeWidgetItem();
            m_treeView->insertTopLevelItem(m_treeView->indexOfTopLevelItem(selectedPaths.last()) + 1, newRow);
        }

        if(newRow)
        {
            newRow->setFlags(newRow->flags() | Qt::ItemIsEditable);
            m_adapter.updateToRow(newRow, typename MFAdapter::value_type());
            updateLabel();
            rebuildRowIndexes();
        }

        Q_EMIT signalChanged();
    }
Exemplo n.º 9
0
bool BaseModel::setData(const QModelIndex & index, const QVariant & value, int role)
{
	if(!index.isValid() || role != Qt::EditRole || index.column() != 0)
		return false;

	switch(value.toInt()) {
	case(0):
		if(selected_.contains(index))
			selected_.remove(index);
		break;
	case(2):
		if(!selected_.contains(index))
			selected_ << index;
		break;
	case(3):
		if(selected_.contains(index))
			selected_.remove(index);
		else
			selected_ << index;
		break;
	}

	emit dataChanged(index, index);
	emit updateLabel(0);

	return true;
}
Exemplo n.º 10
0
void BaseModel::unselectAll()
{
	emit layoutAboutToBeChanged();
	selected_.clear();
	emit updateLabel(0);
	emit layoutChanged();
}
Exemplo n.º 11
0
MumeClockWidget::MumeClockWidget(MumeClock *clock, QWidget *parent)
    : QWidget(parent),
      m_clock(clock)
{
    setupUi(this);

    m_lastSeason = SEASON_UNKNOWN;
    m_lastTime = TIME_UNKNOWN;
    m_lastPrecision = MUMECLOCK_UNSET;

    m_timer = new QTimer(this);
    connect(m_timer, SIGNAL(timeout()), this, SLOT(updateLabel()));
    m_timer->start(1000);

    updateLabel();
}
Exemplo n.º 12
0
void
QueryLabel::setResult( const Tomahawk::result_ptr& result )
{
    if ( result.isNull() )
        return;

    if ( !m_text.isEmpty() && contentsMargins().left() != 0 ) // FIXME: hacky
        m_textMargins = contentsMargins();

    setContentsMargins( BOXMARGIN * 2, BOXMARGIN / 2, BOXMARGIN * 2, BOXMARGIN / 2);

    if ( m_result.isNull() || m_result.data() != result.data() )
    {
        m_result = result;

        m_query = m_result->toQuery();
        QList<Tomahawk::result_ptr> rl;
        rl << m_result;
        m_query->addResults( rl );

        updateLabel();

        emit textChanged( text() );
        emit resultChanged( m_result );
    }
}
Exemplo n.º 13
0
// static
void LLPreviewGesture::onCommitAnimationTrigger(LLUICtrl* ctrl, void *data)
{
	LLPreviewGesture* self = (LLPreviewGesture*)data;

	LLScrollListItem* step_item = self->mStepList->getFirstSelected();
	if (step_item)
	{
		LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
		if (step->getType() == STEP_ANIMATION)
		{
			LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
			if (self->mAnimationRadio->getSelectedIndex() == 0)
			{
				// start
				anim_step->mFlags &= ~ANIM_FLAG_STOP;
			}
			else
			{
				// stop
				anim_step->mFlags |= ANIM_FLAG_STOP;
			}
			// Update the UI label in the list
			updateLabel(step_item);

			self->mDirty = TRUE;
			self->refresh();
		}
	}
}
Exemplo n.º 14
0
// static
void LLPreviewGesture::onCommitWait(LLUICtrl* ctrl, void* data)
{
	LLPreviewGesture* self = (LLPreviewGesture*)data;

	LLScrollListItem* step_item = self->mStepList->getFirstSelected();
	if (!step_item) return;

	LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
	if (step->getType() != STEP_WAIT) return;

	LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
	U32 flags = 0x0;
	if (self->mWaitAnimCheck->get()) flags |= WAIT_FLAG_ALL_ANIM;
	if (self->mWaitTimeCheck->get()) flags |= WAIT_FLAG_TIME;
	wait_step->mFlags = flags;

	{
		LLLocale locale(LLLocale::USER_LOCALE);

		F32 wait_seconds = (F32)atof(self->mWaitTimeEditor->getText().c_str());
		if (wait_seconds < 0.f) wait_seconds = 0.f;
		if (wait_seconds > 3600.f) wait_seconds = 3600.f;
		wait_step->mWaitSeconds = wait_seconds;
	}

	// Enable the input area if necessary
	self->mWaitTimeEditor->setEnabled(self->mWaitTimeCheck->get());

	// Update the UI label in the list
	updateLabel(step_item);

	self->mDirty = TRUE;
	self->refresh();
}
Exemplo n.º 15
0
void CandidateWindowProxy::slotReadyStandardOutput()
{
    QByteArray output = process->readAllStandardOutput();
    QList<QStringList> messageList = parse_messages(QString(output));
    for (int i = 0, j = messageList.count(); i < j; i++) {
        QStringList message = messageList[i];
        QString command = message[0];
        if (command == "set_candidate_index") {
            uim_set_candidate_index(ic->uimContext(), message[1].toInt());
        } else if (command == "set_candidate_index_2") {
            candidateIndex = pageIndex * displayLimit + message[1].toInt();
            uim_set_candidate_index(ic->uimContext(), candidateIndex);
        } else if (command == "set_candwin_active") {
            ic->setCandwinActive();
        } else if (command == "set_focus_widget") {
            setFocusWidget();
        } else if (command == "update_label") {
            updateLabel();
        }
#ifdef WORKAROUND_BROKEN_RESET_IN_QT4
        else if (command == "shown") {
            m_isVisible = true;
        } else if (command == "hidden") {
            m_isVisible = false;
        }
#endif
    }
}
Exemplo n.º 16
0
// static
void LLPreviewGesture::onCommitAnimation(LLUICtrl* ctrl, void* data)
{
	LLPreviewGesture* self = (LLPreviewGesture*)data;

	LLScrollListItem* step_item = self->mStepList->getFirstSelected();
	if (step_item)
	{
		LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
		if (step->getType() == STEP_ANIMATION)
		{
			// Assign the animation name
			LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
			if (self->mAnimationCombo->getCurrentIndex() == 0)
			{
				anim_step->mAnimName.clear();
				anim_step->mAnimAssetID.setNull();
			}
			else
			{
				anim_step->mAnimName = self->mAnimationCombo->getSimple();
				anim_step->mAnimAssetID = self->mAnimationCombo->getCurrentID();
			}
			//anim_step->mFlags = 0x0;

			// Update the UI label in the list
			updateLabel(step_item);

			self->mDirty = TRUE;
			self->refresh();
		}
	}
}
Exemplo n.º 17
0
/**
 * This method is the same as the one for UMLObjects except it
 * displays documentation for an object instance (StateWidget/
 * ObjectWidget).
 */
void DocWindow::showDocumentation(UMLWidget * widget, bool overwrite)
{
    if (!widget) {
        reset();
        return;
    }

    if (m_Showing == st_UMLWidget && widget == m_pUMLWidget) {
        if (!overwrite) {
            return;
        }
    }
    else if (m_Showing == st_UMLObject && widget->umlObject() == m_pUMLObject)
    {
        if (!overwrite) {
            updateDocumentation();
        }
    }
    else if (m_Showing == st_UMLScene && widget->umlScene() == m_pUMLScene)
    {
        if (!overwrite) {
            updateDocumentation();
        }
    }
    else {
        updateDocumentation(true);
    }

    m_Showing = st_UMLWidget;
    m_pUMLWidget = widget;
    m_docTE->setText(m_pUMLWidget->documentation());
    updateLabel(m_pUMLWidget->name());
    toForeground();
}
Exemplo n.º 18
0
void BowButton::onTouchEnded(Touch *pTouch, Event *event) {
	int unlockJewel = 250;
	if (this->isTouchedInsert(pTouch)) {
		switch (_state) {
		case BowButtonState::LOCKED:
			if (DATAOPERATOR->getJewel() > unlockJewel && this->isUpgradeEnable()) {
				DATAOPERATOR->setJewel(DATAOPERATOR->getJewel() - unlockJewel);
				auto parent = dynamic_cast<SelectScene *>(_parent);
				parent->updateLabel();
				this->unlock();
			}
			else {
				if (DATAOPERATOR->getEffectEnable())
					AUDIOENGINE->playEffect(GOLDOVER_EFFECT_NAME);
			}
			break;
		case BowButtonState::UNLOCK_UNSELECTED:
			this->select();
			_showSprite->setSpriteFrame(_up);
			break;
		case BowButtonState::UNLOCK_SELECTED:
			_showSprite->setSpriteFrame(_up);
			break;
		default:
			break;
		}
	}
}
Exemplo n.º 19
0
	void StatusSummaryItem::setCount(uint count) {
		if (m_count != count)
			emit countChanged();
		m_count = count;

		updateLabel();
	}
Exemplo n.º 20
0
/**
 * This method is the same as the one for UMLObjects except it
 * displays documentation for a diagram.
 */
void DocWindow::showDocumentation(UMLScene * scene, bool overwrite)
{
    if (!scene) {
        reset();
        return;
    }

    if (m_Showing == st_UMLScene && scene == m_pUMLScene) {
        if (!overwrite) {
            return;
        }
    }
    else if (m_Showing == st_UMLWidget && scene == m_pUMLWidget->umlScene()) {
        if (!overwrite) {
            updateDocumentation();
        }
    }
    else {
        updateDocumentation(true);
    }

    m_Showing = st_UMLScene;
    m_pUMLScene = scene;
    m_docTE->setText(m_pUMLScene->documentation());
    updateLabel(m_pUMLScene->name());
    toForeground();
}
Exemplo n.º 21
0
void ofxUISlider_<T>::setValue(T _value)
{
    value = ofxUIMap(_value, min, max, 0.0, 1.0, bClampValue);

    updateValueRef();
    updateLabel();
}
Exemplo n.º 22
0
Geometry::Geometry()
{
    setWindowTitle(tr("Geometry"));

    label1 = new QLabel;
    label1->setText("x():"); 
    label2 = new QLabel;
    label2->setText("y():"); 
    label3 = new QLabel;
    label3->setText("frameGeometry():"); 
    label4 = new QLabel;
    label4->setText("pos():"); 
    label5 = new QLabel;
    label5->setText("geometry():"); 
    label6 = new QLabel;
    label6->setText("width():"); 
    label7 = new QLabel;
    label7->setText("height():"); 
    label8 = new QLabel;
    label8->setText("rect():"); 
    label9 = new QLabel;
    label9->setText("size():");  
    
    xLabel = new QLabel;
    yLabel = new QLabel;
    frameGeoLabel = new QLabel;
    posLabel = new QLabel;
    geoLabel = new QLabel;
    widthLabel = new QLabel;
    heightLabel = new QLabel;
    rectLabel = new QLabel;
    sizeLabel = new QLabel;  
    
    QGridLayout *layout = new QGridLayout(this);
    layout->setMargin(20);
    layout->setSpacing(10);
    int l = 0;
    int c = 1;
    layout->addWidget(label1,0,l);
    layout->addWidget(xLabel,0,c);
    layout->addWidget(label2,1,l);
    layout->addWidget(yLabel,1,c);
    layout->addWidget(label3,2,l);
    layout->addWidget(frameGeoLabel,2,c);
    layout->addWidget(label4,3,l);
    layout->addWidget(posLabel,3,c);
    layout->addWidget(label5,4,l);
    layout->addWidget(geoLabel,4,c);
    layout->addWidget(label6,5,l);
    layout->addWidget(widthLabel,5,c);
    layout->addWidget(label7,6,l);
    layout->addWidget(heightLabel,6,c);
    layout->addWidget(label8,7,l);
    layout->addWidget(rectLabel,7,c);
    layout->addWidget(label9,8,l);
    layout->addWidget(sizeLabel,8,c);
  
    updateLabel();
}
Exemplo n.º 23
0
EmailComposer::EmailComposer( QWidget *parent, const char *name )
  : QTextEdit( parent ),
    m_index( -1 )
{
    setObjectName(name);

    setFrameStyle(NoFrame);
    setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );

    connect( this, SIGNAL(textChanged()), this, SIGNAL(contentChanged()) );
    connect( this, SIGNAL(textChanged()), this, SLOT(updateLabel()) );
    setWordWrapMode( QTextOption::WordWrap);

    m_addAttDialog = new AddAttDialog(this, "attachmentDialog");

    updateLabel();
}
Exemplo n.º 24
0
SkyLine::SkyLine(SKY_LINE_TYPE _line_type) : color(0.f, 0.f, 1.f)
{
	// Font size is 14
	font.setPixelSize(StelApp::getInstance().getBaseFontSize()+1);
	line_type = _line_type;

	updateLabel();
}
Exemplo n.º 25
0
void ofxUISlider_<T>::setParent(ofxUIWidget *_parent)
{
	parent = _parent;
	label->getRect()->setY(rect->getHeight()+padding);
	calculatePaddingRect();
	updateValueRef();
	updateLabel();
}
Exemplo n.º 26
0
void
ElideLabel::setElideMode(Qt::TextElideMode mode) {
  if (mode == m_elideMode)
    return;

  m_elideMode = mode;
  updateLabel();
}
Exemplo n.º 27
0
void ofxUIRotarySlider::update()
{
    if(useReference)
    {
        value = ofxUIMap(*valueRef, min, max, 0.0, 1.0, true);
        updateLabel();
    }
}
Exemplo n.º 28
0
void WTrackProperty::slotTrackLoaded(TrackPointer track) {
    if (track) {
        m_pCurrentTrack = track;
        connect(track.data(), SIGNAL(changed(Track*)),
                this, SLOT(updateLabel(Track*)));
        updateLabel(track.data());
    }
}
Exemplo n.º 29
0
void ofxUISlider_<T>::update()
{
	if(useReference)
	{
		value = ofxUIMap(*valueRef, min, max, 0.0, 1.0, bClampValue);
		updateLabel();
	}
}
Exemplo n.º 30
0
void
ElideLabel::changeEvent(QEvent *event) {
  QFrame::changeEvent(event);

  auto type = event->type();
  if ((QEvent::FontChange == type) || (QEvent::ApplicationFontChange == type))
    updateLabel();
}