void MusicWidget::setupSensors()
{
    QSensorGestureManager manager;
    QStringList gestureIds = manager.gestureIds();
    qDebug() << gestureIds;
    if(gestureIds.contains("QtSensors.shake2"))
    {
        qDebug() << "setup shake 2 sensor";
        m_shakeGesture = new QSensorGesture(
                    QStringList() << "QtSensors.shake2"
                    , this);
        connect(m_shakeGesture, SIGNAL(shakeUp()),
                m_playlist, SLOT(previous()));
        connect(m_shakeGesture, SIGNAL(shakeDown()),
                m_playlist, SLOT(next()));
        connect(m_shakeGesture, SIGNAL(shakeLeft()),
                m_playlist, SLOT(previous()));
        connect(m_shakeGesture, SIGNAL(shakeRight()),
                m_playlist, SLOT(next()));

    }
    else if(gestureIds.contains("QtSensors.shake"))
    {
        qDebug() << "setup shake sensor";
        m_shakeGesture = new QSensorGesture(
                    QStringList() << "QtSensors.shake"
                    , this);
        connect(m_shakeGesture, SIGNAL(shake()),
                m_playlist, SLOT(next()));
    }
    if(gestureIds.contains("QtSensors.turnover"))
    {
        m_turnoverGesture = new QSensorGesture(
                    QStringList("QtSensors.turnover")
                    ,this
                    );
        connect(m_turnoverGesture, SIGNAL(turnover()),
                this, SLOT(onTurnover()));
    }
}
Esempio n. 2
0
bool Chain::isCsymm ()
{
	//	is this chain a DNA chain?
	this->setIsDNA ();

	//	is this chain a RNA chain?
	this->setIsRNA ();

	//	yes
	if (isDNA)
	{
		string fw_unicode = genUnicode (0, listOfParts.size ()-1, true);
		string rev_unicode = genUnicode (0, listOfParts.size ()-1, false);
		if (rev_unicode < fw_unicode) {turnover (); unicode = rev_unicode; return false;}
		else if (rev_unicode > fw_unicode) {unicode = fw_unicode; return false;}
		else {unicode = fw_unicode; return true;}
	}
	else
	{
		unicode = genUnicode (0, listOfParts.size ()-1, true);
		return false;
	}
}