void MythWizard::showPage( QWidget * page ) { MythWizardPrivate::Page * p = d->page( page ); if ( p ) { int i; for( i = 0; i < d->pages.size() && d->pages[i] != p; i++ ); bool notFirst( false ); if (i) { i--; while ((i >= 0) && !notFirst) { notFirst |= appropriate(d->pages[i]->w); i--; } } setBackEnabled( notFirst ); setNextEnabled( true ); d->ws->setCurrentWidget(page); d->current = p; } layOut(); updateButtons(); emit selected( p ? p->t : QString() ); if (indexOf(page) == pageCount()-1) { // last page finishButton()->setEnabled(true); finishButton()->setFocus(); } else { nextButton()->setFocus(); } }
void QWizard::updateButtons() { if ( !d->current ) return; int i; for( i = 0; i < (int)d->pages.count() && d->pages.at( i ) != d->current; i++ ); bool notFirst( FALSE ); if( i ) { i--; while( ( i >= 0 ) && !notFirst ) { notFirst |= appropriate( d->pages.at( i )->w ); i--; } } setBackEnabled( d->current->backEnabled && notFirst ); setNextEnabled( d->current->nextEnabled ); d->finishButton->setEnabled( d->current->finishEnabled ); d->helpButton->setEnabled( d->current->helpEnabled ); if ( ( d->current->finishEnabled && !d->finishButton->isVisible() ) || ( d->current->backEnabled && !d->backButton->isVisible() ) || ( d->current->nextEnabled && !d->nextButton->isVisible() ) || ( d->current->helpEnabled && !d->helpButton->isVisible() ) ) layOut(); }
void QWizard::showPage( QWidget * page ) { QWizardPrivate::Page * p = d->page( page ); if ( p ) { int i; for( i = 0; i < (int)d->pages.count() && d->pages.at( i ) != p; i++ ); bool notFirst( FALSE ); if( i ) { i--; while( ( i >= 0 ) && !notFirst ) { notFirst |= appropriate( d->pages.at( i )->w ); i--; } } setBackEnabled( notFirst ); setNextEnabled( TRUE ); d->ws->raiseWidget( page ); d->current = p; } layOut(); updateButtons(); emit selected( p ? p->t : QString::null ); }
void LocationBar::setIndex( const QModelIndex &index ) { qDeleteAll( buttons ); buttons.clear(); qDeleteAll( actions ); actions.clear(); QModelIndex i = index; bool first = true; while( true ) { PLItem *item = model->getItem( i ); QString text; char *fb_name = input_item_GetTitle( item->inputItem() ); if( EMPTY_STR( fb_name ) ) { free( fb_name ); fb_name = input_item_GetName( item->inputItem() ); } text = qfu(fb_name); free(fb_name); QAbstractButton *btn = new LocationButton( text, first, !first, this ); btn->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Fixed ); buttons.append( btn ); QAction *action = new QAction( text, this ); actions.append( action ); CONNECT( btn, clicked(), action, trigger() ); mapper->setMapping( action, item->id() ); CONNECT( action, triggered(), mapper, map() ); first = false; if( i.isValid() ) i = i.parent(); else break; } QString prefix; for( int a = actions.count() - 1; a >= 0 ; a-- ) { actions[a]->setText( prefix + actions[a]->text() ); prefix += QString(" "); } if( isVisible() ) layOut( size() ); }
void LocationBar::setIndex( const QModelIndex &index ) { qDeleteAll( buttons ); buttons.clear(); qDeleteAll( actions ); actions.clear(); QModelIndex i = index; bool first = true; while( true ) { QString text = model->getTitle( i ); QAbstractButton *btn = new LocationButton( text, first, !first, this ); btn->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Fixed ); buttons.append( btn ); QAction *action = new QAction( text, this ); actions.append( action ); CONNECT( btn, clicked(), action, trigger() ); mapper->setMapping( action, model->itemId( i, PLAYLIST_ID ) ); CONNECT( action, triggered(), mapper, map() ); first = false; if( i.isValid() ) i = i.parent(); else break; } QString prefix; for( int a = actions.count() - 1; a >= 0 ; a-- ) { actions[a]->setText( prefix + actions[a]->text() ); prefix += QString(" "); } if( isVisible() ) layOut( size() ); }
void MythWizard::updateButtons() { if ( !d->current ) return; int i; for( i = 0; i < d->pages.size() && d->pages[i] != d->current; i++ ); bool notFirst( false ); if ( i ) { i--; while( ( i >= 0 ) && !notFirst ) { notFirst |= appropriate( d->pages[i]->w ); i--; } } setBackEnabled( d->current->backEnabled && notFirst ); setNextEnabled( d->current->nextEnabled ); d->finishButton->setEnabled( d->current->finishEnabled ); if ( ( d->current->finishEnabled && !d->finishButton->isVisible() ) || ( d->current->backEnabled && !d->backButton->isVisible() ) || ( d->current->nextEnabled && !d->nextButton->isVisible() ) ) layOut(); }
void LocationBar::resizeEvent ( QResizeEvent * event ) { layOut( event->size() ); }