bool DjvuApplication::open( const QString &path_name ) { main_window_.attachModel(&model_); main_window_.show(); DjVuView *view = down_cast<DjVuView*>(main_window_.activateView(DJVU_VIEW)); // connect the signals with view connect( view, SIGNAL(rotateScreen()), this, SLOT(onRotateScreen()) ); connect( view, SIGNAL(testSuspend()), this, SLOT(onSuspend()) ); connect( view, SIGNAL(testWakeUp()), this, SLOT(onWakeUp()) ); // connect the signals with sys_state_ SysStatus & sys_status = SysStatus::instance(); connect( &sys_status, SIGNAL( mountTreeSignal( bool, const QString & ) ), this, SLOT( onMountTreeSignal( bool, const QString &) ) ); connect( &sys_status, SIGNAL( sdCardChangedSignal( bool ) ), this, SLOT( onSDChangedSignal( bool ) ) ); connect( &sys_status, SIGNAL( aboutToShutdown() ), this, SLOT( onAboutToShutDown() ) ); connect( &sys_status, SIGNAL( wakeup() ), this, SLOT( onWakeUp() ) ); #ifdef Q_WS_QWS connect(qApp->desktop(), SIGNAL(resized(int)), this, SLOT(onScreenSizeChanged(int)), Qt::QueuedConnection); #endif view->attachModel(&model_); bool ret = model_.open(path_name); if ( !ret ) { if ( sys::SysStatus::instance().isSystemBusy() ) { // if loading fails, set busy to be false sys::SysStatus::instance().setSystemBusy( false ); } view->deattachModel(); } return ret; }
void NuCachedSource2::onMessageReceived(const sp<AMessage> &msg) { switch (msg->what()) { case kWhatFetchMore: { onFetch(); break; } case kWhatRead: { onRead(msg); break; } case kWhatSuspend: { onSuspend(); break; } default: TRESPASS(); } }