73 mSlots->insert( lcActGalleryId, SLOT( notSupported() ) ); |
71 mSlots->insert( lcActGalleryId, SLOT( notSupported() ) ); |
74 mSlots->insert( lcActChangeCameraId, SLOT( notSupported() ) ); |
72 mSlots->insert( lcActChangeCameraId, SLOT( notSupported() ) ); |
75 mSlots->insert( lcActAdjustVideoId, SLOT( notSupported() ) ); |
73 mSlots->insert( lcActAdjustVideoId, SLOT( notSupported() ) ); |
76 mSlots->insert( lcActShareImageId, SLOT( notSupported() ) ); |
74 mSlots->insert( lcActShareImageId, SLOT( notSupported() ) ); |
77 mSlots->insert( lcActSwapViewsId, SLOT( swap() ) ); |
75 mSlots->insert( lcActSwapViewsId, SLOT( swap() ) ); |
78 mSlots->insert( lcActZoomId, SLOT( notSupported() ) ); |
|
79 mSlots->insert( lcActSwitchToVoiceCallId, SLOT( switchToVoiceCall() ) ); |
76 mSlots->insert( lcActSwitchToVoiceCallId, SLOT( switchToVoiceCall() ) ); |
80 mSlots->insert( lcActOpenKeypadId, SLOT( openDialpad() ) ); |
77 mSlots->insert( lcActOpenKeypadId, SLOT( openDialpad() ) ); |
81 mSlots->insert( lcActDisableCameraId, SLOT( disableCamera() ) ); |
78 mSlots->insert( lcActDisableCameraId, SLOT( disableCamera() ) ); |
82 mSlots->insert( lcActSpeakerId, SLOT( speaker() ) ); |
79 mSlots->insert( lcActSpeakerId, SLOT( speaker() ) ); |
83 |
80 |
399 LC_QDEBUG( "livecomms [UI] <- LcUiComponentRepository::shareOwnVideoQuery()" ); |
396 LC_QDEBUG( "livecomms [UI] <- LcUiComponentRepository::shareOwnVideoQuery()" ); |
400 return mShareOwnVideoQuery; |
397 return mShareOwnVideoQuery; |
401 } |
398 } |
402 |
399 |
403 // ----------------------------------------------------------------------------- |
400 // ----------------------------------------------------------------------------- |
404 // LcUiComponentRepository::zoomSlider |
|
405 // ----------------------------------------------------------------------------- |
|
406 // |
|
407 HbZoomSliderPopup* LcUiComponentRepository::zoomSlider() |
|
408 { |
|
409 LC_QDEBUG( "livecomms [UI] -> LcUiComponentRepository::zoomSlider()" ); |
|
410 |
|
411 if ( !mZoomSlider ) { |
|
412 mZoomSlider = new HbZoomSliderPopup(); |
|
413 mZoomSlider->setDismissPolicy(HbDialog::TapOutside); |
|
414 mZoomSlider->setTimeout(HbDialog::StandardTimeout); |
|
415 mZoomSlider->hide(); |
|
416 QObject::connect( mZoomSlider, SIGNAL(valueChanged(int)), |
|
417 &mEngine, SLOT(zoom(int)) ); |
|
418 |
|
419 } |
|
420 |
|
421 LC_QDEBUG( "livecomms [UI] <- LcUiComponentRepository::zoomSlider()" ); |
|
422 return mZoomSlider; |
|
423 } |
|
424 |
|
425 // ----------------------------------------------------------------------------- |
|
426 // LcUiComponentRepository::sharedVideoContextMenuActions |
401 // LcUiComponentRepository::sharedVideoContextMenuActions |
427 // ----------------------------------------------------------------------------- |
402 // ----------------------------------------------------------------------------- |
428 // |
403 // |
429 void LcUiComponentRepository::sharedVideoContextMenuActions( HbMenu* menu, LcView& view ) |
404 void LcUiComponentRepository::sharedVideoContextMenuActions( HbMenu* menu, LcView& view ) |
430 { |
405 { |
434 |
409 |
435 menu->actions().clear(); |
410 menu->actions().clear(); |
436 //due stubs in unit tests, qobject_cast cannot be used. |
411 //due stubs in unit tests, qobject_cast cannot be used. |
437 //Using static_cast instead |
412 //Using static_cast instead |
438 HbAction* swap = static_cast<HbAction*>( findObject( lcActSwapViewsId ) ); |
413 HbAction* swap = static_cast<HbAction*>( findObject( lcActSwapViewsId ) ); |
439 HbAction* zoom = static_cast<HbAction*>( findObject( lcActZoomId ) ); |
414 HbAction* changeCamera = |
|
415 static_cast<HbAction*>( findObject( lcActMenuChangeCameraId ) ); |
|
416 |
|
417 HbAction* disableCamera = |
|
418 static_cast<HbAction*>( findObject( lcActMenuDisableCameraId ) ); |
|
419 HbAction* enableCamera = |
|
420 static_cast<HbAction*>( findObject( lcActEnableCameraId ) ); |
|
421 |
|
422 if ( swap ) { |
|
423 LC_QDEBUG_2( "Adding ", swap->text() ); |
|
424 menu->addAction( swap ); |
|
425 } |
|
426 if ( changeCamera ) { |
|
427 LC_QDEBUG_2( "Adding ", changeCamera->text() ); |
|
428 menu->addAction( changeCamera ); |
|
429 } |
|
430 if ( mEngine.isLocalPlayerPlaying() ) { |
|
431 if ( disableCamera ) { |
|
432 LC_QDEBUG_2( "Adding ", disableCamera->text() ); |
|
433 menu->addAction( disableCamera ); |
|
434 } |
|
435 } else { |
|
436 if ( enableCamera ) { |
|
437 LC_QDEBUG_2( "Adding ", enableCamera->text() ); |
|
438 menu->addAction( enableCamera ); |
|
439 } |
|
440 } |
|
441 |
|
442 |
|
443 LC_QDEBUG( |
|
444 "livecomms [UI] <- LcUiComponentRepository::sharedVideoContextMenuActions()" ); |
|
445 } |
|
446 |
|
447 // ----------------------------------------------------------------------------- |
|
448 // LcUiComponentRepository::loadView |
|
449 // ----------------------------------------------------------------------------- |
|
450 // |
|
451 LcView* LcUiComponentRepository::loadView( QObjectList& components, |
|
452 const QString& viewId, |
|
453 const QString& xmlFile ) |
|
454 { |
|
455 LC_QDEBUG( "livecomms [UI] -> LcUiComponentRepository::loadView()" ); |
|
456 |
|
457 LcView* view = 0; |
|
458 bool ok( false ); |
|
459 // Load the XML file |
|
460 components = load( xmlFile, &ok ); |
|
461 |
|
462 if ( !ok ) { |
|
463 LC_QCRITICAL_3( "! loading of XML file ", xmlFile , " failed !" ) |
|
464 return 0; |
|
465 } |
|
466 |
|
467 mLastLoadedView = xmlFile; |
|
468 |
|
469 ok = loadLayout( lcLayoutLandscapeDefaultId ); |
|
470 if ( !ok ) { |
|
471 LC_QCRITICAL( "! loading of layout failed !" ) |
|
472 return 0; |
|
473 } |
|
474 |
|
475 view = qobject_cast<LcView*>( findWidget( viewId ) ); |
|
476 if ( view ) { |
|
477 connectActions( *view ); |
|
478 view->init(); |
|
479 } |
|
480 |
|
481 LC_QDEBUG( "livecomms [UI] <- LcUiComponentRepository::loadView()" ); |
|
482 return view; |
|
483 } |
|
484 |
|
485 |
|
486 // ----------------------------------------------------------------------------- |
|
487 // LcUiComponentRepository::connectActions |
|
488 // ----------------------------------------------------------------------------- |
|
489 // |
|
490 void LcUiComponentRepository::connectActions( LcView& view ) const |
|
491 { |
|
492 LC_QDEBUG( "livecomms [UI] -> LcUiComponentRepository::connectActions()" ); |
|
493 foreach( QAction* hbAction, view.menu()->actions() ) { |
|
494 connect( *hbAction, view ); |
|
495 } |
|
496 foreach( QAction* hbAction, view.toolBar()->actions() ) { |
|
497 connect( *hbAction, view ); |
|
498 } |
|
499 |
440 HbAction* changeCamera = |
500 HbAction* changeCamera = |
441 static_cast<HbAction*>( findObject( lcActMenuChangeCameraId ) ); |
501 static_cast<HbAction*>( findObject( lcActMenuChangeCameraId ) ); |
442 HbAction* disableCamera = |
502 HbAction* disableCamera = |
443 static_cast<HbAction*>( findObject( lcActMenuDisableCameraId ) ); |
503 static_cast<HbAction*>( findObject( lcActMenuDisableCameraId ) ); |
444 |
504 HbAction* enableCamera = |
445 if ( swap ) { |
505 static_cast<HbAction*>( findObject( lcActEnableCameraId ) ); |
446 LC_QDEBUG_2( "Adding ", swap->text() ); |
|
447 menu->addAction( swap ); |
|
448 } |
|
449 if ( zoom ) { |
|
450 LC_QDEBUG_2( "Adding ", zoom->text() ); |
|
451 menu->addAction( zoom ); |
|
452 } |
|
453 if ( changeCamera ) { |
|
454 LC_QDEBUG_2( "Adding ", changeCamera->text() ); |
|
455 menu->addAction( changeCamera ); |
|
456 } |
|
457 if ( disableCamera ) { |
|
458 LC_QDEBUG_2( "Adding ", disableCamera->text() ); |
|
459 menu->addAction( disableCamera ); |
|
460 } |
|
461 |
|
462 |
|
463 LC_QDEBUG( |
|
464 "livecomms [UI] <- LcUiComponentRepository::sharedVideoContextMenuActions()" ); |
|
465 } |
|
466 |
|
467 // ----------------------------------------------------------------------------- |
|
468 // LcUiComponentRepository::loadView |
|
469 // ----------------------------------------------------------------------------- |
|
470 // |
|
471 LcView* LcUiComponentRepository::loadView( QObjectList& components, |
|
472 const QString& viewId, |
|
473 const QString& xmlFile ) |
|
474 { |
|
475 LC_QDEBUG( "livecomms [UI] -> LcUiComponentRepository::loadView()" ); |
|
476 |
|
477 LcView* view = 0; |
|
478 bool ok( false ); |
|
479 // Load the XML file |
|
480 components = load( xmlFile, &ok ); |
|
481 |
|
482 if ( !ok ) { |
|
483 LC_QCRITICAL_3( "! loading of XML file ", xmlFile , " failed !" ) |
|
484 return 0; |
|
485 } |
|
486 mLastLoadedView = xmlFile; |
|
487 |
|
488 // Load default layout for the current device orientation |
|
489 if ( !HbInstance::instance()->allMainWindows().isEmpty() && |
|
490 HbInstance::instance()->allMainWindows().at(0)->orientation() == Qt::Horizontal ) { |
|
491 ok = loadLayout( lcLayoutLandscapeDefaultId ); |
|
492 |
|
493 } else { |
|
494 ok = loadLayout( lcLayoutPortraitDefaultId ); |
|
495 } |
|
496 if ( !ok ) { |
|
497 LC_QCRITICAL( "! loading of layout failed !" ) |
|
498 return 0; |
|
499 } |
|
500 |
|
501 view = qobject_cast<LcView*>( findWidget( viewId ) ); |
|
502 if ( view ) { |
|
503 connectActions( *view ); |
|
504 view->init(); |
|
505 } |
|
506 |
|
507 LC_QDEBUG( "livecomms [UI] <- LcUiComponentRepository::loadView()" ); |
|
508 return view; |
|
509 } |
|
510 |
|
511 // ----------------------------------------------------------------------------- |
|
512 // LcUiComponentRepository::connectActions |
|
513 // ----------------------------------------------------------------------------- |
|
514 // |
|
515 void LcUiComponentRepository::connectActions( LcView& view ) const |
|
516 { |
|
517 LC_QDEBUG( "livecomms [UI] -> LcUiComponentRepository::connectActions()" ); |
|
518 foreach( QAction* hbAction, view.menu()->actions() ) { |
|
519 connect( *hbAction, view ); |
|
520 } |
|
521 foreach( QAction* hbAction, view.toolBar()->actions() ) { |
|
522 connect( *hbAction, view ); |
|
523 } |
|
524 |
|
525 HbAction* changeCamera = |
|
526 static_cast<HbAction*>( findObject( lcActMenuChangeCameraId ) ); |
|
527 HbAction* disableCamera = |
|
528 static_cast<HbAction*>( findObject( lcActMenuDisableCameraId ) ); |
|
529 |
506 |
530 QObject::connect( changeCamera, SIGNAL(triggered()), |
507 QObject::connect( changeCamera, SIGNAL(triggered()), |
531 &view, SLOT(notSupported()) ); |
508 &view, SLOT(notSupported()) ); |
532 |
509 |
533 QObject::connect( disableCamera, SIGNAL(triggered()), |
510 QObject::connect( disableCamera, SIGNAL(triggered()), |
534 &view, SLOT(disableCamera()) ); |
511 &view, SLOT(disableCamera()) ); |
|
512 |
|
513 QObject::connect( enableCamera, SIGNAL(triggered()), |
|
514 &view, SLOT(disableCamera()) ); |
535 |
515 |
536 LC_QDEBUG( "livecomms [UI] <- LcUiComponentRepository::connectActions()" ) |
516 LC_QDEBUG( "livecomms [UI] <- LcUiComponentRepository::connectActions()" ) |
537 } |
517 } |
538 |
518 |
539 // ----------------------------------------------------------------------------- |
519 // ----------------------------------------------------------------------------- |