# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1278414440 -10800 # Node ID 608f67c2251478c913907b531fc91cb936c23b74 # Parent f683e24efca3dcac6405fd79a8c4773a461b0815 Revision: 201025 Kit: 2010127 diff -r f683e24efca3 -r 608f67c22514 internetradio2.0/dataproviderinc/irdataprovider.h --- a/internetradio2.0/dataproviderinc/irdataprovider.h Wed Jun 23 18:04:00 2010 +0300 +++ b/internetradio2.0/dataproviderinc/irdataprovider.h Tue Jul 06 14:07:20 2010 +0300 @@ -222,6 +222,13 @@ */ void SetOffsetSeconds( const TTime& aTime ); + /** + * CIRDataProvider::UnzipFileL() + * Unzip the gz file to xml file + * @param aOutputFile out put file + */ + void UnzipFileL( const TDesC& aOutputFile ); + private: /** @@ -248,6 +255,11 @@ */ RFile iFile; + /** + * Name of the Xml Gz file to be created + */ + TFileName iXmlGzFilePath; + /** * Name of the Xml file to be created */ diff -r f683e24efca3 -r 608f67c22514 internetradio2.0/dataproviderinc/irdataproviderconstants.h --- a/internetradio2.0/dataproviderinc/irdataproviderconstants.h Wed Jun 23 18:04:00 2010 +0300 +++ b/internetradio2.0/dataproviderinc/irdataproviderconstants.h Tue Jul 06 14:07:20 2010 +0300 @@ -34,6 +34,8 @@ _LIT8( KAcceptCharset, "iso-8859-1, utf-8, iso-10646-ucs-2; q=0.6" ); // Used to specify the Accept Language _LIT8( KAcceptLanguage, "en" ); +// Used to specify the Accept encoding +_LIT8( KAcceptEncoding, "gzip" ); // Some texts for header output _LIT( KDPColon, ": " ); // Default Content-Type diff -r f683e24efca3 -r 608f67c22514 internetradio2.0/dataprovidersrc/irdataprovider.cpp --- a/internetradio2.0/dataprovidersrc/irdataprovider.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/internetradio2.0/dataprovidersrc/irdataprovider.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -15,6 +15,9 @@ * */ +#include +#include +#include #include "irdataprovider.h" #include "irdataproviderobserver.h" @@ -23,6 +26,9 @@ #include "irhttprequestdata.h" #include "irsettings.h" +_LIT( KGzXmlFile, "iSdsResponse.xml.gz" ); +_LIT( KXmlFile, "iSdsResponse.xml" ); + // --------------------------------------------------------------------------- // CIRDataProvider::NewL(MIRDataProviderObserver& aObserver) // Creates instance of CIRDataProvider. @@ -110,7 +116,7 @@ // Create or replace the file used to store xml response from iSDS - User::LeaveIfError(iFile.Replace( iFsSession, iXmlFilePath, EFileWrite )); + User::LeaveIfError(iFile.Replace( iFsSession, iXmlGzFilePath, EFileWrite )); iHttpDataProvider->CancelTransaction(); TInt err = iHttpDataProvider->IssueHttpRequestL( aRequestObject ); @@ -179,6 +185,10 @@ iFile.Close(); iDataProviderTimer->Cancel(); + // unzip the gz file + TRAP_IGNORE( UnzipFileL( iXmlFilePath ) ); + // delete the original gz file + BaflUtils::DeleteFile( iFsSession, iXmlGzFilePath ); // Need to take a member to a local variable, as the IRHttpDataReceived may initiate // an IRHttpIssueRequestL() call, causing the headers to be replaced with empty ones, and // causing crashes. @@ -341,8 +351,7 @@ void CIRDataProvider::ConstructL() // second-phase constructor { IRLOG_DEBUG( "CIRDataProvider::ConstructL - Entering" ); - _LIT( KXmlFile, "iSdsResponse.xml" ); - ConstructL(KXmlFile); + ConstructL( KGzXmlFile ); iHttpDataProvider->iSetNonUAProfUserAgent = EFalse; IRLOG_DEBUG( "CIRDataProvider::ConstructL - Exiting" ); } @@ -359,8 +368,10 @@ iDataProviderTimer = CIRDataProviderTimer::NewL( EPriorityHigh, *this ); User::LeaveIfError(iFsSession.Connect()); iIRSettings = CIRSettings::OpenL(); - iXmlFilePath = iIRSettings->PrivatePath(); - iXmlFilePath.Append( aFileName ); + iXmlGzFilePath = iIRSettings->PrivatePath(); + iXmlFilePath = iXmlGzFilePath; + iXmlGzFilePath.Append( aFileName ); + iXmlFilePath.Append( KXmlFile ); iTimeOut = iIRSettings->GetTimeOut(); iHttpDataProvider->iSetNonUAProfUserAgent = ETrue; IRLOG_DEBUG( "CIRDataProvider::ConstructL(const TDesC &aFileName) - Exiting." ); @@ -430,4 +441,25 @@ IRLOG_DEBUG( "CIRDataProvider::SetOffsetSeconds - Exiting." ); } +// --------------------------------------------------------------------------- +// CIRDataProvider::UnzipFileL +// --------------------------------------------------------------------------- +// +void CIRDataProvider::UnzipFileL( const TDesC& aOutputFile ) + { + IRLOG_DEBUG( "CIRDataProvider::UnzipFileL - Enter." ); + RFile outputFile; + CleanupClosePushL( outputFile ); + User::LeaveIfError( outputFile.Replace( iFsSession, aOutputFile, + EFileStream | EFileWrite | EFileShareExclusive ) ); + CEZGZipToFile* gZip = + CEZGZipToFile::NewLC( iFsSession, iXmlGzFilePath, outputFile ); + while ( gZip->InflateL() ) + { + // unzip the gz file, quit when finish + } + CleanupStack::PopAndDestroy( gZip ); + CleanupStack::PopAndDestroy( &outputFile ); + IRLOG_DEBUG( "CIRDataProvider::UnzipFileL - Exit." ); + } diff -r f683e24efca3 -r 608f67c22514 internetradio2.0/dataprovidersrc/irhttpdataprovider.cpp --- a/internetradio2.0/dataprovidersrc/irhttpdataprovider.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/internetradio2.0/dataprovidersrc/irhttpdataprovider.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -667,6 +667,12 @@ IRLOG_DEBUG2( "CIRHttpDataProvider::BuildHeadersL - HTTP::EAcceptLanguage = %S", &logstr ); } + // Add Accept-Encoding: gzip HTTP request header. The server will use compression to improve data + // transfer speed. + SetHeaderL( header, HTTP::EAcceptEncoding, KAcceptEncoding ); + logstr.Copy(KAcceptEncoding); + IRLOG_DEBUG2( "CIRHttpDataProvider::BuildHeadersL - HTTP::EAcceptEncoding = %S", &logstr ); + // Set the If-Modified-Since header if required if ( aRequestInfo.isIfModifiedSet ) { diff -r f683e24efca3 -r 608f67c22514 internetradio2.0/favoritesdbinc/irfavoritesdb.h --- a/internetradio2.0/favoritesdbinc/irfavoritesdb.h Wed Jun 23 18:04:00 2010 +0300 +++ b/internetradio2.0/favoritesdbinc/irfavoritesdb.h Tue Jul 06 14:07:20 2010 +0300 @@ -19,8 +19,8 @@ #ifndef IRFAVORITESDB_H #define IRFAVORITESDB_H -#include -#include +#include "pspresetobserver.h" +#include "psserv.h" class CIRIsdsPreset; class CIRPreset; diff -r f683e24efca3 -r 608f67c22514 internetradio2.0/favoritesdbsrc/irfavoritesdb.cpp --- a/internetradio2.0/favoritesdbsrc/irfavoritesdb.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/internetradio2.0/favoritesdbsrc/irfavoritesdb.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -16,9 +16,8 @@ */ -#include -#include - +#include "pspresetnotifier.h" +#include "pstransaction.h" #include "irdebug.h" #include "irfavoritesdb.h" #include "irisdspreset.h" diff -r f683e24efca3 -r 608f67c22514 internetradio2.0/group/irdataprovider.mmp --- a/internetradio2.0/group/irdataprovider.mmp Wed Jun 23 18:04:00 2010 +0300 +++ b/internetradio2.0/group/irdataprovider.mmp Tue Jul 06 14:07:20 2010 +0300 @@ -41,6 +41,9 @@ USERINCLUDE ../presetplugininc USERINCLUDE ../cachemgmtinc USERINCLUDE ../sessionloginc +USERINCLUDE ../../presetserver/include +USERINCLUDE ../../presetserver/clientinc +USERINCLUDE ../../presetserver/serverinc APP_LAYER_SYSTEMINCLUDE // TODO will be removed after the changes of /epoc32/include @@ -85,7 +88,7 @@ LIBRARY pops.lib LIBRARY responsemsg.lib LIBRARY smts.lib - +LIBRARY ezlib.lib //test end diff -r f683e24efca3 -r 608f67c22514 internetradio2.0/group/irfavoritesdb.mmp --- a/internetradio2.0/group/irfavoritesdb.mmp Wed Jun 23 18:04:00 2010 +0300 +++ b/internetradio2.0/group/irfavoritesdb.mmp Tue Jul 06 14:07:20 2010 +0300 @@ -32,7 +32,9 @@ USERINCLUDE ../datastructuresinc USERINCLUDE ../presetplugininc USERINCLUDE ../xmlparserinc - +USERINCLUDE ../../presetserver/include +USERINCLUDE ../../presetserver/clientinc +USERINCLUDE ../../presetserver/serverinc // Default system include paths for application layer modules. diff -r f683e24efca3 -r 608f67c22514 internetradio2.0/group/presetplugin.mmp --- a/internetradio2.0/group/presetplugin.mmp Wed Jun 23 18:04:00 2010 +0300 +++ b/internetradio2.0/group/presetplugin.mmp Tue Jul 06 14:07:20 2010 +0300 @@ -33,6 +33,8 @@ USERINCLUDE ../presetplugininc USERINCLUDE ../include USERINCLUDE ../datastructuresinc +USERINCLUDE ../../presetserver/clientinc +USERINCLUDE ../../presetserver/serverinc // Default system include paths for application layer modules. APP_LAYER_SYSTEMINCLUDE diff -r f683e24efca3 -r 608f67c22514 internetradio2.0/presetplugininc/irpreset.h --- a/internetradio2.0/presetplugininc/irpreset.h Wed Jun 23 18:04:00 2010 +0300 +++ b/internetradio2.0/presetplugininc/irpreset.h Tue Jul 06 14:07:20 2010 +0300 @@ -20,7 +20,8 @@ #define IRPRESET_H #include -#include + +#include "pspresetinterface.h" class CIRIsdsPreset; class CIRChannelServerUrl; diff -r f683e24efca3 -r 608f67c22514 internetradio2.0/sessionloginc/irsessionlogger.h --- a/internetradio2.0/sessionloginc/irsessionlogger.h Wed Jun 23 18:04:00 2010 +0300 +++ b/internetradio2.0/sessionloginc/irsessionlogger.h Tue Jul 06 14:07:20 2010 +0300 @@ -460,7 +460,10 @@ /** * unicode buffer */ - TBuf<256> iUniCodeBuf; //Unicode + //"MAX_URL_CHARACTOR_NUMBER = 255" is defined + // in iropenwebaddressview.cpp, it is 8bit len char. + // the memory should be double when tranfer 8bit to 16bit. + TBuf<512> iUniCodeBuf; //Unicode /** * utf 8 buffer diff -r f683e24efca3 -r 608f67c22514 presetserver/clientinc/pspresetinterface.h --- a/presetserver/clientinc/pspresetinterface.h Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/clientinc/pspresetinterface.h Tue Jul 06 14:07:20 2010 +0300 @@ -19,8 +19,8 @@ #ifndef C_CPSPRESETINTERFACE_H #define C_CPSPRESETINTERFACE_H -#include -#include +#include "pspresetobserver.h" +#include "pstransaction.h" const TUid KPSPresetInterface = { 0x10281CB6 }; /**< The ECOM interface UID for preset plugins. */ diff -r f683e24efca3 -r 608f67c22514 presetserver/clientinc/psserv.h --- a/presetserver/clientinc/psserv.h Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/clientinc/psserv.h Tue Jul 06 14:07:20 2010 +0300 @@ -19,9 +19,10 @@ #ifndef R_RPSSERV_H #define R_RPSSERV_H -#include #include +#include "pscommon.h" + class CPSPresetInterface; /** diff -r f683e24efca3 -r 608f67c22514 presetserver/clientinc/psservnotifier.h --- a/presetserver/clientinc/psservnotifier.h Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/clientinc/psservnotifier.h Tue Jul 06 14:07:20 2010 +0300 @@ -19,8 +19,8 @@ #ifndef R_RPSPRESETNOTIFIER_H #define R_RPSPRESETNOTIFIER_H -#include -#include +#include "pscommon.h" +#include "pspresetobserver.h" class RPSServ; diff -r f683e24efca3 -r 608f67c22514 presetserver/clientinc/psservsession.h --- a/presetserver/clientinc/psservsession.h Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/clientinc/psservsession.h Tue Jul 06 14:07:20 2010 +0300 @@ -20,7 +20,8 @@ #define R_RPSSERVSESSION_H #include -#include + +#include "pscommon.h" class RPSServ; diff -r f683e24efca3 -r 608f67c22514 presetserver/clientsrc/Pspresetinterface.cpp --- a/presetserver/clientsrc/Pspresetinterface.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/clientsrc/Pspresetinterface.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -17,12 +17,12 @@ #include -#include -#include -#include -#include #include +#include "pscommon.h" +#include "pspresetinterface.h" +#include "pspresetnotifier.h" +#include "pstransaction.h" #include "psdebug.h" #include "psservsession.h" diff -r f683e24efca3 -r 608f67c22514 presetserver/clientsrc/Pspresetnotifier.cpp --- a/presetserver/clientsrc/Pspresetnotifier.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/clientsrc/Pspresetnotifier.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -16,9 +16,8 @@ */ -#include -#include - +#include "pspresetnotifier.h" +#include "psserv.h" #include "psservnotifier.h" const TInt KPSDefaultNotifierPriority = CActive::EPriorityLow; // Priority of the non-preset notifiers. diff -r f683e24efca3 -r 608f67c22514 presetserver/clientsrc/Psserv.cpp --- a/presetserver/clientsrc/Psserv.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/clientsrc/Psserv.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -16,8 +16,8 @@ */ -#include -#include +#include "pspresetinterface.h" +#include "psserv.h" // ======== LOCAL FUNCTIONS ======== diff -r f683e24efca3 -r 608f67c22514 presetserver/clientsrc/Psservnotifier.cpp --- a/presetserver/clientsrc/Psservnotifier.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/clientsrc/Psservnotifier.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -16,9 +16,8 @@ */ -#include -#include - +#include "pscommon.h" +#include "psserv.h" #include "psservnotifier.h" // ======== LOCAL FUNCTIONS ======== diff -r f683e24efca3 -r 608f67c22514 presetserver/clientsrc/Psservsession.cpp --- a/presetserver/clientsrc/Psservsession.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/clientsrc/Psservsession.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -16,9 +16,8 @@ */ -#include -#include - +#include "pscommon.h" +#include "psserv.h" #include "psservsession.h" // --------------------------------------------------------------------------- diff -r f683e24efca3 -r 608f67c22514 presetserver/clientsrc/Pstransaction.cpp --- a/presetserver/clientsrc/Pstransaction.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/clientsrc/Pstransaction.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -16,7 +16,7 @@ */ -#include +#include "pstransaction.h" // --------------------------------------------------------------------------- // Two-phased constructor. diff -r f683e24efca3 -r 608f67c22514 presetserver/group/bld.inf --- a/presetserver/group/bld.inf Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/group/bld.inf Tue Jul 06 14:07:20 2010 +0300 @@ -21,14 +21,6 @@ ARMV5 WINSCW PRJ_EXPORTS -../clientinc/pspresetinterface.h /epoc32/include/pspresetinterface.h -../clientinc/pspresetnotifier.h /epoc32/include/pspresetnotifier.h -../clientinc/psserv.h /epoc32/include/psserv.h -../clientinc/psserv.inl /epoc32/include/psserv.inl -../clientinc/pstransaction.h /epoc32/include/pstransaction.h -../include/pscommon.h /epoc32/include/pscommon.h -../serverinc/pspresetobserver.h /epoc32/include/pspresetobserver.h - backup_registration.xml /epoc32/data/z/private/10281cb5/backup_registration.xml ../rom/presetserver.iby CORE_APP_LAYER_IBY_EXPORT_PATH(presetserver.iby) diff -r f683e24efca3 -r 608f67c22514 presetserver/group/psclient.mmp --- a/presetserver/group/psclient.mmp Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/group/psclient.mmp Tue Jul 06 14:07:20 2010 +0300 @@ -40,6 +40,7 @@ SOURCE Pstransaction.cpp USERINCLUDE ../clientinc +USERINCLUDE ../serverinc USERINCLUDE ../include APP_LAYER_SYSTEMINCLUDE diff -r f683e24efca3 -r 608f67c22514 presetserver/group/psserver.mmp --- a/presetserver/group/psserver.mmp Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/group/psserver.mmp Tue Jul 06 14:07:20 2010 +0300 @@ -46,6 +46,7 @@ USERINCLUDE ../include USERINCLUDE ../serverinc +USERINCLUDE ../clientinc APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE OS_LAYER_PUBLIC_EXPORT_PATH(ecom) diff -r f683e24efca3 -r 608f67c22514 presetserver/include/pscommon.h --- a/presetserver/include/pscommon.h Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/include/pscommon.h Tue Jul 06 14:07:20 2010 +0300 @@ -20,7 +20,8 @@ #define PSCOMMON_H #include -#include + +#include "pspresetobserver.h" const TInt KPSVersionMajor = 1; /**< Major version number of the server. */ const TInt KPSVersionMinor = 0; /**< Minor version number of the server. */ diff -r f683e24efca3 -r 608f67c22514 presetserver/serverinc/psserver.h --- a/presetserver/serverinc/psserver.h Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/serverinc/psserver.h Tue Jul 06 14:07:20 2010 +0300 @@ -19,9 +19,8 @@ #ifndef C_CPSSERVER_H #define C_CPSSERVER_H -#include -#include - +#include "pscommon.h" +#include "pspresetobserver.h" #include "psdatabase.h" #include "pspropertyobserver.h" diff -r f683e24efca3 -r 608f67c22514 presetserver/serversrc/Psdatabase.cpp --- a/presetserver/serversrc/Psdatabase.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/serversrc/Psdatabase.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -17,8 +17,8 @@ #include -#include +#include "pscommon.h" #include "psdebug.h" #include "pspendingpreset.h" #include "psdatabase.h" diff -r f683e24efca3 -r 608f67c22514 presetserver/serversrc/Psdatabasecleanup.cpp --- a/presetserver/serversrc/Psdatabasecleanup.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/serversrc/Psdatabasecleanup.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -17,8 +17,8 @@ #include -#include +#include "pspresetinterface.h" #include "psdatabase.h" #include "psdatabasecleanup.h" #include "psdebug.h" diff -r f683e24efca3 -r 608f67c22514 presetserver/serversrc/Psserver.cpp --- a/presetserver/serversrc/Psserver.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/serversrc/Psserver.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -15,10 +15,9 @@ * */ - -#include #include +#include "pscommon.h" #include "psdatabasecleanup.h" #include "psdebug.h" #include "pspendingpreset.h" diff -r f683e24efca3 -r 608f67c22514 presetserver/serversrc/Pssession.cpp --- a/presetserver/serversrc/Pssession.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/presetserver/serversrc/Pssession.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -15,10 +15,9 @@ * */ - -#include #include +#include "pscommon.h" #include "psdebug.h" #include "psserver.h" #include "pssession.h" diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/all.pro --- a/qtinternetradio/all.pro Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/all.pro Tue Jul 06 14:07:20 2010 +0300 @@ -37,7 +37,8 @@ irqnetworkcontroller \ irqsonghistory \ irqnwkinfoobserver \ - irqstatisticsreporter \ + irqstatisticsreporter \ + irhswidgetplugin \ ui SYMBIAN_PLATFORMS = WINSCW ARMV5 diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/common.pri --- a/qtinternetradio/common.pri Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/common.pri Tue Jul 06 14:07:20 2010 +0300 @@ -17,6 +17,7 @@ DEFINES += USER_DEFINED_ISDSURL #DEFINES += NOWPLAYING_VIEW_OPTION_B #DEFINES += ADV_ENABLED +DEFINES += HS_WIDGET_ENABLED # ########################################################## # Logging flag definitions diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/inc/irhswidget.h --- a/qtinternetradio/irhswidgetplugin/inc/irhswidget.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/irhswidgetplugin/inc/irhswidget.h Tue Jul 06 14:07:20 2010 +0300 @@ -19,15 +19,16 @@ #define IRHSWIDGET_H // System includes -#include #include -#include // User includes #include "irservicedef.h" // Forward declarations -class HbLabel; +class QString; +class QGraphicsLinearLayout; +class IrHsWidgetTitleRow; +class IrHsWidgetMetaDataRow; class IrServiceClient; class IrHsWidget : public HbWidget @@ -61,23 +62,22 @@ }; void handleHsWidgetStateChange(IrHsWidgetState aNewState); - void loadStationLogo(); + + void initHomeSreenWidget(); + void resizeHomeScreenWidget(); - void initHomeSreenWidget(); void loadInitLayout(); void loadStoppedLayout(); void loadPlayingLayout(); void loadLoadingLayout(); - - // from QObject - bool eventFilter(QObject *aObject, QEvent *aEvent); + + void enableUserAction(); + void disableUserAction(); private slots: // handle user press event - void handleLogoAreaAction(); + void handleCommonAreaAction(); void handleControlAreaAction(); - void handleGoToIrAreaAction(); - void handleCentralAreaAction(); void handleControlFailed(); @@ -87,17 +87,12 @@ void handleMetaDataUpdated(const QString &aMetaData); void handleIrStateUpdated(IrAppState::Type aNewState); -private: - HbIcon mLoadingIcon; +private: + bool mUserActionEnabled; - HbLabel *mLogoLabel; - HbLabel *mControlLabel; - HbLabel *mGoToIrLabel; - HbLabel *mStationNameLabel; - HbLabel *mMetadataLabel; - - HbWidget *mInfoControlArea; - HbWidget *mCentralArea; + QGraphicsLinearLayout *mRowLayout; + IrHsWidgetTitleRow *mTitleRow; + IrHsWidgetMetaDataRow *mMetaDataRow; IrServiceClient *mServiceClient; diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/inc/irhswidgetmetadatarow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/irhswidgetplugin/inc/irhswidgetmetadatarow.h Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Internet Radio home screen widget +* +*/ + + +#ifndef IRHSWIDGETMETADATAROW_H_ +#define IRHSWIDGETMETADATAROW_H_ + +// System includes +#include +#include + +//FORWARD DECLARATIONS: +class HbLabel; +class HbMarqueeItem; + +class IrHsWidgetMetaDataRow : public HbWidget +{ + Q_OBJECT + +public: + explicit IrHsWidgetMetaDataRow(QGraphicsItem *aParent = 0, Qt::WindowFlags aFlags = 0); + virtual ~IrHsWidgetMetaDataRow(); + + void setMetaData(const QString &aMetaData); + + void startMetaDataMarquee(); + void stopMetaDataMarquee(); + + void setPlayIcon(); + void setStopIcon(); + void setLoadingIcon(); + +private: + // from QObject + bool eventFilter(QObject *aObject, QEvent *aEvent); + +private: + void loadUi(); + void createLoadingIcon(); + +signals: + void controlAreaClicked(); + void metaDataAreaClicked(); + +private: + HbMarqueeItem *mMetaData; + HbLabel *mControlLabel; + HbIcon mLoadingIcon; +}; + +#endif // IRHSWIDGETMETADATAROW_H_ diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/inc/irhswidgettitlerow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/irhswidgetplugin/inc/irhswidgettitlerow.h Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Internet Radio home screen widget +* +*/ + +#ifndef IRHSWIDGETTITLEROW_H_ +#define IRHSWIDGETTITLEROW_H_ + +// System includes +#include + +//FORWARD DECLARATIONS: +class HbLabel; + +class IrHsWidgetTitleRow : public HbWidget +{ + Q_OBJECT + +public: + explicit IrHsWidgetTitleRow(QGraphicsItem *aParent = 0, Qt::WindowFlags aFlags = 0); + virtual ~IrHsWidgetTitleRow(); + + void setDefaultTitle(); + void setStationName(const QString &aStationName); + + void loadStationLogo(); + void setDefaultLogo(); + +signals: + void titleRowClicked(); + +protected: + // from QGraphicsItem + void mousePressEvent(QGraphicsSceneMouseEvent *aEvent); + +private: + void loadUi(); + +private: + HbLabel *mStationLogo; + HbLabel *mStationName; +}; + +#endif // IRHSWIDGETTITLEROW_H_ diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/inc/irhswidgetuiloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/irhswidgetplugin/inc/irhswidgetuiloader.h Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef IRHSWIDGETUILOADER_H_ +#define IRHSWIDGETUILOADER_H_ + +#include + +class IRHsWidgetUiLoader : public HbDocumentLoader +{ +public: + virtual QObject *createObject(const QString& aType, const QString &aName); +}; + +#endif /* IRHSWIDGETUILOADER_H_ */ diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/inc/irserviceclient.h --- a/qtinternetradio/irhswidgetplugin/inc/irserviceclient.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/irhswidgetplugin/inc/irserviceclient.h Tue Jul 06 14:07:20 2010 +0300 @@ -20,6 +20,7 @@ // System includes #include +#include #include // User includes @@ -37,12 +38,25 @@ Q_OBJECT public: - explicit IrServiceClient(QObject *aParent = 0); - virtual ~IrServiceClient(); + + /*! + * Get the instance of IrServiceClient + * @return IrServiceClient* + */ + static IrServiceClient* openInstance(); + + /*! + * Close the instance of IrServiceClient + */ + void closeInstance(); + +private: + IrServiceClient(); + virtual ~IrServiceClient(); public: bool startMonitoringIrState(); - void stopMonitoringIrState(); + bool isStationPlayed(); bool loadStationName(QString &aStationName); @@ -64,6 +78,12 @@ void controlFailed(); +private: + void notifyStationNameUpdated(const QString &aStationName); + void notifyStationLogoUpdated(bool aIsLogoAvailable); + void notifyMetaDataUpdated(const QString &aMetaData); + void notifyIrStateChanged(IrAppState::Type aNewState); + private slots: // used for return value from Monitor Service via Qt HighWay void handleMonitorRequestOk(const QVariant &aRetValue); @@ -80,6 +100,8 @@ bool createControlServiceRequest(); bool createMonitorServiceRequest(); bool createRefreshServiceRequest(); + + void clearMonitorServiceRequest(); enum IrAppVisibilty { @@ -96,9 +118,20 @@ void processNotificationData(const IrServiceData &aServiceData); void initHsWidgetNoRunStopped(); - void resetHsWidgetExitStopped(); + + void refreshAllActiveHsWidgets(); -private: +private: + static QMutex mMutex; + static int mRef; + static bool mMonitoringStarted; + static IrServiceClient *mInstatnce; + + QString mStationName; + bool mStationLogoAvailable; // true if station has its own logo + QString mMetaData; + IrAppState::Type mIrState; + IrAppInspector *mIrAppInspector; bool mMonitorReqOngoing; diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/irhswidgetplugin.pro --- a/qtinternetradio/irhswidgetplugin/irhswidgetplugin.pro Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/irhswidgetplugin/irhswidgetplugin.pro Tue Jul 06 14:07:20 2010 +0300 @@ -20,7 +20,8 @@ LIBS += -lxqsettingsmanager \ -lxqservice \ - -lxqserviceutil + -lxqserviceutil \ + -lirqlogger MOC_DIR = moc @@ -29,6 +30,7 @@ INCLUDEPATH += ./inc INCLUDEPATH += ../irqcommon/inc +INCLUDEPATH += ../irqlogger/inc UID = E257CD03 RESOURCES = resources.qrc diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/resource/irhswidget.docml --- a/qtinternetradio/irhswidgetplugin/resource/irhswidget.docml Wed Jun 23 18:04:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/resource/irhswidgetmetadatarow.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/irhswidgetplugin/resource/irhswidgetmetadatarow.docml Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/resource/irhswidgettitlerow.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/irhswidgetplugin/resource/irhswidgettitlerow.docml Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/resources.qrc --- a/qtinternetradio/irhswidgetplugin/resources.qrc Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/irhswidgetplugin/resources.qrc Tue Jul 06 14:07:20 2010 +0300 @@ -1,5 +1,6 @@ - resource/irhswidget.docml + resource/irhswidgetmetadatarow.docml + resource/irhswidgettitlerow.docml diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/src/irhswidget.cpp --- a/qtinternetradio/irhswidgetplugin/src/irhswidget.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/irhswidgetplugin/src/irhswidget.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -16,57 +16,29 @@ */ // System includes -#include -#include #include #include -#include -#include -#include -#include #include -#include -#include // User includes #include "irhswidget.h" #include "irserviceclient.h" - -// Defines -static const QString KIrHsWidgetDocml = ":/resource/irhswidget.docml"; -static const QString KIrHsWidget = "irhswidget"; -static const QString KLogoLabel = "logoLabel"; -static const QString KGoToIrLabel = "goToIrLabel"; -static const QString KControlLabel = "controlLabel"; -static const QString KFirstRowLabel = "firstRowLabel"; -static const QString KSecondRowLabel = "secondRowLabel"; -static const QString KInfoControlArea = "info_control_area"; -static const QString KCentrolArea = "infoLayout"; +#include "irhswidgettitlerow.h" +#include "irhswidgetmetadatarow.h" +#include "irqlogger.h" -static const QString KDefaultStationLogo = "qtg_large_internet_radio"; -static const QString KPlayButtonIcon = "qtg_mono_play"; -static const QString KStopButtonIcon = "qtg_mono_stop"; - -static const QString KFrameGraphicsName = "qtg_fr_hswidget_normal"; -static const QString KStationNameColor = "qtc_hs_list_item_title"; -static const QString KMetaDataColor = "qtc_hs_list_item_content"; - -static const QString KLoadingAnimationPrefix = "qtg_anim_loading_"; -static const QString KLoadingIconName = "LoadingAnimation"; - -const int KIrHsWidgetLogoSize = 50; // hs widget logo size +// Constants +static const int KIrHsWidgetContentsMargin = 0; +static const QString KIrHsWidgetBackgroundImage = "qtg_fr_hswidget_normal"; // ======== MEMBER FUNCTIONS ======== // Constructor IrHsWidget::IrHsWidget(QGraphicsItem* aParent, Qt::WindowFlags aFlags) : HbWidget(aParent, aFlags), - mLogoLabel(NULL), - mControlLabel(NULL), - mGoToIrLabel(NULL), - mStationNameLabel(NULL), - mMetadataLabel(NULL), - mInfoControlArea(NULL), - mCentralArea(NULL), + mUserActionEnabled(false), + mRowLayout(NULL), + mTitleRow(NULL), + mMetaDataRow(NULL), mServiceClient(NULL), mIrState(IrAppState::Unknown), mIrHsWidgetState(EUnknown) @@ -74,13 +46,23 @@ setupUi(); initHomeSreenWidget(); - mServiceClient = new IrServiceClient(this); + mServiceClient = IrServiceClient::openInstance(); setupConnection(); } // Destructor IrHsWidget::~IrHsWidget() { + if (mServiceClient) + { + mServiceClient->closeInstance(); + } + + if (mRowLayout->count() == 1) + { + delete mMetaDataRow; + mMetaDataRow = NULL; + } } // Initializes the widget. @@ -98,98 +80,62 @@ // Called when widget is shown in the home screen void IrHsWidget::onShow() -{ +{ + if (mRowLayout->count() == 2) + { + mMetaDataRow->startMetaDataMarquee(); + } } // Called when widget is hidden from the home screen void IrHsWidget::onHide() { + if (mRowLayout->count() == 2) + { + mMetaDataRow->stopMetaDataMarquee(); + } } void IrHsWidget::setupUi() { - HbDocumentLoader *uiLoader = new HbDocumentLoader(); - uiLoader->reset(); - - bool loaded = false; - uiLoader->load(KIrHsWidgetDocml, &loaded); - - if (loaded) - { - HbWidget *irHsWidget = qobject_cast(uiLoader->findWidget(KIrHsWidget)); - HbFrameDrawer *irHsWidgetDrawer = new HbFrameDrawer(KFrameGraphicsName, HbFrameDrawer::NinePieces); - HbFrameItem *irHsWidgetBgItem = new HbFrameItem(irHsWidgetDrawer, irHsWidget); - irHsWidgetBgItem->setPreferredSize(irHsWidget->preferredSize()); - - QGraphicsLinearLayout *irHsWidgetLayout = new QGraphicsLinearLayout(Qt::Vertical, this); - irHsWidgetLayout->addItem(irHsWidget); - setLayout(irHsWidgetLayout); - - mGoToIrLabel = qobject_cast(uiLoader->findWidget(KGoToIrLabel)); - mLogoLabel = qobject_cast(uiLoader->findWidget(KLogoLabel)); - mControlLabel = qobject_cast(uiLoader->findWidget(KControlLabel)); - mInfoControlArea = qobject_cast(uiLoader->findWidget(KInfoControlArea)); - mCentralArea = qobject_cast(uiLoader->findWidget(KCentrolArea)); - - // make system's hs backgourd item under logo - irHsWidgetBgItem->stackBefore(mLogoLabel); - - // set font for station name line - mStationNameLabel = qobject_cast(uiLoader->findWidget(KFirstRowLabel)); - mStationNameLabel->setTextColor(HbColorScheme::color(KStationNameColor)); + setContentsMargins( KIrHsWidgetContentsMargin, KIrHsWidgetContentsMargin, + KIrHsWidgetContentsMargin, KIrHsWidgetContentsMargin); + + //Setup layout + mRowLayout = new QGraphicsLinearLayout(Qt::Vertical); - // set font for meta data line - mMetadataLabel = qobject_cast(uiLoader->findWidget(KSecondRowLabel)); - mMetadataLabel->setTextColor(HbColorScheme::color(KMetaDataColor)); - - // Create animation. - HbIconAnimationManager *animationManager = HbIconAnimationManager::global(); - HbIconAnimationDefinition animationDefinition; - HbIconAnimationDefinition::AnimationFrame animationFrame; - QList animationFrameList; - - QString animationFrameIconName; - for (int i = 1; i < 11; i++) - { - animationFrame.duration = 100; - animationFrameIconName.clear(); - animationFrameIconName.append(KLoadingAnimationPrefix); - animationFrameIconName.append(animationFrameIconName.number(i)); - animationFrame.iconName = animationFrameIconName; - animationFrameList.append(animationFrame); - } - animationDefinition.setPlayMode(HbIconAnimationDefinition::Loop); - animationDefinition.setFrameList(animationFrameList); - animationManager->addDefinition(KLoadingIconName, animationDefinition); - - // Construct an icon using the animation definition. - mLoadingIcon.setIconName(KLoadingIconName); - - // install event filter to widget - mGoToIrLabel->installEventFilter(this); - mControlLabel->installEventFilter(this); - mLogoLabel->installEventFilter(this); - mCentralArea->installEventFilter(this); - } - - delete uiLoader; + mRowLayout->setContentsMargins(KIrHsWidgetContentsMargin, KIrHsWidgetContentsMargin, + KIrHsWidgetContentsMargin, KIrHsWidgetContentsMargin); + mRowLayout->setSpacing(KIrHsWidgetContentsMargin); + setLayout(mRowLayout); + + //background + HbFrameDrawer * backgroundFrameDrawer = new HbFrameDrawer(KIrHsWidgetBackgroundImage, HbFrameDrawer::NinePieces); + HbFrameItem* backgroundLayoutItem = new HbFrameItem(backgroundFrameDrawer); + setBackgroundItem( backgroundLayoutItem ); } void IrHsWidget::initHomeSreenWidget() { + mTitleRow = new IrHsWidgetTitleRow(); + mMetaDataRow = new IrHsWidgetMetaDataRow(); + + mRowLayout->addItem(mTitleRow); + resizeHomeScreenWidget(); + if (mServiceClient->isStationPlayed()) { loadStoppedLayout(); QString stationName; if (mServiceClient->loadStationName(stationName)) { - mStationNameLabel->setPlainText(stationName); + mTitleRow->setStationName(stationName); } if (mServiceClient->loadStationLogoFlag()) { - loadStationLogo(); + mTitleRow->loadStationLogo(); } } else @@ -198,6 +144,17 @@ } } +void IrHsWidget::resizeHomeScreenWidget() +{ + //resize here so homescreen will place widget correctly on screen + setPreferredSize( mRowLayout->preferredSize() ); + if (parentWidget()) + { + //to place widget properly after adding to homescreen + parentWidget()->resize(preferredSize()); + } +} + void IrHsWidget::setupConnection() { // signal - slot for service event @@ -210,58 +167,19 @@ QObject::connect(mServiceClient, SIGNAL(irStateChanged(IrAppState::Type)), this, SLOT(handleIrStateUpdated(IrAppState::Type))); QObject::connect(mServiceClient, SIGNAL(controlFailed()), - this, SLOT(handleControlFailed())); -} - -bool IrHsWidget::eventFilter(QObject *aObject, QEvent *aEvent) -{ - bool eventWasConsumed = false; - QString objectName = aObject->objectName(); - QEvent::Type eventType = aEvent->type(); - - if (KGoToIrLabel == objectName) - { - if (QEvent::GraphicsSceneMousePress == eventType) - { - eventWasConsumed = true; - handleGoToIrAreaAction(); - } - } - else if (KLogoLabel == objectName) - { - if (QEvent::GraphicsSceneMousePress == eventType) - { - eventWasConsumed = true; - handleLogoAreaAction(); - } - } - else if (KControlLabel == objectName) - { - if (QEvent::GraphicsSceneMousePress == eventType) - { - eventWasConsumed = true; - handleControlAreaAction(); - } - } - else if (KCentrolArea == objectName) - { - if (QEvent::GraphicsSceneMousePress == eventType) - { - eventWasConsumed = true; - handleCentralAreaAction(); - } - } + this, SLOT(handleControlFailed())); - return eventWasConsumed; + enableUserAction(); } // ================ handle user press event =============== -void IrHsWidget::handleLogoAreaAction() +void IrHsWidget::handleCommonAreaAction() { switch (mIrState) { case IrAppState::NoRunInit: case IrAppState::NoRunStopped: + disableUserAction(); mServiceClient->launchIrNormally(); break; @@ -279,26 +197,28 @@ void IrHsWidget::handleControlAreaAction() { + LOG("IrHsWidget::handleControlAreaAction()"); + //here, for we will control the application by homescreen, + //to avoid repeat actions, we disable all control event here + //and enable them when state changed or failed. + disableUserAction(); + switch (mIrState) { - case IrAppState::NoRunStopped: - mServiceClient->launchIrNowPlaying(); - loadLoadingLayout(); + case IrAppState::NoRunStopped: + mServiceClient->launchIrNowPlaying(); break; case IrAppState::RunningStopped: - mServiceClient->startPlaying(); - loadLoadingLayout(); + mServiceClient->startPlaying(); break; case IrAppState::Playing: - mServiceClient->stopPlaying(); - loadStoppedLayout(); + mServiceClient->stopPlaying(); break; case IrAppState::Loading: - mServiceClient->cancelLoading(); - loadStoppedLayout(); + mServiceClient->cancelLoading(); break; default: @@ -306,18 +226,11 @@ } } -void IrHsWidget::handleGoToIrAreaAction() -{ - handleLogoAreaAction(); -} - -void IrHsWidget::handleCentralAreaAction() -{ - handleLogoAreaAction(); -} void IrHsWidget::handleControlFailed() -{ +{ + LOG("handleControlFailed()"); + enableUserAction(); switch (mIrHsWidgetState) { case EInit: // LAF == [logo][go to interneat radio] @@ -345,35 +258,31 @@ // ======== for service notification ======== void IrHsWidget::handleStationNameUpdated(const QString &aStationName) { - if (mStationNameLabel->plainText() != aStationName) - { - mStationNameLabel->setPlainText(aStationName); - } + mTitleRow->setStationName(aStationName); } void IrHsWidget::handleStationLogoUpdated(bool aLogoAvailable) { if (aLogoAvailable) { - loadStationLogo(); + mTitleRow->loadStationLogo(); } else { - mLogoLabel->setIcon(KDefaultStationLogo); + mTitleRow->setDefaultLogo(); } } void IrHsWidget::handleMetaDataUpdated(const QString &aMetaData) { - if (mMetadataLabel->plainText() != aMetaData) - { - mMetadataLabel->setPlainText(aMetaData); - } + mMetaDataRow->setMetaData(aMetaData); } void IrHsWidget::handleIrStateUpdated(IrAppState::Type aNewState) { + LOG("IrHsWidget::handleIrStateUpdated()"); + enableUserAction(); if (aNewState == mIrState) { return; @@ -438,47 +347,80 @@ // LAF == [logo][go to interneat radio] void IrHsWidget::loadInitLayout() { - mInfoControlArea->hide(); - mGoToIrLabel->show(); + if (mRowLayout->count() == 2) + { + mRowLayout->removeItem(mMetaDataRow); + resizeHomeScreenWidget(); + } + + mTitleRow->setDefaultTitle(); } // LAF == [logo][StationInfo][Play] void IrHsWidget::loadStoppedLayout() { - mGoToIrLabel->hide(); - mInfoControlArea->show(); - mMetadataLabel->setPlainText(QString("")); - mControlLabel->setIcon(KPlayButtonIcon); + if (mRowLayout->count() == 1) + { + mRowLayout->addItem(mMetaDataRow); + resizeHomeScreenWidget(); + } + + mMetaDataRow->setPlayIcon(); } // LAF == [logo][StationInfo][Stop] void IrHsWidget::loadPlayingLayout() { - mGoToIrLabel->hide(); - mInfoControlArea->show(); - mControlLabel->setIcon(KStopButtonIcon); + if (mRowLayout->count() == 1) + { + mRowLayout->addItem(mMetaDataRow); + resizeHomeScreenWidget(); + } + + mMetaDataRow->setStopIcon(); } // LAF == [logo][StationInfo][Loading] void IrHsWidget::loadLoadingLayout() { - mGoToIrLabel->hide(); - mInfoControlArea->show(); - mMetadataLabel->setPlainText(QString("")); - mControlLabel->setIcon(mLoadingIcon); + if (mRowLayout->count() == 1) + { + mRowLayout->addItem(mMetaDataRow); + resizeHomeScreenWidget(); + } + + mMetaDataRow->setLoadingIcon(); } -void IrHsWidget::loadStationLogo() + + +void IrHsWidget::enableUserAction() { - QSettings settings(KIrSettingOrganization, KIrSettingApplicaton); - if (settings.value(KIrSettingStationLogo).canConvert()) + if (!mUserActionEnabled) { - QPixmap logoPixmap = settings.value(KIrSettingStationLogo).value(); - QPixmap newLogoPixmap = - logoPixmap.scaled(QSize(KIrHsWidgetLogoSize,KIrHsWidgetLogoSize),Qt::KeepAspectRatio); - QIcon logoQIcon(newLogoPixmap); - HbIcon logoHbIcon(logoQIcon); - mLogoLabel->setIcon(logoHbIcon); - } + mUserActionEnabled = true; + // signal - slot for user click action + QObject::connect(mTitleRow, SIGNAL(titleRowClicked()), + this, SLOT(handleCommonAreaAction())); + QObject::connect(mMetaDataRow, SIGNAL(metaDataAreaClicked()), + this, SLOT(handleCommonAreaAction())); + QObject::connect(mMetaDataRow, SIGNAL(controlAreaClicked()), + this, SLOT(handleControlAreaAction())); + } } +void IrHsWidget::disableUserAction() +{ + if (mUserActionEnabled) + { + mUserActionEnabled = false; + // signal - slot for user click action + QObject::disconnect(mTitleRow, SIGNAL(titleRowClicked()), + this, SLOT(handleCommonAreaAction())); + QObject::disconnect(mMetaDataRow, SIGNAL(metaDataAreaClicked()), + this, SLOT(handleCommonAreaAction())); + QObject::disconnect(mMetaDataRow, SIGNAL(controlAreaClicked()), + this, SLOT(handleControlAreaAction())); + } +} + diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/src/irhswidgetmetadatarow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/irhswidgetplugin/src/irhswidgetmetadatarow.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Internet Radio home screen widget +* +*/ +// System includes +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "irhswidgetmetadatarow.h" +#include "irhswidgetuiloader.h" + +// Constants +static const QString KIrHsWidgetMetaDataRowDocML = ":/resource/irhswidgetmetadatarow.docml"; +static const QString KIrHsWidgetMetaDataRowContainer = "metadatarow_layout"; +static const QString KIrHsWidgetMetaDataLabel = "metadata_label"; +static const QString KNmHsWidgetControlLabel = "control_label"; + +static const QString KPlayButtonIcon = "qtg_mono_play"; +static const QString KStopButtonIcon = "qtg_mono_stop"; +static const QString KMetaDataColor = "qtc_hs_list_item_title"; + +static const QString KLoadingAnimationPrefix = "qtg_anim_loading_"; +static const QString KLoadingIconName = "LoadingAnimation"; + +static const int KIrHsWidgetContentsMargin = 0; +static const int KLoadingFramePostfixMin = 1; // loading animation frame name postfix (min value) defined in layout guide. +static const int KLoadingFramePostfixMax = 10; // loading animation frame name postfix (max value) defined in layout guide. +static const int KLoadingAnimationDuration = 100; // duration for frames to construct a animation, unit : ms + +IrHsWidgetMetaDataRow::IrHsWidgetMetaDataRow(QGraphicsItem *aParent, Qt::WindowFlags aFlags) : + HbWidget(aParent, aFlags), + mMetaData(NULL), + mControlLabel(NULL) +{ + loadUi(); + createLoadingIcon(); +} + + +IrHsWidgetMetaDataRow::~IrHsWidgetMetaDataRow() +{ +} + +void IrHsWidgetMetaDataRow::loadUi() +{ + IRHsWidgetUiLoader loader; + loader.load(KIrHsWidgetMetaDataRowDocML); + + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); + layout->setContentsMargins(KIrHsWidgetContentsMargin, KIrHsWidgetContentsMargin, + KIrHsWidgetContentsMargin, KIrHsWidgetContentsMargin); + layout->setSpacing(KIrHsWidgetContentsMargin); + setLayout(layout); + + QGraphicsWidget *container = loader.findWidget(KIrHsWidgetMetaDataRowContainer); + layout->addItem(container); + + mMetaData = static_cast (loader.findWidget(KIrHsWidgetMetaDataLabel)); + mControlLabel = static_cast (loader.findWidget(KNmHsWidgetControlLabel)); + mMetaData->setTextColor(HbColorScheme::color(KMetaDataColor)); + mMetaData->setLoopCount(-1); + + mMetaData->installEventFilter(this); + mControlLabel->installEventFilter(this); +} + +void IrHsWidgetMetaDataRow::setMetaData(const QString &aMetaData) +{ + if (mMetaData->text() != aMetaData) + { + mMetaData->setText(aMetaData); + if (aMetaData.isEmpty()) + { + mMetaData->stopAnimation(); + } + else + { + mMetaData->startAnimation(); + } + } +} + +void IrHsWidgetMetaDataRow::startMetaDataMarquee() +{ + if (!mMetaData->text().isEmpty()) + { + mMetaData->startAnimation(); + } +} + +void IrHsWidgetMetaDataRow::stopMetaDataMarquee() +{ + mMetaData->stopAnimation(); +} + +void IrHsWidgetMetaDataRow::setPlayIcon() +{ + mControlLabel->setIcon(KPlayButtonIcon); +} + +void IrHsWidgetMetaDataRow::setStopIcon() +{ + mControlLabel->setIcon(KStopButtonIcon); +} + +void IrHsWidgetMetaDataRow::setLoadingIcon() +{ + mControlLabel->setIcon(mLoadingIcon); +} + +bool IrHsWidgetMetaDataRow::eventFilter(QObject *aObject, QEvent *aEvent) +{ + QString objectName = aObject->objectName(); + + if (QEvent::GraphicsSceneMousePress == aEvent->type()) + { + + if (KIrHsWidgetMetaDataLabel == objectName) + { + emit metaDataAreaClicked(); + } + else if (KNmHsWidgetControlLabel == objectName) + { + emit controlAreaClicked(); + } + } + + return false; +} + +void IrHsWidgetMetaDataRow::createLoadingIcon() +{ + HbIconAnimationManager *animationManager = HbIconAnimationManager::global(); + HbIconAnimationDefinition animationDefinition; + HbIconAnimationDefinition::AnimationFrame animationFrame; + QList animationFrameList; + + QString animationFrameIconName; + for (int i = KLoadingFramePostfixMin; i <= KLoadingFramePostfixMax; i++) + { + animationFrame.duration = KLoadingAnimationDuration; + animationFrameIconName.clear(); + animationFrameIconName.append(KLoadingAnimationPrefix); + animationFrameIconName.append(animationFrameIconName.number(i)); + animationFrame.iconName = animationFrameIconName; + animationFrameList.append(animationFrame); + } + animationDefinition.setPlayMode(HbIconAnimationDefinition::Loop); + animationDefinition.setFrameList(animationFrameList); + animationManager->addDefinition(KLoadingIconName, animationDefinition); + + mLoadingIcon.setIconName(KLoadingIconName); +} diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/src/irhswidgettitlerow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/irhswidgetplugin/src/irhswidgettitlerow.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Internet Radio home screen widget +* +*/ +// System includes +#include +#include +#include +#include +#include +#include + +// User includes +#include "irhswidgettitlerow.h" +#include "irservicedef.h" +#include "irhswidgetuiloader.h" + +// Constants +static const QString KIrHsWidgetTitleRowDocML = ":/resource/irhswidgettitlerow.docml"; +static const QString KIrHsWidgetTitleRowContainer = "titlerow_layout"; +static const QString KIrHsWidgetStationLogo = "station_logo"; +static const QString KNmHsWidgetStationName = "station_name"; + +static const QString KStationNameColor = "qtc_hs_list_item_title"; +static const QString KDefaultStationLogo = "qtg_large_internet_radio"; + +static const int KIrHsWidgetContentsMargin = 0; +static const int KIrHsWidgetLogoSize = 50; // hs widget logo size + +IrHsWidgetTitleRow::IrHsWidgetTitleRow(QGraphicsItem *aParent, Qt::WindowFlags aFlags) : + HbWidget(aParent, aFlags), + mStationLogo(NULL), + mStationName(NULL) +{ + loadUi(); +} + +IrHsWidgetTitleRow::~IrHsWidgetTitleRow() +{ +} + +void IrHsWidgetTitleRow::loadUi() +{ + IRHsWidgetUiLoader loader; + loader.load(KIrHsWidgetTitleRowDocML); + + //Create layout + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); + + layout->setContentsMargins(KIrHsWidgetContentsMargin, KIrHsWidgetContentsMargin, + KIrHsWidgetContentsMargin, KIrHsWidgetContentsMargin); + layout->setSpacing(KIrHsWidgetContentsMargin); + setLayout(layout); + + QGraphicsWidget *container = loader.findWidget(KIrHsWidgetTitleRowContainer); + layout->addItem(container); + + mStationLogo = static_cast (loader.findWidget(KIrHsWidgetStationLogo)); + mStationName = static_cast (loader.findWidget(KNmHsWidgetStationName)); + mStationName->setTextColor(HbColorScheme::color(KStationNameColor)); +} + +void IrHsWidgetTitleRow::setDefaultTitle() +{ +#ifdef SUBTITLE_STR_BY_LOCID + mStationName->setPlainText(hbTrId("txt_irad_title_internet_radio")); +#else + mStationName->setPlainText(hbTrId("Internet radio")); +#endif +} + +void IrHsWidgetTitleRow::setStationName(const QString& aStationName) +{ + if (mStationName->plainText() != aStationName) + { + mStationName->setPlainText(aStationName); + } +} + +void IrHsWidgetTitleRow::loadStationLogo() +{ + QSettings settings(KIrSettingOrganization, KIrSettingApplication); + if (settings.value(KIrSettingStationLogo).canConvert()) + { + QPixmap logoPixmap = settings.value(KIrSettingStationLogo).value(); + QPixmap newLogoPixmap = + logoPixmap.scaled(QSize(KIrHsWidgetLogoSize,KIrHsWidgetLogoSize),Qt::KeepAspectRatio); + QIcon logoQIcon(newLogoPixmap); + HbIcon logoHbIcon(logoQIcon); + mStationLogo->setIcon(logoHbIcon); + } +} + +void IrHsWidgetTitleRow::setDefaultLogo() +{ + mStationLogo->setIcon(KDefaultStationLogo); +} + + +void IrHsWidgetTitleRow::mousePressEvent(QGraphicsSceneMouseEvent *aEvent) +{ + Q_UNUSED(aEvent); + emit titleRowClicked(); +} diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/src/irhswidgetuiloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/irhswidgetplugin/src/irhswidgetuiloader.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include "irhswidgetuiloader.h" + +QObject *IRHsWidgetUiLoader::createObject(const QString& aType, const QString &aName) +{ + if (aType == HbMarqueeItem::staticMetaObject.className()) + { + QObject *object = new HbMarqueeItem; + object->setObjectName(aName); + return object; + } + + return HbDocumentLoader::createObject(aType, aName); +} diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irhswidgetplugin/src/irserviceclient.cpp --- a/qtinternetradio/irhswidgetplugin/src/irserviceclient.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/irhswidgetplugin/src/irserviceclient.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -37,10 +37,52 @@ static const QString KIrServiceMonitorOperation = "registerNotifications()"; static const QString KIrServiceRefreshOperation = "refreshAllData()"; + +// Initialize the static member variable +QMutex IrServiceClient::mMutex; +int IrServiceClient::mRef = 0; +bool IrServiceClient::mMonitoringStarted = false; +IrServiceClient *IrServiceClient::mInstatnce = NULL; + + // ==================== MEMBER FUNCTIONS ====================== +// Static function to get a singleton instance of IrServiceClient +IrServiceClient* IrServiceClient::openInstance() +{ + mMutex.lock(); + if (NULL == mInstatnce) + { + mInstatnce = new IrServiceClient(); + } + if (mInstatnce != NULL) + { + mRef++; + } + mMutex.unlock(); + return mInstatnce; +} + +// Close a singleton instance of IrServiceClient +void IrServiceClient::closeInstance() +{ + if (mInstatnce != NULL) + { + mMutex.lock(); + if (mRef > 0) + { + mRef--; + } + + if (0 == mRef) + { + delete mInstatnce; + } + mMutex.unlock(); + } +} + // Constructor -IrServiceClient::IrServiceClient(QObject *aParent) : - QObject(aParent), +IrServiceClient::IrServiceClient() : mIrAppInspector(NULL), mMonitorReqOngoing(false), mControlReqOngoing(false), @@ -69,6 +111,14 @@ bool IrServiceClient::startMonitoringIrState() { + if (mMonitoringStarted) + { + refreshAllActiveHsWidgets(); + return true; + } + + // if this is the first active hs widget + mMonitoringStarted = true; bool retVal = false; if (mIrAppInspector->isIrRunning()) { @@ -82,37 +132,41 @@ } else { - emit irStateChanged(IrAppState::NoRunInit); + notifyIrStateChanged(IrAppState::NoRunInit); } } return mIrAppInspector->startInspectingIrRunningStatus() && retVal; } -void IrServiceClient::stopMonitoringIrState() -{ - delete mMonitorRequest; - mMonitorRequest = NULL; - - delete mRefreshRequest; - mRefreshRequest = NULL; -} void IrServiceClient::initHsWidgetNoRunStopped() -{ - emit irStateChanged(IrAppState::NoRunStopped); - +{ QString stationName; if (loadStationName(stationName)) { - emit stationNameUpdated(stationName); + notifyStationNameUpdated(stationName); } else { - emit stationNameUpdated(QString("")); +#ifdef SUBTITLE_STR_BY_LOCID + notifyStationNameUpdated(hbTrId("txt_irad_info_unnamed_station")); +#else + notifyStationNameUpdated(hbTrId("Unnamed station")); +#endif } - emit stationLogoUpdated(loadStationLogoFlag()); + notifyStationLogoUpdated(loadStationLogoFlag()); + + notifyIrStateChanged(IrAppState::NoRunStopped); +} + +void IrServiceClient::refreshAllActiveHsWidgets() +{ + emit stationNameUpdated(mStationName); + emit stationLogoUpdated(mStationLogoAvailable); + emit metaDataUpdated(mMetaData); + emit irStateChanged(mIrState); } /****************************************************************** @@ -224,16 +278,13 @@ doSendMonitorRequest(); if (aRetValue.isValid() - && aRetValue.canConvert(QVariant::List)) + && aRetValue.canConvert()) { - QVariantList dataList = aRetValue.toList(); - foreach (const QVariant& data, dataList) + IrServiceDataList dataList; + dataList = qVariantValue(aRetValue); + foreach (const IrServiceData& data, dataList) { - if (data.canConvert()) - { - IrServiceData serviceData = data.value(); - processNotificationData(serviceData); - } + processNotificationData(data); } } } @@ -383,27 +434,35 @@ break; case IrAppInspector::Exiting : - stopMonitoringIrState(); - - if (isStationPlayed()) + { + clearMonitorServiceRequest(); + QString stationName; + if (loadStationName(stationName)) { - resetHsWidgetExitStopped(); + notifyMetaDataUpdated(QString("")); + notifyStationNameUpdated(stationName); + notifyStationLogoUpdated(loadStationLogoFlag()); + notifyIrStateChanged(IrAppState::NoRunStopped); } else { - emit irStateChanged(IrAppState::NoRunInit); + notifyIrStateChanged(IrAppState::NoRunInit); } break; + } default: break; } } -void IrServiceClient::resetHsWidgetExitStopped() +void IrServiceClient::clearMonitorServiceRequest() { - emit irStateChanged(IrAppState::NoRunStopped); - emit metaDataUpdated(QString("")); + delete mMonitorRequest; + mMonitorRequest = NULL; + + delete mRefreshRequest; + mRefreshRequest = NULL; } // used to process service data sent from IR app. @@ -419,28 +478,28 @@ case IrServiceNotification::StationName: if (data.canConvert(QVariant::String)) { - emit stationNameUpdated(data.toString()); + notifyStationNameUpdated(data.toString()); } break; case IrServiceNotification::MetaData: if (data.canConvert(QVariant::String)) { - emit metaDataUpdated(data.toString()); + notifyMetaDataUpdated(data.toString()); } break; case IrServiceNotification::StationLogo: if (data.canConvert(QVariant::Bool)) { - emit stationLogoUpdated(data.toBool()); + notifyStationLogoUpdated(data.toBool()); } break; case IrServiceNotification::IrState: if (data.canConvert(QVariant::Int)) { - emit irStateChanged((IrAppState::Type)data.toInt()); + notifyIrStateChanged((IrAppState::Type)data.toInt()); } break; @@ -476,22 +535,46 @@ aRequest->setInfo(reqInfo); } +void IrServiceClient::notifyStationNameUpdated(const QString &aStationName) +{ + mStationName = aStationName; + emit stationNameUpdated(mStationName); +} + +void IrServiceClient::notifyStationLogoUpdated(bool aIsLogoAvailable) +{ + mStationLogoAvailable = aIsLogoAvailable; + emit stationLogoUpdated(mStationLogoAvailable); +} + +void IrServiceClient::notifyMetaDataUpdated(const QString &aMetaData) +{ + mMetaData = aMetaData; + emit metaDataUpdated(mMetaData); +} + +void IrServiceClient::notifyIrStateChanged(IrAppState::Type aNewState) +{ + mIrState = aNewState; + emit irStateChanged(mIrState); +} + bool IrServiceClient::isStationPlayed() { - QSettings settings(KIrSettingOrganization, KIrSettingApplicaton); + QSettings settings(KIrSettingOrganization, KIrSettingApplication); QString stationName = settings.value(KIrSettingStationName,KIrDefaultStationName).toString(); return stationName != KIrDefaultStationName; } bool IrServiceClient::loadStationLogoFlag() { - QSettings settings(KIrSettingOrganization, KIrSettingApplicaton); + QSettings settings(KIrSettingOrganization, KIrSettingApplication); return settings.value(KIrSettingStationLogoAvailable,false).toBool(); } bool IrServiceClient::loadStationName(QString &aStationName) { - QSettings settings(KIrSettingOrganization, KIrSettingApplicaton); + QSettings settings(KIrSettingOrganization, KIrSettingApplication); aStationName = settings.value(KIrSettingStationName,KIrDefaultStationName).toString(); if(aStationName != KIrDefaultStationName) { @@ -504,4 +587,5 @@ } Q_IMPLEMENT_USER_METATYPE(IrServiceData) +Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(IrServiceDataList) diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irqcommon/inc/irservicedata.h --- a/qtinternetradio/irqcommon/inc/irservicedata.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/irqcommon/inc/irservicedata.h Tue Jul 06 14:07:20 2010 +0300 @@ -19,7 +19,6 @@ #define IRSERVICEDATA_H #include -#include #include class IrServiceData @@ -34,11 +33,11 @@ virtual ~IrServiceData() {} + int mType; + QVariant mData; + template void serialize(Stream &aStream) const; template void deserialize(Stream &aStream); - - int mType; - QVariant mData; }; template inline void IrServiceData::serialize(Stream &aStream) const @@ -53,8 +52,11 @@ aStream >> mData; } + +typedef QList IrServiceDataList; + Q_DECLARE_USER_METATYPE(IrServiceData) - +Q_DECLARE_USER_METATYPE_NO_OPERATORS(IrServiceDataList) #endif // IRSERVICEDATA_H diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irqcommon/inc/irservicedef.h --- a/qtinternetradio/irqcommon/inc/irservicedef.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/irqcommon/inc/irservicedef.h Tue Jul 06 14:07:20 2010 +0300 @@ -22,11 +22,12 @@ // For settings via QSetting static const QString KIrSettingOrganization = "nokia.s60.mymex"; -static const QString KIrSettingApplicaton = "internetradio"; +static const QString KIrSettingApplication = "internetradio"; static const QString KIrSettingStationName = "lastplayedinfo/station_name"; static const QString KIrDefaultStationName = "no_station_played_yet"; static const QString KIrSettingStationLogo = "lastplayedinfo/station_logo"; static const QString KIrSettingStationLogoAvailable = "lastplayedinfo/station_logo_available"; +static const QString KIrSettingSplashNowplaying = "splash/is_nowplaying_view"; // For P&S XQSettingsManager const long int KInternetRadioPSUid = 0xE28364bb; // Internet Radio's UID3 diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irqcommon/irqcommon.pro --- a/qtinternetradio/irqcommon/irqcommon.pro Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/irqcommon/irqcommon.pro Tue Jul 06 14:07:20 2010 +0300 @@ -22,7 +22,10 @@ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE INCLUDEPATH += ../../internetradio2.0/datastructuresinc \ - ../../internetradio2.0/presetplugininc + ../../internetradio2.0/presetplugininc \ + ../../presetserver/include \ + ../../presetserver/clientinc \ + ../../presetserver/serverinc LIBS += -lirdatastructures \ -lfbscli \ diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irqfavoritesdb/inc/irqfavoritesdb_p.h --- a/qtinternetradio/irqfavoritesdb/inc/irqfavoritesdb_p.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/irqfavoritesdb/inc/irqfavoritesdb_p.h Tue Jul 06 14:07:20 2010 +0300 @@ -19,7 +19,8 @@ #define IRQFAVORITESDB_P_H #include -#include + +#include "pspresetobserver.h" class CIRFavoritesDb; class IRQPreset; diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irqfavoritesdb/irqfavoritesdb.pro --- a/qtinternetradio/irqfavoritesdb/irqfavoritesdb.pro Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/irqfavoritesdb/irqfavoritesdb.pro Tue Jul 06 14:07:20 2010 +0300 @@ -27,9 +27,10 @@ INCLUDEPATH += ../../internetradio2.0/favoritesdbinc \ ../../internetradio2.0/datastructuresinc \ ../../internetradio2.0/presetplugininc \ - ../irqcommon/inc - - + ../irqcommon/inc \ + ../../presetserver/include \ + ../../presetserver/clientinc \ + ../../presetserver/serverinc LIBS += -lirdatastructures \ diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/irqisdsclient/irqisdsclient.pro --- a/qtinternetradio/irqisdsclient/irqisdsclient.pro Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/irqisdsclient/irqisdsclient.pro Tue Jul 06 14:07:20 2010 +0300 @@ -28,22 +28,25 @@ INCLUDEPATH += $${OS_LAYER_PUBLIC_EXPORT_PATH(mmf/common)} INCLUDEPATH += $${OS_LAYER_PUBLIC_EXPORT_PATH(xml)} -INCLUDEPATH += ..\..\internetradio2.0\settingsinc \ - ..\..\internetradio2.0\datastructuresinc \ - ..\..\internetradio2.0\favoritesdbinc \ - ..\..\internetradio2.0\networkcontrollerinc \ - ..\..\internetradio2.0\isdsclientinc \ - ..\..\internetradio2.0\resources \ - ..\..\internetradio2.0\include \ - ..\..\internetradio2.0\dataproviderinc \ - ..\..\internetradio2.0\cachemgmtinc \ - ..\..\internetradio2.0\xmlparserinc \ - ..\..\internetradio2.0\sessionloginc \ - ..\..\internetradio2.0\settingsinc \ - ..\irqcommon\inc \ - ..\irqfavoritesdb\inc \ - ..\irqlogger\inc - +INCLUDEPATH += ../../internetradio2.0/settingsinc \ + ../../internetradio2.0/datastructuresinc \ + ../../internetradio2.0/favoritesdbinc \ + ../../internetradio2.0/networkcontrollerinc \ + ../../internetradio2.0/isdsclientinc \ + ../../internetradio2.0/resources \ + ../../internetradio2.0/include \ + ../../internetradio2.0/dataproviderinc \ + ../../internetradio2.0/cachemgmtinc \ + ../../internetradio2.0/xmlparserinc \ + ../../internetradio2.0/sessionloginc \ + ../../internetradio2.0/settingsinc \ + ../irqcommon/inc \ + ../irqfavoritesdb/inc \ + ../irqlogger/inc \ + ../../presetserver/include \ + ../../presetserver/clientinc \ + ../../presetserver/serverinc + LIBS += -lirdatastructures \ -lirfavoritesdb \ -lirqfavorites \ diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/rom/qtinternetradio.iby --- a/qtinternetradio/rom/qtinternetradio.iby Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/rom/qtinternetradio.iby Tue Jul 06 14:07:20 2010 +0300 @@ -37,4 +37,12 @@ data=ZRESOURCE\apps\internet_radio_10_1.mif APP_RESOURCE_DIR\internet_radio_10_1.mif data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\internet_radio_10_1_reg.rsc Private\10003a3f\import\apps\internet_radio_10_1_reg.rsc +#the following is for splash screen +data=ZRESOURCE\hb\splashml\internet_radio_default.splashml RESOURCE_FILES_DIR\hb\splashml\internet_radio_default.splashml +data=ZRESOURCE\hb\splashml\internet_radio_default.docml RESOURCE_FILES_DIR\hb\splashml\internet_radio_default.docml +data=ZRESOURCE\hb\splashml\internet_radio_normal.splashml RESOURCE_FILES_DIR\hb\splashml\internet_radio_normal.splashml +data=ZRESOURCE\hb\splashml\internet_radio_normal.docml RESOURCE_FILES_DIR\hb\splashml\internet_radio_normal.docml +data=ZRESOURCE\hb\splashml\internet_radio_nowplaying.splashml RESOURCE_FILES_DIR\hb\splashml\internet_radio_nowplaying.splashml +data=ZRESOURCE\hb\splashml\internet_radio_nowplaying.docml RESOURCE_FILES_DIR\hb\splashml\internet_radio_nowplaying.docml + #endif diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/inc/irapplication.h --- a/qtinternetradio/ui/inc/irapplication.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/inc/irapplication.h Tue Jul 06 14:07:20 2010 +0300 @@ -41,8 +41,12 @@ class HbProgressDialog; class IRQSystemEventHandler; class IRPlayList; -class HbIconItem; +#ifdef HS_WIDGET_ENABLED +class IrMonitorService; +class IrControlService; +#endif class IRFileViewService; +class HbMessageBox; #ifdef LOCALIZATION class QTranslator; @@ -56,12 +60,19 @@ IRApplication(IRViewManager *aViewManager, IRQSystemEventHandler* aSystemEventHandler); ~IRApplication(); - +#ifdef SUBTITLE_STR_BY_LOCID bool verifyNetworkConnectivity(const QString &aConnectingText = hbTrId("txt_common_info_loading")); +#else + bool verifyNetworkConnectivity(const QString &aConnectingText = hbTrId("Loading")); +#endif - void startLoadingAnimation(const QObject *aReceiver, const char *aFunc); - void startLoadingAnimation(const QPointF& aPos); + void startLoadingAnimation(const QObject *aReceiver, const char *aFunc); void stopLoadingAnimation(); + +#ifdef HS_WIDGET_ENABLED + bool startPlaying(); + void cancelPlayerLoading(); +#endif IRViewManager* getViewManager() const; IRQNetworkController* getNetworkController(); @@ -73,8 +84,11 @@ IRMediaKeyObserver* getMediaKeyObserver(); IRQAdvClient* getAdvClient(); IRPlayList* getPlayList() const; + + void setLaunchView(); + void launchStartingView(TIRViewId aViewId); - void launchStartingView(TIRViewId aViewId); + bool isAppFullyStarted() const; #ifdef LOCALIZATION /* @@ -111,12 +125,9 @@ void createComponents(); void destroyComponents(); void setupConnection(); - void setLaunchView(); void startSystemEventMonitor(); void initApp(); - void setExitingView(); - void getLoadingAnimation(); - + void setExitingView(); TIRHandleResult handleConnectionEstablished(); void startLocalServer(); @@ -165,10 +176,18 @@ QTranslator *iTranslator; #endif - IRQSystemEventHandler *iSystemEventHandler; + IRQSystemEventHandler *iSystemEventHandler; + TIRUseNetworkReason iUseNetworkReason; + + bool iAppFullyStarted; - HbIconItem *iLoadingAnimation; - IRFileViewService *iFileViewService; +#ifdef HS_WIDGET_ENABLED + IrControlService *iControlService; + IrMonitorService *iMonitorService; +#endif + + IRFileViewService *iFileViewService; + HbMessageBox *iMessageBox; }; #endif diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/inc/ircontrolservice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/ui/inc/ircontrolservice.h Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef IRCONTROLSERVICE_H +#define IRCONTROLSERVICE_H + +// System includes +#include +#include + +// User includes +#include "irservicedef.h" + +// Forward declarations +class IRApplication; + +class IrControlService : public XQServiceProvider +{ + Q_OBJECT + +public: + explicit IrControlService(IRApplication *aIrApp, QObject *aParent = 0); + virtual ~IrControlService(); + +public slots: + int handleCmd(int aCmdId); // service interface, called via Qt Highway + +private: + IrServiceResult::Type handleLaunchNowPlayingViewCmd(); + IrServiceResult::Type handleLaunchNormallyCmd(); + IrServiceResult::Type handlePlayCmd(); + IrServiceResult::Type handleStopCmd(); + IrServiceResult::Type handleCancelCmd(); + +private: + IRApplication *mIrApp; + + Q_DISABLE_COPY(IrControlService) + +}; + +#endif // IRCONTROLSERVICE_H diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/inc/irfavoritesview.h --- a/qtinternetradio/ui/inc/irfavoritesview.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/inc/irfavoritesview.h Tue Jul 06 14:07:20 2010 +0300 @@ -51,6 +51,10 @@ private: //from IrAbstractListViewBase +#ifdef HS_WIDGET_ENABLED + void itemAboutToBeSelected(bool &aNeedNetwork); +#endif + void setCheckedAction(); void handleItemSelected(); void prepareMenu(); diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/inc/irhistoryview.h --- a/qtinternetradio/ui/inc/irhistoryview.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/inc/irhistoryview.h Tue Jul 06 14:07:20 2010 +0300 @@ -38,7 +38,7 @@ TIRHandleResult handleCommand(TIRViewCommand aCommand, TIRViewCommandReason aReason); private slots: - void clearAllList(); + void clearAllList(HbAction *aAction); void networkRequestNotified(IRQNetworkEvent aEvent); //to start the convertion asynchronously void convertAnother(); @@ -47,7 +47,7 @@ void modelChanged(); void actionClicked(HbAction *aAction); - + void popupClearHistoryConfirmMessageBox(); private: void showHistory(); void handleItemSelected(); @@ -55,6 +55,9 @@ //from IrAbstractListViewBase void prepareMenu(); +#ifdef HS_WIDGET_ENABLED + void itemAboutToBeSelected(bool &aNeedNetwork); +#endif void startConvert(int aIndex); void convertStationHistory2Preset(const IRQSongHistoryInfo& aHistoryInfo, IRQPreset& aPreset); void addContextAction(); diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/inc/irmainview.h --- a/qtinternetradio/ui/inc/irmainview.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/inc/irmainview.h Tue Jul 06 14:07:20 2010 +0300 @@ -40,6 +40,9 @@ void networkRequestNotified(IRQNetworkEvent aEvent); private: + //from base class IRBaseView + TIRHandleResult handleCommand(TIRViewCommand aCommand, TIRViewCommandReason aReason); + //from base class IrAbstractListViewBase void handleItemSelected(); @@ -52,6 +55,8 @@ void lazyInit(); + void normalInit(); + void initToolBar(); private: diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/inc/irmonitorservice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/ui/inc/irmonitorservice.h Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef IRMONITORSERVICE_H +#define IRMONITORSERVICE_H + +// System includes +#include +#include +#include + +// User includes +#include "irservicedef.h" +#include "irservicedata.h" + +// Forward declarations +class IRApplication; +class IRPlayController; +class IRQMetaData; + +class IrMonitorService : public XQServiceProvider +{ + Q_OBJECT + +public: + explicit IrMonitorService(IRApplication *aIrApp, QObject *aParent = 0); + virtual ~IrMonitorService(); + +public slots: + void registerNotifications(); // service interface, called via Qt Highway + void refreshAllData(); // service interface, called via Qt Highway + +private slots: + // slots for station logo update + void handleStationLogoUpdated(bool aLogoAvailable); + + // slots for play controller + void handleLoadingStarted(const QString &aStationName); + void handleLoadingCancelled(const QString &aStationName); + void handlePlayStarted(); + void handlePlayStopped(); + void updateMetaData(IRQMetaData* aMetaData); + +public: + enum ReadyItem + { + StationName = 0x01, + StationLogo = 0x02, + MetaData = 0x04, + IrState = 0x08 + }; + Q_DECLARE_FLAGS(ReadyItems, ReadyItem) + +private: + void setupConnection(); + + void notifyAll(); + bool notifyList(const IrServiceDataList &aDataList); + +private: + ReadyItems mReadyItems; + QString mStationName; + bool mStationLogoAvailable; // true if station has its own logo + QString mMetaData; + IrAppState::Type mIrState; + + IRApplication *mIrApp; + IRPlayController *mPlayController; + + QList mRequestList; // used to maintain the async request + + Q_DISABLE_COPY(IrMonitorService) + +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(IrMonitorService::ReadyItems) + +#endif // IRMONITORSERVICE_H diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/inc/irnowplayingview.h --- a/qtinternetradio/ui/inc/irnowplayingview.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/inc/irnowplayingview.h Tue Jul 06 14:07:20 2010 +0300 @@ -94,8 +94,9 @@ void updateMusicStoreStatus(); void updateForLauchAction(); - void updateStationLogo(); - + void updateStationLogo(); + void loadStationLogo(); + void lazyInit(); void normalInit(); diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/inc/irplaycontroller.h --- a/qtinternetradio/ui/inc/irplaycontroller.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/inc/irplaycontroller.h Tue Jul 06 14:07:20 2010 +0300 @@ -28,7 +28,7 @@ class IRQMetaData; class IRQSongHistoryEngine; class IRQStatisticsReporter; - +class HbMessageBox; /** * This class is a wrapper for IRQMediaPlayer. */ @@ -46,15 +46,47 @@ explicit IRPlayController(IRApplication* aApplication); ~IRPlayController(); +#ifdef HS_WIDGET_ENABLED + // MUST be called before prepare the network for playback + // i.e., called before IRApplication::verifyNetworkConnectivity + void setConnectingStationName(const QString &aStationName, bool aForceConnecting = false); + QString getConnectingStationName() const; + + // used when nowplaying view is the starting view, to reload preset to the player + // because by default, the player will load the last played station preset into it + // But when nowplaying view as starting view due to open pls with only one url, + // should reload the preset from pls file + void reloadNowplayingPreset(IRQPreset *aPreset, bool aIsLogoAvailable, IRQConnectedFrom aConnectedFrom); +#endif // Play a station void connectToChannel(IRQPreset *aPreset, IRQConnectedFrom aConnectedFrom); + void emitStationLogoUpdated(bool aIsLogoAvailable); + bool isStationLogoAvailable() const; + // Play control methods void resume(); void stop(IRQTerminatedType aStopReason); int getVolume() const; void setVolume(int aVolume); + enum EPlayState + { + //initial state, never ever played station + EIdle = 0, + //a station has been stopped + EStopped, +#ifdef HS_WIDGET_ENABLED + //connecting network + EConnecting, +#endif + //stream buffering + EBuffering, + //playing + EPlaying + }; + EPlayState state() const; + // Check the playing status bool isPlaying() const; @@ -89,8 +121,21 @@ // emitted when playing stopped void playingStopped(); - // emitted when logo needs to update - void initializeLogo(); +#ifdef HS_WIDGET_ENABLED + // emitted when loading(connecting) started + void connectingStarted(const QString &aStationName); + + // emitted when buffering started + void bufferingStarted(const QString &aStationName); + + // emitted when connecting is cancelled + void connectingCancelled(const QString &aStationName); + + // emitted when buffering is cancelled + void bufferingCancelled(const QString &aStationName); + + void stationLogoUpdated(bool aIsDefaultLogo); +#endif private slots: // slots connected with IRQMediaPlayer @@ -104,8 +149,14 @@ void handleError(); private: - void createNote(const QString &aNote = hbTrId("txt_irad_info_failed_to_connect")); +#ifdef SUBTITLE_STR_BY_LOCID + void popupNote(const QString &aNote = hbTrId("txt_irad_info_failed_to_connect")); +#else + void popupNote(const QString &aNote = hbTrId("Connecting failed")); +#endif void connectSignalSlot(); + + QString getFirstTryUrl(IRQPreset *aPreset); // Play next URL if the previous failed to connect. bool playNextUrl(); @@ -120,30 +171,32 @@ IRQMediaPlayer *iMediaPlayer; IRQStatisticsReporter *iStatisticsReporter; - IRQConnectedFrom iConnectedFrom; bool iGetServerResult; - + +#ifdef HS_WIDGET_ENABLED + QString iConnectingStationName; // used for home screen widget +#endif + IRQPreset *iNowPlayingPreset; - //reserve the info in nowplay view IRQPreset *iNowPlayingPresetBackup; - // reference of IRQMediaPlayer meta data + + QString iLastPlayedUrl; + QString iLastPlayedUrlBackup; + + IRQConnectedFrom iConnectedFrom; + IRQConnectedFrom iConnectedFromBackup; + + bool iStationLogoAvailable; + bool iStationLogoAvailableBackup; + + // reference of IRQMediaPlayer meta data IRQMetaData *iMetaData; IRQSongHistoryEngine *iSongHistoryEngine; - enum EPlayState - { - //initial state - EIdle = 0, - //a station has been stopped - EStopped, - //connecting station and buffering - EBuffering, - //playing - EPlaying - }; - EPlayState iPlayState; - // If resuming the last played url fails, connect to all the preset. + + // If resuming the last played url fails, reset the player to init state + // i.e., call connectToChannel() once again. bool iResuming; // variants for play next URL @@ -156,19 +209,15 @@ // the URLs of a specific bitrate QList *iUrlArray; -#ifdef Q_CC_NOKIAX86 - QString iLastPlayedChannelName; -#endif - // the bitrate from real station feedback. int iRealBitrate; - QString iLastPlayedUrl; - //reserve the info in nowplay view - QString iLastPlayedUrlBackup; + // To handle error async IRQError iLastError; IRQTerminatedType iStopReason; + + HbMessageBox *iErrorNote; }; #endif //IRPLAYCONTROLLER_H diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/inc/irplsview.h --- a/qtinternetradio/ui/inc/irplsview.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/inc/irplsview.h Tue Jul 06 14:07:20 2010 +0300 @@ -39,6 +39,9 @@ private: //from base class IrAbstractListViewBase +#ifdef HS_WIDGET_ENABLED + void itemAboutToBeSelected(bool &aNeedNetwork); +#endif void handleItemSelected(); void listViewLongPressed(HbAbstractViewItem *aItem, const QPointF &aCoords); void launchAction(); diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/inc/irsearchchannelsview.h --- a/qtinternetradio/ui/inc/irsearchchannelsview.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/inc/irsearchchannelsview.h Tue Jul 06 14:07:20 2010 +0300 @@ -20,13 +20,11 @@ #include "irqevent.h" #include "irbaseview.h" #include "irqenums.h" - -class HbGroupBox; + class HbListView; class HbSearchPanel; class HbAction; -class IrChannelModel; -class HbProgressDialog; +class IrChannelModel; class IRQPreset; class QTimer; @@ -59,8 +57,7 @@ void lazyInit(); void startConvert(int aIndex); void initTimer(); - //set the subtitle and counter; - void setHeadingText(const QString &aText); + private slots: //slots void cancelRequest(); @@ -75,6 +72,8 @@ void convertAnother(); void presetLogoDownload(IRQPreset* aPreset); void presetLogoDownloadError(); + +public slots: //this slot is used to back to previouse view or minimize the search widget void minimizeSearchPanel(); @@ -85,7 +84,7 @@ ESearch_init = 0, ESearch_Loading //loading means searching or buffering. }; - HbGroupBox *iHeadingLabel; + HbListView *iListView; QString iKeyText; diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/inc/irsonghistoryview.h --- a/qtinternetradio/ui/inc/irsonghistoryview.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/inc/irsonghistoryview.h Tue Jul 06 14:07:20 2010 +0300 @@ -43,7 +43,8 @@ private slots: void modelChanged(); void newMetadataAdded(IRQMetaData * aMetadata); - void clearList(); + void popupClearHistoryConfirmMessageBox(); + void clearList(HbAction *aAction); void showPrompt(); void gotoStationHistory(); void handleOrientationChanged(Qt::Orientation aOrientation); diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/inc/irstationsview.h --- a/qtinternetradio/ui/inc/irstationsview.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/inc/irstationsview.h Tue Jul 06 14:07:20 2010 +0300 @@ -39,6 +39,10 @@ //from base class IRBaseView TIRHandleResult handleCommand(TIRViewCommand aCommand, TIRViewCommandReason aReason); +#ifdef HS_WIDGET_ENABLED + //from IrAbstractListViewBase + void itemAboutToBeSelected(bool &aNeedNetwork); +#endif private slots: void presetResponse(IRQPreset *aPreset); diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/inc/iruidefines.h --- a/qtinternetradio/ui/inc/iruidefines.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/inc/iruidefines.h Tue Jul 06 14:07:20 2010 +0300 @@ -70,7 +70,7 @@ static const char* SEARCH_CHANNELS_VIEW_OBJECT_VIEW = "ext-IRSearchChannelsView"; static const char* SEARCH_CHANNELS_VIEW_SEARCHPANEL_WIDGET = "search_panel"; static const char* SEARCH_CHANNELS_VIEW_SEARCHLISTVIEW_WIDGET = "search_listview"; -static const char* SEARCH_CHANNELS_VIEW_HEADINGTEXT_WIDGET = "headingText"; + // IRNowplayingView -- Object Name static const char* NOW_PLAYING_VIEW_OBJECT_NAME = "ext-nowplayingview"; diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/inc/irviewmanager.h --- a/qtinternetradio/ui/inc/irviewmanager.h Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/inc/irviewmanager.h Tue Jul 06 14:07:20 2010 +0300 @@ -26,6 +26,14 @@ class IRBaseView; class QTimer; +class ActivityInformation +{ +public: + QPixmap screenShot; + QString activityId; + TIRViewId viewId; +}; + class IRViewManager : public HbMainWindow { Q_OBJECT @@ -49,6 +57,12 @@ bool isExiting() const; + void saveScreenShot(); + + void saveActivity(); + + void removeActivity(); + public slots: void backToPreviousView(); @@ -63,7 +77,8 @@ void handleCurrentViewChanged(HbView *aView); void crossLineReset(); void exitTimeout(); - + void handleSaveScreenShot(); + private: void backToView(TIRViewId aViewId); IRBaseView* createView(IRApplication* aApplication, TIRViewId aViewId); @@ -73,7 +88,8 @@ bool readyToQuit(); void switchToNextView(IRBaseView *aView); - + void backupActivity(); + private: IRApplication* iApplication; QStack iViewStack; @@ -93,6 +109,8 @@ QTimer *iExitTimer; bool iExiting; + QMap iScreenShots; + ActivityInformation iActivityBackup; }; #endif diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/resources/layout/searchchannelsview.docml --- a/qtinternetradio/ui/resources/layout/searchchannelsview.docml Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/resources/layout/searchchannelsview.docml Tue Jul 06 14:07:20 2010 +0300 @@ -5,16 +5,7 @@ - - - - - - - - - - + @@ -24,8 +15,7 @@ - - + diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/resources/splashscreen/internet_radio_default.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/ui/resources/splashscreen/internet_radio_default.docml Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/resources/splashscreen/internet_radio_default.splashml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/ui/resources/splashscreen/internet_radio_default.splashml Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,6 @@ + + internet_radio_default.docml + internet_radio_defaultview + 0xe28364bb + internet_radio_10_1 + diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/resources/splashscreen/internet_radio_normal.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/ui/resources/splashscreen/internet_radio_normal.docml Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/resources/splashscreen/internet_radio_normal.splashml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/ui/resources/splashscreen/internet_radio_normal.splashml Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,7 @@ + + internet_radio_normal.docml + internet_radio_normalview + 0xe28364bb + internet_radio_10_1 + normal_screen + diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/resources/splashscreen/internet_radio_nowplaying.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/ui/resources/splashscreen/internet_radio_nowplaying.docml Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/resources/splashscreen/internet_radio_nowplaying.splashml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/ui/resources/splashscreen/internet_radio_nowplaying.splashml Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,7 @@ + + internet_radio_nowplaying.docml + internet_radio_nowplayingview + 0xe28364bb + internet_radio_10_1 + nowplaying_screen + diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irabstractlistviewbase.cpp --- a/qtinternetradio/ui/src/irabstractlistviewbase.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irabstractlistviewbase.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -38,8 +38,7 @@ #include "iruidefines.h" const int KAnimationLoopTimes = 2; // Animation loop times -//#define NOW_PLAYING_BANNER_FRAME "qtg_fr_multimedia_trans" -#define NOW_PLAYING_BANNER_FRAME "qtg_fr_popup_list_highlight" +#define NOW_PLAYING_BANNER_FRAME "qtg_fr_multimedia_trans" IrAbstractListViewBase::IrAbstractListViewBase(IRApplication *aApplication, TIRViewId aViewId) : IRBaseView(aApplication, aViewId), diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irapplication.cpp --- a/qtinternetradio/ui/src/irapplication.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irapplication.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -16,6 +16,7 @@ */ #include +#include #include #include #include @@ -24,11 +25,18 @@ #include #include #include +#include #include #include #include #include +#ifdef HS_WIDGET_ENABLED +#include +#include +#include +#include +#endif #ifdef LOCALIZATION #include @@ -51,6 +59,13 @@ #include "irqsystemeventhandler.h" #include "irabstractlistviewbase.h" #include "irfileviewservice.h" +#ifdef HS_WIDGET_ENABLED +#include "irmonitorservice.h" +#include "ircontrolservice.h" +#include "irservicedef.h" +#include "irqisdsdatastructure.h" +#include "irsearchchannelsview.h" +#endif /* * Description : constructor, initialize all data members * Parameters : aViewManager : pointer to the view manager object @@ -78,9 +93,15 @@ #ifdef LOCALIZATION iTranslator(NULL), #endif - iSystemEventHandler(aSystemEventHandler), - iLoadingAnimation(NULL), - iFileViewService(NULL) + iSystemEventHandler(aSystemEventHandler), + iUseNetworkReason(EIR_UseNetwork_NoReason), + iAppFullyStarted(false), + #ifdef HS_WIDGET_ENABLED + iControlService(NULL), + iMonitorService(NULL), + #endif + iFileViewService(NULL), + iMessageBox(NULL) { LOG_METHOD; @@ -96,13 +117,19 @@ // get advertisement setting iSettings->getGlobalAdvFlag(iEnableGlobalAdv); setupConnection(); - setLaunchView(); + + if (!XQServiceUtil::isService()) + { + setLaunchView(); + } QString name = XQServiceUtil::interfaceName(); if (name == QString("com.nokia.symbian.IFileView")) { iFileViewService = new IRFileViewService(this); } + + iMessageBox = new HbMessageBox(hbTrId("No network connection!"),HbMessageBox::MessageTypeWarning,NULL); } /* @@ -114,6 +141,8 @@ { LOG_METHOD; setExitingView(); + iViewManager->saveActivity(); + destroyComponents(); if (iLocalServer) @@ -127,6 +156,9 @@ delete iLoadingNote; iLoadingNote = NULL; + delete iMessageBox; + iMessageBox = NULL; + delete iSystemEventHandler; #ifdef LOCALIZATION @@ -140,6 +172,13 @@ delete iFileViewService; iFileViewService = NULL; + +#ifdef HS_WIDGET_ENABLED + XQSettingsManager settingsManager; + XQPublishAndSubscribeUtils psUtils(settingsManager); + XQPublishAndSubscribeSettingsKey irStartupKey(KInternetRadioPSUid, KInternetRadioStartupKey); + psUtils.deleteProperty(irStartupKey); +#endif } @@ -151,10 +190,21 @@ */ void IRApplication::setLaunchView() { - if (!XQServiceUtil::isService()) + //get starting view id according to activate reason + TIRViewId viewId = EIRView_CategoryView; + HbApplication *hbApp = qobject_cast(qApp); + + if (hbApp->activateReason() == Hb::ActivationReasonActivity) { - //normal launch, launch starting view - TIRViewId viewId = EIRView_CategoryView; + QVariant data = hbApp->activateData(); + QByteArray serializedModel = data.toByteArray(); + QDataStream stream(&serializedModel, QIODevice::ReadOnly); + int id = 0; + stream>>id; + viewId = TIRViewId(id); + } + else + { iSettings->getStartingViewId(viewId); if (EIRView_PlayingView == viewId) { @@ -164,9 +214,9 @@ viewId = EIRView_CategoryView; } } - - launchStartingView(viewId); } + + launchStartingView(viewId); } /* @@ -183,31 +233,18 @@ if (!iNetworkController->getNetworkStatus()) { + LOG( "IRApplication::verifyNetworkConnectivity--1"); ret = false; if (!iNetworkController->isConnectRequestIssued()) { + LOG( "IRApplication::verifyNetworkConnectivity--2"); iConnectingText = aConnectingText; iNetworkController->chooseAccessPoint(); } } return ret; -} - -void IRApplication::startLoadingAnimation(const QPointF& aPos) -{ - if( NULL == iLoadingAnimation ) - { - getLoadingAnimation(); - } - - if (iLoadingAnimation) - { - iLoadingAnimation->setPos(aPos); - iLoadingAnimation->show(); - iLoadingAnimation->animator().startAnimation(); - } -} +} void IRApplication::startLoadingAnimation(const QObject *aReceiver, const char *aFunc) { @@ -217,27 +254,27 @@ //is initiated by low layer, we don't show any dialog if (!iNetworkController->getNetworkStatus()) { - IRBaseView *currentView = static_cast(iViewManager->currentView()); - if (currentView && EIR_UseNetwork_NoReason == currentView->getUseNetworkReason()) - { - return; + if (EIR_UseNetwork_NoReason == iUseNetworkReason) // network is not used by the Application + { + IRBaseView *currentView = static_cast(iViewManager->currentView()); + if (currentView && EIR_UseNetwork_NoReason == currentView->getUseNetworkReason()) + { + return; + } } } - //if in search, we could not show the dialog - TIRViewId curViewID = static_cast(iViewManager->currentView())->id(); - if ( EIRView_SearchView == curViewID ) - { - return; - } - if (NULL == iLoadingNote) { iLoadingNote = new HbProgressDialog(HbProgressDialog::WaitDialog); iLoadingNote->setModal(true); iLoadingNote->setTimeout(HbPopup::NoTimeout); QAction *action = iLoadingNote->actions().at(0); +#ifdef SUBTITLE_STR_BY_LOCID action->setText(hbTrId("txt_common_button_cancel")); +#else + action->setText(hbTrId("Cancel")); +#endif } iLoadingNote->disconnect(SIGNAL(cancelled())); @@ -256,7 +293,11 @@ } else { +#ifdef SUBTITLE_STR_BY_LOCID iLoadingNote->setText(hbTrId("txt_common_info_loading")); +#else + iLoadingNote->setText(hbTrId("Loading")); +#endif } iLoadingNote->show(); @@ -265,16 +306,19 @@ void IRApplication::stopLoadingAnimation() { LOG_METHOD_ENTER; + + // this function is the endpoint of cancel loading actions for all views + // so we can do cleanup action here, including player stop action. + // No need to stop the player in each views in the slot connected to the cancel signal of the loading note + if (!getPlayController()->isPlaying()) + { + getPlayController()->stop(EIRQUnknownTermination); + } + if (iLoadingNote) { iLoadingNote->close(); - } - - if( iLoadingAnimation ) - { - iLoadingAnimation->animator().stopAnimation(); - iLoadingAnimation->hide(); - } + } } /* @@ -407,6 +451,10 @@ void IRApplication::createComponents() { getSettings(); +#ifdef HS_WIDGET_ENABLED + iControlService = new IrControlService(this); + iMonitorService = new IrMonitorService(this); +#endif } /* @@ -445,6 +493,14 @@ delete iMediaKeyObserver; iMediaKeyObserver = NULL; + +#ifdef HS_WIDGET_ENABLED + delete iControlService; + iControlService = NULL; + + delete iMonitorService; + iMonitorService = NULL; +#endif } void IRApplication::setupConnection() @@ -514,8 +570,14 @@ case EIRQDisplayNetworkMessageNoConnectivity: { - stopLoadingAnimation(); - HbMessageBox::warning(hbTrId("txt_irad_info_no_network_connectiion"), (QObject*)NULL, NULL); + stopLoadingAnimation(); + LOG("IRApplication::networkEventNotified::no network connection"); + if( !iMessageBox->isVisible() ) + { + LOG("IRApplication::networkEventNotified::no network connection -- show dialog"); + iMessageBox->show(); + } + if (!iDisconnected) { /* the handling is up to each view */ @@ -537,14 +599,12 @@ if (!hasCache) { - IRBaseView *currView = static_cast(iViewManager->currentView()); - Q_ASSERT(currView); - currView->setUseNetworkReason(EIR_UseNetwork_LoadCategory); + iUseNetworkReason = EIR_UseNetwork_LoadCategory; if (false == verifyNetworkConnectivity()) { return; } - currView->setUseNetworkReason(EIR_UseNetwork_NoReason); + iUseNetworkReason = EIR_UseNetwork_NoReason; } IRCategoryView *categoryView = static_cast(getViewManager()->getView(EIRView_CategoryView, true)); @@ -561,26 +621,7 @@ delete socket; iViewManager->raise(); -} - -void IRApplication::getLoadingAnimation() -{ - HbIconAnimationManager::global()->addDefinitionFile("qtg_anim_loading.axml"); - iLoadingAnimation = new HbIconItem("qtg_anim_loading"); - iLoadingAnimation->hide(); - QGraphicsScene *targetScene = getViewManager()->scene(); - QGraphicsScene *oldScene = iLoadingAnimation->scene(); - - if (targetScene != oldScene) - { - if (oldScene) - { - oldScene->removeItem(iLoadingAnimation); - } - targetScene->addItem(iLoadingAnimation); // takes ownership - } - -} +} void IRApplication::initApp() { @@ -595,6 +636,19 @@ getMediaKeyObserver(); startSystemEventMonitor(); startLocalServer(); + //when IR is running, remove activity. Otherwise user can see two items in task switcher + iViewManager->removeActivity(); + +#ifdef HS_WIDGET_ENABLED + // Write the startup timestamp to P&S key for the homescreen widget + XQSettingsManager settingsManager; + XQPublishAndSubscribeUtils psUtils(settingsManager); + XQPublishAndSubscribeSettingsKey irStartupKey(KInternetRadioPSUid, KInternetRadioStartupKey); + if (psUtils.defineProperty(irStartupKey, XQSettingsManager::TypeInt)) + { + settingsManager.writeItemValue(irStartupKey, (int)QDateTime::currentDateTime().toTime_t()); + } +#endif } bool IRApplication::event(QEvent* e) @@ -610,18 +664,29 @@ TIRHandleResult IRApplication::handleConnectionEstablished() { - IRBaseView *currView = static_cast(iViewManager->currentView()); - Q_ASSERT(currView); - - if (EIR_UseNetwork_LoadCategory == currView->getUseNetworkReason()) + TIRHandleResult retVal = EIR_DoDefault; + switch (iUseNetworkReason) { - IRCategoryView *categoryView = static_cast(getViewManager()->getView(EIRView_CategoryView, true)); - categoryView->loadCategory(IRQIsdsClient::EGenre); - currView->setUseNetworkReason(EIR_UseNetwork_NoReason); - return EIR_NoDefault; + case EIR_UseNetwork_LoadCategory: + { + IRCategoryView *categoryView = static_cast(getViewManager()->getView(EIRView_CategoryView, true)); + categoryView->loadCategory(IRQIsdsClient::EGenre); + retVal = EIR_NoDefault; + break; + } + +#ifdef HS_WIDGET_ENABLED + case EIR_UseNetwork_PlayStation: // play last station when player is in Idle state while there is no connection. + getPlayController()->resume(); + retVal = EIR_NoDefault; + break; +#endif + default: + break; } - return EIR_DoDefault; + iUseNetworkReason = EIR_UseNetwork_NoReason; + return retVal; } void IRApplication::handleTermsConsAccepted() @@ -639,29 +704,33 @@ void IRApplication::launchStartingView(TIRViewId aViewId) { - bool isFirstTimeUsage = false; + iStartingViewId = aViewId; + /* bool isFirstTimeUsage = false; iSettings->isFlagTermsAndConditions(isFirstTimeUsage); - iStartingViewId = aViewId; + if(isFirstTimeUsage) { iViewManager->activateView(EIRView_TermsConsView); QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents); } - else + else*/ { iViewManager->activateView(iStartingViewId); QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents); QEvent* initEvent = new QEvent(iInitEvent); QCoreApplication::postEvent(this, initEvent, Qt::HighEventPriority); - } + } + + iAppFullyStarted = true; +} + +bool IRApplication::isAppFullyStarted() const +{ + return iAppFullyStarted; } void IRApplication::setExitingView() -{ - if (XQServiceUtil::isService()) - { - return; - } +{ TIRViewId viewId = iViewManager->getExitingView(); if(EIRView_InvalidId != viewId) { @@ -669,6 +738,52 @@ } } + +#ifdef HS_WIDGET_ENABLED +bool IRApplication::startPlaying() +{ + // if any loading is in progress, disallow to play + if (iLoadingNote && iLoadingNote->isVisible()) + { + LOG( "IRApplication::startPlaying() in the return false1"); + return false; + } + + if (getPlayController()->isStopped()) + { + LOG_FORMAT( "IRApplication::startPlaying(), the station name is %s", + STRING2CHAR(getPlayController()->getNowPlayingPreset()->name)); + iUseNetworkReason = EIR_UseNetwork_PlayStation; + getPlayController()->setConnectingStationName(getPlayController()->getNowPlayingPreset()->name); + if (verifyNetworkConnectivity()) + { + iUseNetworkReason = EIR_UseNetwork_NoReason; + getPlayController()->resume(); + } + return true; + } + else + { + LOG( "IRApplication::startPlaying() in the return false2"); + return false; + } +} + +void IRApplication::cancelPlayerLoading() +{ + if (IRPlayController::EConnecting == getPlayController()->state() + || IRPlayController::EBuffering == getPlayController()->state()) + { + if (iLoadingNote && iLoadingNote->isVisible()) + { + iLoadingNote->cancel(); + } + } +} + +#endif + + void IRApplication::startLocalServer() { QString serverName = QCoreApplication::applicationName(); @@ -745,8 +860,13 @@ void IRApplication::handleDiskSpaceLow(qint64 aCriticalLevel) { Q_UNUSED(aCriticalLevel); - HbDeviceMessageBox messageBox(hbTrId("txt_irad_info_no_space_on_c_drive_internet_radio_closed"), +#ifdef SUBTITLE_STR_BY_LOCID + HbDeviceMessageBox messageBox(hbTrId("txt_irad_info_insufficient_disk_space"), HbMessageBox::MessageTypeWarning); +#else + HbDeviceMessageBox messageBox(hbTrId("Insufficient disk space"), + HbMessageBox::MessageTypeWarning); +#endif messageBox.setTimeout(HbPopup::NoTimeout); messageBox.exec(); qApp->quit(); diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/ircategoryview.cpp --- a/qtinternetradio/ui/src/ircategoryview.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/ircategoryview.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -94,6 +94,13 @@ } break; + case EIR_ViewCommand_ACTIVATED: + if (EIRViewPara_Genre == getViewParameter()) + { + getViewManager()->saveScreenShot(); + } + break; + default: break; } @@ -103,23 +110,9 @@ void IRCategoryView::launchAction() { - bool ret = false; - switch(iViewParameter) - { - case EIRViewPara_Genre: - ret = iIsdsClient->isdsIsCategoryCached(IRQIsdsClient::EGenre); - break; - case EIRViewPara_Language: - ret = iIsdsClient->isdsIsCategoryCached(IRQIsdsClient::ELanguages); - break; - case EIRViewPara_Country: - ret = iIsdsClient->isdsIsCategoryCached(IRQIsdsClient::ECountries); - break; + Q_ASSERT(EIRViewPara_Genre == iViewParameter); + bool ret = iIsdsClient->isdsIsCategoryCached(IRQIsdsClient::EGenre); - default: - break; - } - if ( !ret ) { setUseNetworkReason(EIR_UseNetwork_StartingView); @@ -173,7 +166,11 @@ break; case IRQIsdsClient::ELanguages : +#ifdef SUBTITLE_STR_BY_LOCID setHeadingText(hbTrId("txt_irad_list_stations_by_language")); +#else + setHeadingText(hbTrId("Stations by language")); +#endif if (EIRViewPara_Language != getViewParameter()) { //the view is used for other categories other than Language @@ -186,7 +183,11 @@ break; case IRQIsdsClient::ECountries : +#ifdef SUBTITLE_STR_BY_LOCID setHeadingText(hbTrId("txt_irad_list_stations_by_country_region")); +#else + setHeadingText(hbTrId("Stations by country/region")); +#endif if (EIRViewPara_Country != getViewParameter()) { //the view is used for other categories other than Country @@ -390,7 +391,11 @@ disconnectIsdsClient(); +#ifdef SUBTITLE_STR_BY_LOCID popupNote(hbTrId("txt_irad_info_failed_to_connect"), HbMessageBox::MessageTypeWarning); +#else + popupNote(hbTrId("Connecting failed"), HbMessageBox::MessageTypeWarning); +#endif //if category view is starting view and failed to get data from ISDS server, back to main view if (getViewManager()->currentView() == this && diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/ircontrolservice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/ui/src/ircontrolservice.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// System includes +#include + +// User includes +#include "ircontrolservice.h" +#include "irapplication.h" +#include "irplaycontroller.h" +#include "irqlogger.h" + +// Contants +static const QString IR_CONTROL_SERVICE_NAME = "internet_radio_10_1.com.nokia.symbian.IInternetRadioControl"; + +// Constructor +IrControlService::IrControlService(IRApplication *aIrApp, QObject *aParent) : + XQServiceProvider(IR_CONTROL_SERVICE_NAME, aParent), + mIrApp(aIrApp) +{ + publishAll(); +} + +// Destructor +IrControlService::~IrControlService() +{ +} + +// service interface, called via Qt Highway +int IrControlService::handleCmd(int aCmdId) +{ + LOG_FORMAT( "IrControlService::handleCmd, the command is %d", aCmdId); + IrServiceResult::Type result = IrServiceResult::Fail; + + switch (aCmdId) + { + case IrServiceCmd::LaunchNormally: + result = handleLaunchNormallyCmd(); + break; + + case IrServiceCmd::LaunchNowPlayingView: + result = handleLaunchNowPlayingViewCmd(); + break; + + case IrServiceCmd::Play: + result = handlePlayCmd(); + break; + + case IrServiceCmd::Stop: + result = handleStopCmd(); + break; + + case IrServiceCmd::Cancel: + result = handleCancelCmd(); + break; + + case IrServiceCmd::Foreground: + XQServiceUtil::toBackground(false); + result = IrServiceResult::Success; + break; + + default: + break; + } + + if (!requestInfo().isSynchronous()) + { + // NOTE ! we consider the Async to be success as long as the request can be sent here + completeRequest(setCurrentRequestAsync(), (int)result); + } + + return (int)result; +} + +IrServiceResult::Type IrControlService::handleLaunchNowPlayingViewCmd() +{ + if (!mIrApp->isAppFullyStarted()) + { + mIrApp->launchStartingView(EIRView_PlayingView); + } + return IrServiceResult::Success; +} + +IrServiceResult::Type IrControlService::handleLaunchNormallyCmd() +{ + if (!mIrApp->isAppFullyStarted()) + { + mIrApp->setLaunchView(); + } + return IrServiceResult::Success; +} + +IrServiceResult::Type IrControlService::handlePlayCmd() +{ +#ifdef HS_WIDGET_ENABLED + LOG( "IrControlService::handlePlayCmd"); + bool ret = mIrApp->startPlaying(); + LOG_FORMAT( "IrControlService::handlePlayCmd, the ret is:%d",(int)ret); + return ret?IrServiceResult::Success : IrServiceResult::Fail; +#else + return IrServiceResult::Fail; +#endif + +} + +IrServiceResult::Type IrControlService::handleStopCmd() +{ + if (mIrApp->getPlayController()->isPlaying()) + { + mIrApp->getPlayController()->stop(EIRQUserTerminated); + } + return IrServiceResult::Success; +} + +IrServiceResult::Type IrControlService::handleCancelCmd() +{ +#ifdef HS_WIDGET_ENABLED + mIrApp->cancelPlayerLoading(); +#endif + return IrServiceResult::Success; +} + diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irfavoritesview.cpp --- a/qtinternetradio/ui/src/irfavoritesview.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irfavoritesview.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -112,6 +112,8 @@ { iConvertTimer->start(); } + + getViewManager()->saveScreenShot(); ret = EIR_NoDefault; break; @@ -173,6 +175,16 @@ } } +#ifdef HS_WIDGET_ENABLED +void IRFavoritesView::itemAboutToBeSelected(bool &aNeedNetwork) +{ + aNeedNetwork = true; + + int currentIndex = iListView->currentIndex().row(); + iPlayController->setConnectingStationName(iModel->getPreset(currentIndex)->name); +} +#endif + void IRFavoritesView::handleItemSelected() { int currentIndex = iListView->currentIndex().row(); @@ -202,7 +214,11 @@ iMultiDeleteDialog->setSelectionMode(HbAbstractItemView::MultiSelection); HbGroupBox * header = new HbGroupBox; - header->setHeading(hbTrId("txt_irad_select_items_to_delete")); +#ifdef SUBTITLE_STR_BY_LOCID + header->setHeading(hbTrId("txt_irad_subtitle_select_items_to_delete")); +#else + header->setHeading(hbTrId("Select items to delete")); +#endif iMultiDeleteDialog->setHeadingWidget(header); @@ -213,8 +229,13 @@ delete oriActions.at(i); } +#ifdef SUBTITLE_STR_BY_LOCID iMultiDeleteDialog->addAction(new HbAction(hbTrId("txt_common_button_delete"))); iMultiDeleteDialog->addAction(new HbAction(hbTrId("txt_common_button_cancel"))); +#else + iMultiDeleteDialog->addAction(new HbAction(hbTrId("Delete"))); + iMultiDeleteDialog->addAction(new HbAction(hbTrId("Cancel"))); +#endif } iMultiDeleteDialog->setModel(iModel); @@ -249,7 +270,11 @@ { if (NULL == iMultiDeleteAction) { - iMultiDeleteAction = new HbAction(hbTrId("txt_irad_opt_delete_favorites"), menu()); +#ifdef SUBTITLE_STR_BY_LOCID + iMultiDeleteAction = new HbAction(hbTrId("txt_irad_opt_delete_stations"), menu()); +#else + iMultiDeleteAction = new HbAction(hbTrId("Delete stations"), menu()); +#endif connect(iMultiDeleteAction, SIGNAL(triggered()), this, SLOT(deleteFavorites())); } @@ -364,7 +389,11 @@ if(!iModel->deleteMultiFavorites(selectedIndexes)) { +#ifdef SUBTITLE_STR_BY_LOCID popupNote(hbTrId("txt_irad_info_operation_failed"), HbMessageBox::MessageTypeWarning); +#else + popupNote(hbTrId("Operation failed"), HbMessageBox::MessageTypeWarning); +#endif } updateIconIndexArray(); @@ -428,13 +457,29 @@ contextMenu->setAttribute(Qt::WA_DeleteOnClose); connect(contextMenu, SIGNAL(triggered(HbAction*)), this, SLOT(actionClicked(HbAction*))); - action = contextMenu->addAction(hbTrId("txt_irad_opt_share_station")); +#ifdef SUBTITLE_STR_BY_LOCID + action = contextMenu->addAction(hbTrId("txt_irad_opt_share")); +#else + action = contextMenu->addAction(hbTrId("Share")); +#endif action->setObjectName(KActionShareName); +#ifdef SUBTITLE_STR_BY_LOCID action = contextMenu->addAction(hbTrId("txt_common_menu_delete")); +#else + action = contextMenu->addAction(hbTrId("Delete")); +#endif action->setObjectName(KActionDeleteName); +#ifdef SUBTITLE_STR_BY_LOCID action = contextMenu->addAction(hbTrId("txt_common_menu_rename_item")); +#else + action = contextMenu->addAction(hbTrId("Rename")); +#endif action->setObjectName(KActionRenameName); +#ifdef SUBTITLE_STR_BY_LOCID action = contextMenu->addAction(hbTrId("txt_common_menu_details")); +#else + action = contextMenu->addAction(hbTrId("Details")); +#endif action->setObjectName(KActionDetailsName); contextMenu->open(); @@ -469,7 +514,11 @@ { int current = iListView->currentIndex().row(); IRQPreset *preset = iModel->getPreset(current); +#ifdef SUBTITLE_STR_BY_LOCID HbInputDialog::getText(hbTrId("txt_common_menu_rename_item"), this, SLOT(renameConfirmed(HbAction*)), preset->name); +#else + HbInputDialog::getText(hbTrId("Rename"), this, SLOT(renameConfirmed(HbAction*)), preset->name); +#endif } void IRFavoritesView::detailsContextAction() @@ -504,7 +553,11 @@ } else { +#ifdef SUBTITLE_STR_BY_LOCID popupNote(hbTrId("txt_irad_info_operation_failed"), HbMessageBox::MessageTypeWarning); +#else + popupNote(hbTrId("Operation failed"), HbMessageBox::MessageTypeWarning); +#endif } if (!iIconIndexArray.empty()) @@ -526,7 +579,11 @@ QString newName = dialog->value().toString().trimmed(); if (newName.isEmpty()) { +#ifdef SUBTITLE_STR_BY_LOCID newName = hbTrId("txt_irad_info_unnamed_station"); +#else + newName = hbTrId("Unnamed station"); +#endif } if (newName == preset->name) diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irhistoryview.cpp --- a/qtinternetradio/ui/src/irhistoryview.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irhistoryview.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -59,19 +59,29 @@ iListView->setModel(iModel); iListView->setCurrentIndex(iModel->index(0)); - iClearHistoryAction = new HbAction(hbTrId("txt_irad_menu_clear_list"), menu()); - +#ifdef SUBTITLE_STR_BY_LOCID + iClearHistoryAction = new HbAction(hbTrId("txt_irad_opt_clear_list"), menu()); +#else + iClearHistoryAction = new HbAction(hbTrId("Clear list"), menu()); +#endif iConvertTimer = new QTimer(this); iConvertTimer->setInterval(10); - connect(iClearHistoryAction, SIGNAL(triggered()), this, SLOT(clearAllList())); + connect(iClearHistoryAction, SIGNAL(triggered()), this, SLOT(popupClearHistoryConfirmMessageBox())); connect(iNetworkController, SIGNAL(networkRequestNotified(IRQNetworkEvent)), this, SLOT(networkRequestNotified(IRQNetworkEvent))); connect(iModel, SIGNAL(modelChanged()), this, SLOT(modelChanged())); connect(iConvertTimer, SIGNAL(timeout()), this, SLOT(convertAnother())); } - +void IRHistoryView::popupClearHistoryConfirmMessageBox() +{ +#ifdef SUBTITLE_STR_BY_LOCID + HbMessageBox::question(hbTrId("txt_irad_info_clear_station_list"), this, SLOT(clearAllList(HbAction*)), hbTrId("txt_common_button_ok"), hbTrId("txt_common_button_cancel")); +#else + HbMessageBox::question(hbTrId("Clear station list?"), this, SLOT(clearAllList(HbAction*)), hbTrId("Ok"), hbTrId("Cancel")); +#endif +} /* * Description : destructor */ @@ -171,6 +181,16 @@ } } +#ifdef HS_WIDGET_ENABLED +void IRHistoryView::itemAboutToBeSelected(bool &aNeedNetwork) +{ + aNeedNetwork = true; + + int index = iListView->currentIndex().row(); + iPlayController->setConnectingStationName(iModel->getHistoryInfo(index)->getChannelName()); +} +#endif + void IRHistoryView::networkRequestNotified(IRQNetworkEvent aEvent) { if (getViewManager()->currentView() != this) @@ -224,13 +244,20 @@ // IRHistoryView::clearAllList() // gets the List which was stored earlier //--------------------------------------------------------------------------- -void IRHistoryView::clearAllList() +void IRHistoryView::clearAllList(HbAction *aAction) { - iIconIndexArray.clear(); - iModel->clearAllList(); - iConvertTimer->stop(); - iIsdsClient->isdsLogoDownCancelTransaction(); - iListView->reset(); + HbMessageBox *dialog = static_cast(sender()); + if (dialog) + { + if (aAction == dialog->actions().at(0)) + { + iIconIndexArray.clear(); + iModel->clearAllList(); + iConvertTimer->stop(); + iIsdsClient->isdsLogoDownCancelTransaction(); + iListView->reset(); + } + } } void IRHistoryView::prepareMenu() @@ -366,19 +393,31 @@ switch (retValue) { case EIRQErrorNone: +#ifdef SUBTITLE_STR_BY_LOCID add2FavNote->setTitle(hbTrId("txt_irad_info_added_to_favorites")); +#else + add2FavNote->setTitle(hbTrId("Added to Favorites")); +#endif //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); add2FavNote->show(); break; case EIRQErrorOutOfMemory: +#ifdef SUBTITLE_STR_BY_LOCID add2FavNote->setTitle(hbTrId("txt_irad_info_can_not_add_more")); +#else + add2FavNote->setTitle(hbTrId("Can't add more")); +#endif //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); add2FavNote->show(); break; case EIRQErrorAlreadyExist: +#ifdef SUBTITLE_STR_BY_LOCID add2FavNote->setTitle(hbTrId("txt_irad_info_favorite_updated")); +#else + add2FavNote->setTitle(hbTrId("Favorite updated")); +#endif //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); add2FavNote->show(); break; @@ -395,7 +434,11 @@ bool ret = iModel->deleteOneItem(current); if( !ret ) { +#ifdef SUBTITLE_STR_BY_LOCID popupNote(hbTrId("txt_irad_info_operation_failed"), HbMessageBox::MessageTypeWarning); +#else + popupNote(hbTrId("Operation failed"), HbMessageBox::MessageTypeWarning); +#endif } } void IRHistoryView::detailsContextAction() @@ -422,11 +465,23 @@ contextMenu->setAttribute(Qt::WA_DeleteOnClose); connect(contextMenu, SIGNAL(triggered(HbAction*)), this, SLOT(actionClicked(HbAction*))); +#ifdef SUBTITLE_STR_BY_LOCID action = contextMenu->addAction(hbTrId("txt_irad_menu_add_to_favorite")); +#else + action = contextMenu->addAction(hbTrId("Add to favorites")); +#endif action->setObjectName(KActionAddName); +#ifdef SUBTITLE_STR_BY_LOCID action = contextMenu->addAction(hbTrId("txt_common_menu_delete")); +#else + action = contextMenu->addAction(hbTrId("Delete")); +#endif action->setObjectName(KActionDeleteName); +#ifdef SUBTITLE_STR_BY_LOCID action = contextMenu->addAction(hbTrId("txt_common_menu_details")); +#else + action = contextMenu->addAction(hbTrId("Details")); +#endif action->setObjectName(KActionDetailsName); contextMenu->open(); diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irlastplayedstationinfo.cpp --- a/qtinternetradio/ui/src/irlastplayedstationinfo.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irlastplayedstationinfo.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -16,6 +16,10 @@ */ #include #include +#ifdef HS_WIDGET_ENABLED +#include +#include "irservicedef.h" +#endif #include "irqisdsdatastructure.h" #include "irlastplayedstationinfo.h" @@ -57,6 +61,11 @@ return; } +#ifdef HS_WIDGET_ENABLED + QSettings settings(KIrSettingOrganization, KIrSettingApplication); + settings.setValue(KIrSettingStationName,iLastPlayedStation->name); +#endif + QFile file(KFileName); bool ret = file.open(QIODevice::Truncate | QIODevice::WriteOnly); if (!ret) diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irmainmodel.cpp --- a/qtinternetradio/ui/src/irmainmodel.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irmainmodel.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -51,10 +51,17 @@ void IRMainModel::initModel() { +#ifdef SUBTITLE_STR_BY_LOCID iPrimaryTexts << hbTrId("txt_irad_list_stations_by_country_region") << hbTrId("txt_irad_list_stations_by_language") - << hbTrId("txt_irad_list_recently_played_stations") - << hbTrId("txt_irad_list_recently_played_songs"); + << hbTrId("txt_irad_list_stations_recently_played") + << hbTrId("txt_irad_list_songs_recently_played"); +#else + iPrimaryTexts << hbTrId("Stations by country/region") + << hbTrId("Stations by language") + << hbTrId("Stations recently played") + << hbTrId("Songs recently played"); +#endif } void IRMainModel::checkUpdate() @@ -64,7 +71,12 @@ return; } +#ifdef SUBTITLE_STR_BY_LOCID QString primary = hbTrId("txt_irad_subtitle_stations_from_play_list"); +#else + QString primary = hbTrId("Stations from play list"); +#endif + if (iPlayList->getNumberOfEntries() > 0) { //if pls item is not in collections view, add diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irmainview.cpp --- a/qtinternetradio/ui/src/irmainview.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irmainview.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -43,7 +43,7 @@ //if this view is not starting view, finish all initialization in constructor if (getViewManager()->views().count() > 0) { - lazyInit(); + normalInit(); } } @@ -172,10 +172,45 @@ iMainModel->checkUpdate(); } +//from base class IRBaseView +TIRHandleResult IRMainView::handleCommand(TIRViewCommand aCommand, TIRViewCommandReason aReason) +{ + if (!initCompleted()) + { + return EIR_DoDefault; + } + + Q_UNUSED(aReason); + TIRHandleResult ret = IrAbstractListViewBase::handleCommand(aCommand, aReason); + + switch (aCommand) + { + case EIR_ViewCommand_ACTIVATED: + getViewManager()->saveScreenShot(); + break; + + default: + break; + } + + return ret; +} + void IRMainView::lazyInit() { if (!initCompleted()) { + normalInit(); + + //initialization from handleCommand() + handleCommand(EIR_ViewCommand_ACTIVATED, EIR_ViewCommandReason_Show); + } +} + +void IRMainView::normalInit() +{ + if (!initCompleted()) + { IrAbstractListViewBase::lazyInit(); initToolBar(); setCheckedAction(); diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irmemorycollector.cpp --- a/qtinternetradio/ui/src/irmemorycollector.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irmemorycollector.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -16,10 +16,12 @@ */ #include +#include #include "irmemorycollector.h" #include "irapplication.h" #include "irviewmanager.h" +#include "irservicedef.h" IRMemoryCollector::IRMemoryCollector(IRApplication* aApplication) : iApplication(aApplication) { @@ -29,6 +31,15 @@ void IRMemoryCollector::aboutToQuit() { IRViewManager *viewManager = iApplication->getViewManager(); + + //we need to save the status for splash view, need to extend in future + TIRViewId exitingID = viewManager->getExitingView(); + QSettings settings(KIrSettingOrganization, KIrSettingApplication); + QVariant data(QVariant::Bool); + bool isNowplaying = (EIRView_PlayingView == exitingID)? true:false; + data.setValue(isNowplaying); + settings.setValue(KIrSettingSplashNowplaying,data); + delete iApplication; iApplication = NULL; diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irmonitorservice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/ui/src/irmonitorservice.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -0,0 +1,299 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// System includes +#include + +// User includes +#include "irmonitorservice.h" +#include "irapplication.h" +#include "irplaycontroller.h" +#include "irlastplayedstationinfo.h" +#include "irqisdsdatastructure.h" +#include "irqmetadata.h" +#include "irplaylist.h" +#include "irviewmanager.h" +#include "irqlogger.h" + +// Contants +static const QString IR_MONITOR_SERVICE = "internet_radio_10_1.com.nokia.symbian.IInternetRadioMonitor"; + +#define IS_READY(itemFlag) mReadyItems.testFlag(itemFlag) +#define SET_FLAG(itemFlag) mReadyItems |= itemFlag +#define CLEAR_FLAG(itemFlag) mReadyItems &= ~itemFlag +#define CLEAR_ALL_FLAGS() mReadyItems &= !mReadyItems +#define ANY_READY() \ + mReadyItems.testFlag(StationName) || \ + mReadyItems.testFlag(StationLogo) || \ + mReadyItems.testFlag(MetaData) || \ + mReadyItems.testFlag(IrState) + +// Constructor +IrMonitorService::IrMonitorService(IRApplication *aIrApp, QObject *aParent) : + XQServiceProvider(IR_MONITOR_SERVICE, aParent), + mStationLogoAvailable(false), + mIrState(IrAppState::Unknown), + mIrApp(aIrApp), + mPlayController(NULL) +{ + publishAll(); + mPlayController = mIrApp->getPlayController(); + setupConnection(); +} + +// Destructor +IrMonitorService::~IrMonitorService() +{ +} + +void IrMonitorService::setupConnection() +{ + // meta data update + connect(mPlayController, SIGNAL(metaDataAvailable(IRQMetaData*)), + this, SLOT(updateMetaData(IRQMetaData*))); + // station logo update + connect(mPlayController, SIGNAL(stationLogoUpdated(bool)), + this, SLOT(handleStationLogoUpdated(bool))); + // connecting started + connect(mPlayController, SIGNAL(connectingStarted(QString)), + this, SLOT(handleLoadingStarted(QString))); + // buffering started + connect(mPlayController, SIGNAL(bufferingStarted(QString)), + this, SLOT(handleLoadingStarted(QString))); + // playing started + connect(mPlayController, SIGNAL(playingStarted()), + this, SLOT(handlePlayStarted())); + // playing stopped + connect(mPlayController, SIGNAL(playingStopped()), + this, SLOT(handlePlayStopped())); + // connecting cancelled + connect(mPlayController, SIGNAL(connectingCancelled(QString)), + this, SLOT(handleLoadingCancelled(QString))); + // buffering cancelled + connect(mPlayController, SIGNAL(bufferingCancelled(QString)), + this, SLOT(handleLoadingCancelled(QString))); +} + +// service interface, called via Qt Highway +void IrMonitorService::registerNotifications() +{ + mRequestList.append(setCurrentRequestAsync()); + + if (ANY_READY()) + { + notifyAll(); + } +} + +// service interface, called via Qt Highway +void IrMonitorService::refreshAllData() +{ + IrServiceDataList notificationList; + + IRQPreset * currentPreset = mPlayController->getNowPlayingPreset(); + + switch (mPlayController->state()) + { + case IRPlayController::EIdle: + notificationList.append(IrServiceData((int)IrServiceNotification::IrState, (int)IrAppState::RunningInit)); + break; + + case IRPlayController::EStopped: + notificationList.append(IrServiceData((int)IrServiceNotification::StationName, currentPreset->name)); +#ifdef HS_WIDGET_ENABLED + notificationList.append(IrServiceData((int)IrServiceNotification::StationLogo, mPlayController->isStationLogoAvailable())); +#endif + notificationList.append(IrServiceData((int)IrServiceNotification::MetaData, QString(""))); + notificationList.append(IrServiceData((int)IrServiceNotification::IrState, (int)IrAppState::RunningStopped)); + break; + +#ifdef HS_WIDGET_ENABLED + case IRPlayController::EConnecting: + notificationList.append(IrServiceData((int)IrServiceNotification::StationName, mPlayController->getConnectingStationName())); + notificationList.append(IrServiceData((int)IrServiceNotification::StationLogo, mPlayController->isStationLogoAvailable())); + notificationList.append(IrServiceData((int)IrServiceNotification::MetaData, QString(""))); + notificationList.append(IrServiceData((int)IrServiceNotification::IrState, (int)IrAppState::Loading)); + break; +#endif + + case IRPlayController::EBuffering: + notificationList.append(IrServiceData((int)IrServiceNotification::StationName, currentPreset->name)); + notificationList.append(IrServiceData((int)IrServiceNotification::StationLogo, mPlayController->isStationLogoAvailable())); + notificationList.append(IrServiceData((int)IrServiceNotification::MetaData, QString(""))); + notificationList.append(IrServiceData((int)IrServiceNotification::IrState, (int)IrAppState::Loading)); + break; + + case IRPlayController::EPlaying: + notificationList.append(IrServiceData((int)IrServiceNotification::StationName, currentPreset->name)); +#ifdef HS_WIDGET_ENABLED + notificationList.append(IrServiceData((int)IrServiceNotification::StationLogo, mPlayController->isStationLogoAvailable())); +#endif + notificationList.append(IrServiceData((int)IrServiceNotification::MetaData, mMetaData)); + notificationList.append(IrServiceData((int)IrServiceNotification::IrState, (int)IrAppState::Playing)); + break; + + default: + break; + } + + completeRequest(setCurrentRequestAsync(), qVariantFromValue(notificationList)); +} + +/******************************************************************************************************** + * SLOT for Play Controller + ******************************************************************************************************* + */ + +void IrMonitorService::updateMetaData(IRQMetaData* aMetaData) +{ + if (aMetaData) + { + SET_FLAG(MetaData); + mMetaData = aMetaData->getArtistSongName(); + + notifyAll(); + } +} + +void IrMonitorService::handleStationLogoUpdated(bool aLogoAvailable) +{ + mStationLogoAvailable = aLogoAvailable; + SET_FLAG(StationLogo); + + notifyAll(); +} + +void IrMonitorService::handleLoadingStarted(const QString &aStationName) +{ + mMetaData.clear(); + SET_FLAG(MetaData); + + mStationName = aStationName; + SET_FLAG(StationName); + + mIrState = IrAppState::Loading; + SET_FLAG(IrState); + + notifyAll(); +} + +void IrMonitorService::handleLoadingCancelled(const QString &aStationName) +{ + mMetaData.clear(); + SET_FLAG(MetaData); + + mStationName = aStationName; + SET_FLAG(StationName); + + if (mPlayController->isStopped()) + { + mIrState = IrAppState::RunningStopped; + } + else + { + mIrState = IrAppState::RunningInit; + } + SET_FLAG(IrState); + + notifyAll(); +} + +void IrMonitorService::handlePlayStarted() +{ + mMetaData.clear(); + SET_FLAG(MetaData); + + IRQPreset * currentPreset = mPlayController->getNowPlayingPreset(); + mStationName = currentPreset->name; + SET_FLAG(StationName); + + mIrState = IrAppState::Playing; + SET_FLAG(IrState); + + notifyAll(); +} + +void IrMonitorService::handlePlayStopped() +{ + mMetaData.clear(); + SET_FLAG(MetaData); + + mIrState = IrAppState::RunningStopped; + SET_FLAG(IrState); + + notifyAll(); +} + + +/******************************************************************************************************** + * Others + ******************************************************************************************************* + */ +void IrMonitorService::notifyAll() +{ + IrServiceDataList notificationList; + + if(IS_READY(StationName)) + { + notificationList.append(IrServiceData((int)IrServiceNotification::StationName, mStationName)); + } + + if(IS_READY(StationLogo)) + { + notificationList.append(IrServiceData((int)IrServiceNotification::StationLogo, mStationLogoAvailable)); + } + + if(IS_READY(MetaData)) + { + notificationList.append(IrServiceData((int)IrServiceNotification::MetaData, mMetaData)); + } + + if(IS_READY(IrState)) + { + notificationList.append(IrServiceData((int)IrServiceNotification::IrState, (int)mIrState)); + } + + if(notifyList(notificationList)) + { + CLEAR_ALL_FLAGS(); + } +} + +bool IrMonitorService::notifyList(const IrServiceDataList &aDataList) +{ + bool retVal = true; + + if (mRequestList.count() > 0 + && aDataList.count() > 0) + { + foreach (int requestId, mRequestList) + { + retVal &= completeRequest(requestId, qVariantFromValue(aDataList)); + } + mRequestList.clear(); + } + else + { + return false; + } + + return retVal; +} + +Q_IMPLEMENT_USER_METATYPE(IrServiceData) +Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(IrServiceDataList) + diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irnowplayingview.cpp --- a/qtinternetradio/ui/src/irnowplayingview.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irnowplayingview.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -19,6 +19,7 @@ #include #include #include +#include #ifdef NOWPLAYING_VIEW_OPTION_B #include @@ -45,6 +46,7 @@ #include "irqlogger.h" #include "irplaylist.h" #include "irstationdetailsview.h" +#include "irservicedef.h" #ifdef ADV_ENABLED #include @@ -61,6 +63,9 @@ static const QString KLcdGraphics("qtg_fr_lcd"); #endif + +static void saveStationLogo(const QPixmap &aStationLogo); + /* * Description : constructor */ @@ -215,10 +220,16 @@ */ void IRNowPlayingView::updateWidgets() { + if (iLaunchActionNeeded) // if lunch as starting view, leave the update action to launchAction() + { + return; + } + if(iPlayController->getNowPlayingPreset()) { iStationName->setPlainText(iPlayController->getNowPlayingPreset()->name); } + loadStationLogo(); } void IRNowPlayingView::updateMusicStoreStatus() @@ -331,6 +342,7 @@ connect(iIsdsClient, SIGNAL(presetLogoDownloaded(IRQPreset* )), this, SLOT(handleLogoDownloaded(IRQPreset* ))); updateStationLogo(); + getViewManager()->saveScreenShot(); break; case EIR_ViewCommand_DEACTIVATE: @@ -355,14 +367,19 @@ void IRNowPlayingView::launchAction() { setUseNetworkReason(EIR_UseNetwork_StartingView); + updateForLauchAction(); +#ifdef HS_WIDGET_ENABLED + iPlayController->setConnectingStationName(iStationName->plainText()); +#endif iApplication->verifyNetworkConnectivity(); getViewManager()->pushViewById(EIRView_MainView); - iLaunchActionNeeded = true; - updateForLauchAction(); + iLaunchActionNeeded = false; } void IRNowPlayingView::lazyInit() { + iLaunchActionNeeded = true; + if (!initCompleted()) { normalInit(); @@ -408,22 +425,33 @@ IRQPreset *preset = playList->getPresetForEntry(0); iStationName->setPlainText(preset->name); iFindinNmsAllowed = (0 == preset->musicStoreStatus.compare("yes",Qt::CaseInsensitive)); +#ifdef HS_WIDGET_ENABLED + iPlayController->reloadNowplayingPreset(preset,false,EIRQAdhocExternal); +#endif + iStationLogo->setIcon(HbIcon(KDefaultStationLogo)); + iLogoNeedUpdate = true; +#ifdef ADV_ENABLED + iAdvUrl = KDefaultAdvLink; + iAdvImage->setIcon(logoHbIcon); + iAdvImageNeedUpdate = true; +#endif delete preset; } else { IRLastPlayedStationInfo *lastPlayedStationInfo = iApplication->getLastPlayedStationInfo(); IRQPreset *lastPreset = lastPlayedStationInfo->getLastPlayedStation(); - if (lastPreset) { iStationName->setPlainText(lastPreset->name); - iFindinNmsAllowed = (0 == lastPreset->musicStoreStatus.compare("yes",Qt::CaseInsensitive)); + iFindinNmsAllowed = (0 == lastPreset->musicStoreStatus.compare("yes",Qt::CaseInsensitive)); } else { + iStationName->setPlainText(QString("")); iFindinNmsAllowed = false; } + loadStationLogo(); } } @@ -464,13 +492,16 @@ if( logoPixmap.loadFromData(logoRawData, aPreset->logoData.Length()) ) { if( EDownloadLogo == iLogoDownloadState ) - { + { + saveStationLogo(logoPixmap); QPixmap newLogoPixmap = - logoPixmap.scaled(QSize(KNowPlayingLogoSize,KNowPlayingLogoSize),Qt::KeepAspectRatio); + logoPixmap.scaled(QSize(KNowPlayingLogoSize,KNowPlayingLogoSize),Qt::KeepAspectRatio); QIcon logoQIcon(newLogoPixmap); HbIcon logoHbIcon(logoQIcon); - iStationLogo->setIcon(logoHbIcon); + iStationLogo->setIcon(logoHbIcon); + iPlayController->emitStationLogoUpdated(true); iLogoNeedUpdate = false; + getViewManager()->saveScreenShot(); #ifdef ADV_ENABLED QTimer::singleShot(1, this, SLOT(updateAdvImage())); #endif @@ -547,7 +578,7 @@ } else if( EIR_UseNetwork_PlayStation == getUseNetworkReason() ) { - handlePlayStopAction(); + iPlayController->resume(); } break; } @@ -581,11 +612,6 @@ */ void IRNowPlayingView::handlePlayStarted() { - if(iLaunchActionNeeded) - { - iLaunchActionNeeded = false; - updateStationLogo(); - } iPlayStopAction->setIcon(HbIcon(KStopButtonIcon)); } @@ -595,17 +621,6 @@ iSongName->setPlainText(""); iArtistName->setPlainText(""); iSongNameAvailable = false; - - if( this != getViewManager()->currentView() ) - { - iStationLogo->setIcon(HbIcon(KDefaultStationLogo)); - iLogoNeedUpdate = true; -#ifdef ADV_ENABLED - iAdvUrl = KDefaultAdvLink; - iAdvImage->setIcon(HbIcon(KDefaultStationLogo)); - iAdvImageNeedUpdate = true; -#endif - } } void IRNowPlayingView::updateMetaData(IRQMetaData* aMetaData) @@ -650,7 +665,11 @@ { if(!iFindinNmsAllowed) { - popupNote(hbTrId("txt_irad_info_disallowed_by_this_station"), HbMessageBox::MessageTypeInformation); +#ifdef SUBTITLE_STR_BY_LOCID + popupNote(hbTrId("txt_irad_info_not_allowed_by_this_station"), HbMessageBox::MessageTypeInformation); +#else + popupNote(hbTrId("Not allowed by this station"), HbMessageBox::MessageTypeInformation); +#endif return; } @@ -660,8 +679,12 @@ return; } - // Need to log the find song in NMS event, iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRFind,channelId); + // Need to log the find song in NMS event, iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRFind,channelId); +#ifdef SUBTITLE_STR_BY_LOCID popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation); +#else + popupNote(hbTrId("Music store not available"), HbMessageBox::MessageTypeInformation); +#endif } void IRNowPlayingView::handleIdentifySongAction() @@ -675,27 +698,28 @@ void IRNowPlayingView::handlePlayStopAction() { - if(iPlayController->isIdle()) + switch (iPlayController->state()) { - setUseNetworkReason(EIR_UseNetwork_StartingView); - } - else - { - setUseNetworkReason(EIR_UseNetwork_PlayStation); + case IRPlayController::EPlaying: + iPlayController->stop(EIRQUserTerminated); + return; + + case IRPlayController::EStopped: + setUseNetworkReason(EIR_UseNetwork_PlayStation); + break; + + default: + return; } - if (false == iApplication->verifyNetworkConnectivity()) + +#ifdef HS_WIDGET_ENABLED + iPlayController->setConnectingStationName(iStationName->plainText()); +#endif + + if (iApplication->verifyNetworkConnectivity()) { - return; - } - setUseNetworkReason(EIR_UseNetwork_NoReason); - - if (iPlayController->isPlaying()) - { - iPlayController->stop(EIRQUserTerminated); - } - else - { + setUseNetworkReason(EIR_UseNetwork_NoReason); iPlayController->resume(); } } @@ -710,19 +734,31 @@ switch (retValue) { case EIRQErrorNone: +#ifdef SUBTITLE_STR_BY_LOCID add2FavNote->setTitle(hbTrId("txt_irad_info_added_to_favorites")); +#else + add2FavNote->setTitle(hbTrId("Added to Favorites")); +#endif //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); add2FavNote->show(); break; case EIRQErrorOutOfMemory: +#ifdef SUBTITLE_STR_BY_LOCID add2FavNote->setTitle(hbTrId("txt_irad_info_can_not_add_more")); +#else + add2FavNote->setTitle(hbTrId("Can't add more")); +#endif //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); add2FavNote->show(); break; case EIRQErrorAlreadyExist: +#ifdef SUBTITLE_STR_BY_LOCID add2FavNote->setTitle(hbTrId("txt_irad_info_favorite_updated")); +#else + add2FavNote->setTitle(hbTrId("Favorite updated")); +#endif //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); add2FavNote->show(); break; @@ -782,3 +818,42 @@ } #endif +void IRNowPlayingView::loadStationLogo() +{ + if (iPlayController->isStationLogoAvailable()) + { + QSettings settings(KIrSettingOrganization, KIrSettingApplication); + if (settings.value(KIrSettingStationLogo).canConvert()) + { + QPixmap logoPixmap = settings.value(KIrSettingStationLogo).value(); + QPixmap newLogoPixmap = + logoPixmap.scaled(QSize(KNowPlayingLogoSize,KNowPlayingLogoSize),Qt::KeepAspectRatio); + QIcon logoQIcon(newLogoPixmap); + HbIcon logoHbIcon(logoQIcon); + iStationLogo->setIcon(logoHbIcon); + iLogoNeedUpdate = false; +#ifdef ADV_ENABLED + iAdvUrl = iPlayController->getNowPlayingPreset()->advertisementUrl; + iAdvImage->setIcon(logoHbIcon); + iAdvImageNeedUpdate = false; +#endif + return; + } + } + + iStationLogo->setIcon(HbIcon(KDefaultStationLogo)); + iLogoNeedUpdate = true; +#ifdef ADV_ENABLED + iAdvUrl = KDefaultAdvLink; + iAdvImage->setIcon(logoHbIcon); + iAdvImageNeedUpdate = true; +#endif +} + +void saveStationLogo(const QPixmap &aStationLogo) +{ + QSettings settings(KIrSettingOrganization, KIrSettingApplication); + QVariant logoData(QVariant::Pixmap); + logoData.setValue(aStationLogo); + settings.setValue(KIrSettingStationLogo,logoData); +} diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/iropenwebaddressview.cpp --- a/qtinternetradio/ui/src/iropenwebaddressview.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/iropenwebaddressview.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -167,7 +167,11 @@ if (0 == stationName.size()) { - iName->setContentWidgetData(QString("text"), hbTrId("txt_irad_info_unnamed")); +#ifdef SUBTITLE_STR_BY_LOCID + iName->setContentWidgetData(QString("text"), hbTrId("txt_irad_info_unnamed_station")); +#else + iName->setContentWidgetData(QString("text"), hbTrId("Unnamed station")); +#endif } else { @@ -189,7 +193,11 @@ temp = iName->contentWidgetData(QString("text")).toString(); if (0 == temp.size()) { - iName->setContentWidgetData(QString("text"), hbTrId("txt_irad_info_unnamed")); +#ifdef SUBTITLE_STR_BY_LOCID + iName->setContentWidgetData(QString("text"), hbTrId("txt_irad_info_unnamed_station")); +#else + iName->setContentWidgetData(QString("text"), hbTrId("Unnamed station")); +#endif } } @@ -206,8 +214,13 @@ iUrl->setContentWidgetData("maxLength",MAX_URL_CHARACTOR_NUMBER); iModel->appendDataFormItem(iUrl); +#ifdef SUBTITLE_STR_BY_LOCID iName = new HbDataFormModelItem( HbDataFormModelItem::TextItem, hbTrId("txt_irad_formlabel_station_name")); +#else + iName = new HbDataFormModelItem( + HbDataFormModelItem::TextItem, hbTrId("Station name")); +#endif iName->setContentWidgetData("maxLength", MAX_URL_CHARACTOR_NUMBER); iModel->appendDataFormItem(iName); @@ -229,7 +242,9 @@ } setUseNetworkReason(EIR_UseNetwork_OpenWebAddress); - +#ifdef HS_WIDGET_ENABLED + iPlayController->setConnectingStationName(preset.name); +#endif // Verify the connectivity if (false == iApplication->verifyNetworkConnectivity()) { @@ -282,7 +297,11 @@ // check the URL if (!IRQUtility::isValidUrl(server.url)) { - popupNote(hbTrId("txt_irad_info_invalid_link_please_change_it"), HbMessageBox::MessageTypeInformation); +#ifdef SUBTITLE_STR_BY_LOCID + popupNote(hbTrId("txt_irad_info_invalid_station_address"), HbMessageBox::MessageTypeInformation); +#else + popupNote(hbTrId("Invalid station address"), HbMessageBox::MessageTypeInformation); +#endif return false; } @@ -291,7 +310,11 @@ server.serverName = iName->contentWidgetData(QString("text")).toString(); if (0 == server.serverName.size()) { - server.serverName = hbTrId("txt_irad_info_unnamed"); +#ifdef SUBTITLE_STR_BY_LOCID + server.serverName = hbTrId("txt_irad_info_unnamed_station"); +#else + server.serverName = hbTrId("Unnamed station"); +#endif } aPreset.insertChannelServer(server); @@ -345,7 +368,11 @@ if( object == iNameEditorPtr && event->type() == QEvent::FocusIn ) { - if(hbTrId("txt_irad_info_unnamed") == iName->contentWidgetData(QString("text")).toString()) +#ifdef SUBTITLE_STR_BY_LOCID + if(hbTrId("txt_irad_info_unnamed_station") == iName->contentWidgetData(QString("text")).toString()) +#else + if(hbTrId("Unnamed station") == iName->contentWidgetData(QString("text")).toString()) +#endif { iName->setContentWidgetData(QString("text"), QString("")); } diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irplaycontroller.cpp --- a/qtinternetradio/ui/src/irplaycontroller.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irplaycontroller.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -20,6 +20,9 @@ #include #include #endif +#ifdef HS_WIDGET_ENABLED +#include +#endif #include "irplaycontroller.h" #include "irapplication.h" @@ -35,6 +38,9 @@ #include "irqstatisticsreporter.h" #include "irenummapper.h" #include "irqlogger.h" +#ifdef HS_WIDGET_ENABLED +#include "irservicedef.h" +#endif #ifdef Q_CC_NOKIAX86 void getRadioServerAddress(QString & aUrl); @@ -77,6 +83,10 @@ IRQStatisticsReporter::IRConnectedFrom, \ ui_enum, KConnectedFromMap ) + +static bool loadStationLogoFlag(); +static void saveStationLogoFlag(bool aIsStationLogoAvailable); + // public functions /* @@ -86,10 +96,13 @@ iApplication(aApplication), iMediaPlayer(new IRQMediaPlayer()), iStatisticsReporter(NULL), - iConnectedFrom(EIRQIsds), iGetServerResult(false), iNowPlayingPreset(new IRQPreset()), iNowPlayingPresetBackup(new IRQPreset()), + iConnectedFrom(EIRQIsds), + iConnectedFromBackup(EIRQIsds), + iStationLogoAvailable(false), + iStationLogoAvailableBackup(false), iMetaData(NULL), iSongHistoryEngine(IRQSongHistoryEngine::openInstance()), iPlayState(EIdle), @@ -98,8 +111,29 @@ iUrlArray(0), iRealBitrate(0), iLastError(EIRQErrorNone), - iStopReason(EIRQUnknownTermination) + iStopReason(EIRQUnknownTermination), + iErrorNote(NULL) { + // use the last played station to initiliaze the backup value. + // can regard the player is bootup, and initilize its LCD screen with last played station info if available. + IRQPreset *lastPlayedPreset = iApplication->getLastPlayedStationInfo()->getLastPlayedStation(); + if (lastPlayedPreset) + { + *iNowPlayingPreset = *lastPlayedPreset; + iLastPlayedUrl = getFirstTryUrl(lastPlayedPreset); + iConnectedFrom = iApplication->getLastPlayedStationInfo()->connectedFrom(); + iStationLogoAvailable = loadStationLogoFlag(); + } + + if (iNowPlayingPreset->getChannelURLCount()) + { + iPlayState = EStopped; + } + else + { + iPlayState = EIdle; + } + connectSignalSlot(); iStatisticsReporter = IRQStatisticsReporter::openInstance(); } @@ -120,7 +154,12 @@ delete iUrlArray; iUrlArray = NULL; + + delete iErrorNote; + iErrorNote = NULL; + saveStationLogoFlag(iStationLogoAvailable); + if (iSongHistoryEngine) { iSongHistoryEngine->closeInstance(); @@ -139,72 +178,74 @@ */ void IRPlayController::connectToChannel(IRQPreset *aPreset, IRQConnectedFrom aConnectedFrom) { - iConnectedFrom = aConnectedFrom; if (!aPreset) { return; } if (iMediaPlayer) - { - // sort the URL by ascending order and get all available rates. - // iAvailableBitrate is cleared in getAvailableBitrates(). - aPreset->sortURLArray(); - aPreset->getAvailableBitrates(iAvailableBitrate); - if (iAvailableBitrate.count() == 0) + { + QString firstTryUrl = getFirstTryUrl(aPreset); + if (firstTryUrl.isEmpty()) { return; } - int selectedBitRate = 0; - IRQPreferredQuality preferredQuality = iApplication->getSettings()->getPreferredQuality(); - switch(preferredQuality) - { - case EIRQStandardQuality: - selectedBitRate = iAvailableBitrate.first(); - break; - case EIRQHighQuality: - selectedBitRate = iAvailableBitrate.last(); - break; - default: - selectedBitRate = iAvailableBitrate.first(); - break; - } - - // get URL to play - iTryingBitrate = selectedBitRate; - - //reserve the info in nowplay view - *iNowPlayingPresetBackup = *iNowPlayingPreset; - *iNowPlayingPreset = *aPreset; + *iNowPlayingPresetBackup = *iNowPlayingPreset; + iLastPlayedUrlBackup = iLastPlayedUrl; + iConnectedFromBackup = iConnectedFrom; - delete iUrlArray; - iUrlArray = NULL; - iUrlArray = iNowPlayingPreset->getURLsForBitrate(selectedBitRate); - if (iUrlArray) - { - QString url = iUrlArray->at(0); + *iNowPlayingPreset = *aPreset; + iLastPlayedUrl = firstTryUrl; + iConnectedFrom = aConnectedFrom; + iResuming = false; + doPlay(iLastPlayedUrl); + } +} + +QString IRPlayController::getFirstTryUrl(IRQPreset *aPreset) +{ + QString firstTryUrl; + // sort the URL by ascending order and get all available rates. + // iAvailableBitrate is cleared in getAvailableBitrates(). + aPreset->sortURLArray(); + aPreset->getAvailableBitrates(iAvailableBitrate); + if (iAvailableBitrate.count() == 0) + { + return firstTryUrl; + } + + int selectedBitRate = 0; + IRQPreferredQuality preferredQuality = iApplication->getSettings()->getPreferredQuality(); + switch(preferredQuality) + { + case EIRQStandardQuality: + selectedBitRate = iAvailableBitrate.first(); + break; + case EIRQHighQuality: + selectedBitRate = iAvailableBitrate.last(); + break; + default: + selectedBitRate = iAvailableBitrate.first(); + break; + } + + // get URL to play + iTryingBitrate = selectedBitRate; + + delete iUrlArray; + iUrlArray = NULL; + iUrlArray = aPreset->getURLsForBitrate(selectedBitRate); + if (iUrlArray) + { + firstTryUrl = iUrlArray->at(0); #ifdef Q_CC_NOKIAX86 - if (iLastPlayedChannelName != aPreset->name) - { - emit initializeLogo(); - } - url = "http://172.28.205.171:8000"; - getRadioServerAddress(url); - iLastPlayedChannelName = aPreset->name; -#else - if (iLastPlayedUrl != iUrlArray->at(0)) - { - emit initializeLogo(); - } + firstTryUrl = "http://172.28.182.59:8000"; + getRadioServerAddress(firstTryUrl); #endif - //reserve the info in nowplay view - iLastPlayedUrlBackup = iLastPlayedUrl; - iLastPlayedUrl = url; - iResuming = false; - doPlay(url); - } } + + return firstTryUrl; } /* @@ -232,23 +273,98 @@ */ void IRPlayController::stop(IRQTerminatedType aStopReason) { - qDebug("IRPlayController::stop, Entering, aStopReason=%d", aStopReason); - if (iMediaPlayer) - { - iMediaPlayer->disableStereoEffect(); - - iMediaPlayer->stop(); - - if (EPlaying == iPlayState) - { + qDebug("IRPlayController::stop, Entering, aStopReason=%d", aStopReason); + + switch (iPlayState) + { + case EPlaying: + iPlayState = EStopped; iStopReason = aStopReason; + if (iMediaPlayer) + { + iMediaPlayer->disableStereoEffect(); + iMediaPlayer->stop(); + } // playingStarted is emitted while iPlaying is set to true, // so when stop() is called and iPlaying is true, playingStopped // should be emitted. - qDebug("IRPlayController::stop, emit playingStopped()"); - emit playingStopped(); - } - iPlayState = EStopped; + qDebug("IRPlayController::stop, emit playingStopped()"); + emit playingStopped(); + break; + +#ifdef HS_WIDGET_ENABLED + case EConnecting: + // No need to restore because when connecting occurs, because the connectToChannel() has NOT been invoked yet. + // Only need to reset the player state + if (iNowPlayingPreset->getChannelURLCount()) + { + iPlayState = EStopped; + } + else + { + iPlayState = EIdle; + } + + iStopReason = aStopReason; + + // Only need to restore the station logo flag since we may force it to be false when connecting started. + // force logo to be default when current view is NOT nowplaying view && is not resuming (start playing a different station.) + if (EIRView_PlayingView != iApplication->getViewManager()->currentViewId() + && iConnectingStationName != iNowPlayingPreset->name) + { + iStationLogoAvailable = iStationLogoAvailableBackup; + emit stationLogoUpdated(iStationLogoAvailable); + } + emit connectingCancelled(iNowPlayingPreset->name); + break; +#endif + + case EBuffering: + if (iMediaPlayer) + { + iMediaPlayer->disableStereoEffect(); + iMediaPlayer->stop(); + } + // when player is forced to stop in bufferring state, we have to revert to backup preset. + // only with exception when current view is nowplaying view. + // in IR case, user can only stay in nowplaying view when buffering: + // 1. starging view is now playing view; 2. open a pls file with only one url + if (EIRView_PlayingView != iApplication->getViewManager()->currentViewId()) + { + iLastPlayedUrl = iLastPlayedUrlBackup; + *iNowPlayingPreset = *iNowPlayingPresetBackup; + iConnectedFrom = iConnectedFromBackup; + } + + if (iNowPlayingPreset->getChannelURLCount()) + { + iPlayState = EStopped; + } + else + { + iPlayState = EIdle; + } + + iStopReason = aStopReason; + +#ifdef HS_WIDGET_ENABLED + // Need to restore the station logo flag since we may force it to be false when buffering started. + // force logo to be default when current view is NOT nowplaying view && is not resuming (start playing a different station.) + if (EIRView_PlayingView != iApplication->getViewManager()->currentViewId() + && !iResuming) + { + iStationLogoAvailable = iStationLogoAvailableBackup; + emit stationLogoUpdated(iStationLogoAvailable); + } + emit bufferingCancelled(iNowPlayingPreset->name); +#endif + break; + + + case EIdle: + case EStopped: + default: + break; } endSession(aStopReason); qDebug("IRPlayController::stop, Exiting"); @@ -299,6 +415,76 @@ iApplication->getSettings()->setVolumeSetting(aVolume); } +#ifdef HS_WIDGET_ENABLED +void IRPlayController::setConnectingStationName(const QString &aStationName, bool aForceConnecting) +{ + iConnectingStationName = aStationName; + if (aForceConnecting + || !iApplication->getNetworkController()->getNetworkStatus()) + { + LOG_FORMAT("IRPlayController::setConnectingStationName, the station name is %s", STRING2CHAR(aStationName)); + iPlayState = EConnecting; + + // force logo to be default when current view is NOT nowplaying view && is not resuming (start playing a different station.) + if (EIRView_PlayingView != iApplication->getViewManager()->currentViewId() + && iConnectingStationName != iNowPlayingPreset->name) + { + emitStationLogoUpdated(false); + } + emit connectingStarted(aStationName); + } +} + +QString IRPlayController::getConnectingStationName() const +{ + return iConnectingStationName; +} + +void IRPlayController::reloadNowplayingPreset(IRQPreset *aPreset, bool aIsLogoAvailable, IRQConnectedFrom aConnectedFrom) +{ + if (aPreset) + { + *iNowPlayingPreset = *aPreset; + iLastPlayedUrl = getFirstTryUrl(aPreset); + iConnectedFrom = aConnectedFrom; + iStationLogoAvailable = aIsLogoAvailable; + } + + if (iNowPlayingPreset->getChannelURLCount()) + { + iPlayState = EStopped; + } + else + { + iPlayState = EIdle; + } +} + +bool IRPlayController::isStationLogoAvailable() const +{ + return iStationLogoAvailable; +} + +void IRPlayController::emitStationLogoUpdated(bool aIsLogoAvailable) +{ + iStationLogoAvailableBackup = iStationLogoAvailable; + iStationLogoAvailable = aIsLogoAvailable; + emit stationLogoUpdated(iStationLogoAvailable); +} + +bool loadStationLogoFlag() +{ + QSettings settings(KIrSettingOrganization, KIrSettingApplication); + return settings.value(KIrSettingStationLogoAvailable,false).toBool(); +} + +#endif + +IRPlayController::EPlayState IRPlayController::state() const +{ + return iPlayState; +} + /* * Description : return the flag of playing state * Return : true : playing is ongoing @@ -428,11 +614,6 @@ // if there's NO other URL to try, show warning. if (iNowPlayingPreset->getChannelURLCount() == 1) { - //here recover info in nowplay view, only for cases: - //1/a channel has one url. 2/ invoked by "go to station" view. - //if a channel has more than one url, here can't be reached. - iLastPlayedUrl = iLastPlayedUrlBackup; - *iNowPlayingPreset = *iNowPlayingPresetBackup; stop(EIRQNoConnectionToServer); break; } @@ -474,7 +655,7 @@ } iApplication->stopLoadingAnimation(); - createNote(); + popupNote(); qDebug("IRPlayController::handleError(), Exiting"); } @@ -488,36 +669,39 @@ { if (100 == aProgress) { + //updateProgress(100) sometimes can be called more than one time, to improve performance, + //we only need to do the following work once. + if (EPlaying == iPlayState) + { + iApplication->stopLoadingAnimation(); + return; + } + + iPlayState = EPlaying; iApplication->stopLoadingAnimation(); - //updateProgress(100) sometimes can be called more than one time, to improve performance, - //we only need to do the following work once. - if (EBuffering == iPlayState) - { - iApplication->getViewManager()->activateView(EIRView_PlayingView); - iPlayState = EPlaying; + iApplication->getViewManager()->activateView(EIRView_PlayingView); - //update last played station - IRLastPlayedStationInfo *lastPlayedStationInfo = iApplication->getLastPlayedStationInfo(); - lastPlayedStationInfo->updateLastPlayedStation(iNowPlayingPreset,iConnectedFrom); - lastPlayedStationInfo->commitLastPlayedStation(); + //update last played station + IRLastPlayedStationInfo *lastPlayedStationInfo = iApplication->getLastPlayedStationInfo(); + lastPlayedStationInfo->updateLastPlayedStation(iNowPlayingPreset,iConnectedFrom); + lastPlayedStationInfo->commitLastPlayedStation(); + + //increase the played times of current preset + iApplication->getFavoritesDB()->increasePlayedTimes(*iNowPlayingPreset); - //increase the played times of current preset - iApplication->getFavoritesDB()->increasePlayedTimes(*iNowPlayingPreset); + emit playingStarted(); - emit playingStarted(); - - // if the metadata is available, show it. - emit metaDataAvailable(iMetaData); + // if the metadata is available, show it. + emit metaDataAvailable(iMetaData); - // Save the station information to database - IRQMetaData tmpMetaData; - tmpMetaData.setBitrate(iRealBitrate); - tmpMetaData.setStreamUrl(iLastPlayedUrl); - iSongHistoryEngine->handleMetaDataReceived(tmpMetaData, *iNowPlayingPreset); - // open stereo defaultly - iMediaPlayer->enableStereoEffect(); - } + // Save the station information to database + IRQMetaData tmpMetaData; + tmpMetaData.setBitrate(iRealBitrate); + tmpMetaData.setStreamUrl(iLastPlayedUrl); + iSongHistoryEngine->handleMetaDataReceived(tmpMetaData, *iNowPlayingPreset); + // open stereo defaultly + iMediaPlayer->enableStereoEffect(); } } @@ -571,9 +755,21 @@ * Description : show a note to user to inform that error occured. * */ -void IRPlayController::createNote(const QString &aNote) +void IRPlayController::popupNote(const QString &aNote) { - HbMessageBox::warning(aNote, (QObject*)NULL, NULL); + if (NULL == iErrorNote) + { + iErrorNote = new HbMessageBox(HbMessageBox::MessageTypeWarning); + iErrorNote->setModal(true); + iErrorNote->setTimeout(HbPopup::StandardTimeout); + } + + iErrorNote->setText(aNote); + // if there is already on error note showing, only change the text + if (!iErrorNote->isVisible()) + { + iErrorNote->show(); + } } /* @@ -670,6 +866,15 @@ qDebug("IRPlayController::doPlay, access point : %d", apId); iMediaPlayer->playStation(aUrl, apId); iPlayState = EBuffering; +#ifdef HS_WIDGET_ENABLED + // force logo to be default when current view is NOT nowplaying view && is not resuming (start playing a different station.) + if (EIRView_PlayingView != iApplication->getViewManager()->currentViewId() + && !iResuming) + { + emitStationLogoUpdated(false); + } + emit bufferingStarted(iNowPlayingPreset->name); +#endif startSession(); iApplication->startLoadingAnimation(this, SLOT(cancelBuffering())); } @@ -700,6 +905,14 @@ } #endif +void saveStationLogoFlag(bool aIsStationLogoAvailable) +{ + QSettings settings(KIrSettingOrganization, KIrSettingApplication); + QVariant data(QVariant::Bool); + data.setValue(aIsStationLogoAvailable); + settings.setValue(KIrSettingStationLogoAvailable,data); +} + //get IP address configuration of test radio server #ifdef Q_CC_NOKIAX86 void getRadioServerAddress(QString & aUrl) diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irplaylist.cpp --- a/qtinternetradio/ui/src/irplaylist.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irplaylist.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -242,7 +242,11 @@ else { //no station name is available - item = new IRPlayListItem(currentLine, hbTrId("txt_irad_info_unnamed"), -1); +#ifdef SUBTITLE_STR_BY_LOCID + item = new IRPlayListItem(currentLine, hbTrId("txt_irad_info_unnamed_station"), -1); +#else + item = new IRPlayListItem(currentLine, hbTrId("Unnamed station"), -1); +#endif } iItemList.append(item); } diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irplsview.cpp --- a/qtinternetradio/ui/src/irplsview.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irplsview.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -75,6 +75,16 @@ setUseNetworkReason(EIR_UseNetwork_NoReason); } +#ifdef HS_WIDGET_ENABLED +void IRPlsView::itemAboutToBeSelected(bool &aNeedNetwork) +{ + aNeedNetwork = true; + + int currentRow = iListView->currentIndex().row(); + iPlayController->setConnectingStationName(iPlsModel->getTitle(currentRow)); +} +#endif + void IRPlsView::handleItemSelected() { int currentRow = iListView->currentIndex().row(); @@ -101,7 +111,11 @@ HbMenu *contextMenu = new HbMenu; contextMenu->setAttribute(Qt::WA_DeleteOnClose); +#ifdef SUBTITLE_STR_BY_LOCID HbAction *action = contextMenu->addAction(hbTrId("txt_common_menu_delete")); +#else + HbAction *action = contextMenu->addAction(hbTrId("Delete")); +#endif action->setObjectName(KActionDeleteName); contextMenu->open(); connect(contextMenu, SIGNAL(triggered(HbAction*)), this, SLOT(actionClicked(HbAction*))); diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irsearchchannelsview.cpp --- a/qtinternetradio/ui/src/irsearchchannelsview.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irsearchchannelsview.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -41,7 +41,7 @@ IRSearchChannelsView::IRSearchChannelsView(IRApplication* aApplication, TIRViewId aViewId): IRBaseView(aApplication, aViewId), - iHeadingLabel(NULL),iListView(NULL),iSearchPanelWidget(NULL),iSearchState(ESearch_init), + iListView(NULL),iSearchPanelWidget(NULL),iSearchState(ESearch_init), iChannelModel(NULL),iPreset(NULL),iLogoPreset(NULL), iConvertTimer(NULL) { @@ -124,10 +124,7 @@ QObjectList roots; roots.append( this ); iLoader.setObjectTree( roots ); - iLoader.load(SEARCH_CHANNELS_VIEW_LAYOUT_FILENAME); - - iHeadingLabel = qobject_cast(iLoader.findWidget(SEARCH_CHANNELS_VIEW_HEADINGTEXT_WIDGET)); - + iLoader.load(SEARCH_CHANNELS_VIEW_LAYOUT_FILENAME); iSearchPanelWidget = qobject_cast(iLoader.findWidget(SEARCH_CHANNELS_VIEW_SEARCHPANEL_WIDGET)); @@ -140,15 +137,7 @@ iChannelModel = new IrChannelModel(this); iChannelModel->initWithCache(); - iListView->setModel(iChannelModel); - //anywhere, before show the count, updated it ahead. -#ifdef SUBTITLE_STR_BY_LOCID - QString headingStr = hbTrId("txt_irad_subtitle_search_results") + " (" + QString::number(iChannelModel->rowCount()) + ")"; -#else - QString headingStr = hbTrId("Search results") + " (" + QString::number(iChannelModel->rowCount()) + ")"; -#endif - - setHeadingText(headingStr); + iListView->setModel(iChannelModel); } void IRSearchChannelsView::connectWidget() @@ -200,14 +189,8 @@ { iSearchPanelWidget->clearFocus(); iListView->setFocus(); - iSearchState = ESearch_Loading; - - QSizeF searchPanelSize = iSearchPanelWidget->size(); - QSizeF windowSize = getViewManager()->size(); - QPointF pos(windowSize.width()/2,(windowSize.height() - searchPanelSize.height())/2); - QPointF iconPos(LOADING_ANIMATION_ICON_SIZE/2, LOADING_ANIMATION_ICON_SIZE/2); - pos -= iconPos; - iApplication->startLoadingAnimation(pos); + iSearchState = ESearch_Loading; + iApplication->startLoadingAnimation(this, SLOT(minimizeSearchPanel())); } void IRSearchChannelsView::handleItemSelected() @@ -299,10 +282,18 @@ switch(aError) { case EIRQErrorNotFound: - errStr = hbTrId("txt_irad_info_no_matching_stations_found"); +#ifdef SUBTITLE_STR_BY_LOCID + errStr = hbTrId("txt_irad_info_no_matching_station_found"); +#else + errStr = hbTrId("No matching station found"); +#endif break; default: +#ifdef SUBTITLE_STR_BY_LOCID errStr = hbTrId("txt_irad_info_failed_to_connect"); +#else + errStr = hbTrId("Connecting failed"); +#endif break; } @@ -313,6 +304,11 @@ void IRSearchChannelsView::clickItem(const QModelIndex&) { setUseNetworkReason(EIR_UseNetwork_SelectItem); +#ifdef HS_WIDGET_ENABLED + int index = iListView->currentIndex().row(); + IRQChannelItem* currentItem = iChannelModel->getChannelItemByIndex(index); + iPlayController->setConnectingStationName(currentItem->channelName,true); +#endif if (false == iApplication->verifyNetworkConnectivity()) { switch2LoadingState(); @@ -346,25 +342,10 @@ startConvert(iIconIndexArray[0]); } } - -//set the subtitle and counter; -void IRSearchChannelsView::setHeadingText(const QString &aText) -{ - if (iHeadingLabel) - { - iHeadingLabel->setHeading(aText); - } -} + void IRSearchChannelsView::dataChanged() { - switch2InitState(); - //here update count in subtitle -#ifdef SUBTITLE_STR_BY_LOCID - QString headingStr = hbTrId("txt_irad_subtitle_search_results") + " (" + QString::number(iChannelModel->rowCount()) + ")"; -#else - QString headingStr = hbTrId("Search results") + " (" + QString::number(iChannelModel->rowCount()) + ")"; -#endif - setHeadingText(headingStr); + switch2InitState(); iListView->reset(); if( iChannelModel->rowCount() ) { @@ -470,13 +451,7 @@ { if( ESearch_Loading == iSearchState ) { - if( ! ( iPlayController->isStopped() || iPlayController->isIdle() ) ) - { - //cancel buffering - iPlayController->cancelBuffering(); - } - - disconnectIsdsClient(); + iPlayController->cancelBuffering(); iIsdsClient->isdsCancelRequest(); iConvertTimer->stop(); iIsdsClient->isdsLogoDownCancelTransaction(); diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irsettingsview.cpp --- a/qtinternetradio/ui/src/irsettingsview.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irsettingsview.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -48,7 +48,11 @@ setLayout(layout); HbGroupBox * titleText = new HbGroupBox(); - titleText->setHeading( hbTrId("txt_common_opt_settings") ); +#ifdef SUBTITLE_STR_BY_LOCID + titleText->setHeading( hbTrId("txt_common_opt_settings") ); +#else + titleText->setHeading( hbTrId("Settings") ); +#endif layout->addItem(titleText); iForm = new HbDataForm(); @@ -62,25 +66,44 @@ iForm->setModel(iModel); HbMenu *viewMenu = menu(); - viewMenu->addAction(hbTrId("txt_common_opt_exit"),iApplication, SIGNAL(quit())); +#ifdef SUBTITLE_STR_BY_LOCID + viewMenu->addAction(hbTrId("txt_common_opt_exit"),iApplication, SIGNAL(quit())); +#else + viewMenu->addAction(hbTrId("Exit"),iApplication, SIGNAL(quit())); +#endif } void IRSettingsView::setPreferredQuality() { +#ifdef SUBTITLE_STR_BY_LOCID HbDataFormModelItem *preferredQualityItem = new HbDataFormModelItem( HbDataFormModelItem::ToggleValueItem, hbTrId("txt_irad_setlabel_download_quality")); +#else + HbDataFormModelItem *preferredQualityItem = new HbDataFormModelItem( + HbDataFormModelItem::ToggleValueItem, hbTrId("Download quality")); +#endif iModel->appendDataFormItem(preferredQualityItem); IRQPreferredQuality settingValue = iSettings->getPreferredQuality(); if(EIRQStandardQuality == settingValue) { +#ifdef SUBTITLE_STR_BY_LOCID preferredQualityItem->setContentWidgetData("text", hbTrId("txt_irad_setlabel_download_quality_val_standard")); preferredQualityItem->setContentWidgetData("additionalText", hbTrId("txt_irad_setlabel_download_quality_val_high")); +#else + preferredQualityItem->setContentWidgetData("text", hbTrId("Standard")); + preferredQualityItem->setContentWidgetData("additionalText", hbTrId("High")); +#endif } else if(EIRQHighQuality == settingValue) { +#ifdef SUBTITLE_STR_BY_LOCID preferredQualityItem->setContentWidgetData("text", hbTrId("txt_irad_setlabel_download_quality_val_high")); - preferredQualityItem->setContentWidgetData("additionalText", hbTrId("txt_irad_setlabel_download_quality_val_standard")); + preferredQualityItem->setContentWidgetData("additionalText", hbTrId("txt_irad_setlabel_download_quality_val_standard")); +#else + preferredQualityItem->setContentWidgetData("text", hbTrId("High")); + preferredQualityItem->setContentWidgetData("additionalText", hbTrId("Standard")); +#endif } connect(iModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), @@ -95,17 +118,29 @@ if(item->type() == HbDataFormModelItem::ToggleValueItem) { - if(item->data(HbDataFormModelItem::LabelRole).toString() == hbTrId("txt_irad_setlabel_download_quality")) +#ifdef SUBTITLE_STR_BY_LOCID + if(item->data(HbDataFormModelItem::LabelRole).toString() == hbTrId("txt_irad_setlabel_download_quality")) +#else + if(item->data(HbDataFormModelItem::LabelRole).toString() == hbTrId("Download quality")) +#endif { QVariant data = item->contentWidgetData("text"); QString value = data.toString(); +#ifdef SUBTITLE_STR_BY_LOCID if(value == (hbTrId("txt_irad_setlabel_download_quality_val_standard"))) +#else + if(value == (hbTrId("Standard"))) +#endif { // User has made it Standard. iSettings->setPreferredQuality(EIRQStandardQuality); } +#ifdef SUBTITLE_STR_BY_LOCID else if(value == (hbTrId("txt_irad_setlabel_download_quality_val_high"))) +#else + else if(value == (hbTrId("High"))) +#endif { // User has made it High. iSettings->setPreferredQuality(EIRQHighQuality); diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irsonghistorymodel.cpp --- a/qtinternetradio/ui/src/irsonghistorymodel.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irsonghistorymodel.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -68,13 +68,21 @@ QString artistName = mSongHistoryList.at(row)->getArtistName().trimmed(); if( "" == artistName ) { - artistName = hbTrId("txt_irad_list_unknown_artist"); +#ifdef SUBTITLE_STR_BY_LOCID + artistName = hbTrId("txt_irad_list_unknown_artist_p"); +#else + artistName = hbTrId("Unknown artist"); +#endif } QString songName = mSongHistoryList.at(row)->getSongName().trimmed(); if( "" == songName ) { - songName = hbTrId("txt_irad_list_unknown_song"); +#ifdef SUBTITLE_STR_BY_LOCID + songName = hbTrId("txt_irad_list_unknown_song_p"); +#else + songName = hbTrId("Unknown song"); +#endif } QString stationName = mSongHistoryList.at(row)->getStationName().trimmed(); diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irsonghistoryview.cpp --- a/qtinternetradio/ui/src/irsonghistoryview.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irsonghistoryview.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -52,7 +52,11 @@ iListView->setModel(iModel); iListView->setCurrentIndex(iModel->index(0)); - iClearSongHistoryAction = new HbAction(hbTrId("txt_irad_menu_clear_list"), this); +#ifdef SUBTITLE_STR_BY_LOCID + iClearSongHistoryAction = new HbAction(hbTrId("txt_irad_opt_clear_list"), this); +#else + iClearSongHistoryAction = new HbAction(hbTrId("Clear list"), this); +#endif iStatisticsReporter = IRQStatisticsReporter::openInstance(); iShowPrompt = iSettings->getSongHistoryShow(); @@ -61,7 +65,7 @@ iSettings->setSongHistoryShow(0); } - connect(iClearSongHistoryAction, SIGNAL(triggered()), this, SLOT(clearList())); + connect(iClearSongHistoryAction, SIGNAL(triggered()), this, SLOT(popupClearHistoryConfirmMessageBox())); connect(iModel, SIGNAL(modelChanged()), this, SLOT(modelChanged())); } @@ -142,7 +146,11 @@ // TODO : Add the report in future. Add the channel id in the song info db // iStatisticsReporter->logNmsEvents(EIRQFind,channelId); - popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation); +#ifdef SUBTITLE_STR_BY_LOCID + popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation); +#else + popupNote(hbTrId("Music store not available"), HbMessageBox::MessageTypeInformation); +#endif } @@ -193,14 +201,33 @@ } -void IRSongHistoryView::clearList() +void IRSongHistoryView::popupClearHistoryConfirmMessageBox() { - iModel->clearList(); +#ifdef SUBTITLE_STR_BY_LOCID + HbMessageBox::question(hbTrId("txt_irad_info_clear_song_list"), this, SLOT(clearList(HbAction*)), hbTrId("txt_common_button_ok"), hbTrId("txt_common_button_cancel")); +#else + HbMessageBox::question(hbTrId("Clear song list?"), this, SLOT(clearList(HbAction*)), hbTrId("Ok"), hbTrId("Cancel")); +#endif +} +void IRSongHistoryView::clearList(HbAction *aAction) +{ + HbMessageBox *dialog = static_cast(sender()); + if (dialog) + { + if (aAction == dialog->actions().at(0)) + { + iModel->clearList(); + } + } } void IRSongHistoryView::showPrompt() { +#ifdef SUBTITLE_STR_BY_LOCID QString str = hbTrId("txt_irad_info_click_the_song_and_find_it_in_nokia_music_store"); +#else + QString str = hbTrId("Click the song and find it in nokia music store"); +#endif popupNote(str, HbMessageBox::MessageTypeInformation); } @@ -220,9 +247,17 @@ contextMenu->setAttribute(Qt::WA_DeleteOnClose); connect(contextMenu, SIGNAL(triggered(HbAction*)), this, SLOT(actionClicked(HbAction*))); +#ifdef SUBTITLE_STR_BY_LOCID action = contextMenu->addAction(hbTrId("txt_irad_menu_search_in_music_store")); +#else + action = contextMenu->addAction(hbTrId("Search in music store")); +#endif action->setObjectName(KActionSearchInMusicStoreName); +#ifdef SUBTITLE_STR_BY_LOCID action = contextMenu->addAction(hbTrId("txt_common_menu_delete")); +#else + action = contextMenu->addAction(hbTrId("Delete")); +#endif action->setObjectName(KActionDeleteName); contextMenu->open(); @@ -230,8 +265,12 @@ void IRSongHistoryView::searchInMusicStoreContextAction() { - // Need to log the find song in NMS event, iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRFind,channelId); + // Need to log the find song in NMS event, iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRFind,channelId); +#ifdef SUBTITLE_STR_BY_LOCID popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation); +#else + popupNote(hbTrId("Music store not available"), HbMessageBox::MessageTypeInformation); +#endif } void IRSongHistoryView::deleteContextAction() { @@ -239,7 +278,11 @@ bool ret = iModel->deleteOneItem(current); if( !ret ) { +#ifdef SUBTITLE_STR_BY_LOCID popupNote(hbTrId("txt_irad_info_operation_failed"), HbMessageBox::MessageTypeWarning); +#else + popupNote(hbTrId("Operation failed"), HbMessageBox::MessageTypeWarning); +#endif } } diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irstationsview.cpp --- a/qtinternetradio/ui/src/irstationsview.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irstationsview.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -157,6 +157,16 @@ return ret; } +#ifdef HS_WIDGET_ENABLED +void IRStationsView::itemAboutToBeSelected(bool &aNeedNetwork) +{ + aNeedNetwork = true; + + int index = iListView->currentIndex().row(); + iPlayController->setConnectingStationName(iChannelModel->getChannelItemByIndex(index)->channelName); +} +#endif + // slots functions /* @@ -251,12 +261,20 @@ iApplication->stopLoadingAnimation(); disconnectIsdsClient(); +#ifdef SUBTITLE_STR_BY_LOCID QString errorString = hbTrId("txt_irad_info_failed_to_connect"); +#else + QString errorString = hbTrId("Connecting failed"); +#endif switch (aError) { case EIRQErrorNotFound: - errorString = hbTrId("txt_irad_info_no_matching_stations_found"); +#ifdef SUBTITLE_STR_BY_LOCID + errorString = hbTrId("txt_irad_info_no_matching_station_found"); +#else + errorString = hbTrId("No matching station found"); +#endif if (iConnectTimer->isActive()) { iConnectTimer->stop(); @@ -413,5 +431,9 @@ { iConnectTimer->stop(); cancelRequest(); +#ifdef SUBTITLE_STR_BY_LOCID popupNote(hbTrId("txt_irad_info_connecting_timout"), HbMessageBox::MessageTypeWarning); +#else + popupNote(hbTrId("Connecting timeout"), HbMessageBox::MessageTypeWarning); +#endif } diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/irviewmanager.cpp --- a/qtinternetradio/ui/src/irviewmanager.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/irviewmanager.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -17,6 +17,10 @@ #include #include #include +#include +#include +#include + #include "irviewmanager.h" #include "irapplication.h" @@ -46,6 +50,9 @@ static bool crossLineReady(const QLineF &aLine); static bool crossLineIntersected(const QLineF &aLineA, const QLineF &aLineB); +static const QString KActivityMainView("InternetRadioMainView"); +static const QString KActivityPlayingView("InternetRadioNowPlayingView"); + enum CrossLineAngleType { EPositiveAngle = 0, // Line within 1,3 quadrant @@ -349,7 +356,96 @@ Q_ASSERT(curView); iViewStack.push(curView); } - + +void IRViewManager::saveScreenShot() +{ + //if capture screen shot immediately for first view, can't get correct result + //use timer as a temp solution, will raise error to Orbit + QTimer::singleShot(200, this, SLOT(handleSaveScreenShot())); +} + +void IRViewManager::saveActivity() +{ + HbActivityManager *activityManager = qobject_cast(qApp)->activityManager(); + + //for embedded applications, don't publish activity. If backup activity is available, need to restore + if (XQServiceUtil::isEmbedded()) + { + if (!iActivityBackup.activityId.isEmpty()) + { + QVariantHash metadata; + metadata.insert("screenshot", iActivityBackup.screenShot); + + QByteArray serializedActivity; + QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append); + stream<addActivity(iActivityBackup.activityId, serializedActivity, metadata); + } + return; + } + + removeActivity(); + + + QVariantHash metadata; + + QByteArray serializedActivity; + QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append); + + TIRViewId viewId = getExitingView(); + switch (viewId) + { + case EIRView_MainView: + case EIRView_FavoritesView: + case EIRView_CategoryView: + stream<addActivity(KActivityMainView, serializedActivity, metadata); + break; + + case EIRView_PlayingView: + stream<addActivity(KActivityPlayingView, serializedActivity, metadata); + break; + + default: + break; + } +} + +void IRViewManager::removeActivity() +{ + if (XQServiceUtil::isEmbedded()) + { + backupActivity(); + } + + HbActivityManager *activityManager = qobject_cast(qApp)->activityManager(); + activityManager->removeActivity(KActivityMainView); + activityManager->removeActivity(KActivityPlayingView); +} + +void IRViewManager::backupActivity() +{ + HbApplication *hbApp = qobject_cast(qApp); + HbActivityManager *activityManager = hbApp->activityManager(); + QList params = activityManager->activities(); + TInt count = params.count(); + if (count > 0) + { + QVariantHash activity = params[0]; + QString path = activity.value(activity.keys().at(2)).toString(); + iActivityBackup.screenShot = QPixmap(path); + iActivityBackup.activityId = activity.value(activity.keys().at(1)).toString(); + + QByteArray serializedModel = activityManager->activityData(iActivityBackup.activityId).toByteArray(); + QDataStream stream(&serializedModel, QIODevice::ReadOnly); + int id = 0; + stream>>id; + iActivityBackup.viewId = TIRViewId(id); + } +} // slot functions @@ -491,6 +587,15 @@ } } +void IRViewManager::handleSaveScreenShot() +{ + if (!XQServiceUtil::isEmbedded()) + { + TIRViewId id = currentViewId(); + iScreenShots[id] = QPixmap::grabWidget(this, rect()); + } +} + void IRViewManager::mousePressEvent(QMouseEvent *aEvent) { if(iCrossLineEnable) @@ -591,7 +696,11 @@ { crossLineReset(); viewport()->repaint(); +#ifdef SUBTITLE_STR_BY_LOCID HbMessageBox::information(hbTrId("txt_common_info_exiting"), (QObject*)NULL, NULL); +#else + HbMessageBox::information(hbTrId("Exiting..."), (QObject*)NULL, NULL); +#endif qApp->quit(); iExiting = true; } diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/src/main.cpp --- a/qtinternetradio/ui/src/main.cpp Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/src/main.cpp Tue Jul 06 14:07:20 2010 +0300 @@ -18,12 +18,16 @@ #include #include #include +#include +#include #include "irviewmanager.h" #include "irapplication.h" #include "irmemorycollector.h" #include "irqlogger.h" #include "irqsystemeventhandler.h" +#include "irqsettings.h" +#include "irservicedef.h" #ifdef LOCALIZATION #include @@ -32,12 +36,18 @@ bool isDiskSpaceLow(IRQSystemEventHandler* aEventHandler); bool isSecondInstance(); +void setSplashScreen(); +bool isSplashNowplaying(); int main(int argc, char* argv[]) { installLogDir(); INSTALL_MESSAGE_HANDLER; + //the following is for splash screen, this must be placed + //before the creating of HbApplication + setSplashScreen(); + HbApplication app(argc, argv); #ifdef LOCALIZATION @@ -46,7 +56,11 @@ Q_ASSERT( NULL != translator ); #endif +#ifdef SUBTITLE_STR_BY_LOCID QCoreApplication::setApplicationName(hbTrId("txt_irad_title_internet_radio")); +#else + QCoreApplication::setApplicationName(hbTrId("Internet radio")); +#endif if (isSecondInstance()) { return 0; @@ -89,8 +103,13 @@ bool ret = aEventHandler->isBelowCriticalLevel(); if(ret) { - HbDeviceMessageBox messageBox(hbTrId("txt_irad_info_no_space_on_c_drive_internet_radio_closed"), +#ifdef SUBTITLE_STR_BY_LOCID + HbDeviceMessageBox messageBox(hbTrId("txt_irad_info_insufficient_disk_space"), HbMessageBox::MessageTypeWarning); +#else + HbDeviceMessageBox messageBox(hbTrId("Insufficient disk space"), + HbMessageBox::MessageTypeWarning); +#endif messageBox.setTimeout(HbPopup::NoTimeout); messageBox.exec(); } @@ -123,3 +142,22 @@ return false; } } + +void setSplashScreen() +{ + if( isSplashNowplaying() ) + { + HbSplashScreen::setScreenId("nowplaying_screen"); + } + else + { + HbSplashScreen::setScreenId("normal_screen"); + } +} + +bool isSplashNowplaying() +{ + QSettings settings(KIrSettingOrganization, KIrSettingApplication); + return settings.value(KIrSettingSplashNowplaying,false).toBool(); +} + diff -r f683e24efca3 -r 608f67c22514 qtinternetradio/ui/ui.pro --- a/qtinternetradio/ui/ui.pro Wed Jun 23 18:04:00 2010 +0300 +++ b/qtinternetradio/ui/ui.pro Tue Jul 06 14:07:20 2010 +0300 @@ -26,6 +26,33 @@ INCLUDEPATH += $${OS_LAYER_PUBLIC_EXPORT_PATH(http)} INCLUDEPATH += $${MW_LAYER_PUBLIC_EXPORT_PATH(http)} +#the following is for splash screen in phone +BLD_INF_RULES.prj_exports += "resources/splashscreen/internet_radio_default.splashml /epoc32/data/z/resource/hb/splashml/internet_radio_default.splashml" \ + "resources/splashscreen/internet_radio_default.docml /epoc32/data/z/resource/hb/splashml/internet_radio_default.docml" \ + "resources/splashscreen/internet_radio_normal.splashml /epoc32/data/z/resource/hb/splashml/internet_radio_normal.splashml" \ + "resources/splashscreen/internet_radio_normal.docml /epoc32/data/z/resource/hb/splashml/internet_radio_normal.docml" \ + "resources/splashscreen/internet_radio_nowplaying.splashml /epoc32/data/z/resource/hb/splashml/internet_radio_nowplaying.splashml" \ + "resources/splashscreen/internet_radio_nowplaying.docml /epoc32/data/z/resource/hb/splashml/internet_radio_nowplaying.docml" + +#the following is for splash screen in winscw_udeb +BLD_INF_RULES.prj_exports += "resources/splashscreen/internet_radio_default.splashml /epoc32/release/winscw/udeb/z/resource/hb/splashml/internet_radio_default.splashml" \ + "resources/splashscreen/internet_radio_default.docml /epoc32/release/winscw/udeb/z/resource/hb/splashml/internet_radio_default.docml" \ + "resources/splashscreen/internet_radio_normal.splashml /epoc32/release/winscw/udeb/z/resource/hb/splashml/internet_radio_normal.splashml" \ + "resources/splashscreen/internet_radio_normal.docml /epoc32/release/winscw/udeb/z/resource/hb/splashml/internet_radio_normal.docml" \ + "resources/splashscreen/internet_radio_nowplaying.splashml /epoc32/release/winscw/udeb/z/resource/hb/splashml/internet_radio_nowplaying.splashml" \ + "resources/splashscreen/internet_radio_nowplaying.docml /epoc32/release/winscw/udeb/z/resource/hb/splashml/internet_radio_nowplaying.docml" + + +#the following is for splash screen in winscw_urel +BLD_INF_RULES.prj_exports += "resources/splashscreen/internet_radio_default.splashml /epoc32/release/winscw/urel/z/resource/hb/splashml/internet_radio_default.splashml" \ + "resources/splashscreen/internet_radio_default.docml /epoc32/release/winscw/urel/z/resource/hb/splashml/internet_radio_default.docml" \ + "resources/splashscreen/internet_radio_normal.splashml /epoc32/release/winscw/urel/z/resource/hb/splashml/internet_radio_normal.splashml" \ + "resources/splashscreen/internet_radio_normal.docml /epoc32/release/winscw/urel/z/resource/hb/splashml/internet_radio_normal.docml" \ + "resources/splashscreen/internet_radio_nowplaying.splashml /epoc32/release/winscw/urel/z/resource/hb/splashml/internet_radio_nowplaying.splashml" \ + "resources/splashscreen/internet_radio_nowplaying.docml /epoc32/release/winscw/urel/z/resource/hb/splashml/internet_radio_nowplaying.docml" + + + INCLUDEPATH += inc \ ..\irqisdsclient\inc \ ..\irqmediaplayer\inc \ @@ -63,7 +90,8 @@ -lirqlogger \ -lshareui \ -lirqsystemeventhandler \ - -lxqservice \ + -lxqsettingsmanager \ + -lxqservice \ -lxqserviceutil symbian{ @@ -107,6 +135,8 @@ inc\irstationshare.h \ inc\irstationdetailsview.h \ inc\irtermsconsview.h \ + inc\ircontrolservice.h \ + inc\irmonitorservice.h \ inc\irplaylist.h \ inc\irsearchresultdb.h \ inc\irfileviewservice.h @@ -143,6 +173,8 @@ irstationshare.cpp \ irstationdetailsview.cpp \ irtermsconsview.cpp \ + ircontrolservice.cpp \ + irmonitorservice.cpp \ irplaylist.cpp \ irsearchresultdb.cpp \ irfileviewservice.cpp