radioapp/radiouiengine/inc/radiouiengine.h
changeset 13 46974bebc798
child 14 63aabac4416d
equal deleted inserted replaced
0:f3d95d9c00ab 13:46974bebc798
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef RADIOUIENGINE_H_
       
    20 #define RADIOUIENGINE_H_
       
    21 
       
    22 // System includes
       
    23 #include <qobject>
       
    24 #include <qstring>
       
    25 //#include <qlist>
       
    26 
       
    27 // User includes
       
    28 #include "radiouiengineexport.h"
       
    29 #include "radio_global.h"
       
    30 
       
    31 // Forward declarations
       
    32 class RadioUiEnginePrivate;
       
    33 class RadioStationModel;
       
    34 class RadioSettings;
       
    35 class RadioStation;
       
    36 class RadioPlayLogModel;
       
    37 class RadioStationFilterModel;
       
    38 
       
    39 class UI_ENGINE_DLL_EXPORT RadioUiEngine : public QObject
       
    40 {
       
    41     Q_OBJECT
       
    42     Q_DECLARE_PRIVATE_D( d_ptr, RadioUiEngine )
       
    43     Q_DISABLE_COPY( RadioUiEngine )
       
    44 
       
    45 public:
       
    46 
       
    47     static bool isOfflineProfile();
       
    48     static QString parseFrequency( uint frequency );
       
    49     static QString nameOrFrequency( const RadioStation& station, uint frequency = 0 );
       
    50 
       
    51     RadioUiEngine( QObject* parent = 0 );
       
    52     ~RadioUiEngine();
       
    53 
       
    54     bool startRadio();
       
    55 
       
    56     bool isFirstTimeStart();
       
    57 
       
    58     /**
       
    59      * Getters for things owned by the engine
       
    60      */
       
    61     RadioSettings& settings();
       
    62     RadioStationModel& model();
       
    63     RadioPlayLogModel& playLogModel();
       
    64     RadioStationFilterModel* createNewFilterModel( QObject* parent = 0 );
       
    65 
       
    66     bool isRadioOn() const;
       
    67     bool isScanning() const;
       
    68     bool isMuted() const;
       
    69     bool isAntennaAttached() const;
       
    70     bool isUsingLoudspeaker() const;
       
    71 
       
    72     RadioRegion::Region region() const;
       
    73     uint currentFrequency() const;
       
    74     uint minFrequency() const;
       
    75     uint maxFrequency() const;
       
    76     uint frequencyStepSize() const;
       
    77 
       
    78     void scanFrequencyBand();
       
    79     void cancelScanFrequencyBand();
       
    80 
       
    81     QList<RadioStation> stationsInRange( uint minFrequency, uint maxFrequency );
       
    82 
       
    83     QString genreToString( int genre );
       
    84 
       
    85     bool isSongRecognitionAppAvailable();
       
    86 
       
    87     void addRecognizedSong( const QString& artist, const QString& title );
       
    88 
       
    89 signals:
       
    90 
       
    91     void tunedToFrequency( uint frequency, int commandSender );
       
    92     void seekingStarted( int direction );
       
    93     void radioStatusChanged( bool radioIsOn );
       
    94 
       
    95     void rdsAvailabilityChanged( bool available );
       
    96 
       
    97     void volumeChanged( int volume );
       
    98     void muteChanged( bool muted );
       
    99 
       
   100     void audioRouteChanged( bool loudspeaker );
       
   101     void scanAndSaveFinished();
       
   102     void headsetStatusChanged( bool connected );
       
   103 
       
   104 public slots:
       
   105 
       
   106     /**
       
   107      * Slots to tune to given frequency or preset
       
   108      */
       
   109     void tuneFrequency( uint frequency, const int sender = CommandSender::Unspecified );
       
   110     void tuneWithDelay( uint frequency, const int sender = CommandSender::Unspecified );
       
   111     void tunePreset( int presetIndex );
       
   112 
       
   113     /*!
       
   114      * volume update command slot for the engine
       
   115      */
       
   116     void setVolume( int volume );
       
   117     void toggleMute();
       
   118     void toggleAudioRoute();
       
   119 
       
   120     void skipPrevious();
       
   121     void skipNext();
       
   122 
       
   123     void seekUp();
       
   124     void seekDown();
       
   125 
       
   126     void launchSongRecognition();
       
   127 
       
   128 private:
       
   129 
       
   130     /**
       
   131      * functions used only by the private class to get signals emitted
       
   132      */
       
   133     void emitTunedToFrequency( uint frequency, int commandSender );
       
   134     void emitSeekingStarted( Seeking::Direction direction );
       
   135     void emitRadioStatusChanged( bool radioIsOn );
       
   136     void emitRdsAvailabilityChanged( bool available );
       
   137     void emitVolumeChanged( int volume );
       
   138     void emitMuteChanged( bool muted );
       
   139     void emitAudioRouteChanged( bool loudspeaker );
       
   140     void emitScanAndSaveFinished();
       
   141     void emitheadsetStatusChanged( bool connected );
       
   142 
       
   143 private: // data
       
   144 
       
   145     /**
       
   146      * Unmodifiable pointer to the private implementation
       
   147      */
       
   148     RadioUiEnginePrivate* const d_ptr;
       
   149 
       
   150 };
       
   151 
       
   152 
       
   153 #endif // RADIOUIENGINE_H_