void Qgs3DAnimationWidget::onEditKeyframe()
{
  int index = cboKeyframe->currentIndex();
  if ( index <= 0 )
    return;

  Qgs3DAnimationSettings::Keyframe kf = cboKeyframe->itemData( index, Qt::UserRole + 1 ).value<Qgs3DAnimationSettings::Keyframe>();

  bool ok;
  float t = askForKeyframeTime( kf.time, &ok );
  if ( !ok )
    return;

  cboKeyframe->setCurrentIndex( 0 );
  cboKeyframe->removeItem( index );

  initializeController( animation() );

  // figure out position of this keyframe
  int newIndex = findIndexForKeyframe( t );

  kf.time = t;

  cboKeyframe->insertItem( newIndex + 1, QStringLiteral( "%1 s" ).arg( kf.time ) );
  cboKeyframe->setItemData( newIndex + 1, QVariant::fromValue<Qgs3DAnimationSettings::Keyframe>( kf ), Qt::UserRole + 1 );

  initializeController( animation() );

  cboKeyframe->setCurrentIndex( newIndex + 1 );
}
void Qgs3DAnimationWidget::onInterpolationChanged()
{
  initializeController( animation() );

  if ( cboKeyframe->currentIndex() <= 0 )
    onSliderValueChanged();
}
示例#3
0
VirusGenius::VirusGenius(QWidget *parent)
	: QMainWindow(parent)
{
	ui.setupUi(this);
	initializeController();
	synchronizeGUI();
}
void Qgs3DAnimationWidget::onRemoveKeyframe()
{
  int index = cboKeyframe->currentIndex();
  if ( index <= 0 )
    return;

  cboKeyframe->setCurrentIndex( 0 );
  cboKeyframe->removeItem( index );

  initializeController( animation() );
}
ChooseProfileDialog::ChooseProfileDialog(QWidget *parent, const QStringList &profiles, const QString &current_profile) :
    QDialog(parent),
    ui(new Ui::ChooseProfileDialog)
{
    ui->setupUi(this);

    setWindowTitle(tr("Choose Profile to use"));

    initialize(profiles, current_profile);
    initializeController();
}
void Qgs3DAnimationWidget::setAnimation( const Qgs3DAnimationSettings &animSettings )
{
  cboInterpolation->setCurrentIndex( animSettings.easingCurve().type() );

  // initialize GUI from the given animation
  cboKeyframe->clear();
  cboKeyframe->addItem( tr( "<none>" ) );
  for ( const Qgs3DAnimationSettings::Keyframe &keyframe : animSettings.keyFrames() )
  {
    cboKeyframe->addItem( QStringLiteral( "%1 s" ).arg( keyframe.time ) );
    int lastIndex = cboKeyframe->count() - 1;
    cboKeyframe->setItemData( lastIndex, QVariant::fromValue<Qgs3DAnimationSettings::Keyframe>( keyframe ), Qt::UserRole + 1 );
  }

  initializeController( animSettings );
}
void Qgs3DAnimationWidget::onCameraChanged()
{
  if ( cboKeyframe->currentIndex() <= 0 )
    return;

  // update keyframe's camera position/rotation
  int i = cboKeyframe->currentIndex();
  Qgs3DAnimationSettings::Keyframe kf = cboKeyframe->itemData( i, Qt::UserRole + 1 ).value<Qgs3DAnimationSettings::Keyframe>();
  kf.point = mCameraController->lookingAtPoint();
  kf.dist = mCameraController->distance();
  kf.pitch = mCameraController->pitch();
  kf.yaw = mCameraController->yaw();
  cboKeyframe->setItemData( i, QVariant::fromValue<Qgs3DAnimationSettings::Keyframe>( kf ), Qt::UserRole + 1 );

  initializeController( animation() );
}
void Qgs3DAnimationWidget::onAddKeyframe()
{
  bool ok;
  float t = askForKeyframeTime( sliderTime->value() / 100., &ok );
  if ( !ok )
    return;

  int index = findIndexForKeyframe( t );

  Qgs3DAnimationSettings::Keyframe kf;
  kf.time = t;
  kf.point = mCameraController->lookingAtPoint();
  kf.dist = mCameraController->distance();
  kf.pitch = mCameraController->pitch();
  kf.yaw = mCameraController->yaw();

  cboKeyframe->insertItem( index + 1, QStringLiteral( "%1 s" ).arg( kf.time ) );
  cboKeyframe->setItemData( index + 1, QVariant::fromValue<Qgs3DAnimationSettings::Keyframe>( kf ), Qt::UserRole + 1 );

  initializeController( animation() );

  cboKeyframe->setCurrentIndex( index + 1 );
}
void Facade::initializeFacade(void)
{
    initializeModel();
    initializeController();
    initializeView();
}