+/* Function called when the button is clicked() */
+void AdvControlsWidget::fromAtoB()
+{
+ if( !timeA )
+ {
+ timeA = var_GetTime( THEMIM->getInput(), "time" );
+ ABButton->setText( "A->..." );
+ return;
+ }
+ if( !timeB )
+ {
+ timeB = var_GetTime( THEMIM->getInput(), "time" );
+ var_SetTime( THEMIM->getInput(), "time" , timeA );
+ ABButton->setText( "A<=>B" );
+ return;
+ }
+ timeA = 0;
+ timeB = 0;
+ ABButton->setText( "AB" );
+}
+
+/* Function called regularly when in an AtoB loop */
+void AdvControlsWidget::AtoBLoop( float f_pos, int i_time, int i_length )
+{
+ if( timeB )
+ {
+ if( i_time >= (int)(timeB/1000000) )
+ var_SetTime( THEMIM->getInput(), "time" , timeA );
+ }
+}
+
+/* FIXME Record function */
+void AdvControlsWidget::record(){}
+
+//FIXME Frame by frame function
+void AdvControlsWidget::frame(){}
+
+/*****************************
+ * DA Control Widget !
+ *****************************/
+ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
+ MainInterface *_p_mi,
+ bool b_advControls,
+ bool b_shiny ) :
+ QFrame( NULL ), p_intf( _p_i )
+{
+ controlLayout = new QGridLayout( this );
+ controlLayout->setSpacing( 0 );
+#if QT43
+ controlLayout->setContentsMargins( 9, 6, 9, 6 );
+#else
+ controlLayout->setMargin( 6 );
+#endif
+
+ setSizePolicy( QSizePolicy::Preferred , QSizePolicy::Maximum );
+
+ /** The main Slider **/
+ slider = new InputSlider( Qt::Horizontal, NULL );
+ controlLayout->addWidget( slider, 0, 1, 1, 16 );
+ /* Update the position when the IM has changed */
+ CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
+ slider, setPosition( float, int, int ) );
+ /* And update the IM, when the position has changed */
+ CONNECT( slider, sliderDragged( float ),
+ THEMIM->getIM(), sliderUpdate( float ) );
+
+ /** Slower and faster Buttons **/
+ slowerButton = new QPushButton;
+ slowerButton->setFlat( true );
+ slowerButton->setMaximumSize( QSize( 26, 20 ) );
+
+ BUTTON_SET_ACT( slowerButton, "-", qtr( "Slower" ), slower() );
+ controlLayout->addWidget( slowerButton, 0, 0 );
+
+ fasterButton = new QPushButton;
+ fasterButton->setFlat( true );
+ fasterButton->setMaximumSize( QSize( 26, 20 ) );
+
+ BUTTON_SET_ACT( fasterButton, "+", qtr( "Faster" ), faster() );
+ controlLayout->addWidget( fasterButton, 0, 17 );
+
+ /* advanced Controls handling */
+ b_advancedVisible = b_advControls;
+
+ advControls = new AdvControlsWidget( p_intf );
+ controlLayout->addWidget( advControls, 1, 3, 2, 4, Qt::AlignBottom );
+ if( !b_advancedVisible ) advControls->hide();
+
+ /** Disc and Menus handling */
+ discFrame = new QFrame( this );
+
+ QHBoxLayout *discLayout = new QHBoxLayout( discFrame );
+ discLayout->setSpacing( 0 );
+ discLayout->setMargin( 0 );
+
+ prevSectionButton = new QPushButton( discFrame );
+ setupSmallButton( prevSectionButton );
+ discLayout->addWidget( prevSectionButton );
+
+ menuButton = new QPushButton( discFrame );
+ setupSmallButton( menuButton );
+ discLayout->addWidget( menuButton );
+
+ nextSectionButton = new QPushButton( discFrame );
+ setupSmallButton( nextSectionButton );
+ discLayout->addWidget( nextSectionButton );
+
+ controlLayout->addWidget( discFrame, 1, 10, 2, 3, Qt::AlignBottom );
+
+ BUTTON_SET_IMG( prevSectionButton, "", previous.png, "" );
+ BUTTON_SET_IMG( nextSectionButton, "", next.png, "" );
+ BUTTON_SET_IMG( menuButton, "", previous.png, "" );
+
+ discFrame->hide();
+
+ /* Change the navigation button display when the IM navigation changes */
+ CONNECT( THEMIM->getIM(), navigationChanged( int ),
+ this, setNavigation( int ) );
+ /* Changes the IM navigation when triggered on the nav buttons */
+ CONNECT( prevSectionButton, clicked(), THEMIM->getIM(),
+ sectionPrev() );
+ CONNECT( nextSectionButton, clicked(), THEMIM->getIM(),
+ sectionNext() );
+ CONNECT( menuButton, clicked(), THEMIM->getIM(),
+ sectionMenu() );
+
+ /** TODO
+ * Telextext QFrame
+ * Merge with upper menu in a StackLayout
+ **/
+
+ /** Play Buttons **/
+ QSizePolicy sizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
+ sizePolicy.setHorizontalStretch( 0 );
+ sizePolicy.setVerticalStretch( 0 );
+
+ /* Play */
+ playButton = new QPushButton;
+ playButton->setSizePolicy( sizePolicy );
+ playButton->setMaximumSize( QSize( 36, 36 ) );
+ playButton->setMinimumSize( QSize( 36, 36 ) );
+ playButton->setIconSize( QSize( 30, 30 ) );
+
+ controlLayout->addWidget( playButton, 2, 0, 2, 2 );
+
+ controlLayout->setColumnMinimumWidth( 2, 20 );
+ controlLayout->setColumnStretch( 2, 0 );
+
+ /** Prev + Stop + Next Block **/
+ QHBoxLayout *controlButLayout = new QHBoxLayout;
+ controlButLayout->setSpacing( 0 ); /* Don't remove that, will be useful */
+
+ /* Prev */
+ QPushButton *prevButton = new QPushButton;
+ prevButton->setSizePolicy( sizePolicy );
+ setupSmallButton( prevButton );
+
+ controlButLayout->addWidget( prevButton );
+
+ /* Stop */
+ QPushButton *stopButton = new QPushButton;
+ stopButton->setSizePolicy( sizePolicy );
+ setupSmallButton( stopButton );
+
+ controlButLayout->addWidget( stopButton );
+
+ /* next */
+ QPushButton *nextButton = new QPushButton;
+ nextButton->setSizePolicy( sizePolicy );
+ setupSmallButton( nextButton );
+
+ controlButLayout->addWidget( nextButton );