Exemplo n.º 1
0
  /*
  * \bug fel  om vi flyttas till att vara första barn..
  */
  void CellCursor::moveBefore(Cell *current)
  {
    // 2006-04-27 AF,
    cursorIsMoved();

    removeFromCurrentPosition();

    //Remove all widgets from currents parent.
    current->parentCell()->removeCellWidgets();

    //Move to new position.
    if(current->hasParentCell())
    {
      setParentCell(current->parentCell());
      if(!current->hasPrevious())
        current->parentCell()->setChild(this);
      else
        current->previous()->setNext(this);

    }
    else
      throw runtime_error("Could not insert before root");

    setPrevious(current->previous());
    current->setPrevious(this);
    setNext(current);

    //Insert widgets to parents layout.
    parentCell()->addCellWidgets();

    // TMP EMIT
    emit changedPosition();
    //      emit positionChanged(x(), y(), 5, 5);
  }
Exemplo n.º 2
0
  void CellCursor::addBefore(Cell *newCell)
  {
    // 2006-04-27 AF,
    cursorIsMoved();

    if(parentCell()->child() == this)
    { //first in line.
      newCell->setParentCell(parentCell());
      newCell->setNext(this);
      newCell->setPrevious(0);
      parentCell()->setChild(newCell);
      setPrevious(newCell);
    }
    else
    {
      newCell->setParentCell(parentCell());
      newCell->setPrevious(previous());
      previous()->setNext(newCell);
      setPrevious(newCell);
      newCell->setNext(this);
    }

    parentCell()->addCellWidget(newCell);

    // TMP EMIT
    emit changedPosition();
  }
QGraphicsItem * JackTransportClient::createGraphicsItem()
{
    JackTransportGraphicsItem *graphicsItem = new JackTransportGraphicsItem(this);
    JackTransportThread *thread = (JackTransportThread*)getJackThread();
    QObject::connect(thread, SIGNAL(changedPosition(QString)), graphicsItem, SLOT(changePosition(QString)));
    return graphicsItem;
}
void JackTransportThread::processDeferred()
{
    if (ringBufferFromClient && ringBufferFromClient->readSpace()) {
        ringBufferFromClient->readAdvance(ringBufferFromClient->readSpace() - 1);
        jack_position_t pos = ringBufferFromClient->read();
        // create a string describing the current position:
        // (ignore unique_1 and usecs because these are rather unnerving)
        QString posText = QString("frame_rate: %1\nframe: %2")
                .arg(pos.frame_rate)
                .arg(pos.frame);
        if (pos.valid & JackPositionBBT) {
            posText += QString("\nbar: %1\nbeat: %2\ntick: %3\nbar_start_tick: %4\nbeats_per_bar: %5\nbeat_type: %6\nticks_per_beat: %7\nbeats_per_minute: %8")
                    .arg(pos.bar)
                    .arg(pos.beat)
                    .arg(pos.tick)
                    .arg(pos.bar_start_tick)
                    .arg(pos.beats_per_bar)
                    .arg(pos.beat_type)
                    .arg(pos.ticks_per_beat)
                    .arg(pos.beats_per_minute);
        }
        if (pos.valid & JackPositionTimecode) {
            posText += QString("\nframe_time: %1\nnext_time: %2")
                    .arg(pos.frame_time)
                    .arg(pos.next_time);
        }
        if (pos.valid & JackBBTFrameOffset) {
            posText += QString("\nbbt_offset: %1")
                    .arg(pos.bbt_offset);
        }
        changedPosition(posText);
    }
}
Exemplo n.º 5
0
Util_Move_Object_Class::Util_Move_Object_Class(QObject *parent) :
    QObject(parent)
{
    moveTimer = new QTimer();
    QObject::connect(this->moveTimer, SIGNAL(timeout()), this, SLOT(changedPosition()));

    rotateTimer = new QTimer();
    QObject::connect(this->rotateTimer, SIGNAL(timeout()), this, SLOT(changedRotation()));

    rotateCameraTimer= new QTimer();
         QObject::connect(this->rotateCameraTimer, SIGNAL(timeout()), this, SLOT(changedCameraRotation()));
}
Exemplo n.º 6
0
ThingView::ThingView(const Thing& thing, QGraphicsItem *parent) :
        QGraphicsPolygonItem(parent)
{
    /* colorize! */
    setAppearanceDependingOnID(thing.id());

    /* we need the body only to connect to it. no reference is stored. */
    connect(&thing, SIGNAL(changedPosition(QTransform)), this, SLOT(bodyChanged(QTransform)));

    /* initially set our location parameters */
    bodyChanged(thing.getWorldMap());

    /* adept our model's shape */
    setPolygon(thing.shape());
}
Exemplo n.º 7
0
  // 2006-08-24 AF, changed so the function returns a boolean value, true if
  // the cursor is moved.
  bool CellCursor::moveUp()
  {
    // 2006-08-24 AF,
        bool moved( false );

    // 2006-04-27 AF,
    cursorIsMoved();

    if( !hasPrevious() )
    {
      if( parentCell()->hasParentCell() )
      {
        moveBefore( parentCell() );
        moved = true;
      }
    }
    else
    {
      //previous() exists.
      if(previous()->hasChilds())
      {
        if(!previous()->isClosed())
        {
          moveToLastChild(previous());
          moved = true;
        }
        else
        {
          moveBefore(previous());
          moved = true;
        }
      }
      else
      {
        moveBefore(previous());
        moved = true;
      }
    }
    emit positionChanged(x(), y(), 5,5);

    // TMP EMIT
    emit changedPosition();
    return moved;
  }
Exemplo n.º 8
0
  /*!
  * \bug This does not seem to work correctly.
  */
  void CellCursor::moveToLastChild(Cell *parent)
  {
    // 2006-04-27 AF,
    cursorIsMoved();

    if(parent->hasChilds())
    {
      parent->removeCellWidgets();
      moveAfter(parent->last());
      parent->addCellWidgets();
    }
    else
    {
      throw runtime_error("LAST CHILD: Tried to move to a child that did not exist.");
    }

    // TMP EMIT
    emit changedPosition();
  }
Exemplo n.º 9
0
  /*!
  * \bug Segmentationfault when last cell.
  *
  * \todo It is better that Commands take care of how to change
  * state of cells.(Ingemar Axelsson)
  *
  * 2006-08-24 AF, changed so the function returns a boolean value, true if
  * the cursor is moved.
  */
  bool CellCursor::moveDown()
  {
    // 2006-08-24 AF,
        bool moved( false );

    // 2006-04-27 AF,
    cursorIsMoved();

    if( !hasNext() )
    {
      if( parentCell()->hasParentCell() )
      {
        moveAfter( parentCell() );
        moved = true;
      }
    }
    else //Has next.
    {
      if(next()->hasChilds())
      {
        if(!next()->isClosed())
        {
          moveToFirstChild(next());
          moved = true;
        }
        else
        {
          moveAfter(next());
          moved = true;
        }
      }
      else
      {
        moveAfter(next());
        moved = true;
      }
    }
    // TMP EMIT
    emit changedPosition();
    emit positionChanged(x(), y(), 5,5);
    return moved;
  }
Exemplo n.º 10
0
  /*!
  * \bug Fel vid flytt så cursor hamnar som sista barn.
  */
  void CellCursor::moveAfter(Cell *current)
  {
    // 2006-04-27 AF,
    cursorIsMoved();

    removeFromCurrentPosition();

    //if(!current->hasParentCell())
    //  throw runtime_error("Could not insert after root");

    if(current->hasParentCell())
    {
      current->parentCell()->removeCellWidgets();

      if(current->hasNext() == 0)
      {
        current->parentCell()->setLast(this);
      }
      else
        current->next()->setPrevious(this);

      setParentCell(current->parentCell());
      setNext(current->next());
      current->setNext(this);
      setPrevious(current);

      //insert widgets to parents layout.
      parentCell()->addCellWidgets();
    }
    else
    {
      //If current does not have a parent. That is current is not
      //in the celltree at all or that current is the root of the
      //tree. It should not be possible to move after the root of
      //the tree. Do nothing!
    }

    // TMP EMIT
    emit changedPosition();
    //      emit positionChanged(x(), y(), 5,5);
  }
Exemplo n.º 11
0
  /*! Insert this cell as first child of parent.
  *
  * \bug This does not seem to work correctly.
  */
  void CellCursor::moveToFirstChild(Cell *parent)
  {
    // 2006-04-27 AF,
    cursorIsMoved();

    if(parent->hasChilds())
    {
      parent->removeCellWidgets();
      moveBefore(parent->child());
      parent->addCellWidgets();
    }
    else //No child.
    {
      //Become first child.
      parent->removeCellWidgets();
      parent->setChild(this);
      parent->setLast(this);
      parent->addCellWidgets();
    }

    // TMP EMIT
    emit changedPosition();
  }
Exemplo n.º 12
0
  /*! \bug Segfault in cellgroups. Probably a parent, child or last.
  * \bug Deletion of last cell in cellgroup should be taken care of.
  */
  void CellCursor::deleteCurrentCell()
  {
    if(hasPrevious()) //If cursor has previous
    {
      // 2006-04-27 AF,
      cursorIsMoved();

      //removeCurrentCell();

      //OLD CODE
      //Remove currentCell.
      Cell *current = previous(); //Save a pointer to the cell being deleted.

      removeCurrentCell();
      // removeFromCurrentPosition();

      //    if(current->hasPrevious())
      //       current->previous()->setNext(this);
      //    else
      //       parentCell()->setChild(this);

      //    setPrevious(current->previous());

      //    current->setParentCell(0);
      //    current->setPrevious(0);
      //    current->setNext(0);
      //    current->setChild(0);
      //    current->setLast(0);

      //Segfault on delete.
      delete current;

      //parentCell()->addCellWidgets();
    }
    // TMP EMIT
    emit changedPosition();
  }