CDReader::CDReader( CDInfo *info, CDEdit *edit, QWidget *parent ) : QWidget( parent ) , mpCDReaderThread( new CDReaderThread() ) , mpCDInfo( info ) , mpCDEdit( edit ) , mpProgressBar( new QProgressBar( this ) ) , mpRippingSpeed( new QLabel( this ) ) , mEncoders() , mDevice() { mpProgressBar->setRange( 0, 100 ); mpProgressBar->setAlignment( Qt::AlignCenter ); QGridLayout *mainLayout = new QGridLayout( this ); mainLayout->setContentsMargins( 0, 0, 0, 0 ); mainLayout->addWidget( mpRippingSpeed, 1, 0 ); mainLayout->addWidget( mpProgressBar, 0, 0 ); connect( mpCDReaderThread, SIGNAL(stateNoDisc()), this, SIGNAL(stateNoDisc()) ); connect( mpCDReaderThread, SIGNAL(stateDisc()), this, SIGNAL(stateDisc()) ); connect( mpCDReaderThread, SIGNAL(stateScan()), this, SIGNAL(stateScan()) ); connect( mpCDReaderThread, SIGNAL(stateRip()), this, SIGNAL(stateRip()) ); connect( mpCDReaderThread, SIGNAL(gotToc()), this, SIGNAL(gotToc()) ); connect( mpCDReaderThread, SIGNAL(gotData()), this, SIGNAL(gotData()) ); connect( mpCDReaderThread, SIGNAL(noEject()), this, SLOT(noEject()) ); connect( mpCDReaderThread, SIGNAL(foundDevices(QStringList)), this, SIGNAL(foundDevices(QStringList)) ); connect( mpCDReaderThread, SIGNAL(message(QString)), this, SIGNAL(message(QString)) ); connect( mpCDReaderThread, SIGNAL(setTrackDisabled(int,bool)), this, SIGNAL(setTrackDisabled(int,bool)) ); connect( mpCDReaderThread, SIGNAL(ensureVisible(int)), this, SIGNAL(ensureVisible(int)) ); connect( mpCDReaderThread, SIGNAL(progress(int,int)), this, SLOT(updateProgress(int,int)) ); connect( mpCDReaderThread, SIGNAL(errors(int,unsigned int,const unsigned long*)), this, SIGNAL(errors(int,unsigned int,const unsigned long*)) ); updateProgress( 0, 0 ); setLayout( mainLayout ); }
/* P2P discovery finite state machine */ static void fsm(bcm_p2p_discovery_t *disc, eventT event) { WL_P2PO(("--------------------------------------------------------\n")); WL_P2PO(("current state=%s event=%s\n", state_str[disc->state], event_str[event])); switch (disc->state) { case STATE_IDLE: state_idle(disc, event); break; case STATE_SCAN: stateScan(disc, event); break; case STATE_LISTEN: stateListen(disc, event); break; case STATE_SEARCH: stateSearch(disc, event); break; case STATE_EXT_LISTEN_ON: stateExtListenOn(disc, event); break; case STATE_EXT_LISTEN_OFF: stateExtListenOff(disc, event); break; default: WL_ERROR(("invalid state %d\n", disc->state)); break; } /* transition to next state */ if (disc->state != disc->nextState) { WL_P2PO(("state change %s -> %s\n", state_str[disc->state], state_str[disc->nextState])); disc->state = disc->nextState; } WL_P2PO(("--------------------------------------------------------\n")); }