radioapp/radiouiengine/src/radiouiengine.cpp
changeset 14 63aabac4416d
parent 13 46974bebc798
child 16 f54ebcfc1b80
equal deleted inserted replaced
13:46974bebc798 14:63aabac4416d
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // System includes
    18 // System includes
    19 #include <qscopedpointer>
    19 #include <QScopedPointer>
    20 #include <qprocess>
    20 #include <QProcess>
    21 #include <qfile>
    21 #include <QFile>
    22 
    22 
    23 #ifdef BUILD_WIN32
    23 #ifdef BUILD_WIN32
    24 #   include <qsettings>
    24 #   include <QSettings>
       
    25 #else
       
    26 #   include <qsysteminfo.h>
       
    27 using namespace QtMobility;
    25 #endif // WIN32_BUILD
    28 #endif // WIN32_BUILD
    26 
    29 
    27 // User includes
    30 // User includes
    28 #include "radiouiengine.h"
    31 #include "radiouiengine.h"
    29 #include "radiouiengine_p.h"
    32 #include "radiouiengine_p.h"
    33 #include "radioplaylogmodel.h"
    36 #include "radioplaylogmodel.h"
    34 #include "radiosettings.h"
    37 #include "radiosettings.h"
    35 #include "radiostationfiltermodel.h"
    38 #include "radiostationfiltermodel.h"
    36 #include "radiolocalization.h"
    39 #include "radiolocalization.h"
    37 
    40 
    38 #ifdef USE_MOBILE_EXTENSIONS_API
       
    39     #include "xqprofile"
       
    40 #endif
       
    41 
       
    42 // Constants
    41 // Constants
    43 const QString KPathFormatter = "%1:%2%3";
    42 const QString KPathFormatter = "%1:%2%3";
    44 const QString KApplicationDir = "\\sys\\bin\\";
    43 const QString KApplicationDir = "\\sys\\bin\\";
    45 const QString KSongRecognitionApp = "Shazam_0x200265B3.exe";
    44 const QString KSongRecognitionApp = "Shazam_0x200265B3.exe";
    46 const QString KSongRecognitionAppParams = "-listen";
    45 const QString KSongRecognitionAppParams = "-listen";
    50  */
    49  */
    51 bool RadioUiEngine::isOfflineProfile()
    50 bool RadioUiEngine::isOfflineProfile()
    52 {
    51 {
    53     bool offline = false;
    52     bool offline = false;
    54 
    53 
    55 #ifdef USE_MOBILE_EXTENSIONS_API
    54 #ifdef BUILD_WIN32
    56     QScopedPointer<XQProfile> profile ( new XQProfile() );  // Deletes automatically when out of scope
       
    57     offline = profile->activeProfile() == XQProfile::ProfileOffLine;
       
    58 #elif BUILD_WIN32
       
    59     QScopedPointer<QSettings> settings( new QSettings( "Nokia", "QtFmRadio" ) );
    55     QScopedPointer<QSettings> settings( new QSettings( "Nokia", "QtFmRadio" ) );
    60     offline = settings->value( "Offline", false ).toBool();
    56     offline = settings->value( "Offline", false ).toBool();
       
    57 #else
       
    58     QSystemDeviceInfo deviceInfo;
       
    59     if ( deviceInfo.currentProfile() == QSystemDeviceInfo::OfflineProfile ) {
       
    60         offline = true;
       
    61     }
    61 #endif
    62 #endif
    62 
    63 
    63     return offline;
    64     return offline;
    64 }
    65 }
    65 
    66 
   163  * Returns the stations list
   164  * Returns the stations list
   164  */
   165  */
   165 RadioStationFilterModel* RadioUiEngine::createNewFilterModel( QObject* parent )
   166 RadioStationFilterModel* RadioUiEngine::createNewFilterModel( QObject* parent )
   166 {
   167 {
   167     return new RadioStationFilterModel( *this, parent );
   168     return new RadioStationFilterModel( *this, parent );
       
   169 }
       
   170 
       
   171 /*!
       
   172  * Returns the stations list
       
   173  */
       
   174 RadioMonitorService& RadioUiEngine::monitor()
       
   175 {
       
   176     Q_D( const RadioUiEngine );
       
   177     return *d->mMonitorService;
   168 }
   178 }
   169 
   179 
   170 /*!
   180 /*!
   171  *
   181  *
   172  */
   182  */
   336 }
   346 }
   337 
   347 
   338 /*!
   348 /*!
   339  *
   349  *
   340  */
   350  */
   341 void RadioUiEngine::addRecognizedSong( const QString& artist, const QString& title )
   351 void RadioUiEngine::addRecognizedSong( const QString& artist, const QString& title, const RadioStation& station )
   342 {
   352 {
   343     Q_D( RadioUiEngine );
   353     Q_D( RadioUiEngine );
   344     d->mPlayLogModel->addItem( artist, title );
   354     d->mPlayLogModel->addItem( artist, title, station );
   345 }
   355 }
   346 
   356 
   347 /*!
   357 /*!
   348  * Public slot
   358  * Public slot
   349  * Tunes to the given frequency
   359  * Tunes to the given frequency
   484 /*!
   494 /*!
   485  * Function used by the private implementation to emit a seekingStarted signal
   495  * Function used by the private implementation to emit a seekingStarted signal
   486  */
   496  */
   487 void RadioUiEngine::emitSeekingStarted( Seeking::Direction direction )
   497 void RadioUiEngine::emitSeekingStarted( Seeking::Direction direction )
   488 {
   498 {
   489     emit seekingStarted( direction );
   499     if ( isAntennaAttached() ) {
       
   500         emit seekingStarted( direction );
       
   501     }
   490 }
   502 }
   491 
   503 
   492 /*!
   504 /*!
   493  * Function used by the private implementation to emit a radioStatusChanged signal
   505  * Function used by the private implementation to emit a radioStatusChanged signal
   494  */
   506  */