radioapp/radiowidgets/src/radioviewbase.cpp
changeset 16 f54ebcfc1b80
parent 14 63aabac4416d
child 19 afea38384506
--- a/radioapp/radiowidgets/src/radioviewbase.cpp	Fri Apr 16 14:58:55 2010 +0300
+++ b/radioapp/radiowidgets/src/radioviewbase.cpp	Mon May 03 12:31:41 2010 +0300
@@ -25,17 +25,15 @@
 #include "radiostationmodel.h"
 #include "radioxmluiloader.h"
 #include "radiouiengine.h"
-#include "radiolocalization.h"
 #include "radiologger.h"
 
 /*!
  *
  */
-RadioViewBase::RadioViewBase( RadioXmlUiLoader* uiLoader, bool transient ) :
+RadioViewBase::RadioViewBase( bool transient ) :
     HbView( 0 ),
     mMainWindow( 0 ),
-    mModel( 0 ),
-    mUiLoader( uiLoader ),
+    mUiLoader( 0 ),
     mTransientView( transient ),
     mUseLoudspeakerAction( 0 ),
     mOrientation( Qt::Vertical )
@@ -47,8 +45,7 @@
  */
 RadioViewBase::~RadioViewBase()
 {
-    if ( mUiLoader )
-    {
+    if ( mUiLoader ) {
         mUiLoader->reset();
     }
 }
@@ -56,11 +53,11 @@
 /*!
  *
  */
-void RadioViewBase::init( RadioMainWindow* aMainWindow, RadioStationModel* aModel )
+void RadioViewBase::init( RadioXmlUiLoader* uiLoader, RadioMainWindow* mainWindow )
 {
     // Default implementation does nothing
-    Q_UNUSED( aMainWindow );
-    Q_UNUSED( aModel );
+    Q_UNUSED( uiLoader );
+    Q_UNUSED( mainWindow );
 }
 
 /*!
@@ -127,23 +124,12 @@
 /*!
  *
  */
-HbAction* RadioViewBase::addMenuItem( const QString& aTitle, QObject* aRecipient, const char* aSlot )
-{
-    HbAction* action = menu()->addAction( aTitle );
-    connectAndTest( action, SIGNAL(triggered()), aRecipient, aSlot );
-    return action;
-}
-
-/*!
- *
- */
 void RadioViewBase::connectCommonMenuItem( int menuItem )
 {
     RadioUiEngine* engine = &mMainWindow->uiEngine();
-    switch ( menuItem )
-    {
+    switch ( menuItem ) {
         case MenuItem::UseLoudspeaker:
-            mUseLoudspeakerAction = mUiLoader->findObject<HbAction>( DOCML_NAME_LOUDSPEAKERACTION );
+            mUseLoudspeakerAction = mUiLoader->findObject<HbAction>( DOCML::NAME_LOUDSPEAKER_ACTION );
             if ( mUseLoudspeakerAction ) {
                 connectAndTest( mUseLoudspeakerAction, SIGNAL(triggered()), engine, SLOT(toggleAudioRoute()) );
                 updateAudioRouting( engine->isUsingLoudspeaker() );
@@ -161,8 +147,7 @@
  */
 void RadioViewBase::connectXmlElement( const char* name, const char* signal, QObject* receiver, const char* slot )
 {
-    if ( QObject* action = mUiLoader->findObject<QObject>( name ) )
-    {
+    if ( QObject* action = mUiLoader->findObject<QObject>( name ) ) {
         connectAndTest( action, signal, receiver, slot );
     }
 }
@@ -172,8 +157,7 @@
  */
 void RadioViewBase::connectViewChangeMenuItem( QString name, const char* slot )
 {
-    if ( QObject* action = mUiLoader->findObject<QObject>( name ) )
-    {
+    if ( QObject* action = mUiLoader->findObject<QObject>( name ) ) {
         connectAndTest( action, SIGNAL(triggered()), mMainWindow, slot );
     }
 }
@@ -181,6 +165,16 @@
 /*!
  *
  */
+void RadioViewBase::loadSection( const QString& docml, const QString& section )
+{
+    bool ok = false;
+    mUiLoader->load( docml, section, &ok );
+    LOG_ASSERT( ok, LOG_FORMAT( "Loading of section %s failed!", GETSTRING( section ) ) );
+}
+
+/*!
+ *
+ */
 void RadioViewBase::setOrientation()
 {
     // Default implementation does nothing