--- a/radioapp/radiouiengine/src/radiouiengine.cpp Fri Jun 11 16:24:13 2010 +0100
+++ b/radioapp/radiouiengine/src/radiouiengine.cpp Thu Jul 22 16:33:45 2010 +0100
@@ -19,163 +19,109 @@
#include <QScopedPointer>
#include <QProcess>
#include <QFile>
+#include <QTimer>
+#include <QDesktopServices>
+#include <QUrl>
#ifdef BUILD_WIN32
# include <QSettings>
#else
-# include <qsysteminfo.h>
# include <XQSettingsManager>
-using namespace QtMobility;
#endif // WIN32_BUILD
// User includes
#include "radiouiengine.h"
#include "radiouiengine_p.h"
-#include "radiologger.h"
#include "radioenginewrapper.h"
#include "radiostationmodel.h"
#include "radiohistorymodel.h"
-#include "radiocarouselmodel.h"
#include "radiohistoryitem.h"
#include "radiosettings.h"
-#include "radiostationfiltermodel.h"
#include "radioscannerengine.h"
+#include "radiogenrelocalizer.h"
+#include "radiologger.h"
// Constants
-const QString KPathFormatter = "%1:%2%3";
-const QString KApplicationDir = "\\sys\\bin\\";
-const QString KSongRecognitionApp = "Shazam_0x200265B3.exe";
-const QString KSongRecognitionAppParams = "-listen";
-
-const uint DEFAULT_MIN_FREQUENCY = 87500000;
-const uint RADIO_CENREP_UID = 0x101FF976;
-const uint RADIO_CENREP_FREQUENCY_KEY = 0x00000107;
-
-struct GenreStruct
-{
- int mGenreCode;
- const char* mInCarousel;
- const char* mInStationsList;
- const char* mInHomeScreen;
-};
+const uint RADIO_CENREP_UID = 0x2002FF52;
+const uint RADIO_CENREP_FREQUENCY_KEY = 0x207;
+const uint RADIO_CENREP_HEADSET_VOLUME = 0x200;
-const GenreStruct EuropeanGenres[] =
-{
- { GenreEurope::RdsNone, "", "", "" }
- ,{ GenreEurope::RdsNews, "txt_rad_info_news", "txt_rad_dblist_l1_mhz_val_news", "txt_rad_info_news_hs" }
- ,{ GenreEurope::RdsCurrentAffairs, "txt_rad_info_current_affairs", "txt_rad_dblist_l1_mhz_val_current_affairs", "txt_rad_info_current_affairs_hs" }
- ,{ GenreEurope::RdsInformation, "txt_rad_info_information", "txt_rad_dblist_l1_mhz_val_information", "txt_rad_info_information_hs" }
- ,{ GenreEurope::RdsSport, "txt_rad_info_sport", "txt_rad_dblist_l1_mhz_val_sport", "txt_rad_info_sport_hs" }
- ,{ GenreEurope::RdsEducation, "txt_rad_info_education", "txt_rad_dblist_l1_mhz_val_education", "txt_rad_info_education_hs" }
- ,{ GenreEurope::RdsDrama, "txt_rad_info_drama", "txt_rad_dblist_l1_mhz_val_drama", "txt_rad_info_drama_hs" }
- ,{ GenreEurope::RdsCulture, "txt_rad_info_culture", "txt_rad_dblist_l1_mhz_val_culture", "txt_rad_info_culture_hs" }
- ,{ GenreEurope::RdsScience, "txt_rad_info_science", "txt_rad_dblist_l1_mhz_val_science", "txt_rad_info_science_hs" }
- ,{ GenreEurope::RdsVariedSpeech, "txt_rad_info_varied", "txt_rad_dblist_l1_mhz_val_varied", "txt_rad_info_varied_hs" }
- ,{ GenreEurope::RdsPopMusic, "txt_rad_info_pop_music", "txt_rad_dblist_l1_mhz_val_pop_music", "txt_rad_info_pop_music_hs" }
- ,{ GenreEurope::RdsRockMusic, "txt_rad_info_rock_music", "txt_rad_dblist_l1_mhz_val_rock_music", "txt_rad_info_rock_music_hs" }
- ,{ GenreEurope::RdsEasyListening, "txt_rad_info_easy_listening", "txt_rad_dblist_l1_mhz_val_easy_listening", "txt_rad_info_easy_listening_hs" }
- ,{ GenreEurope::RdsLightClassical, "txt_rad_info_light_classical", "txt_rad_dblist_l1_mhz_val_light_classical", "txt_rad_info_light_classical_hs" }
- ,{ GenreEurope::RdsSeriousClassical, "txt_rad_info_serious_classical", "txt_rad_dblist_l1_mhz_val_serious_classical", "txt_rad_info_serious_classical_hs" }
- ,{ GenreEurope::RdsOtherMusic, "txt_rad_info_other_music", "txt_rad_dblist_l1_mhz_val_other_music", "txt_rad_info_other_music_hs" }
- ,{ GenreEurope::RdsWeather, "txt_rad_info_weather", "txt_rad_dblist_l1_mhz_val_weather", "txt_rad_info_weather_hs" }
- ,{ GenreEurope::RdsFinance, "txt_rad_info_finance", "txt_rad_dblist_l1_mhz_val_finance", "txt_rad_info_finance_hs" }
- ,{ GenreEurope::RdsChildrensProgrammes, "txt_rad_info_childrens_programmes", "txt_rad_dblist_l1_mhz_val_childrens_programmes", "txt_rad_info_childrens_programmes_hs" }
- ,{ GenreEurope::RdsSocialAffairs, "txt_rad_info_social_affairs", "txt_rad_dblist_l1_mhz_val_social_affairs", "txt_rad_info_social_affairs_hs" }
- ,{ GenreEurope::RdsReligion, "txt_rad_info_religion", "txt_rad_dblist_l1_mhz_val_religion", "txt_rad_info_religion_hs" }
- ,{ GenreEurope::RdsPhoneIn, "txt_rad_info_phone_in", "txt_rad_dblist_l1_mhz_val_phone_in", "txt_rad_info_phone_in_hs" }
- ,{ GenreEurope::RdsTravel, "txt_rad_info_travel", "txt_rad_dblist_l1_mhz_val_travel", "txt_rad_info_travel_hs" }
- ,{ GenreEurope::RdsLeisure, "txt_rad_info_leisure", "txt_rad_dblist_l1_mhz_val_leisure", "txt_rad_info_leisure_hs" }
- ,{ GenreEurope::RdsJazzMusic, "txt_rad_info_jazz_music", "txt_rad_dblist_l1_mhz_val_jazz_music", "txt_rad_info_jazz_music_hs" }
- ,{ GenreEurope::RdsCountryMusic, "txt_rad_info_country_music", "txt_rad_dblist_l1_mhz_val_country_music", "txt_rad_info_country_music_hs" }
- ,{ GenreEurope::RdsNationalMusic, "txt_rad_info_national_music", "txt_rad_dblist_l1_mhz_val_national_music", "txt_rad_info_national_music_hs" }
- ,{ GenreEurope::RdsOldiesMusic, "txt_rad_info_oldies_music", "txt_rad_dblist_l1_mhz_val_oldies_music", "txt_rad_info_oldies_music_hs" }
- ,{ GenreEurope::RdsFolkMusic, "txt_rad_info_folk_music", "txt_rad_dblist_l1_mhz_val_folk_music", "txt_rad_info_folk_music_hs" }
- ,{ GenreEurope::RdsDocumentary, "txt_rad_info_documentary", "txt_rad_dblist_l1_mhz_val_documentary", "txt_rad_info_documentary_hs" }
- ,{ GenreEurope::RdsAlarmTest, "txt_rad_info_alarm_test", "txt_rad_dblist_l1_mhz_val_alarm_test", "txt_rad_info_alarm_test_hs" }
- ,{ GenreEurope::RdsAlarm, "txt_rad_info_alarm", "txt_rad_dblist_l1_mhz_val_alarm", "txt_rad_info_alarm_hs" }
-};
-const int EuropeanGenresCount = sizeof( EuropeanGenres ) / sizeof ( EuropeanGenres[0] );
+const QLatin1String OVI_STORE_URL( "http://www.music.nokia.co.uk/Touch/Search.aspx?artistsearch=#artist#&titlesearch=#title#" );
+const QLatin1String OTHER_STORE_URL( "http://www.amazon.com/gp/search/ref=sr_adv_m_digital/?search-alias=digital-music&field-author=#artist#&field-title=#title#" );
+const QLatin1String OTHER_STORE_ARTIST_TAG( "#artist#" );
+const QLatin1String OTHER_STORE_TITLE_TAG( "#title#" );
+const char WHITESPACE = ' ';
+const char WHITESPACE_REPLACEMENT = '+';
-const GenreStruct AmericanGenres[] =
-{
- { GenreAmerica::RbdsNone, "", "", "" }
- ,{ GenreAmerica::RbdsNews, "txt_rad_info_news", "txt_rad_dblist_l1_mhz_val_news", "txt_rad_info_news_hs" }
- ,{ GenreAmerica::RbdsInformation, "txt_rad_info_information", "txt_rad_dblist_l1_mhz_val_information", "txt_rad_info_information_hs" }
- ,{ GenreAmerica::RbdsSports, "txt_rad_info_sport", "txt_rad_dblist_l1_mhz_val_sport", "txt_rad_info_sport_hs" }
- ,{ GenreAmerica::RbdsTalk, "txt_rad_info_talk", "txt_rad_dblist_l1_mhz_val_talk", "txt_rad_info_talk_hs" }
- ,{ GenreAmerica::RbdsRock, "txt_rad_info_rock_music", "txt_rad_dblist_l1_mhz_val_rock_music", "txt_rad_info_rock_music_hs" } //TODO: Check
- ,{ GenreAmerica::RbdsClassicRock, "txt_rad_info_classic_rock", "txt_rad_dblist_l1_mhz_val_classic_rock", "txt_rad_info_classic_rock_hs" }
- ,{ GenreAmerica::RbdsAdultHits, "txt_rad_info_adult_hits", "txt_rad_dblist_l1_mhz_val_adult_hits", "txt_rad_info_adult_hits_hs" }
- ,{ GenreAmerica::RbdsSoftRock, "txt_rad_info_soft_rock", "txt_rad_dblist_l1_mhz_val_soft_rock", "txt_rad_info_soft_rock_hs" }
- ,{ GenreAmerica::RbdsTop40, "txt_rad_info_top_40", "txt_rad_dblist_l1_mhz_val_top_40", "txt_rad_info_top_40_hs" }
- ,{ GenreAmerica::RbdsCountry, "txt_rad_info_country_music", "txt_rad_dblist_l1_mhz_val_country_music", "txt_rad_info_country_music_hs" } //TODO: Check
- ,{ GenreAmerica::RbdsOldies, "txt_rad_info_oldies_music", "txt_rad_dblist_l1_mhz_val_oldies_music", "txt_rad_info_oldies_music_hs" } //TODO: Check
- ,{ GenreAmerica::RbdsSoft, "txt_rad_info_soft", "txt_rad_dblist_l1_mhz_val_soft", "txt_rad_info_soft_hs" }
- ,{ GenreAmerica::RbdsNostalgia, "txt_rad_info_nostalgia", "txt_rad_dblist_l1_mhz_val_nostalgia", "txt_rad_info_nostalgia_hs" }
- ,{ GenreAmerica::RbdsJazz, "txt_rad_info_jazz_music", "txt_rad_dblist_l1_mhz_val_jazz_music", "txt_rad_info_jazz_music_hs" } //TODO: Check
- ,{ GenreAmerica::RbdsClassical, "txt_rad_info_classical", "txt_rad_dblist_l1_mhz_val_classical", "txt_rad_info_classical_hs" }
- ,{ GenreAmerica::RbdsRhythmAndBlues, "txt_rad_info_rhythm_and_blues", "txt_rad_dblist_l1_mhz_val_rhythm_and_blues", "txt_rad_info_rhythm_and_blues_hs" }
- ,{ GenreAmerica::RbdsSoftRhythmAndBlues, "txt_rad_info_soft_rhythm_and_blues", "txt_rad_dblist_l1_mhz_val_soft_rhythm_and_blues", "txt_rad_info_soft_rhythm_and_blues_hs" }
- ,{ GenreAmerica::RbdsLanguage, "txt_rad_info_language", "txt_rad_dblist_l1_mhz_val_language", "txt_rad_info_language_hs" }
- ,{ GenreAmerica::RbdsReligiousMusic, "txt_rad_info_religious_music", "txt_rad_dblist_l1_mhz_val_religious_music", "txt_rad_info_religious_music_hs" }
- ,{ GenreAmerica::RbdsReligiousTalk, "txt_rad_info_religious_talk", "txt_rad_dblist_l1_mhz_val_religious_talk", "txt_rad_info_religious_talk_hs" }
- ,{ GenreAmerica::RbdsPersonality, "txt_rad_info_personality", "txt_rad_dblist_l1_mhz_val_personality", "txt_rad_info_personality_hs" }
- ,{ GenreAmerica::RbdsPublic, "txt_rad_info_public", "txt_rad_dblist_l1_mhz_val_public", "txt_rad_info_public_hs" }
- ,{ GenreAmerica::RbdsCollege, "txt_rad_info_college", "txt_rad_dblist_l1_mhz_val_college", "txt_rad_info_college_hs" }
- ,{ GenreAmerica::RbdsUnassigned1, "", "", "" }
- ,{ GenreAmerica::RbdsUnassigned2, "", "", "" }
- ,{ GenreAmerica::RbdsUnassigned3, "", "", "" }
- ,{ GenreAmerica::RbdsUnassigned4, "", "", "" }
- ,{ GenreAmerica::RbdsUnassigned5, "", "", "" }
- ,{ GenreAmerica::RbdsWeather, "txt_rad_info_weather", "txt_rad_dblist_l1_mhz_val_weather", "txt_rad_info_weather_hs" }//TODO: Check
- ,{ GenreAmerica::RbdsEmergencyTest, "txt_rad_info_alarm_test", "txt_rad_dblist_l1_mhz_val_alarm_test", "txt_rad_info_alarm_test_hs" }//TODO: Check
- ,{ GenreAmerica::RbdsEmergency, "txt_rad_info_alarm", "txt_rad_dblist_l1_mhz_val_alarm", "txt_rad_info_alarm_hs" }//TODO: Check
-};
-const int AmericanGenresCount = sizeof( AmericanGenres ) / sizeof ( AmericanGenres[0] );
+// Constants used when launching radio server
+const QLatin1String RADIO_SERVER_NAME( "radioserver.exe" );
+const QLatin1String RADIO_RANGE_USEURO( "useuro" );
+const QLatin1String RADIO_RANGE_JAPAN( "japan" );
+
+// ====== STATIC FUNCTIONS ========
/*!
- *
+ * Gets the last tuned frequency from central repository
*/
-bool RadioUiEngine::isOfflineProfile()
+uint RadioUiEngine::lastTunedFrequency( uint defaultFrequency )
{
- bool offline = false;
-
-#ifdef BUILD_WIN32
- QScopedPointer<QSettings> settings( new QSettings( "Nokia", "QtFmRadio" ) );
- offline = settings->value( "Offline", false ).toBool();
-#else
- QSystemDeviceInfo deviceInfo;
- if ( deviceInfo.currentProfile() == QSystemDeviceInfo::OfflineProfile ) {
- offline = true;
- }
-#endif
-
- return offline;
-}
-
-/*!
- *
- */
-uint RadioUiEngine::lastTunedFrequency()
-{
- uint frequency = DEFAULT_MIN_FREQUENCY;
+ uint frequency = defaultFrequency;
#ifdef BUILD_WIN32
QScopedPointer<QSettings> settings( new QSettings( "Nokia", "QtFmRadio" ) );
frequency = settings->value( "CurrentFreq", DEFAULT_MIN_FREQUENCY ).toUInt();
if ( frequency == 0 ) {
- frequency = DEFAULT_MIN_FREQUENCY;
+ frequency = defaultFrequency;
}
#else
QScopedPointer<XQSettingsManager> settings( new XQSettingsManager() );
XQSettingsKey key( XQSettingsKey::TargetCentralRepository, RADIO_CENREP_UID, RADIO_CENREP_FREQUENCY_KEY );
frequency = settings->readItemValue( key, XQSettingsManager::TypeInt ).toUInt();
+ if ( frequency == 0 ) {
+ frequency = defaultFrequency;
+ }
#endif
return frequency;
}
/*!
+ * Gets the last used volume level
+ */
+int RadioUiEngine::lastVolume()
+{
+ int volume = DEFAULT_VOLUME_LEVEL;
+
+#ifndef BUILD_WIN32
+ QScopedPointer<XQSettingsManager> settings( new XQSettingsManager() );
+ XQSettingsKey key( XQSettingsKey::TargetCentralRepository, RADIO_CENREP_UID, RADIO_CENREP_HEADSET_VOLUME );
+ volume = settings->readItemValue( key, XQSettingsManager::TypeInt ).toInt();
+ if ( volume == 0 ) {
+ volume = DEFAULT_VOLUME_LEVEL;
+ }
+#endif
+
+ return volume;
+}
+
+/*!
+ * Launches the radio server process
+ */
+void RadioUiEngine::launchRadioServer()
+{
+ QStringList args;
+ args << RADIO_RANGE_USEURO; //TODO: Determine current region
+ args << QString::number( lastTunedFrequency( 0 ) );
+ args << QString::number( lastVolume() );
+
+ QProcess serverProcess;
+ bool success = serverProcess.startDetached( RADIO_SERVER_NAME, args );
+ LOG_ASSERT( success, LOG( "Failed to start radio server!" ) );
+}
+
+// ====== MEMBER FUNCTIONS ========
+
+/*!
*
*/
RadioUiEngine::RadioUiEngine( QObject* parent ) :
@@ -189,7 +135,6 @@
*/
RadioUiEngine::~RadioUiEngine()
{
- delete d_ptr;
}
/*!
@@ -220,6 +165,60 @@
}
/*!
+ *
+ */
+void RadioUiEngine::setFirstTimeStartPerformed( bool firstTimeStartPerformed )
+{
+ Q_D( RadioUiEngine );
+ d->mEngineWrapper->settings().setFirstTimeStartPerformed( firstTimeStartPerformed );
+}
+
+/*!
+ *
+ */
+void RadioUiEngine::setPowerOn()
+{
+ setMute( false );
+
+ Q_D( RadioUiEngine );
+ if ( d->mPowerOffTimer ) {
+ d->mPowerOffTimer->stop();
+ d->mPowerOffTimer->deleteLater();
+ d->mPowerOffTimer = NULL;
+ }
+}
+
+/*!
+ *
+ */
+void RadioUiEngine::setPowerOff( int delay )
+{
+ Q_D( RadioUiEngine );
+ d->mEngineWrapper->setMute( true, false );
+
+ if ( delay > 0 ) {
+ if ( !d->mPowerOffTimer ) {
+ d->mPowerOffTimer = new QTimer( this );
+ Radio::connect( d->mPowerOffTimer, SIGNAL(timeout()),
+ this, SIGNAL(powerOffRequested()) );
+ }
+
+ d->mPowerOffTimer->start( delay );
+ } else {
+ emit powerOffRequested();
+ }
+}
+
+/*!
+ *
+ */
+bool RadioUiEngine::isPoweringOff() const
+{
+ Q_D( const RadioUiEngine );
+ return d->mPowerOffTimer && d->mPowerOffTimer->isActive();
+}
+
+/*!
* Returns the settings handler owned by the engine
*/
RadioSettingsIf& RadioUiEngine::settings()
@@ -247,24 +246,22 @@
}
/*!
- * Creates a new filter model
+ * Creates a scanner engine and returns a pointer to it
+ * The returned pointer is wrapped inside a QScopedPointer to ensure this won't
+ * leak memory. The returned engine will be deleted even if the caller ignored
+ * the return value.
*/
-RadioStationFilterModel* RadioUiEngine::createNewFilterModel( QObject* parent )
-{
- return new RadioStationFilterModel( *this, parent );
-}
-
-/*!
- * Creates a new carousel model
- */
-RadioCarouselModel* RadioUiEngine::carouselModel()
+RadioScannerEnginePtr RadioUiEngine::createScannerEngine()
{
Q_D( RadioUiEngine );
- if ( !d->mCarouselModel ) {
- d->mCarouselModel.reset( new RadioCarouselModel( *this, *d->mStationModel ) );
- }
+#if defined BUILD_WIN32 || defined __WINS__
+ Q_ASSERT_X( !d->mScannerEngine, "RadioUiEngine::createScannerEngine", "Previous scanner instance not freed" );
+#endif
- return d->mCarouselModel.data();
+ RadioScannerEnginePtr enginePtr( new RadioScannerEngine( *d ) );
+ d->mScannerEngine = enginePtr;
+
+ return enginePtr;
}
/*!
@@ -273,10 +270,7 @@
RadioScannerEngine* RadioUiEngine::scannerEngine()
{
Q_D( RadioUiEngine );
- if ( !d->mScannerEngine ) {
- d->mScannerEngine = new RadioScannerEngine( *d );
- }
- return d->mScannerEngine;
+ return d->mScannerEngine.data();
}
/*!
@@ -295,7 +289,7 @@
{
Q_D( const RadioUiEngine );
if ( d->mScannerEngine ) {
- return d->mScannerEngine->isScanning();
+ return d->mScannerEngine.data()->isScanning();
}
return false;
}
@@ -395,24 +389,7 @@
*/
QString RadioUiEngine::genreToString( int genre, GenreTarget::Target target )
{
- RadioRegion::Region currentRegion = region();
-
- const GenreStruct* genreArray = currentRegion == RadioRegion::America ? AmericanGenres : EuropeanGenres;
- const int genreCount = currentRegion == RadioRegion::America ? AmericanGenresCount : EuropeanGenresCount;
-
- for( int i = 0; i < genreCount; ++i ) {
- if ( genreArray[i].mGenreCode == genre ) {
- if ( target == GenreTarget::Carousel ) {
- return qtTrId( genreArray[i].mInCarousel );
- } else if ( target == GenreTarget::StationsList ) {
- return qtTrId( genreArray[i].mInStationsList );
- } else if ( target == GenreTarget::HomeScreen ) {
- return qtTrId( genreArray[i].mInHomeScreen );
- }
- }
- }
-
- return "";
+ return RadioGenreLocalizer::genreToString( region(), genre, target );
}
/*!
@@ -420,28 +397,8 @@
*/
bool RadioUiEngine::isSongRecognitionAppAvailable()
{
- //TODO: Check if there is a better way to check if an application is available
- bool available = false;
-
- // Check the Z: drive
- QString fullPath = QString( KPathFormatter ).arg( "Z" ).arg( KApplicationDir ).arg( KSongRecognitionApp );
- available = QFile::exists( fullPath );
-
- LOG_FORMAT( "Checking file: %s. found %d", GETSTRING( fullPath ), available );
-
- if ( !available ) {
- // Check the C: drive
- fullPath = QString( KPathFormatter ).arg( "C" ).arg( KApplicationDir ).arg( KSongRecognitionApp );
- available = QFile::exists( fullPath );
- LOG_FORMAT( "Checking file: %s. found %d", GETSTRING( fullPath ), available );
- if ( !available ) {
- // Check the E: drive
- fullPath = QString( KPathFormatter ).arg( "E" ).arg( KApplicationDir ).arg( KSongRecognitionApp );
- available = QFile::exists( fullPath );
- LOG_FORMAT( "Checking file: %s. found %d", GETSTRING( fullPath ), available );
- }
- }
- return available;
+ //TODO: Implement Shazam support
+ return false;
}
/*!
@@ -467,54 +424,54 @@
*/
void RadioUiEngine::openMusicStore( const RadioHistoryItem& item, MusicStore store )
{
- Q_UNUSED( item );
- Q_UNUSED( store );
- //TODO: Integrate to music store
+ QString artist = item.artist();
+ artist.replace( WHITESPACE, WHITESPACE_REPLACEMENT );
+ QString title = item.title();
+ title.replace( WHITESPACE, WHITESPACE_REPLACEMENT );
+
+ QString url = store == OviStore ? OVI_STORE_URL : OTHER_STORE_URL;
+ url.replace( OTHER_STORE_ARTIST_TAG, artist );
+ url.replace( OTHER_STORE_TITLE_TAG, title );
+
+ launchBrowser( url );
+}
+
+/*!
+ *
+ */
+void RadioUiEngine::launchBrowser( const QString& url )
+{
+ QDesktopServices::openUrl( QUrl( url ) );
}
/*!
- * Public slot
- * Tunes to the given frequency
+ * Sets or unsets the engine to manual seek mode
+ */
+void RadioUiEngine::setManualSeekMode( bool manualSeek )
+{
+ Q_D( RadioUiEngine );
+ d->mEngineWrapper->setManualSeekMode( manualSeek );
+}
+
+/*!
+ * Checks if the engine is in manual seek mode
*/
-void RadioUiEngine::tuneFrequency( uint frequency, const int reason )
+bool RadioUiEngine::isInManualSeekMode() const
+{
+ Q_D( const RadioUiEngine );
+ return d->mEngineWrapper->isInManualSeekMode();
+}
+
+/*!
+ * Tunes the radio engine to given frequency
+ */
+void RadioUiEngine::setFrequency( uint frequency, const int reason )
{
Q_D( RadioUiEngine );
if ( frequency != d->mStationModel->currentStation().frequency() && d->mEngineWrapper->isFrequencyValid( frequency ) ) {
LOG_FORMAT( "RadioUiEngine::tuneFrequency, frequency: %d", frequency );
d->cancelSeeking();
- d->mEngineWrapper->tuneFrequency( frequency, reason );
- }
-}
-
-/*!
- * Public slot
- * Tunes to the given frequency after a delay
- */
-void RadioUiEngine::tuneWithDelay( uint frequency, const int reason )
-{
- Q_D( RadioUiEngine );
- if ( frequency != d->mStationModel->currentStation().frequency() && d->mEngineWrapper->isFrequencyValid( frequency ) ) {
- LOG_FORMAT( "RadioEngineWrapperPrivate::tuneWithDelay, frequency: %d", frequency );
- d->cancelSeeking();
- d->mEngineWrapper->tuneWithDelay( frequency, reason );
- }
-}
-
-/*!
- * Public slot
- * Tunes to the given preset
- */
-void RadioUiEngine::tunePreset( int presetIndex )
-{
- Q_D( RadioUiEngine );
- if ( presetIndex != d->mStationModel->currentStation().presetIndex() ) {
- RadioStation station;
- if ( d->mStationModel->findPresetIndex( presetIndex, station ) != RadioStation::NotFound &&
- d->mEngineWrapper->isFrequencyValid( station.frequency() ) ) {
- LOG_FORMAT( "RadioEngineWrapperPrivate::tunePreset, presetIndexPosition: %d", presetIndex );
-
- d->mEngineWrapper->tuneFrequency( station.frequency(), TuneReason::Unspecified );
- }
+ d->mEngineWrapper->setFrequency( frequency, reason );
}
}
@@ -558,7 +515,7 @@
{
if ( isAntennaAttached() ) {
Q_D( RadioUiEngine );
- Seeking::Direction direction = static_cast<Seeking::Direction>( seekDirection );
+ Seek::Direction direction = static_cast<Seek::Direction>( seekDirection );
emitSeekingStarted( direction );
d->mEngineWrapper->startSeeking( direction, TuneReason::Seek );
}
@@ -570,14 +527,7 @@
*/
void RadioUiEngine::launchSongRecognition()
{
- LOG_FORMAT("RadioUiEngine::launchSongRecognition() starting: %s", GETSTRING( KSongRecognitionApp ) );
-
- QStringList arguments;
- arguments << KSongRecognitionAppParams;
-
- bool started = QProcess::startDetached( KSongRecognitionApp, arguments );
- Q_UNUSED( started );
- LOG_ASSERT( started, LOG_FORMAT("RadioUiEngine::launchSongRecognition() failed to start %s", GETSTRING( KSongRecognitionApp ) ) );
+ //TODO: Implement Shazam support
}
/*!
@@ -591,7 +541,7 @@
/*!
* Function used by the private implementation to emit a seekingStarted signal
*/
-void RadioUiEngine::emitSeekingStarted( Seeking::Direction direction )
+void RadioUiEngine::emitSeekingStarted( Seek::Direction direction )
{
emit seekingStarted( direction );
}