void GestureController::dealMoved(const QPointF& pos)
{
  // Record the move
  if (gestureState == ChooseGesture)
  {
    int index = gameboardInfo->indexOfPosition(pos);
    if (index >= 0)
    {
      if (gestureIndexes.size() == 0 ||
          (gestureIndexes.size() > 0 &&
           gestureIndexes[gestureIndexes.size() - 1] != index))
      {
        if (controller->balls[index] && !controller->balls[index]->getLocked())
        {
          gestureIndexes.push_back(index);
          effectPainter->selectAt(index);
        }
        else
        {
          // Clear
          gestureIndexes.clear();
          effectPainter->clearSelectionHints();
        }
      }
    }

    // Test the gesture
    testGesture(pos);
  }
  if (gestureState == LocateGesture)
    controller->rotateTransition(pos);
}
Example #2
0
    StateGestureDialog::StateGestureDialog(GestureModel* gestureModel, ObjectModel* objectModel, TestDialog* testDialog, QWidget *parent) :
        QDialog(parent),
        gestureModel_(gestureModel),
        objectModel_(objectModel),
        testDialog_(testDialog),
        testedGesture_(0),
        editedGesture_(0),
        currentState_(0),
        ui_(new Ui::StateGestureDialog)
    {
        ui_->setupUi(this);

        states_.push_back(new ObjectStateSettings<bool>("vibility", &ObjectWrapper::RawObject::isVisible));
        states_.push_back(new ObjectStateSettings<Point>("position", &ObjectWrapper::RawObject::position));
        states_.push_back(new ObjectStateSettings<int>("angle", &ObjectWrapper::RawObject::angle));
        states_.push_back(new ObjectStateSettings<Fraction>("area", &ObjectWrapper::RawObject::areaSize));
        states_.push_back(new ObjectStateSettings<double>("sides aspect ratio", &ObjectWrapper::RawObject::sidesAspectRatio));

        ui_->object->setModel(objectModel);

        initPropertyComboBox();

        connect(ui_->deleteButton, SIGNAL(clicked()), this, SLOT(deleteGesture()));
        connect(ui_->testButton, SIGNAL(clicked()), this, SLOT(testGesture()));
    }