--- a/internetradio2.0/inc/irdebug.h Thu Sep 02 20:17:46 2010 +0300
+++ b/internetradio2.0/inc/irdebug.h Fri Sep 17 08:27:59 2010 +0300
@@ -46,7 +46,9 @@
// DEBUG SETTINGS:
// To enable /adjust debug output, modify values ONLY in this section
/////////////////////////////////////////////////////////////////////
-//#define IRDEBUG_LOGGING_ENABLED
+#ifndef NDEBUG
+#define IRDEBUG_LOGGING_ENABLED
+#endif
//#define IRDEBUG_TRACE_TO_FILE
--- a/internetradio2.0/irdataprovider/src/irhttpdataprovider.cpp Thu Sep 02 20:17:46 2010 +0300
+++ b/internetradio2.0/irdataprovider/src/irhttpdataprovider.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -45,6 +45,12 @@
const TUid KUidHelixController = { 0x101F8514 }; // Helix Video controller UID
const TInt KLogbufferLenth = KLogBufferSize/2 - 1;
+// Since the supported formats gotten from Helix don't include aac & aacp while it
+// does support them, we add them here.
+_LIT( KIRDPAacMimeType, "audio/aac" );
+_LIT( KIRDPAacpMimeType, "audio/aacp" );
+_LIT( KComma, "," );
+
// ---------------------------------------------------------------------------
// CIRHttpDataProvider::CIRHttpDataProvider(MIRHttpDataProviderObserver&
// aObserver):iObserver(aObserver),iRunning(EFalse)
@@ -793,7 +799,6 @@
}
else
{
- _LIT(KComma,",");
audioMIMEs.Append( KComma );
}
tempD++;
@@ -804,6 +809,13 @@
}
};
+ // Since the supported formats gotten from Helix don't include aac & aacp while it
+ // does support them, we add them here.
+ audioMIMEs.Append( KIRDPAacMimeType );
+ audioMIMEs.Append( KComma );
+ audioMIMEs.Append( KIRDPAacpMimeType );
+ audioMIMEs.Append( KComma );
+
// Set the X-Nokia-iRAPP-Accept header
TBuf8<KNokiaIrAppAcceptMaxLength> xNokiaIrAppAccept;
_LIT(KXNokiaIrAppAccept,"X-Nokia-iRAPP-Accept");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/internetradio2.0/rom/bld.inf Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2010 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: Build information file for project InternetRadio
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <bldvariant.hrh>
+
+#include "../ircachemgmt/group/bld.inf"
+#include "../ircommon/group/bld.inf"
+#include "../irdataprovider/group/bld.inf"
+#include "../irfavoritesdb/group/bld.inf"
+#include "../irfilerecognizer/group/bld.inf"
+#include "../irisdsclient/group/bld.inf"
+#include "../irnetworkcontroller/group/bld.inf"
+#include "../irpresetplugin/group/bld.inf"
+#include "../irrfsplugin/group/bld.inf"
+#include "../irsessionlog/group/bld.inf"
+#include "../irsettings/group/bld.inf"
+#include "../irxmlparser/group/bld.inf"
+
+PRJ_EXPORTS
+../group/backup_registration.xml /epoc32/data/z/private/2002ffac/backup_registration.xml
+
+//ROM Build
+// THESE COMMENTED IBYS SHOULD BE EXPORTED BY PRODUCTS
+internetradio.iby CORE_APP_LAYER_IBY_EXPORT_PATH(internetradio.iby)
+internetradiosettings.iby CORE_APP_LAYER_IBY_EXPORT_PATH(internetradiosettings.iby)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemDefinition schema="3.0.0" xmlns:qt="http://www.nokia.com/qt">
+ <package id="internetradio" name="Internet Radio Apps" levels="engine server ui">
+ <collection id="internetradio2_0" name="Internet Radio 2.0" level="ui">
+ <!-- collection is really a component. Move down a dir -->
+ <component id="internetradio2_0_rom" name="Internet Radio 2.0 ROM" class="config" filter="s60">
+ <unit bldFile="internetradio2.0/rom"/>
+ </component>
+ <component id="ircachemgmt" name="Internet Radio Cache Management" filter="s60">
+ <unit bldFile="internetradio2.0/ircachemgmt/group"/>
+ </component>
+ <component id="ircommon" name="Internet Radio Common" filter="s60">
+ <unit bldFile="internetradio2.0/ircommon/group"/>
+ </component>
+ <component id="irdataprovider" name="Internet Radio Data Provider" filter="s60">
+ <unit bldFile="internetradio2.0/irdataprovider/group"/>
+ </component>
+ <component id="irfavoritesdb" name="Internet Radio Favorites Database" filter="s60">
+ <unit bldFile="internetradio2.0/irfavoritesdb/group"/>
+ </component>
+ <component id="irfilerecognizer" name="Internet Radio File Recognizer" filter="s60">
+ <unit bldFile="internetradio2.0/irfilerecognizer/group"/>
+ </component>
+ <component id="irisdsclient" name="Internet Radio ISDS Client" filter="s60">
+ <unit bldFile="internetradio2.0/irisdsclient/group"/>
+ </component>
+ <component id="irnetworkcontroller" name="Internet Radio Network Controller" filter="s60">
+ <unit bldFile="internetradio2.0/irnetworkcontroller/group"/>
+ </component>
+ <component id="irpresetplugin" name="Internet Radio Preset Plugin" filter="s60" class="plugin">
+ <unit bldFile="internetradio2.0/irpresetplugin/group"/>
+ </component>
+ <component id="irrfsplugin" name="Internet Radio RFS Plugin" filter="s60" class="plugin">
+ <unit bldFile="internetradio2.0/irrfsplugin/group"/>
+ </component>
+ <component id="irsessionlog" name="Internet Radio Session Log" filter="s60">
+ <unit bldFile="internetradio2.0/irsessionlog/group"/>
+ </component>
+ <component id="irsettings" name="Internet Radio Settings" filter="s60">
+ <unit bldFile="internetradio2.0/irsettings/group"/>
+ </component>
+ <component id="irxmlparser" name="Internet Radio XML Parser" filter="s60">
+ <unit bldFile="internetradio2.0/irxmlparser/group"/>
+ </component>
+ </collection>
+ <collection id="presetserver" name="Preset Server" level="server">
+ <!-- collection is really a component. Move down a dir -->
+ <component id="presetserver_build" name="Preset Server Build" filter="s60">
+ <unit bldFile="presetserver/group"/>
+ </component>
+ </collection>
+ <collection id="qtinternetradio" name="Qt Internet Radio">
+ <component id="qtinternetradio_build" name="Qt Internet Radio Build" filter="s60">
+ <!-- Move down a dir or break into components-->
+ <unit bldFile="qtinternetradio" qt:proFile="all.pro" qt:qmakeArgs="-r -config rom"/>
+ </component>
+ <component id="qtinternetradio_internal" name="Qt Internet Radio Internal" filter="s60,test,qt_unit_test">
+ <!-- appears to be missing. Remove?
+ <unit bldFile="qtinternetradio/internal/tsrc" qt:proFile="tsrc.pro" filter="TA_InternetRadio"/> -->
+ </component>
+ </collection>
+ </package>
+</SystemDefinition>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/package_map.xml Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,1 @@
+<PackageMap root="sf" layer="app"/>
--- a/qtinternetradio/all.pro Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/all.pro Fri Sep 17 08:27:59 2010 +0300
@@ -30,6 +30,7 @@
SUBDIRS = irqlogger \
irqcommon \
irqsystemeventhandler \
+ irdb \
irqsettings \
irqfavoritesdb \
irqisdsclient \
@@ -37,8 +38,8 @@
irqnetworkcontroller \
irqsonghistory \
irqnwkinfoobserver \
- irqstatisticsreporter \
- irhswidgetplugin \
+ irqstatisticsreporter \
+ irhswidgetplugin \
ui
SYMBIAN_PLATFORMS = WINSCW ARMV5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/bwins/irdbu.def Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,57 @@
+EXPORTS
+ ?getChannelId@IRDBWrapper@@QAEPAV?$QList@I@@PBV?$QMap@IVQString@@@@0@Z @ 1 NONAME ; class QList<unsigned int> * IRDBWrapper::getChannelId(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ??_EIRDBWrapper@@UAE@I@Z @ 2 NONAME ; IRDBWrapper::~IRDBWrapper(unsigned int)
+ ??_EsearchRltWrapper@@UAE@I@Z @ 3 NONAME ; searchRltWrapper::~searchRltWrapper(unsigned int)
+ ?combineDeleteStr@IRDBWrapper@@IAEXPBV?$QMap@IVQString@@@@0PBVQString@@AAV3@@Z @ 4 NONAME ; void IRDBWrapper::combineDeleteStr(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *, class QString const *, class QString &)
+ ?srhChannelId@searchRltWrapper@@AAEIAAVQString@@PBV?$QMap@IVQString@@@@1@Z @ 5 NONAME ; unsigned int searchRltWrapper::srhChannelId(class QString &, class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ??0urlInfoWrapper@@QAE@XZ @ 6 NONAME ; urlInfoWrapper::urlInfoWrapper(void)
+ ??1imgWrapper@@UAE@XZ @ 7 NONAME ; imgWrapper::~imgWrapper(void)
+ ??0channelHistoryWrapper@@QAE@XZ @ 8 NONAME ; channelHistoryWrapper::channelHistoryWrapper(void)
+ ??0IRDBWrapper@@QAE@XZ @ 9 NONAME ; IRDBWrapper::IRDBWrapper(void)
+ ?getImg@imgWrapper@@QAEPAV?$QList@PAVQVariant@@@@PBV?$QMap@IVQString@@@@0@Z @ 10 NONAME ; class QList<class QVariant *> * imgWrapper::getImg(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ?loadDataOfChannelIdCB@IRDBWrapper@@AAE_NAAVQSqlQuery@@PAV?$QList@I@@@Z @ 11 NONAME ; bool IRDBWrapper::loadDataOfChannelIdCB(class QSqlQuery &, class QList<unsigned int> *)
+ ?getIRDB@IRDBWrapper@@IAEPAV?$QList@PAVQVariant@@@@PBV?$QMap@IVQString@@@@0@Z @ 12 NONAME ; class QList<class QVariant *> * IRDBWrapper::getIRDB(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ?combinePutStr@IRDBWrapper@@IAEXPBV?$QMap@IVQString@@@@PBVQString@@AAV3@2PBV?$QMap@IVQByteArray@@@@PAV?$QList@VQByteArray@@@@@Z @ 13 NONAME ; void IRDBWrapper::combinePutStr(class QMap<unsigned int, class QString> const *, class QString const *, class QString &, class QString &, class QMap<unsigned int, class QByteArray> const *, class QList<class QByteArray> *)
+ ??1searchRltWrapper@@UAE@XZ @ 14 NONAME ; searchRltWrapper::~searchRltWrapper(void)
+ ?putChannelHistory@channelHistoryWrapper@@QAE_NPBV?$QMap@IVQString@@@@PAIPBV?$QMap@IVQByteArray@@@@00@Z @ 15 NONAME ; bool channelHistoryWrapper::putChannelHistory(class QMap<unsigned int, class QString> const *, unsigned int *, class QMap<unsigned int, class QByteArray> const *, class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ??1urlInfoWrapper@@UAE@XZ @ 16 NONAME ; urlInfoWrapper::~urlInfoWrapper(void)
+ ?getIRTableCB@songHistoryWrapper@@EAE_NAAVQSqlQuery@@PAV?$QList@PAVQVariant@@@@@Z @ 17 NONAME ; bool songHistoryWrapper::getIRTableCB(class QSqlQuery &, class QList<class QVariant *> *)
+ ?deleteSongHistory@songHistoryWrapper@@QAE_NPBV?$QMap@IVQString@@@@0@Z @ 18 NONAME ; bool songHistoryWrapper::deleteSongHistory(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ?resetUrlInfo@urlInfoWrapper@@QAE_NPBV?$QMap@VQString@@I@@ABI@Z @ 19 NONAME ; bool urlInfoWrapper::resetUrlInfo(class QMap<class QString, unsigned int> const *, unsigned int const &)
+ ?getIRTableCB@searchRltWrapper@@EAE_NAAVQSqlQuery@@PAV?$QList@PAVQVariant@@@@@Z @ 20 NONAME ; bool searchRltWrapper::getIRTableCB(class QSqlQuery &, class QList<class QVariant *> *)
+ ?getIRTableCB@imgWrapper@@EAE_NAAVQSqlQuery@@PAV?$QList@PAVQVariant@@@@@Z @ 21 NONAME ; bool imgWrapper::getIRTableCB(class QSqlQuery &, class QList<class QVariant *> *)
+ ?combineGetStr@IRDBWrapper@@IAEXPBV?$QMap@IVQString@@@@0PBVQString@@AAV3@@Z @ 22 NONAME ; void IRDBWrapper::combineGetStr(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *, class QString const *, class QString &)
+ ??1channelHistoryWrapper@@UAE@XZ @ 23 NONAME ; channelHistoryWrapper::~channelHistoryWrapper(void)
+ ?deleteFavorites@favoritesWrapper@@QAE_NPBV?$QMap@IVQString@@@@0@Z @ 24 NONAME ; bool favoritesWrapper::deleteFavorites(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ?combineCondStr@IRDBWrapper@@IAEXPBV?$QMap@IVQString@@@@0PBVQString@@AAV3@@Z @ 25 NONAME ; void IRDBWrapper::combineCondStr(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *, class QString const *, class QString &)
+ ??0searchRltWrapper@@QAE@XZ @ 26 NONAME ; searchRltWrapper::searchRltWrapper(void)
+ ??0songHistoryWrapper@@QAE@XZ @ 27 NONAME ; songHistoryWrapper::songHistoryWrapper(void)
+ ?putFavorites@favoritesWrapper@@QAE_NPAV?$QMap@IVQString@@@@AA_N@Z @ 28 NONAME ; bool favoritesWrapper::putFavorites(class QMap<unsigned int, class QString> *, bool &)
+ ??_EfavoritesWrapper@@UAE@I@Z @ 29 NONAME ; favoritesWrapper::~favoritesWrapper(unsigned int)
+ ?getIRTableCB@IRDBWrapper@@EAE_NAAVQSqlQuery@@PAV?$QList@PAVQVariant@@@@@Z @ 30 NONAME ; bool IRDBWrapper::getIRTableCB(class QSqlQuery &, class QList<class QVariant *> *)
+ ?getChannelHistory@channelHistoryWrapper@@QAEPAV?$QList@PAVQVariant@@@@PBV?$QMap@IVQString@@@@0@Z @ 31 NONAME ; class QList<class QVariant *> * channelHistoryWrapper::getChannelHistory(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ?srhChannelId@channelHistoryWrapper@@AAEIAAVQString@@PBV?$QMap@IVQString@@@@1@Z @ 32 NONAME ; unsigned int channelHistoryWrapper::srhChannelId(class QString &, class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ??_EsongHistoryWrapper@@UAE@I@Z @ 33 NONAME ; songHistoryWrapper::~songHistoryWrapper(unsigned int)
+ ??1favoritesWrapper@@UAE@XZ @ 34 NONAME ; favoritesWrapper::~favoritesWrapper(void)
+ ??_EchannelHistoryWrapper@@UAE@I@Z @ 35 NONAME ; channelHistoryWrapper::~channelHistoryWrapper(unsigned int)
+ ?putSongHistory@songHistoryWrapper@@QAE_NPBV?$QMap@IVQString@@@@00@Z @ 36 NONAME ; bool songHistoryWrapper::putSongHistory(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ?getFavorites@favoritesWrapper@@QAEPAV?$QList@PAVQVariant@@@@PBV?$QMap@IVQString@@@@0@Z @ 37 NONAME ; class QList<class QVariant *> * favoritesWrapper::getFavorites(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ?putSearchRlt@searchRltWrapper@@QAE_NPBV?$QMap@IVQString@@@@PBV?$QMap@IVQByteArray@@@@00@Z @ 38 NONAME ; bool searchRltWrapper::putSearchRlt(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QByteArray> const *, class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ?loadDataOfIRDBCB@IRDBWrapper@@AAE_NAAVQSqlQuery@@PAV?$QList@PAVQVariant@@@@@Z @ 39 NONAME ; bool IRDBWrapper::loadDataOfIRDBCB(class QSqlQuery &, class QList<class QVariant *> *)
+ ?getUrlInfo@urlInfoWrapper@@QAEPAV?$QList@PAVQVariant@@@@PBV?$QMap@IVQString@@@@0@Z @ 40 NONAME ; class QList<class QVariant *> * urlInfoWrapper::getUrlInfo(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ??_EurlInfoWrapper@@UAE@I@Z @ 41 NONAME ; urlInfoWrapper::~urlInfoWrapper(unsigned int)
+ ??1songHistoryWrapper@@UAE@XZ @ 42 NONAME ; songHistoryWrapper::~songHistoryWrapper(void)
+ ?getIRTableCB@favoritesWrapper@@EAE_NAAVQSqlQuery@@PAV?$QList@PAVQVariant@@@@@Z @ 43 NONAME ; bool favoritesWrapper::getIRTableCB(class QSqlQuery &, class QList<class QVariant *> *)
+ ??_EimgWrapper@@UAE@I@Z @ 44 NONAME ; imgWrapper::~imgWrapper(unsigned int)
+ ?combineInsertStr@urlInfoWrapper@@AAEXPBV?$QMap@VQString@@I@@ABIAAVQStringList@@@Z @ 45 NONAME ; void urlInfoWrapper::combineInsertStr(class QMap<class QString, unsigned int> const *, unsigned int const &, class QStringList &)
+ ?deleteChannelHistory@channelHistoryWrapper@@QAE_NPBV?$QMap@IVQString@@@@0@Z @ 46 NONAME ; bool channelHistoryWrapper::deleteChannelHistory(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ?getIRTableCB@channelHistoryWrapper@@EAE_NAAVQSqlQuery@@PAV?$QList@PAVQVariant@@@@@Z @ 47 NONAME ; bool channelHistoryWrapper::getIRTableCB(class QSqlQuery &, class QList<class QVariant *> *)
+ ??1IRDBWrapper@@UAE@XZ @ 48 NONAME ; IRDBWrapper::~IRDBWrapper(void)
+ ?getSearchRlt@searchRltWrapper@@QAEPAV?$QList@PAVQVariant@@@@PBV?$QMap@IVQString@@@@0@Z @ 49 NONAME ; class QList<class QVariant *> * searchRltWrapper::getSearchRlt(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ?deleteSearchRlt@searchRltWrapper@@QAE_NPBV?$QMap@IVQString@@@@0@Z @ 50 NONAME ; bool searchRltWrapper::deleteSearchRlt(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ?updateImg@imgWrapper@@QAE_NPBV?$QMap@IVQString@@@@ABIPBV?$QMap@IVQByteArray@@@@@Z @ 51 NONAME ; bool imgWrapper::updateImg(class QMap<unsigned int, class QString> const *, unsigned int const &, class QMap<unsigned int, class QByteArray> const *)
+ ??0favoritesWrapper@@QAE@XZ @ 52 NONAME ; favoritesWrapper::favoritesWrapper(void)
+ ??0imgWrapper@@QAE@XZ @ 53 NONAME ; imgWrapper::imgWrapper(void)
+ ?getSongHistory@songHistoryWrapper@@QAEPAV?$QList@PAVQVariant@@@@PBV?$QMap@IVQString@@@@0@Z @ 54 NONAME ; class QList<class QVariant *> * songHistoryWrapper::getSongHistory(class QMap<unsigned int, class QString> const *, class QMap<unsigned int, class QString> const *)
+ ?getIRTableCB@urlInfoWrapper@@EAE_NAAVQSqlQuery@@PAV?$QList@PAVQVariant@@@@@Z @ 55 NONAME ; bool urlInfoWrapper::getIRTableCB(class QSqlQuery &, class QList<class QVariant *> *)
+
--- a/qtinternetradio/common.pri Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/common.pri Fri Sep 17 08:27:59 2010 +0300
@@ -24,7 +24,7 @@
# ##########################################################
# Enable logging in release builds
-# LOGGING_FLAGS += LOGGING_ENABLED
+LOGGING_FLAGS += LOGGING_ENABLED
# Combines Ui and Engine logs
# LOGGING_FLAGS += COMBINE_WITH_ENGINE_LOGGER
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/eabi/irdbu.def Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,85 @@
+EXPORTS
+ _ZN10imgWrapper12getIRTableCBER9QSqlQueryP5QListIP8QVariantE @ 1 NONAME
+ _ZN10imgWrapper6getImgEPK4QMapIj7QStringES4_ @ 2 NONAME
+ _ZN10imgWrapper9updateImgEPK4QMapIj7QStringERKjPKS0_Ij10QByteArrayE @ 3 NONAME
+ _ZN10imgWrapperC1Ev @ 4 NONAME
+ _ZN10imgWrapperC2Ev @ 5 NONAME
+ _ZN10imgWrapperD0Ev @ 6 NONAME
+ _ZN10imgWrapperD1Ev @ 7 NONAME
+ _ZN10imgWrapperD2Ev @ 8 NONAME
+ _ZN11IRDBWrapper12getChannelIdEPK4QMapIj7QStringES4_ @ 9 NONAME
+ _ZN11IRDBWrapper12getIRTableCBER9QSqlQueryP5QListIP8QVariantE @ 10 NONAME
+ _ZN11IRDBWrapper13combineGetStrEPK4QMapIj7QStringES4_PKS1_RS1_ @ 11 NONAME
+ _ZN11IRDBWrapper13combinePutStrEPK4QMapIj7QStringEPKS1_RS1_S7_PKS0_Ij10QByteArrayEP5QListIS8_E @ 12 NONAME
+ _ZN11IRDBWrapper14combineCondStrEPK4QMapIj7QStringES4_PKS1_RS1_ @ 13 NONAME
+ _ZN11IRDBWrapper16combineDeleteStrEPK4QMapIj7QStringES4_PKS1_RS1_ @ 14 NONAME
+ _ZN11IRDBWrapper16loadDataOfIRDBCBER9QSqlQueryP5QListIP8QVariantE @ 15 NONAME
+ _ZN11IRDBWrapper21loadDataOfChannelIdCBER9QSqlQueryP5QListIjE @ 16 NONAME
+ _ZN11IRDBWrapper7getIRDBEPK4QMapIj7QStringES4_ @ 17 NONAME
+ _ZN11IRDBWrapperC1Ev @ 18 NONAME
+ _ZN11IRDBWrapperC2Ev @ 19 NONAME
+ _ZN11IRDBWrapperD0Ev @ 20 NONAME
+ _ZN11IRDBWrapperD1Ev @ 21 NONAME
+ _ZN11IRDBWrapperD2Ev @ 22 NONAME
+ _ZN14urlInfoWrapper10getUrlInfoEPK4QMapIj7QStringES4_ @ 23 NONAME
+ _ZN14urlInfoWrapper12getIRTableCBER9QSqlQueryP5QListIP8QVariantE @ 24 NONAME
+ _ZN14urlInfoWrapper12resetUrlInfoEPK4QMapI7QStringjERKj @ 25 NONAME
+ _ZN14urlInfoWrapper16combineInsertStrEPK4QMapI7QStringjERKjR11QStringList @ 26 NONAME
+ _ZN14urlInfoWrapperC1Ev @ 27 NONAME
+ _ZN14urlInfoWrapperC2Ev @ 28 NONAME
+ _ZN14urlInfoWrapperD0Ev @ 29 NONAME
+ _ZN14urlInfoWrapperD1Ev @ 30 NONAME
+ _ZN14urlInfoWrapperD2Ev @ 31 NONAME
+ _ZN16favoritesWrapper12getFavoritesEPK4QMapIj7QStringES4_ @ 32 NONAME
+ _ZN16favoritesWrapper12getIRTableCBER9QSqlQueryP5QListIP8QVariantE @ 33 NONAME
+ _ZN16favoritesWrapper12putFavoritesEP4QMapIj7QStringERb @ 34 NONAME
+ _ZN16favoritesWrapper15deleteFavoritesEPK4QMapIj7QStringES4_ @ 35 NONAME
+ _ZN16favoritesWrapperC1Ev @ 36 NONAME
+ _ZN16favoritesWrapperC2Ev @ 37 NONAME
+ _ZN16favoritesWrapperD0Ev @ 38 NONAME
+ _ZN16favoritesWrapperD1Ev @ 39 NONAME
+ _ZN16favoritesWrapperD2Ev @ 40 NONAME
+ _ZN16searchRltWrapper12getIRTableCBER9QSqlQueryP5QListIP8QVariantE @ 41 NONAME
+ _ZN16searchRltWrapper12getSearchRltEPK4QMapIj7QStringES4_ @ 42 NONAME
+ _ZN16searchRltWrapper12putSearchRltEPK4QMapIj7QStringEPKS0_Ij10QByteArrayES4_S4_ @ 43 NONAME
+ _ZN16searchRltWrapper12srhChannelIdER7QStringPK4QMapIjS0_ES5_ @ 44 NONAME
+ _ZN16searchRltWrapper15deleteSearchRltEPK4QMapIj7QStringES4_ @ 45 NONAME
+ _ZN16searchRltWrapperC1Ev @ 46 NONAME
+ _ZN16searchRltWrapperC2Ev @ 47 NONAME
+ _ZN16searchRltWrapperD0Ev @ 48 NONAME
+ _ZN16searchRltWrapperD1Ev @ 49 NONAME
+ _ZN16searchRltWrapperD2Ev @ 50 NONAME
+ _ZN18songHistoryWrapper12getIRTableCBER9QSqlQueryP5QListIP8QVariantE @ 51 NONAME
+ _ZN18songHistoryWrapper14getSongHistoryEPK4QMapIj7QStringES4_ @ 52 NONAME
+ _ZN18songHistoryWrapper14putSongHistoryEPK4QMapIj7QStringES4_S4_ @ 53 NONAME
+ _ZN18songHistoryWrapper17deleteSongHistoryEPK4QMapIj7QStringES4_ @ 54 NONAME
+ _ZN18songHistoryWrapperC1Ev @ 55 NONAME
+ _ZN18songHistoryWrapperC2Ev @ 56 NONAME
+ _ZN18songHistoryWrapperD0Ev @ 57 NONAME
+ _ZN18songHistoryWrapperD1Ev @ 58 NONAME
+ _ZN18songHistoryWrapperD2Ev @ 59 NONAME
+ _ZN21channelHistoryWrapper12getIRTableCBER9QSqlQueryP5QListIP8QVariantE @ 60 NONAME
+ _ZN21channelHistoryWrapper12srhChannelIdER7QStringPK4QMapIjS0_ES5_ @ 61 NONAME
+ _ZN21channelHistoryWrapper17getChannelHistoryEPK4QMapIj7QStringES4_ @ 62 NONAME
+ _ZN21channelHistoryWrapper17putChannelHistoryEPK4QMapIj7QStringEPjPKS0_Ij10QByteArrayES4_S4_ @ 63 NONAME
+ _ZN21channelHistoryWrapper20deleteChannelHistoryEPK4QMapIj7QStringES4_ @ 64 NONAME
+ _ZN21channelHistoryWrapperC1Ev @ 65 NONAME
+ _ZN21channelHistoryWrapperC2Ev @ 66 NONAME
+ _ZN21channelHistoryWrapperD0Ev @ 67 NONAME
+ _ZN21channelHistoryWrapperD1Ev @ 68 NONAME
+ _ZN21channelHistoryWrapperD2Ev @ 69 NONAME
+ _ZTI10imgWrapper @ 70 NONAME
+ _ZTI11IRDBWrapper @ 71 NONAME
+ _ZTI14urlInfoWrapper @ 72 NONAME
+ _ZTI16favoritesWrapper @ 73 NONAME
+ _ZTI16searchRltWrapper @ 74 NONAME
+ _ZTI18songHistoryWrapper @ 75 NONAME
+ _ZTI21channelHistoryWrapper @ 76 NONAME
+ _ZTV10imgWrapper @ 77 NONAME
+ _ZTV11IRDBWrapper @ 78 NONAME
+ _ZTV14urlInfoWrapper @ 79 NONAME
+ _ZTV16favoritesWrapper @ 80 NONAME
+ _ZTV16searchRltWrapper @ 81 NONAME
+ _ZTV18songHistoryWrapper @ 82 NONAME
+ _ZTV21channelHistoryWrapper @ 83 NONAME
+
--- a/qtinternetradio/install/ir3_qtinternetradio_armv5_udeb.pkg Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/install/ir3_qtinternetradio_armv5_udeb.pkg Fri Sep 17 08:27:59 2010 +0300
@@ -61,4 +61,5 @@
"\epoc32\release\armv5\udeb\irqnwkinfoobserver.dll" - "!:\sys\bin\irqnwkinfoobserver.dll"
"\epoc32\release\armv5\udeb\irqstatisticsreporter.dll" - "!:\sys\bin\irqstatisticsreporter.dll"
"\epoc32\release\armv5\udeb\irqsystemeventhandler.dll" - "!:\sys\bin\irqsystemeventhandler.dll"
-"\epoc32\release\armv5\udeb\irqlogger.dll" - "!:\sys\bin\irqlogger.dll"
\ No newline at end of file
+"\epoc32\release\armv5\udeb\irqlogger.dll" - "!:\sys\bin\irqlogger.dll"
+"\epoc32\release\armv5\urel\irdb.dll" - "!:\sys\bin\irdb.dll"
\ No newline at end of file
--- a/qtinternetradio/install/ir3_qtinternetradio_armv5_urel.pkg Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/install/ir3_qtinternetradio_armv5_urel.pkg Fri Sep 17 08:27:59 2010 +0300
@@ -62,4 +62,5 @@
"\epoc32\release\armv5\urel\irqnwkinfoobserver.dll" - "!:\sys\bin\irqnwkinfoobserver.dll"
"\epoc32\release\armv5\urel\irqstatisticsreporter.dll" - "!:\sys\bin\irqstatisticsreporter.dll"
"\epoc32\release\armv5\urel\irqsystemeventhandler.dll" - "!:\sys\bin\irqsystemeventhandler.dll"
-"\epoc32\release\armv5\urel\irqlogger.dll" - "!:\sys\bin\irqlogger.dll"
\ No newline at end of file
+"\epoc32\release\armv5\urel\irqlogger.dll" - "!:\sys\bin\irqlogger.dll"
+"\epoc32\release\armv5\urel\irdb.dll" - "!:\sys\bin\irdb.dll"
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/inc/channelhistorywrapper.h Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* 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.
+*
+* Description:
+*
+*/
+
+#ifndef _CHANNEL_HISTORY_WRAPPER_H_
+#define _CHANNEL_HISTORY_WRAPPER_H_
+
+#include "irdbexport.h"
+#include "irdbwrapper.h"
+
+class IRDB_DLL_EXPORT channelHistoryWrapper: public IRDBWrapper
+{
+public:
+ channelHistoryWrapper();
+ ~channelHistoryWrapper();
+
+public:
+ /*
+ * RowData: [direction: in]table row value;
+ * cidUserDefined: [direction: out] return the channelid allocated by IRDB,
+ * the channelId is a user-defined channelId;
+ * logoMap: [direction: in]the logo rowData will be inserted into irdb via this structure;
+ * the logo rowData should be filled into logoMap as below:
+ * logoMap* pLogo = new logoMap();
+ * QByteArray bLog("XXXXXXXXXXXXXXXX");
+ * QByteArray sLog("ssssssssssssssss");
+ * pLogo->insert(bLogoInsert, bLog);
+ * pLogo->insert(sLogoInsert, sLog);
+ *
+ * condAND: [direction: in]condition for search channelHistory, it is AND relationship in every pair;
+ * condOR: [direction: in]condition for search channelHistory, it is OR relationship in every pair;
+ */
+ bool putChannelHistory(const columnMap* const RowData,
+ uint* const cidUserDefined = NULL,
+ const logoMap* const logoData = NULL,
+ const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+ /*
+ * If all parameters are default,all rows in channelHistory will be deleted if not violating constraint;
+ * condAND: [direction: in]condition for search channelHistory, it is AND relationship in every pair;
+ * condOR: [direction: in]condition for search channelHistory, it is OR relationship in every pair;
+ */
+ bool deleteChannelHistory(const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+ /*
+ * If all parameters are default, all rows in channelHistory will return;
+ * condAND: [direction: in]condition for search channelHistory, it is AND relationship in every pair;
+ * condOR: [direction: in]condition for search channelHistory, it is OR relationship in every pair;
+ */
+ QList<QVariant*>* getChannelHistory(const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+private:
+ /*
+ * It is called by IRDB instance;
+ * IRDB instance delivers rows set to IRDBWrapper via this function;
+ * the rows set is storaged in m_IRDataSet;
+ */
+ bool getIRTableCB(QSqlQuery& aIRDataSet,
+ QList<QVariant*>* pDataSet);
+
+private:
+ /*
+ * search channelId according to parameter;
+ * condUserCidStr:[direction: in]specific condition(where) string for user-define uid;
+ * condAND: [direction: in]condition for search channelHistory, it is AND relationship in every pair;
+ * condOR: [direction: in]condition for search channelHistory, it is OR relationship in every pair;
+ * uint: return channelId;
+ */
+ uint srhChannelId(QString& condUserCidStr,
+ const columnMap* const condAND,
+ const columnMap* const condOR = NULL);
+
+};
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/inc/favoriteswrapper.h Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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.
+*
+* Description:
+*
+*/
+
+#ifndef _FAVORITES_WRAPPER_H_
+#define _FAVORITES_WRAPPER_H_
+
+#include "irdbexport.h"
+#include "irdbwrapper.h"
+
+class IRDB_DLL_EXPORT favoritesWrapper: public IRDBWrapper
+{
+public:
+ favoritesWrapper();
+ ~favoritesWrapper();
+
+public:
+ /*
+ * RowData: [direction: in] table row value;
+ * bNewRow: [direction: out] true for new row added to favorites table;
+ * false for row updated;
+ * return true if operation success;
+ */
+ bool putFavorites(columnMap* const RowData,
+ bool& bNewRow);
+
+public:
+ /*
+ * If all parameters are default,all rows in favorites will be deleted if not violating constraint;
+ * condAND: [direction: in]condition for search favorites, it is AND relationship in every pair;
+ * condOR: [direction: in]condition for search favorites, it is OR relationship in every pair;
+ * return true if operation success;
+ */
+ bool deleteFavorites(const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+public:
+ /*
+ * If all parameters are default, all rows in favorites will return;
+ * condAND: [direction: in]condition for search favorites, it is AND relationship in every pair;
+ * condOR: [direction: in]condition for search favorites, it is OR relationship in every pair;
+ * return true if operation success;
+ */
+ QList<QVariant*>* getFavorites(const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+private:
+ /*
+ * It is called by IRDB instance;
+ * IRDB instance delivers rows set to IRDBWrapper via this function;
+ * the rows set is storaged in m_IRDataSet;
+ */
+ bool getIRTableCB(QSqlQuery& aIRDataSet,
+ QList<QVariant*>* pDataSet);
+
+};
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/inc/imgwrapper.h Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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.
+*
+* Description:
+*
+*/
+
+#ifndef _IMG_WRAPPER_H_
+#define _IMG_WRAPPER_H_
+
+#include "irdbexport.h"
+#include "irdbwrapper.h"
+
+class IRDB_DLL_EXPORT imgWrapper: public IRDBWrapper
+{
+public:
+ imgWrapper();
+ ~imgWrapper();
+
+public:
+ /*
+ * RowData: [direction: in] table row value, only accept imgUrl and imgLocalFile column;
+ * channelId: [direction: in] channelid for update row;
+ * return true if operation success;
+ */
+ bool updateImg(const columnMap* const RowData,
+ const uint& channelId,
+ const logoMap* const logoData = NULL);
+
+ QList<QVariant*>* getImg(const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+private:
+ /*
+ * It is called by IRDB instance;
+ * IRDB instance delivers rows set to IRDBWrapper via this function;
+ * the rows set is storaged in m_IRDataSet;
+ */
+ bool getIRTableCB(QSqlQuery& aIRDataSet,
+ QList<QVariant*>* pDataSet);
+
+};
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/inc/irdb.h Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,257 @@
+/*
+* 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.
+*
+* Description: Manipulate Interface of Internet Radio Database
+*
+*/
+
+#ifndef IRDB_H_
+#define IRDB_H_
+
+#include <QSqlDatabase>
+
+typedef unsigned char IRDBCHAR;
+
+class QSqlQuery;
+class QMutex;
+class IRDBWrapper;
+
+class IRDB
+{
+
+public:
+ /*
+ * create singleton instance or increase reference count;
+ */
+ static IRDB* getInstance();
+
+ /*
+ * release instance or decrease reference count;
+ */
+ void releaseInstance();
+
+public:
+ /*
+ * destory Internet Radio database,
+ * It will remove the IR database file from disk.
+ * this interface is reserved for future use.
+ */
+ bool destoryIRDB();
+
+ /*
+ * create internet Radio database
+ * It will create the IR database file in disk.
+ * If createIRDB return false, the instance point of IRDB will be released and set to null;
+ */
+ bool createIRDB();
+
+public:
+ /*
+ * action is invoked from view of playHistory or search;
+ * INSERT/UPDATE row;
+ * manipulation for multiple tables;
+ * for row has a channelid value;
+ * First, this function will insert a row in IRBuff table;
+ * then INSERT/UPDATE this row to searchRlt and channelHistory table,
+ * next above operations will trigger other actions for manipulation other tables in IRDB.
+ * channelId is mandatory paramter.
+ */
+ IRDBCHAR chgRowIRDB(const QString& aInsSqlStr,
+ const QString& aUpdSqlStr,
+ const uint& channelId,
+ const QString& aCondSqlStr,
+ const QList<QByteArray>* apImgList = NULL,
+ bool bPreHandle = false);
+ /*
+ * action is invoked from view of go to station;
+ * INSERT/UPDATE row;
+ * manipulation for multiple tables;
+ * for no channelid
+ * new channelId will be allocated for this row if condStr == NULL;
+ * or
+ * A exist channelId will be used for this row, this exist channelId is gotten according to condStr
+ * AND this channelId isNOT iSDS's channelID;
+ */
+ IRDBCHAR chgRowIRDB(QString aInsSqlStr,
+ QString aUpdSqlStr,
+ uint* const cidRet = NULL,
+ const QString& condStr = NULL,
+ const QString& condUserCidStr = NULL,
+ const QList<QByteArray>* apImgList = NULL);
+
+ /*
+ * this fuction is used while synchronization data with iSDS side;
+ * INSERT/UPDATE row;
+ * manipulation for multiple tables;
+ * for row has a channelid value,
+ * update rows that are storged in channelInfo, advertisement, and img tables;
+ * about urls for channelId,
+ * we need to call <EIRDB insertUrlInfo(const QStringList&) const> after this function call if there is urls updated.
+ * TBD
+ */
+ IRDBCHAR updateChannelDetailsIRDB(const QString& aInsSqlStr,
+ const QString& aUpdSqlStr,
+ const uint& channelId)
+ {
+ Q_UNUSED(aInsSqlStr);
+ Q_UNUSED(aUpdSqlStr);
+ Q_UNUSED(channelId);
+ return (IRDBCHAR)0;
+ };
+
+public:
+ /*
+ * INSERT/UPDATE row;
+ * manipulation for single table, songHistory table;
+ * the song name is used as the criterion.
+ */
+ IRDBCHAR chgRowSongHistory(const QString& aInsSqlStr,
+ const QString& aUpdSqlStr,
+ const QString& aSongName,
+ const QString& aCondSqlStr = NULL,
+ const uint& channelId = 0);
+
+ /*
+ * INSERT/UPDATE row;
+ * for change(update/insert) data in favorites,
+ * channelId is used as criterion
+ */
+ IRDBCHAR chgRowFavorites(const QString& aInsSqlStr,
+ const QString& aUpdSqlStr,
+ const uint& channelId,
+ bool& bNewRow);
+
+ /*
+ * TBD
+ */
+ IRDBCHAR chgAdvertisement(const QString& aInsSqlStr,
+ const QString& aUpdSqlStr,
+ const uint& channelId)
+ {
+ Q_UNUSED(aInsSqlStr);
+ Q_UNUSED(aUpdSqlStr);
+ Q_UNUSED(channelId);
+
+ return (IRDBCHAR)0;
+ }
+
+public:
+ /*
+ * INSERT/DELETE row, in urlInfo table;
+ * step:
+ * 1/ first delete all the rows whose channelID equals to input channelId,
+ * 2/ insert all the rows belonged to one channelId to urlinfo
+ */
+ IRDBCHAR resetUrlInfo(const QStringList& aInsSqlList,
+ const uint& channelId);
+
+ /*
+ * only update channelLatestplaytime in channelHistory table for recently play
+ */
+ IRDBCHAR updRowChannelHistory(const uint& channelId);
+
+ /*
+ * only update imgUrl, imgLocalFile in img table;
+ */
+ IRDBCHAR updRowImg(const uint& channelId,
+ const QString& updSqlStr,
+ QList<QByteArray>* apImgList = NULL);
+
+public:
+ /*
+ * DELETE rows in
+ * channelHistory, searchRlt, songHistory, favorites, advertisement;
+ * rows in img, channelInfo and urlInfo can't be removed directly.
+ */
+ IRDBCHAR deleteRow(const QString& aDltSqlStr);
+
+ /*
+ * DELETE rows in
+ * channelHistory, searchRlt, songHistory, favorites, advertisement;
+ * rows in img, channelInfo and urlInfo can't be removed directly.
+ */
+ IRDBCHAR selectRow(IRDBWrapper* const apWrapper,
+ const QString& aSltSqlStr,
+ QList<QVariant*>* pDataSet);
+
+public:
+ /*
+ * SELECT * from IR_VIEW_ALL;
+ * param is used as condition string;
+ */
+ IRDBCHAR selectRowIRDB(IRDBWrapper* const apWrapper,
+ const QString& aCondStr,
+ bool bIsSrhCid,
+ QList<uint>* pQListCIDSet,
+ QList<QVariant*>* pQLIstIRDataSet);
+private:
+ /*
+ * default constructor
+ */
+ IRDB();
+
+ /*
+ * forbid copy constructor
+ */
+ IRDB(IRDB&);
+
+ /*
+ * destructor
+ */
+ ~IRDB();
+
+private:
+ /*
+ * here "=" is forbidded
+ */
+ const IRDB& operator=(const IRDB&);
+
+private:
+ /*
+ * create tables and relations in IRDB;
+ */
+ bool createIRTable();
+
+ /*
+ * open IRDB connection;
+ */
+ bool openIRDBConnection();
+
+ /*
+ * search channelid from channelInfo table;
+ */
+ IRDBCHAR isChannelIdExisted(uint channelId);
+
+private:
+ //IRDB Instance
+ QSqlDatabase m_sqlDB;
+
+ // reference count
+ int m_RefCnt;
+
+ // Mutex locker
+ static QMutex mMutex;
+
+ // The static instance
+ static IRDB* mpIRDBInstance;
+
+};
+
+
+#endif /* IRDB_H_ */
+
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/inc/irdbexport.h Fri Sep 17 08:27:59 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 IRDBEXPORT_H_
+#define IRDBEXPORT_H_
+
+#include <QtGlobal>
+
+#ifdef BUILD_IRDB_DLL
+ #define IRDB_DLL_EXPORT Q_DECL_EXPORT
+#else
+ #define IRDB_DLL_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif /* IRDBEXPORT_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/inc/irdbviewstruct.h Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* 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.
+*
+* Description: Manipulate Interface of Internet Radio Database
+*
+*/
+
+#ifndef _IRDB_VIEW_STRUCT_H_
+#define _IRDB_VIEW_STRUCT_H_
+
+#include <QString>
+#include <QMap>
+#include <QByteArray>
+
+
+/*
+* pair node for column-value;
+* uint: column enum;
+* QString: column value;
+*/
+typedef QMap<uint, QString> columnMap;
+typedef QMap<uint, QByteArray> logoMap;
+
+enum EColumnLogo{bLogoInsert, sLogoInsert};
+const QString colNameLogo[] = {"bIcon", "sIcon"};
+const QString strBLogo = ":bIcon";
+const QString strSLogo = ":sIcon";
+
+const int IRDB_ALL_COLUMN = 25;
+const int IRDB_OPT_INSERT = 1;
+const int IRDB_OPT_UPDATE = 2;
+const int IRDB_OPT_TRIGGER = 3;
+const int IRDB_CHANNELINFO_COLUMN = 20;
+const int IRDB_CHANNELHISTORY_COLUMN = 20;
+const int IRDB_SEARCHRLT_COLUMN = 20;
+const int IRDB_SONGHISTORY_COLUMN = 22;
+const int IRDB_FAVORITES_COLUMN = 20;
+const int IRDB_IMG_COLUMN = 4;
+
+enum EColumnView{channelId, channelName, channelNickName,
+ genreName, genreId, languageName, languageCode,
+ countryName, countryCode, description, shortDesc,
+ lastModified, channelType, musicStoreStatus,
+ imgUrl, bLogoGet, sLogoGet,
+ advertisementUrl, advertisementInUse, expiration,
+ songName, artistName, channelUrl, opt, dataSource};
+
+const QString colNameView[] = {"channelId", "channelName", "channelNickName",
+ "genreName", "genreId", "languageName", "languageCode",
+ "countryName", "countryCode", "description", "shortDesc",
+ "lastModified", "channelType", "musicStoreStatus",
+ "imgUrl", "bIcon", "sIcon",
+ "advertisementUrl", "advertisementInUse", "expiration",
+ "songName", "artistName", "channelUrl", "opt", "dataSource"};
+
+//flag of data belong to channelHistory;
+const int DATA_OF_CHANNELHISTORY = 1;
+
+//flag of data belong to searchRlt;
+const int DATA_OF_SEARCHRLT = 2;
+
+/*
+* for urlinfo table;
+*/
+//columns count of urlinfo;
+const int IRDB_URLINFO_COLUMN = 3;
+
+//urlInfo's column enum;
+enum EColumnUrlInfo{channelUrl_URL, channelId_URL, bitRate_URL};
+
+//urlInfo's column name;
+const QString colNameUrlInfo[] = {"channelUrl", "channelId", "bitRate" };
+
+//for urlInfo insert
+typedef QMap<QString, uint> columnUrlInfoInsertMap;
+
+
+/*
+* for advertisement table;
+*/
+/*
+* Due to the advertisement wrapper is unavailable, the structure is masked temporarily.
+*/
+//columns count of advertisement;
+//const int IRDB_ADVERTISEMENT_COLUMN = 5;
+
+//advertisement's column enum;
+//enum EColumnAdvertisement{channelId_AD, advertisementUrl_AD, advertisementInUse_AD, expiration_AD};
+
+//advertisement's column name;
+//const QString colNameAdvertisement[] = {"channelId", "advertisementUrl", "advertisementInUse", "expiration"};
+
+
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/inc/irdbwrapper.h Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,141 @@
+/*
+* 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.
+*
+* Description: Manipulate Interface of Internet Radio Database
+*
+*/
+
+#ifndef _IRDB_WRAPPER_H_
+#define _IRDB_WRAPPER_H_
+
+#include <QList>
+#include "irdbexport.h"
+#include "irdbviewstruct.h"
+
+class QVariant;
+class QSqlQuery;
+class IRDB;
+
+
+class IRDB_DLL_EXPORT IRDBWrapper
+{
+public:
+
+ IRDBWrapper();
+
+ virtual ~IRDBWrapper();
+
+public:
+ /*
+ * If all parameters are default, all cid rows in IRDB will return;
+ * condAND: condition for search IRDB, it is AND relationship in every pair;
+ * condOR: condition for search IRDB, it is OR relationship in every pair;
+ */
+ QList<uint>* getChannelId(const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+friend class IRDB;
+
+protected:
+ /*
+ * If all parameters are default, all rows in IRDB will return;
+ * condAND: condition for search IRDB, it is AND relationship in every pair;
+ * condOR: condition for search IRDB, it is OR relationship in every pair;
+ */
+ QList<QVariant*>* getIRDB(const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+protected:
+ /*
+ * create sql condition(where) string according to the input condAND and condAND;
+ * condAND: [direction:in] it is AND relationship in every pair;
+ * condOR: [direction:in] it is OR relationship in every pair;
+ * pArrayColName:[direction:in] array pointer to colName<table>[];
+ * for example:colNameView[],colNameChannelHistory[];
+ * condSqlStr: [direction:out] return the sqlString;
+ */
+ void combineCondStr(const columnMap* const condAND,
+ const columnMap* const condOR,
+ const QString* pArryColName,
+ QString& condSqlStr);
+
+ /*
+ * create sql insert/update string according to RowData;
+ * RowData: [direction:in] row value of table;
+ * pArrayColName:[direction:in] array pointer to colName<table>[];
+ * for example:colNameView[],colNameChannelHistory[];
+ * insSqlStr: [direction:out] return the sqlString;
+ * updSqlStr: [direction:out] return the sqlString;
+ */
+ void combinePutStr(const columnMap* const RowData,
+ const QString* pArryColName,
+ QString& insSqlStr,
+ QString& updSqlStr,
+ const logoMap* const logoData = NULL,
+ QList<QByteArray>* logoArrayList = NULL);
+
+ /*
+ * create sql select string according to the input condAND and condOR;
+ * condAND: [direction:in] it is AND relationship in every pair;
+ * condOR: [direction:in] it is OR relationship in every pair;
+ * pArrayColName:[direction:in] array pointer to colName<table>[];
+ * for example:colNameView[],colNameChannelHistory[];
+ * sltSqlStr: [direction:out] return the sqlString;
+ */
+ void combineGetStr(const columnMap* const condAND,
+ const columnMap* const condOR,
+ const QString* pArryColName,
+ QString& sltSqlStr);
+
+ /*
+ * create sql delete string according to the input condAND and condOR;
+ * condAND: [direction:in] it is AND relationship in every pair;
+ * condOR: [direction:in] it is OR relationship in every pair;
+ * pArrayColName:[direction:in] array pointer to colName<table>[];
+ * for example:colNameView[],colNameChannelHistory[];
+ * dltSqlStr: [direction:out] return the sqlString;
+ */
+ void combineDeleteStr(const columnMap* const condAND,
+ const columnMap* const condOR,
+ const QString* pArryColName,
+ QString& dltSqlStr);
+
+private:
+
+ /*
+ * It is called by IRDB instance;
+ * IRDB instance delivers rows set(channelId) to IRDBWrapper via this function;
+ * the rows set is storaged in m_IRCIDSet;
+ */
+ bool loadDataOfChannelIdCB(QSqlQuery& aIRDataSet, QList<uint>* pCIDDataSet);
+
+ /*
+ * It is called by IRDB instance;
+ * IRDB instance delivers rows set to IRDBWrapper via this function;
+ * the rows set is storaged in m_IRDataSet;
+ */
+ bool loadDataOfIRDBCB(QSqlQuery& aIRDataSet, QList<QVariant*>* pViewDataSet);
+
+ /*
+ * it is for the single table;
+ */
+ virtual bool getIRTableCB(QSqlQuery& aIRDataSet, QList<QVariant*>* pTableDataSet);
+
+protected:
+ //pointer for IRDB;
+ IRDB* m_pIRDB;
+};
+
+
+#endif
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/inc/irsqlstr.h Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,789 @@
+/*
+* 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.
+*
+* Description: DDL(Data Definition Language) of Internet Radio Database
+*
+*/
+
+#ifndef IRSQLSTR_H_
+#define IRSQLSTR_H_
+
+#include <QString>
+
+const QString IRDBName = "IRDB.db";
+
+#ifdef Q_CC_NOKIAX86
+ const QString IRDBFile = IRDBName;
+#else
+ const QString IRDBFile = "c:\\private\\2002FFAC\\IRDB.db";
+#endif
+
+
+
+const QString IRDBConnectionName("IR");
+const QString IRDBSrhCIdCntFrmChannelInfo("select count(channelId) from channelInfo where channelId =");
+const QString IRDBSrhCIdCntFrmFavorites("select count(channelId) from favorites where channelId =");
+const QString IRDBSrhCIdFrmView("select channelid from IRVIEW_CHANNELINFO ");
+const QString IRDBSrhAllFrmView("select * from IRVIEW_CHANNELINFO ");
+const QString IRDBInsertIRBuff("insert into IRBuff (channelid, datasource, opt) values(");
+const QString IRDBSrhCIdCntFrmSongHistory("select count(channelId) from songHistory where songName =");
+const QString IRDBSrhCIdCntFrmChannelHistory("select count(channelId) from channelHistory where channelId =");
+const QString IRDBSrhCIdMaxFrmChannelInfo("select max(channelId) from channelInfo;");
+const QString IRDBDltRowFrmUrlInfoByCId("delete from urlInfo where channelId =");
+const QString IRDBSrhUserCid("select channelId from IR_VIEW_SRH_USERCID ");
+const QString IRDBSrhRecordCntFrmSongHistory("select count(songName) from songHistory ");
+/*
+ * notes
+ * About two columns in IRBuff table;
+ * opt:
+ -- opt = 1, insert
+ -- opt = 2, update
+ -- opt = 3, invoke the actions in update trigger;
+
+ * dataSource:
+ -- dataSource = 1, data for channelHistory
+ -- dataSource = 2, data for searchRlt
+ -- dataSource = other, data dont belong to both channelHistory and searchRlt ,
+ come from go to station view or synchronization with iSDS side;
+
+ * trigger recursion
+ -- until now the sqlite don't support recursive trigger,
+ -- !!! if in future, the sqlite support the trigger recursion function,
+ -- the trigger recursion function must be disabled.
+ *
+*/
+
+
+/************************************************
+* define for table IRBUFF and its triggers;
+************************************************/
+/*
+* Define for IRBuff table;
+* it is a temporary table for storage the row about IRDB;
+*/
+const QString CREATE_TABEL_IRBUFF("CREATE TABLE [IRBuff] ( \
+[channelID] integer(4) NOT NULL UNIQUE, \
+[channelName] nvarchar(255), \
+[channelNickName] nvarchar(255), \
+[genreName] nvarchar(255), \
+[genreId] nvarchar(64), \
+[languageName] nvarchar(255), \
+[languageCode] nvarchar(8), \
+[countryName] nvarchar(255), \
+[countryCode] INTEGER(2), \
+[description] nvarchar(255), \
+[shortDesc] nvarchar(255), \
+[lastModified] datetime DEFAULT (datetime(current_timestamp,'localtime')), \
+[musicStoreStatus] numeric(1) DEFAULT (1), \
+[imgUrl] nvarchar(255), \
+[bIcon] BLOB, \
+[sIcon] BLOB, \
+[advertisementUrl] nvarchar(255), \
+[advertisementInUse] nvarchar(255), \
+[expiration] datetime DEFAULT (datetime(current_timestamp,'+10 day','localtime')), \
+[dataSource] numeric(1) NOT NULL, \
+[opt] NUMERIC(1) DEFAULT (1), \
+PRIMARY KEY ([channelID]));");
+
+
+/*
+* Define for IRBuff insert trigger;
+*/
+const QString TRI_INSERT_IRBUFF("CREATE TRIGGER [TRI_INSERT_IRBuff] \
+AFTER INSERT ON [IRBuff] FOR EACH ROW \
+BEGIN \
+ \
+insert into channelInfo \
+(channelID, channelName, channelNickName, genreName, \
+ genreId, languageName, languageCode, countryName, \
+ countryCode, description, shortDesc, lastModified, \
+ musicStoreStatus) \
+select \
+ channelID, channelName, channelNickName, genreName, \
+ genreId, languageName, languageCode, countryName, \
+ countryCode, description, shortDesc, lastModified, \
+ musicStoreStatus \
+from IRBuff \
+where channelId = new.channelId \
+AND new.opt =1;\
+\
+insert into channelHistory(channelID) \
+select channelID from IRBuff \
+where channelId = new.channelID \
+AND new.dataSource = 1 \
+AND new.opt = 1; \
+\
+insert into \
+searchRlt(channelID) \
+select channelID from IRBuff \
+where channelId = new.channelID \
+AND new.dataSource = 2 \
+AND new.opt = 1; \
+\
+insert into \
+img(channelID, imgUrl, bIcon, sIcon) \
+select channelID, imgUrl, bIcon, sIcon from IRBuff \
+where channelId = new.channelId \
+AND new.opt =1;\
+\
+insert into \
+advertisement(channelID, advertisementUrl, advertisementInUse, expiration) \
+select channelID, advertisementUrl, advertisementInUse, expiration from IRBuff \
+where channelId = new.channelId \
+AND new.opt =1;\
+\
+\
+\
+update IRBuff \
+set \
+imgUrl = (select imgUrl from img where channelid = new.channelid), \
+bIcon = (select bIcon from img where channelid = new.channelid), \
+sIcon = (select sIcon from img where channelid = new.channelid), \
+advertisementUrl = (select advertisementUrl from advertisement where channelid = new.channelid), \
+advertisementInUse = (select advertisementInUse from advertisement where channelid = new.channelid), \
+expiration = (select expiration from advertisement where channelid = new.channelid), \
+channelName = (select channelName from channelinfo where channelid = new.channelid), \
+channelNickName = (select channelNickName from channelinfo where channelid = new.channelid), \
+genreName = (select genreName from channelinfo where channelid = new.channelid), \
+genreId = (select genreId from channelinfo where channelid = new.channelid), \
+languageName = (select languageName from channelinfo where channelid = new.channelid), \
+languageCode = (select languageCode from channelinfo where channelid = new.channelid), \
+countryName = (select countryName from channelinfo where channelid = new.channelid), \
+countryCode = (select countryCode from channelinfo where channelid = new.channelid), \
+description = (select description from channelinfo where channelid = new.channelid), \
+shortDesc = (select shortDesc from channelinfo where channelid = new.channelid), \
+musicStoreStatus = (select musicStoreStatus from channelinfo where channelid = new.channelid) \
+where channelId = new.channelID \
+AND opt = 2; \
+ \
+\
+END;");
+
+
+/*
+* Define for IRBuff update trigger;
+*/
+const QString TRI_UPDATE_IRBUFF("CREATE TRIGGER [TRI_UPDATE_IRBUFF] \
+AFTER UPDATE ON [IRBuff] FOR EACH ROW \
+BEGIN \
+\
+update channelHistory \
+set \
+channelLatestPlayTime = datetime(current_timestamp,'localtime') \
+where \
+new.opt = 3 \
+AND Channelid = new.channelid \
+AND new.datasource = 1; \
+\
+update searchRlt \
+set \
+channelLatestSrhTime = datetime(current_timestamp,'localtime') \
+where \
+new.opt = 3 \
+AND Channelid = new.channelid \
+AND new.datasource = 2; \
+\
+\
+insert into channelHistory(channelID) \
+select channelID from IRBuff \
+where \
+new.opt = 3 \
+AND channelId = new.channelID \
+AND new.dataSource = 1 \
+AND not exists \
+(select channelID from channelHistory where channelID = new.channelID); \
+\
+insert into \
+searchRlt(channelID) \
+select channelID from IRBuff \
+where \
+new.opt = 3 \
+AND channelId = new.channelID \
+AND new.dataSource = 2 \
+AND not exists \
+(select channelID from searchRlt where channelID = new.channelID); \
+\
+\
+UPDATE channelInfo \
+SET \
+channelName = (select channelName from IRBuff where channelId = new.channelId), \
+channelNickName = (select channelNickName from IRBuff where channelId = new.channelId), \
+genreName = (select genreName from IRBuff where channelId = new.channelId), \
+genreId = (select genreId from IRBuff where channelId = new.channelId), \
+languageName = (select languageName from IRBuff where channelId = new.channelId), \
+languageCode = (select languageCode from IRBuff where channelId = new.channelId), \
+countryName = (select countryName from IRBuff where channelId = new.channelId), \
+countryCode = (select countryCode from IRBuff where channelId = new.channelId), \
+description = (select description from IRBuff where channelId = new.channelId), \
+shortDesc = (select shortDesc from IRBuff where channelId = new.channelId), \
+lastModified = (select lastModified from IRBuff where channelId = new.channelId), \
+musicStoreStatus = (select musicStoreStatus from IRBuff where channelId = new.channelId) \
+where \
+new.opt = 3 \
+AND channelId = new.channelId; \
+\
+update img \
+set \
+imgUrl = (select imgUrl from IRBuff where channelId = new.channelId), \
+bIcon = (select bIcon from IRBuff where channelId = new.channelId), \
+sIcon = (select sIcon from IRBuff where channelId = new.channelId) \
+where \
+new.opt = 3 \
+AND channelId = new.channelId; \
+\
+update advertisement \
+set advertisementUrl = (select advertisementUrl from IRBuff where channelId = new.channelId), \
+advertisementInUse = (select advertisementInUse from IRBuff where channelId = new.channelId), \
+expiration = (select expiration from IRBuff where channelId = new.channelId) \
+where \
+new.opt = 3 \
+AND channelId = new.channelId; \
+\
+END;");
+
+//above trigger should add handle the case that the channelId exist in channelinfo but unexist in channelHistory.
+/*
+insert into channelHistory(channelID) \
+select channelID from IRBuff \
+where channelId = new.channelID \
+AND new.dataSource = 1 \
+AND new.opt = 3 \
+AND not exists \
+(select channelID from channelHistory where channelID = new.channelID); \
+*/
+
+
+/**************************************************
+* define for table channelHistory and its triggers;
+***************************************************/
+/*
+* Define for channelHistory table;
+*
+* it stores the channels played by IR,the row counts is no more than 100;
+*/
+const QString CREATE_TABEL_CHANNELHISTORY("CREATE TABLE [channelHistory] ( \
+[SID] integer NOT NULL PRIMARY KEY UNIQUE, \
+[channelID] integer(4) NOT NULL UNIQUE, \
+[channelLatestPlayTime] datetime DEFAULT (datetime(current_timestamp, 'localtime')));");
+
+
+/*
+* Define for channelHistory insert trigger;
+*
+* if rows counts > 100, it will trigger delete action.
+*
+* if one row is added here,
+* the corresponsive row with the same channelId may be inserted to channelinfo.
+*
+* other:
+* from pragram logic judge,
+* the probability of insert a row into IRBuff
+* when the row's opt = 1 while the row's channelId is in channelInfo table
+* equals zero
+*/
+const QString TRI_INSERT_CHANNELHISTORY("CREATE TRIGGER [TRI_INSERT_channelHistory] \
+AFTER INSERT ON [channelHistory] FOR EACH ROW \
+BEGIN \
+\
+UPDATE channelInfo \
+SET \
+refCnt = refCnt+1 \
+where channelId = new.channelId; \
+\
+delete from channelHistory \
+where channelLatestPlayTime = ( select min(channelLatestPlayTime) from channelHistory) \
+AND (select count(*) from channelHistory)> 100; \
+\
+END;");
+
+
+/*
+* Define for channelHistory delete trigger;
+*
+* if one row is deleted,
+* the refcnt of corresponsive row, it has same channelId in channelInfo,
+* will be decreased.
+*/
+const QString TRI_DELETE_CHANNELHISTORY("CREATE TRIGGER [TRI_DELETE_channelHistory] \
+AFTER DELETE ON [channelHistory] \
+BEGIN \
+UPDATE channelInfo \
+SET refCnt = refCnt-1 \
+where \
+channelId = OLD.channelId; \
+END;");
+
+
+/**************************************************
+* define for table searchRlt and its triggers;
+***************************************************/
+/*
+* Definition for searchRlt table;
+*
+* it stores the channels searched by IR user,the row counts is no more than 100;
+*/
+const QString CREATE_TABEL_SEARCHRLT("CREATE TABLE [searchRlt] ( \
+[SID] integer NOT NULL PRIMARY KEY UNIQUE, \
+[channelID] integer(4) NOT NULL UNIQUE, \
+[channelLatestSrhTime] DATETIME DEFAULT (datetime(current_timestamp, 'localtime')));");
+
+
+/*
+* Define for searchRlt insert trigger;
+*
+* if rows counts > 100, it will trigger delete action.
+*
+* if one row is added here,
+* the corresponsive row with the same channelId may be inserted to channelinfo.
+*
+*/
+const QString TRI_INSERT_SEARCHRLT("CREATE TRIGGER [TRI_INSERT_searchRlt] \
+AFTER INSERT ON [searchRlt] FOR EACH ROW \
+BEGIN \
+\
+UPDATE channelInfo \
+SET refCnt = refCnt+1 \
+where \
+channelId = new.channelId; \
+ \
+delete from searchRlt \
+where SID = ( select min(SID) from searchRlt) AND (select count(*) from searchRlt)> 100; \
+\
+END;");
+
+
+/*
+* Define for searchRlt delete trigger;
+*
+* if one row is deleted,
+* the refcnt of corresponsive row, it has same channelId in channelInfo,
+* will be decreased.
+*/
+const QString TRI_DELETE_SEARCHRLT("CREATE TRIGGER [TRI_DELETE_searchRlt] \
+AFTER DELETE ON [searchRlt] \
+BEGIN \
+UPDATE channelInfo \
+SET refCnt = refCnt-1 \
+where channelId = OLD.channelId; \
+\
+END;");
+
+
+/**************************************************
+* define for table channelInfo and its triggers;
+***************************************************/
+/*
+* Definition for channelInfo table;
+* it stores the channels infomation;
+*/
+const QString CREATE_TABEL_CHANNELINFO("CREATE TABLE channelInfo( \
+[channelID] integer(4) PRIMARY KEY UNIQUE NOT NULL ,\
+[channelName] nvarchar(255) ,\
+[channelNickName] nvarchar(255) ,\
+[genreName] nvarchar(255) ,\
+[genreId] nvarchar(64)), \
+[languageName] nvarchar(255) ,\
+[languageCode] nvarchar(8) ,\
+[countryName] nvarchar(255) ,\
+[countryCode] nvarchar(255) ,\
+[description] nvarchar(255) ,\
+[shortDesc] nvarchar(255) ,\
+[lastModified] datetime DEFAULT (datetime(current_timestamp,'localtime')), \
+[channelType] numeric(1) DEFAULT (1) ,\
+[musicStoreStatus] numeric(1) NOT NULL ,\
+[refCnt] numeric(1) DEFAULT (0));");
+
+
+/*
+* Define for channelInfo Insert trigger;
+* the refCnt default value is 1;
+*/
+const QString TRI_INSERT_CHANNELINFO("CREATE TRIGGER [TRI_INSERT_channelInfo] \
+AFTER INSERT ON [channelInfo] FOR EACH ROW \
+BEGIN \
+\
+UPDATE channelInfo \
+SET channelType = 0 \
+WHERE channelId = new.channelID \
+AND new.channelID > 4294967295; \
+\
+END;");
+
+
+/*
+* Define for channelInfo update trigger;
+* if refCnt default is 0 after update, it will trigger delete action,
+* all infomation about this row in IRDB will be removed.
+*/
+const QString TRI_UPDATE_CHANNELINFO("CREATE TRIGGER [TRI_UPDATE_channelInfo] \
+AFTER UPDATE ON [channelInfo] FOR EACH ROW \
+BEGIN \
+delete from channelInfo \
+where \
+channelId = new.channelID \
+AND refCnt = 0; \
+END;");
+
+
+/*
+* Definition for channelInfo delete trigger;
+* the refCnt default value is 1;
+*/
+const QString TRI_DELETE_CHANNELINFO("CREATE TRIGGER [TRI_DELETE_channelInfo] \
+AFTER DELETE ON [channelInfo] FOR EACH ROW \
+BEGIN \
+delete from advertisement where channelID = old.channelID; \
+delete from img where channelID = old.channelID; \
+delete from urlInfo where channelID = old.channelID; \
+END;");
+
+
+
+/**************************************************
+* define for table img and its triggers;
+***************************************************/
+/*
+* Definition for img table;
+* it stores the channels logo img infomation;
+*/
+const QString CREATE_TABEL_IMG("CREATE TABLE [img] ( \
+[SID] integer NOT NULL PRIMARY KEY UNIQUE, \
+[channelID] integer(4) NOT NULL, \
+[imgUrl] nvarchar(255) DEFAULT ('unavailable'), \
+[bIcon] BLOB, \
+[sIcon] BLOB); ");
+
+
+
+/**************************************************
+* define for table urlInfo and its triggers;
+***************************************************/
+/*
+* Definition for urlInfo table;
+* it stores the channels url information;
+*/
+const QString CREATE_TABEL_URLINFO("CREATE TABLE [urlInfo] ( \
+[SID] integer NOT NULL PRIMARY KEY UNIQUE, \
+[channelUrl] nvarchar(255) DEFAULT ('unavailable'), \
+[channelID] integer(4) NOT NULL, \
+[bitRate] integer(4));");
+
+
+/**************************************************
+* define for table advertisement and its triggers;
+***************************************************/
+/*
+* Definition for advertisement table;
+* it stores the advertisement information;
+*/
+const QString CREATE_TABEL_ADVERTISEMENT("CREATE TABLE [advertisement] ( \
+[SID] integer NOT NULL PRIMARY KEY UNIQUE, \
+[channelID] integer(4) NOT NULL, \
+[advertisementUrl] nvarchar(255), \
+[advertisementInUse] nvarchar(255), \
+[expiration] datetime);");
+
+
+/*
+* Definition for advertisement update trigger;
+* if there is row in IRbuff, it will be deleted,
+* here is last defender for remove rows in IRbuff;
+*/
+const QString TRI_INSERT_ADVERTISEMENT("CREATE TRIGGER [TRI_INSERT_advertisement] \
+AFTER INSERT ON [advertisement] FOR EACH ROW \
+BEGIN \
+DELETE FROM IRBuff; \
+END;");
+
+
+/*
+* Definition for advertisement update trigger;
+* update channelid in advertisement is forbidden;
+*
+* if there is row in IRbuff, it will be deleted,
+* here is last defender for remove rows in IRbuff;
+*
+*/
+const QString TRI_UPDATE_ADVERTISEMENT("CREATE TRIGGER [TRI_UPDATE_advertisement] \
+AFTER UPDATE ON advertisement FOR EACH ROW \
+BEGIN \
+update advertisement set channelid = old.channelid where channelid = new.channelid; \
+DELETE FROM IRBuff; \
+END;");
+
+
+
+/**************************************************
+* define for table songHistory and its triggers;
+***************************************************/
+/*
+* Definition for songHistory table;
+* it stores the song played information;
+* the rows in this table are no more than 100;
+*/
+const QString CREATE_TABEL_SONGHISTORY("CREATE TABLE [songHistory]( \
+[SID] integer PRIMARY KEY UNIQUE NOT NULL ,\
+[songName] nvarchar(64) NOT NULL ,\
+[artistName] nvarchar(64) ,\
+[channelID] integer(4) NOT NULL ,\
+[songPlaySeq] LARGEINT DEFAULT (0), \
+[songLatestPlayTime] DATETIME DEFAULT (datetime(current_timestamp,'localtime')) );");
+
+
+/*
+* Definition for songHistory insert trigger;
+*
+* if the rows are more than 100, the oldest row will be removed;
+* after a row insert, the channel's refCnt in channelInfo will be increase;
+*/
+const QString TRI_INSERT_SONGHISTORY("CREATE TRIGGER [TRI_INSERT_songHistory] \
+AFTER INSERT ON [songHistory] FOR EACH ROW \
+BEGIN \
+UPDATE channelInfo \
+SET refCnt = refCnt+1 \
+where channelId = new.channelId; \
+ \
+update songHistory \
+SET \
+songName = new.songName, \
+channelId = new.channelId, \
+artistName = new.artistName \
+where \
+songName = new.songName \
+AND channelId = new.channelId \
+AND artistName = new.artistName; \
+ \
+delete from songHistory \
+where songPlaySeq = ( select min(songPlaySeq) from searchRlt) \
+AND (select count(*) from songHistory)> 100; \
+END;");
+
+
+/*
+* Definition for songHistory delete trigger;
+*
+* after row is removed, the channel's refCnt in channelInfo will be decreased;
+*/
+const QString TRI_DELETE_SONGHISTORY("CREATE TRIGGER [TRI_DELETE_songHistory] \
+AFTER DELETE ON [songHistory] FOR EACH ROW \
+BEGIN \
+UPDATE channelInfo \
+SET refCnt = refCnt-1 \
+where channelId = OLD.channelId; \
+END;");
+
+
+/*
+* Definition for songHistory update trigger;
+*/
+const QString TRI_UPDATE_SONGHISTORY("CREATE TRIGGER [TRI_UPDATE_songHistory] \
+AFTER UPDATE ON songHistory FOR EACH ROW \
+BEGIN \
+ \
+update songHistory \
+set songPlaySeq = (select max(songPlaySeq) from songHistory) + 1 \
+where songName = new.songName \
+AND channelId = new.channelId \
+AND artistName = new.artistName; \
+ \
+END");
+
+
+/**************************************************
+* define for table favorites and its triggers;
+***************************************************/
+/*
+* Definition for favorites table;
+* it stores the information of song user's favorites;
+* the rows in this table are no more than 100;
+*/
+const QString CREATE_TABEL_FAVORITES("CREATE TABLE [favorites]( \
+[SID] integer PRIMARY KEY UNIQUE NOT NULL ,\
+[ChannelID] integer(4) UNIQUE NOT NULL ,\
+[PlayCount] integer(4) DEFAULT (1),\
+[FavSeq] LARGEINT DEFAULT (0) );");
+
+
+/*
+* Definition for favorites insert trigger;
+*
+* if the rows are more than 100, the oldest row will be removed;
+* after a row insert, the channel's refCnt in channelInfo will be increase;
+*/
+const QString TRI_INSERT_FAVORITES("CREATE TRIGGER TRI_INSERT_favorites \
+AFTER INSERT On favorites \
+BEGIN \
+\
+update favorites \
+set channelId = new.channelid \
+where channelid = new.channelid; \
+\
+UPDATE channelInfo \
+SET refCnt = refCnt+1 \
+where channelId = new.channelId; \
+ \
+delete from favorites \
+where \
+FavSeq = ( select min(FavSeq) from favorites ) \
+AND (select count(*) from favorites)> 100; \
+ \
+END;");
+
+
+/*
+* Definition for songHistory update trigger;
+*/
+const QString TRI_UPDATE_FAVORITES("CREATE TRIGGER [TRI_UPDATE_favorites] \
+AFTER UPDATE ON favorites FOR EACH ROW \
+BEGIN \
+update favorites \
+set \
+PlayCount = PlayCount+1, \
+FavSeq = (select max(FavSeq) from favorites) +1 \
+where channelid = old.channelID; \
+ \
+update favorites \
+set channelid = old.channelid \
+where channelid = new.channelid; \
+END;");
+
+
+/*
+* Definition for favorites delete trigger;
+*
+* after row is removed, the channel's refCnt in channelInfo will be decreased;
+*/
+const QString TRI_DELETE_FAVORITES("CREATE TRIGGER TRI_DELETE_favorites \
+AFTER DELETE On favorites \
+BEGIN \
+UPDATE channelInfo \
+SET refCnt = refCnt-1 \
+where \
+channelId = OLD.channelId; \
+END;");
+
+
+
+/**************************************************
+* define for IRDB VIEW
+* channelId is the join key;
+***************************************************/
+const QString IRVIEW_CHANNELINFO1(" Create View [IRVIEW_CHANNELINFO1] As \
+select \
+channelInfo.[channelID], \
+channelInfo.[channelName], channelInfo.[channelNickName], channelInfo.[genreName], \
+channelInfo.[genreId], channelInfo.[languageName], channelInfo.[languageCode], \
+channelInfo.[countryName], channelInfo.[countryCode], channelInfo.[description], \
+channelInfo.[shortDesc], channelInfo.[lastModified], channelInfo.[channelType], \
+channelInfo.[musicStoreStatus], \
+img.[imgUrl], img.[bIcon], img.[sIcon] \
+from \
+ channelInfo LEFT JOIN img ON channelInfo.channelID = img.channelID ");
+
+
+
+const QString IRVIEW_CHANNELINFO(" Create View [IRView_channelinfo] As \
+select \
+IRView_channelinfo1.*, \
+advertisement.[advertisementUrl], advertisement.[advertisementInUse],advertisement.[expiration] \
+from \
+IRView_channelinfo1 LEFT JOIN advertisement ON IRView_channelinfo1.[channelId] = advertisement.[channelID] ");
+
+
+const QString IRVIEW_CHANNELHISTORY(" Create View [IRVIEW_channelHistory] As \
+select \
+IRView_channelinfo.* \
+from \
+channelHistory LEFT JOIN IRView_channelinfo ON channelHistory.[channelId] = IRView_channelinfo.[channelID] ");
+
+const QString IRVIEW_FAVORITES(" Create View [IRVIEW_favorites] As \
+select \
+IRView_channelinfo.*, favorites.[FavSeq] \
+from \
+favorites LEFT JOIN IRView_channelinfo ON favorites.[channelId] = IRView_channelinfo.[channelID] ");
+
+
+const QString IRVIEW_SEARCHRLT(" Create View [IRVIEW_searchRlt] As \
+select \
+IRView_channelinfo.* \
+from \
+searchRlt LEFT JOIN IRView_channelinfo ON searchRlt.[channelId] = IRView_channelinfo.[channelID] ");
+
+const QString IRVIEW_SONGHISTORY("Create View [IRVIEW_songHistory] As \
+select \
+IRView_channelinfo.*, songHistory.[songName], songHistory.[artistName], songHistory.[songPlaySeq] \
+from \
+songHistory LEFT JOIN IRView_channelinfo ON songHistory.[channelId] = IRView_channelinfo.[channelID] ");
+
+
+const QString IR_VIEW_SRH_USERCID(" CREATE VIEW [IR_VIEW_SRH_USERCID] As \
+select channelinfo.[channelID], channelNickName, channelUrl, bitRate \
+FROM channelinfo LEFT JOIN urlInfo ON channelinfo.channelID = urlInfo.channelID ");
+
+
+/**************************************************
+* define for drop IRDB VIEW, TABLE AND TRIGGER
+***************************************************/
+//drop view;
+const QString IR_VIEW1_DROP("Drop View If Exists MAIN.[IR_VIEW1];");
+const QString IR_VIEW2_DROP("Drop View If Exists MAIN.[IR_VIEW2];");
+const QString IR_VIEW3_DROP("Drop View If Exists MAIN.[IR_VIEW3];");
+const QString IR_VIEW4_DROP("Drop View If Exists MAIN.[IR_VIEW4];");
+const QString IR_VIEW5_DROP("Drop View If Exists MAIN.[IR_VIEW5];");
+const QString IR_VIEW6_DROP("Drop View If Exists MAIN.[IR_VIEW6];");
+const QString IR_VIEW_ALL_DROP("Drop View If Exists MAIN.[IR_VIEW_ALL];");
+
+//drop table;
+const QString IR_IRBUFF_DROP("Drop table if exists main.[IRBUFF];");
+const QString IR_CHANNELHISTORY_DROP("Drop table if exists main.[channelHistory];");
+const QString IR_SEARCHRLT_DROP("Drop table if exists main.[searchRlt];");
+const QString IR_CHANNELINFO_DROP("Drop table if exists main.[channelInfo];");
+const QString IR_IMG_DROP("Drop table if exists main.[img];");
+const QString IR_URLINFO_DROP("Drop table if exists main.[urlInfo];");
+const QString IR_ADVERTISEMENT_DROP("Drop table if exists main.[advertisement];");
+const QString IR_SONGHISTORY_DROP("Drop table if exists main.[songHistory];");
+const QString IR_FAVORITES_DROP("Drop table if exists main.[favorites];");
+
+
+
+#endif /* IRSQLSTR_H_ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/inc/searchrltwrapper.h Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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.
+*
+* Description:
+*
+*/
+
+#ifndef _SEARCH_RLT_WRAPPER_H_
+#define _SEARCH_RLT_WRAPPER_H_
+
+#include "irdbexport.h"
+#include "irdbwrapper.h"
+
+class IRDB_DLL_EXPORT searchRltWrapper: public IRDBWrapper
+{
+public:
+ searchRltWrapper();
+ ~searchRltWrapper();
+
+public:
+ /*
+ * RowData: [direction: in]table row value;
+ * condAND: [direction: in]condition for search searchRlt, it is AND relationship in every pair;
+ * condOR: [direction: in]condition for search searchRlt, it is OR relationship in every pair;
+ */
+ bool putSearchRlt(const columnMap* const RowData,
+ const logoMap* const logoData = NULL,
+ const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+ /*
+ * If all parameters are default,all rows in searchRlt will be deleted if not violating constraint;
+ * condAND: [direction: in]condition for search searchRlt, it is AND relationship in every pair;
+ * condOR: [direction: in]condition for search searchRlt, it is OR relationship in every pair;
+ */
+ bool deleteSearchRlt(const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+ /*
+ * If all parameters are default, all rows in searchRlt will return;
+ * cond1: condition for search searchRlt, it is AND relationship in every pair;
+ * cond2: condition for search searchRlt, it is OR relationship in every pair;
+ */
+ QList<QVariant*>* getSearchRlt(const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+private:
+ /*
+ * It is called by IRDB instance;
+ * IRDB instance delivers rows set to IRDBWrapper via this function;
+ * the rows set is storaged in m_IRDataSet;
+ */
+ bool getIRTableCB(QSqlQuery& aIRDataSet,
+ QList<QVariant*>* pDataSet);
+
+private:
+ /*
+ * search channelId according to parameter;
+ * condUserCidStr:[direction: in]specific condition(where) string for user-define uid;
+ * condAND: [direction: in]condition for search channelHistory, it is AND relationship in every pair;
+ * condOR: [direction: in]condition for search channelHistory, it is OR relationship in every pair;
+ * uint: return channelId;
+ */
+ uint srhChannelId(QString& condUserCidStr,
+ const columnMap* const condAND,
+ const columnMap* const condOR = NULL);
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/inc/songhistorywrapper.h Fri Sep 17 08:27:59 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.
+*
+* Description:
+*
+*/
+
+#ifndef _SONG_HISTORY_WRAPPER_H_
+#define _SONG_HISTORY_WRAPPER_H_
+
+#include "irdbexport.h"
+#include "irdbwrapper.h"
+
+class IRDB_DLL_EXPORT songHistoryWrapper: public IRDBWrapper
+{
+public:
+ songHistoryWrapper();
+ ~songHistoryWrapper();
+
+public:
+ /*
+ * RowData: [direction: in]table row value;
+ * condAND: [direction: in]condition for search songHistory, it is AND relationship in every pair;
+ * condOR: [direction: in]condition for search songHistory, it is OR relationship in every pair;
+ */
+ bool putSongHistory(const columnMap* const RowData,
+ const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+ /*
+ * If all parameters are default,all rows in songHistory will be deleted if not violating constraint;
+ * condAND: [direction: in]condition for search songHistory, it is AND relationship in every pair;
+ * condOR: [direction: in]condition for search songHistory, it is OR relationship in every pair;
+ */
+ bool deleteSongHistory(const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+ /*
+ * If all parameters are default, all rows in songHistory will return;
+ * cond1: condition for search songHistory, it is AND relationship in every pair;
+ * cond2: condition for search songHistory, it is OR relationship in every pair;
+ */
+ QList<QVariant*>* getSongHistory(const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+private:
+ /*
+ * It is called by IRDB instance;
+ * IRDB instance delivers rows set to IRDBWrapper via this function;
+ * the rows set is storaged in m_IRDataSet;
+ */
+ bool getIRTableCB(QSqlQuery& aIRDataSet,
+ QList<QVariant*>* pDataSet);
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/inc/urlinfowrapper.h Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* 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.
+*
+* Description:
+*
+*/
+
+#ifndef _URLINFO_WRAPPER_H_
+#define _URLINFO_WRAPPER_H_
+
+#include "irdbexport.h"
+#include "irdbwrapper.h"
+
+class IRDB_DLL_EXPORT urlInfoWrapper: public IRDBWrapper
+{
+public:
+ urlInfoWrapper();
+ ~urlInfoWrapper();
+
+public:
+ /*
+ * RowData: [direction: in] column value for channelUrl and bitrate;
+ * first oprand in QMap is channelUrl,
+ * sencod oprand in QMap is bitrate;
+ * channelId: [direction: in] channelid for update row;
+ * return true if operation success;
+ */
+ bool resetUrlInfo(const columnUrlInfoInsertMap* const RowData,
+ const uint& channelId);
+
+ QList<QVariant*>* getUrlInfo(const columnMap* const condAND = NULL,
+ const columnMap* const condOR = NULL);
+
+private:
+ /*
+ * It is called by IRDB instance;
+ * IRDB instance delivers rows set to IRDBWrapper via this function;
+ * the rows set is storaged in m_IRDataSet;
+ */
+ bool getIRTableCB(QSqlQuery& aIRDataSet,
+ QList<QVariant*>* pDataSet);
+
+ /*
+ * create sql insert string according to the input RowData;
+ * RowData: [direction:in] refer to line 29;
+ * channelId: [direction:in] it is row channelId;
+ * insSqlStrList: [direction:out] return the sql QStringList;
+ */
+ void combineInsertStr(const columnUrlInfoInsertMap* const RowData,
+ const uint& channelId,
+ QStringList& insSqlStrList);
+};
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/irdb.pro Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,62 @@
+# 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:
+
+TEMPLATE = lib
+TARGET = irdb
+TARGET.CAPABILITY = CAP_GENERAL_DLL
+
+INCLUDEPATH += inc
+
+defFilePath = ..
+
+MOC_DIR = moc
+QT += sql
+DEFINES += BUILD_IRDB_DLL
+
+symbian {
+ TARGET.UID3 = 0x2002FFFF
+ TARGET.EPOCALLOWDLLDATA = 1
+ TARGET.CAPABILITY += CAP_GENERAL_DLL
+ MMP_RULES += SMPSAFE
+}
+
+HEADERS += inc/irsqlstr.h \
+ inc/irdb.h \
+ inc/irdbwrapper.h \
+ inc/irdbviewstruct.h \
+ inc/channelhistorywrapper.h \
+ inc/searchrltwrapper.h \
+ inc/songhistorywrapper.h \
+ inc/favoriteswrapper.h \
+ inc/imgwrapper.h \
+ inc/urlinfowrapper.h
+
+SOURCES += src/irdb.cpp \
+ src/irdbwrapper.cpp \
+ src/channelhistorywrapper.cpp \
+ src/searchrltwrapper.cpp \
+ src/songhistorywrapper.cpp \
+ src/favoriteswrapper.cpp \
+ src/imgwrapper.cpp \
+ src/urlinfowrapper.cpp
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+!exists( $(RVCT22BIN) ) {
+ !exists( $(RVCT31BIN) ) {
+ exists( $(RVCT40BIN) ) {
+ QMAKE_CFLAGS.ARMCC += --import_all_vtbl
+ }
+ }
+ }
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/src/channelhistorywrapper.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,262 @@
+/*
+* 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.
+*
+* Description:
+*
+*/
+
+#include <QSqlQuery>
+#include <QVariant>
+#include "channelhistorywrapper.h"
+#include "irdb.h"
+
+
+channelHistoryWrapper::channelHistoryWrapper()
+{
+}
+
+channelHistoryWrapper::~channelHistoryWrapper()
+{
+}
+
+bool channelHistoryWrapper::deleteChannelHistory(const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ QString deleteSqlStr;
+
+ if( (NULL != condAND)&&(NULL != condOR) )
+ {
+ return false;
+ }
+
+ if(condAND)
+ {
+ if(condAND->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ if(condOR)
+ {
+ if(condOR->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ deleteSqlStr = "delete from channelHistory ";
+ combineDeleteStr(condAND, condOR, colNameView, deleteSqlStr);
+
+ return m_pIRDB->deleteRow(deleteSqlStr)?false:true;
+}
+
+bool channelHistoryWrapper::getIRTableCB(QSqlQuery& aIRDataSet, QList<QVariant*>* pQListDataSet)
+{
+ while (aIRDataSet.next())
+ {
+ QVariant* const p = new QVariant[IRDB_CHANNELHISTORY_COLUMN];
+ *pQListDataSet<<p;
+
+ for(int i = 0; i < IRDB_CHANNELHISTORY_COLUMN; i++)
+ {
+ *(p+i) = aIRDataSet.value(i);
+ }
+ }
+
+ return true;
+}
+
+uint channelHistoryWrapper::srhChannelId(QString& condUserCidStr,
+ const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ uint srhCID = 0;
+
+ //if condAND or condOR has channeld,
+ if(condAND != NULL)
+ {
+ srhCID = (condAND->value(channelId)).toUInt();
+ }
+ else if(condOR != NULL)
+ {
+ srhCID = (condOR->value(channelId)).toUInt();
+ }
+
+ if(srhCID)
+ {
+ return srhCID ;
+ }
+
+ //channelId column is false
+ //only one case, go to station view, channelUrl and channelNickName
+ //search channelId according to urlinof and channelNickName;
+ QString srhStr;
+ if(condAND != NULL)
+ {
+ if( ( !(condAND->value(channelUrl).isEmpty()) )&&( !(condAND->value(channelNickName).isEmpty()) ) )
+ {
+ srhStr = "where "+ colNameView[channelUrl] + " = ";
+ srhStr = srhStr + "'" + condAND->value(channelUrl) + "' AND " ;
+ srhStr = srhStr + colNameView[channelNickName] + " = ";
+ srhStr = srhStr + "'" + condAND->value(channelNickName) + "'";
+ }
+ condUserCidStr = srhStr;
+ }
+
+ return srhCID;
+}
+
+/*
+* this fuction don't suport "update" operation for mutliple records ;
+* if condAND != NULL AND condOR != NULL, illegal operation;
+* if condAND != NULL or condOR != NULL, it must be "update" operation.
+* if condAND == NULL AND condOR == NULL, it is "insert" or "update" operation;
+*
+*/
+bool channelHistoryWrapper::putChannelHistory(const columnMap* const RowData,
+ uint* const cidUserDefined,
+ const logoMap* const logoData,
+ const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ uint uCid = 0;
+ QString insSqlStr;
+ QString updSqlStr;
+ QString condSqlStr;
+ QString condUserCidStr;
+ columnMap* const RowDataAppend = const_cast<columnMap*>(RowData);
+ QList<QByteArray>* pImgList = NULL;
+ bool ret = true;
+
+
+ if( NULL == RowData )
+ {
+ return false;
+ }
+
+ if(RowData->isEmpty())
+ {
+ return false;
+ }
+
+
+ if( (NULL != condAND)&&(NULL != condOR) )
+ {
+ return false;
+ }
+
+ if(condAND)
+ {
+ if(condAND->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ if(condOR)
+ {
+ if(condOR->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ if(cidUserDefined)
+ {
+ *cidUserDefined = 0;
+ }
+
+ insSqlStr = "insert into IRBuff ";
+ updSqlStr = "update IRBuff set ";
+ RowDataAppend->insert(opt, QString::number(IRDB_OPT_INSERT));
+ RowDataAppend->insert(dataSource, QString::number(DATA_OF_CHANNELHISTORY));
+
+ if(NULL != logoData)
+ {
+ pImgList = new QList<QByteArray>();
+ combinePutStr(RowDataAppend, colNameView, insSqlStr, updSqlStr, logoData, pImgList);
+ *pImgList=logoData->values();
+
+ }
+ else
+ {
+ combinePutStr(RowDataAppend, colNameView, insSqlStr, updSqlStr);
+ }
+
+ if( (NULL == condAND)&&(NULL == condOR) )
+ {
+ uCid = srhChannelId(condUserCidStr,RowData);
+ }
+ else //here it must be "update" operation; condition string
+ {
+ uCid = srhChannelId(condUserCidStr,condAND, condOR);
+ combineCondStr(condAND, condOR, colNameView, condSqlStr);
+ }
+
+ if(uCid)
+ {
+ //updSqlStr += condSqlStr;
+ m_pIRDB->chgRowIRDB(insSqlStr, updSqlStr, uCid, condSqlStr, pImgList)? ret = false:true;
+ }
+ else //here deliver the updSqlstr and condSqlStr seperately.
+ {
+ m_pIRDB->chgRowIRDB(insSqlStr, updSqlStr, cidUserDefined, condSqlStr, condUserCidStr, pImgList)?ret = false:true;
+ }
+
+ if(pImgList)
+ {
+ delete pImgList;
+ pImgList = NULL;
+ }
+
+ return ret;
+}
+
+
+QList<QVariant*>* channelHistoryWrapper::getChannelHistory(const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ QString sltSqlStr;
+ QList<QVariant*> *pDataSet = NULL;
+ if( (NULL != condAND)&&(NULL != condOR) )
+ {
+ return NULL;
+ }
+
+ if(condAND)
+ {
+ if(condAND->isEmpty())
+ {
+ return NULL;
+ }
+ }
+
+ if(condOR)
+ {
+ if(condOR->isEmpty())
+ {
+ return NULL;
+ }
+ }
+
+ sltSqlStr = "select * from IRView_channelinfo ";
+ combineGetStr(condAND, condOR, colNameView,sltSqlStr);
+ pDataSet = new QList<QVariant*>();
+ if( m_pIRDB->selectRow(this, sltSqlStr, pDataSet) )
+ {
+ delete pDataSet;
+ pDataSet = NULL;
+ }
+
+ return pDataSet;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/src/favoriteswrapper.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* 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.
+*
+* Description:
+*
+*/
+
+#include <QSqlQuery>
+#include <QVariant>
+#include "favoriteswrapper.h"
+#include "irdb.h"
+
+favoritesWrapper::favoritesWrapper()
+{
+}
+
+favoritesWrapper::~favoritesWrapper()
+{
+}
+
+bool favoritesWrapper::putFavorites(columnMap* const RowData,
+ bool& bNewRow)
+{
+ uint uCid = 0;
+ QString insSqlStr;
+ QString updSqlStr;
+
+
+ if( NULL == RowData )
+ {
+ return false;
+ }
+
+ if(RowData->isEmpty())
+ {
+ return false;
+ }
+
+ uCid = (RowData->value(channelId)).toUInt();
+
+
+ if(!uCid)
+ {
+ return false;
+ }
+
+ insSqlStr = "insert into favorites ";
+ updSqlStr = "update favorites set ";
+
+ //create insSqlstr and updSqlStr in advance;
+ combinePutStr(RowData, colNameView, insSqlStr, updSqlStr);
+
+ return m_pIRDB->chgRowFavorites(insSqlStr, updSqlStr, uCid, bNewRow)? false:true;
+}
+
+bool favoritesWrapper::deleteFavorites(const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ QString deleteSqlStr = "delete from Favorites ";
+
+ if( (NULL != condAND)&&(NULL != condOR) )
+ {
+ return false;
+ }
+
+ if(condAND)
+ {
+ if(condAND->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ if(condOR)
+ {
+ if(condOR->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ combineDeleteStr(condAND, condOR, colNameView, deleteSqlStr);
+
+ return m_pIRDB->deleteRow(deleteSqlStr)? false:true;
+}
+
+QList<QVariant*>* favoritesWrapper::getFavorites(const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ QString sltSqlStr = "select * from IRVIEW_favorites ";
+ QList<QVariant*>* pDataSet = NULL;
+
+ if( (NULL != condAND)&&(NULL != condOR) )
+ {
+ return NULL;
+ }
+
+ if(condAND)
+ {
+ if(condAND->isEmpty())
+ {
+ return NULL;
+ }
+ }
+
+ if(condOR)
+ {
+ if(condOR->isEmpty())
+ {
+ return NULL;
+ }
+ }
+
+ combineGetStr(condAND, condOR, colNameView, sltSqlStr);
+ sltSqlStr = sltSqlStr + " order by FavSeq desc ";
+ pDataSet = new QList<QVariant*>();
+ if( m_pIRDB->selectRow(this, sltSqlStr, pDataSet) )
+ {
+ delete pDataSet;
+ pDataSet = NULL;
+ }
+
+ return pDataSet;
+}
+
+bool favoritesWrapper::getIRTableCB(QSqlQuery& aIRDataSet, QList<QVariant*>* pDataSet)
+{
+ while (aIRDataSet.next())
+ {
+ QVariant* const p = new QVariant[IRDB_FAVORITES_COLUMN];
+ *pDataSet<<p;
+
+ for(int i = 0; i < IRDB_FAVORITES_COLUMN; i++)
+ {
+ *(p+i) = aIRDataSet.value(i);
+ }
+ }
+
+ return true;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/src/imgwrapper.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* 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.
+*
+* Description:
+*
+*/
+
+#include <QSqlQuery>
+#include <QVariant>
+#include "imgwrapper.h"
+#include "irdb.h"
+
+imgWrapper::imgWrapper()
+{
+}
+
+imgWrapper::~imgWrapper()
+{
+}
+
+
+bool imgWrapper::updateImg(const columnMap* const RowData,
+ const uint& channelId,
+ const logoMap* const logoData)
+{
+ QString insSqlStr;
+ QString updSqlStr;
+ QList<QByteArray>* pImgList = NULL;
+ bool ret = true;
+
+ if(!channelId)
+ {
+ return false;
+ }
+
+ if( NULL == RowData )
+ {
+ return false;
+ }
+
+ if(RowData->isEmpty())
+ {
+ return false;
+ }
+
+ if( true != (RowData->value(channelId)).isEmpty() )
+ {
+ return false;
+ }
+
+ updSqlStr = "update img set ";
+ if(NULL != logoData)
+ {
+ pImgList = new QList<QByteArray>();
+ combinePutStr(RowData, colNameView, insSqlStr, updSqlStr, logoData, pImgList);
+
+ }
+ else
+ {
+ combinePutStr(RowData, colNameView, insSqlStr, updSqlStr);
+ }
+
+ //create insSqlstr and updSqlStr in advance;
+ updSqlStr = updSqlStr + "where channelId = " + QString::number(channelId);
+
+ m_pIRDB->updRowImg(channelId, updSqlStr, pImgList)? ret = false:true;
+ if(pImgList)
+ {
+ delete pImgList;
+ pImgList = NULL;
+ }
+
+ return ret;
+}
+
+QList<QVariant*>* imgWrapper::getImg(const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ QString sltSqlStr = "select * from IRVIEW_channelinfo ";
+ QList<QVariant*>* pDataSet = NULL;
+
+ if( (NULL != condAND)&&(NULL != condOR) )
+ {
+ return NULL;
+ }
+
+ if(condAND)
+ {
+ if(condAND->isEmpty())
+ {
+ return NULL;
+ }
+ }
+
+ if(condOR)
+ {
+ if(condOR->isEmpty())
+ {
+ return NULL;
+ }
+ }
+
+ combineGetStr(condAND, condOR, colNameView, sltSqlStr);
+ pDataSet = new QList<QVariant*>();
+
+ if( m_pIRDB->selectRow(this, sltSqlStr, pDataSet) )
+ {
+ delete pDataSet;
+ pDataSet = NULL;
+ }
+
+ return pDataSet;
+}
+
+bool imgWrapper::getIRTableCB(QSqlQuery& aIRDataSet, QList<QVariant*>* pDataSet)
+{
+
+ while (aIRDataSet.next())
+ {
+ QVariant* const p = new QVariant[IRDB_CHANNELINFO_COLUMN];
+ *pDataSet<<p;
+
+ for(int i = 0; i < IRDB_CHANNELINFO_COLUMN; i++)
+ {
+ *(p+i) = aIRDataSet.value(i);
+ }
+ }
+
+ return true;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/src/irdb.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,920 @@
+/*
+* 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 <QtGlobal>
+#include <QString>
+#include <QStringList>
+#include <QSqlQuery>
+#include <QFile>
+#include <QMutex>
+#include <QVariant>
+#include <QtDebug>
+#include <QByteArray>
+#include "irdbwrapper.h"
+#include "irsqlstr.h"
+#include "irdb.h"
+
+#define IRDB_ERR_NONE (0x00)
+#define IRDB_ERR_INSERT (0x01)
+#define IRDB_ERR_UPDATE (0x02)
+#define IRDB_ERR_SELECT (0x03)
+#define IRDB_ERR_DELETE (0x04)
+#define IRDB_ERR_OPEN (0x05)
+#define IRDB_ERR_CHANGE (0x06)
+#define IRDB_ERR_ILLEGAL (0x07)
+#define IRDB_ERR_WRAPPER (0x08)
+#define IRDB_CID_EXISTED (0x10)
+#define IRDB_CID_UNEXISTED (0x11)
+#define IRDB_CID_USER_DEFINE (0xF0000000)
+
+
+IRDB* IRDB::mpIRDBInstance = NULL;
+QMutex IRDB::mMutex;
+
+IRDB::IRDB(): m_RefCnt(0)
+{
+}
+
+IRDB::~IRDB()
+{
+}
+
+IRDB* IRDB::getInstance()
+{
+ mMutex.lock();
+ bool existed = true;
+
+ if(NULL == mpIRDBInstance)
+ {
+ mpIRDBInstance = new IRDB();
+ existed = false;
+ }
+
+ ++mpIRDBInstance->m_RefCnt;
+ mMutex.unlock();
+
+ if(false == existed)
+ {
+ if(!mpIRDBInstance->createIRDB())
+ {
+ //remove IR database;
+ QFile::remove(IRDBFile);
+ mpIRDBInstance->releaseInstance();
+ }
+ }
+ return mpIRDBInstance;
+}
+
+void IRDB::releaseInstance()
+{
+ mMutex.lock();
+ if ((--m_RefCnt) == 0)
+ {
+ delete this;
+ mpIRDBInstance = NULL;
+ }
+ mMutex.unlock();
+}
+
+bool IRDB::createIRDB()
+{
+ bool ret = true;
+
+ m_sqlDB = QSqlDatabase::addDatabase("QSQLITE");
+ m_sqlDB.setDatabaseName(IRDBName);
+
+ if( !QFile::exists(IRDBFile) )
+ {
+ mMutex.lock();
+ if(!m_sqlDB.isOpen())
+ {
+ m_sqlDB.open();
+ mMutex.unlock();
+
+ ret = createIRTable();
+ m_sqlDB.close();
+ }
+ else
+ {
+ mMutex.unlock();
+ ret = false;
+ }
+ }
+
+ return ret;
+}
+
+bool IRDB::destoryIRDB()
+{
+ bool ret = true;
+ mMutex.lock();
+ if(!m_sqlDB.isOpen())
+ {
+ QFile::remove (IRDBFile);
+ mMutex.unlock();
+ }
+ else
+ {
+ mMutex.unlock();
+ ret = false;
+ }
+
+ return ret;
+}
+
+//if the IR database file in disk exists, we don't need to call this function;
+bool IRDB::createIRTable()
+{
+ bool Rlt = true;
+
+ QStringList sqlList;
+ QSqlQuery sqlQuery(m_sqlDB);
+
+ sqlList<<CREATE_TABEL_IRBUFF<<CREATE_TABEL_CHANNELHISTORY<<CREATE_TABEL_SEARCHRLT<<CREATE_TABEL_CHANNELINFO \
+ <<CREATE_TABEL_URLINFO<<CREATE_TABEL_IMG<<CREATE_TABEL_ADVERTISEMENT<<CREATE_TABEL_SONGHISTORY<<CREATE_TABEL_FAVORITES \
+\
+ <<TRI_INSERT_IRBUFF<<TRI_UPDATE_IRBUFF \
+ <<TRI_INSERT_SEARCHRLT<<TRI_DELETE_SEARCHRLT \
+ <<TRI_INSERT_CHANNELINFO<<TRI_UPDATE_CHANNELINFO<<TRI_DELETE_CHANNELINFO \
+ <<TRI_INSERT_CHANNELHISTORY<<TRI_DELETE_CHANNELHISTORY \
+ <<TRI_INSERT_ADVERTISEMENT<<TRI_UPDATE_ADVERTISEMENT \
+\
+ <<TRI_INSERT_SONGHISTORY<<TRI_UPDATE_SONGHISTORY<<TRI_DELETE_SONGHISTORY \
+ <<TRI_INSERT_FAVORITES<<TRI_UPDATE_FAVORITES<<TRI_DELETE_FAVORITES \
+\
+ <<IRVIEW_CHANNELINFO1<<IRVIEW_CHANNELINFO<<IRVIEW_CHANNELHISTORY<<IR_VIEW_SRH_USERCID \
+ <<IRVIEW_FAVORITES<<IRVIEW_SEARCHRLT<<IRVIEW_SONGHISTORY ;
+
+
+ for(int i = 0; i<sqlList.size();i++)
+ {
+ Rlt = sqlQuery.exec(sqlList.at(i));
+
+ if(Rlt == false)
+ {
+ break;
+ }
+ }
+
+ sqlQuery.clear();
+
+ //remove string in sqlList;
+ for(int i = 0; i<sqlList.size();i++)
+ {
+ sqlList.removeFirst();
+ }
+
+ return Rlt;
+}
+
+
+bool IRDB::openIRDBConnection()
+{
+ bool ret = true;
+ mMutex.lock();
+
+ if(m_sqlDB.isOpen())
+ {
+ ret = false;
+ }
+ else
+ {
+ ret = m_sqlDB.open();
+ }
+
+ mMutex.unlock();
+ return ret;
+}
+
+
+IRDBCHAR IRDB::chgRowIRDB(QString aInsSqlStr,
+ QString aUpdSqlStr,
+ uint* const retCid,
+ const QString& aCondSqlStr,
+ const QString& condUserCidStr,
+ const QList<QByteArray>* apImgList)
+{
+ IRDBCHAR ret = IRDB_ERR_NONE;
+ //channelId value 0 don't be used in CIRDB;
+ uint channelId = 0;
+ //sql string for search cid according to nickname and url;
+ QString strSrhCid = IRDBSrhUserCid + condUserCidStr;
+ QString strSrhDataSet = IRDBSrhCIdFrmView + aCondSqlStr;
+
+ //initialize the channelId for application level;
+ if(retCid)
+ {
+ *retCid = 0;
+ }
+
+ if(false == openIRDBConnection())
+ {
+ return IRDB_ERR_OPEN;
+ }
+
+ QSqlQuery iIRQuery(m_sqlDB);
+
+ if(NULL != condUserCidStr)
+ {
+ if(false == iIRQuery.exec(strSrhCid))
+ {
+ iIRQuery.clear();
+ m_sqlDB.close();
+ ret = IRDB_ERR_SELECT;
+ }
+ else
+ {
+ iIRQuery.next();
+ channelId = iIRQuery.value(0).toInt();
+ }
+ }
+
+ if(ret != IRDB_ERR_NONE)
+ {
+ return ret;
+ }
+
+ /*for below case, because it is a channel inputted by user.
+ * Although the channelId can be gotten according to the condstr,
+ * if the channelId is defined by iSDS, still new user-defined channelId will be allocated.
+ */
+ if(channelId < IRDB_CID_USER_DEFINE)
+ {
+ channelId = 0;
+ }
+
+ if(0 == channelId )
+ {
+ //new channelId should be allocated.
+ if( false == iIRQuery.exec(IRDBSrhCIdMaxFrmChannelInfo) )
+ {
+ iIRQuery.clear();
+ m_sqlDB.close();
+ ret = IRDB_ERR_SELECT;
+ }
+
+ if(ret != IRDB_ERR_NONE)
+ {
+ return ret;
+ }
+
+ iIRQuery.next();
+
+ if(iIRQuery.value(0).toInt()< IRDB_CID_USER_DEFINE )
+ {
+ channelId = (uint)IRDB_CID_USER_DEFINE;
+ }
+ else
+ {
+ channelId = (uint)iIRQuery.value(0).toInt() + 1;
+ }
+
+ //if a userdefined channelid is created, the value will be returned to application level;
+ if(retCid)
+ {
+ *retCid = channelId;
+ }
+ }
+ else
+ {
+ /*
+ * for case: although channelId can be gotten, but the updSqlStr is invalid,
+ * operation should be stopped
+ */
+ if(false == iIRQuery.exec(strSrhDataSet))
+ {
+ iIRQuery.clear();
+ m_sqlDB.close();
+ ret = IRDB_ERR_SELECT;
+ }
+ else
+ {
+ iIRQuery.next();
+ if(0 == iIRQuery.value(0).toInt())
+ {
+ iIRQuery.clear();
+ m_sqlDB.close();
+ ret = IRDB_ERR_UPDATE;
+ }
+ }
+ }
+
+ if(IRDB_ERR_NONE == ret )
+ {
+ iIRQuery.clear();
+
+ aInsSqlStr.insert(aInsSqlStr.indexOf(')'), QString(" ,channelId"));
+ aInsSqlStr.insert(aInsSqlStr.lastIndexOf(')'),QString(" ,")+QString::number(channelId));
+
+ /*
+ * Since process will go ahead to call
+ * EIRDB IRDB::chgRowIRDB(const QString& aInsSqlStr, const QString& aUpdSqlStr, uint channelId, bool bPreHandle),
+ * for the synchoronization concern, the m_sqlDB can't be closed until all the process is compeleted;
+ * m_sqlDB.close();
+ */
+ ret = chgRowIRDB(aInsSqlStr, aUpdSqlStr, channelId, aCondSqlStr, apImgList, true);
+ }
+/* else
+ {
+ iIRQuery.clear();
+ m_sqlDB.close();
+ }
+*/
+ return ret;
+}
+
+
+
+// if the action invoked from 'go to station view', don't use this function
+IRDBCHAR IRDB::chgRowIRDB(const QString& aInsSqlStr,
+ const QString& aUpdSqlStr,
+ const uint& channelId,
+ const QString& aCondSqlStr,
+ const QList<QByteArray>* apImgList,
+ bool bPreHandle)
+{
+ IRDBCHAR ret = IRDB_ERR_NONE;
+ QString strIsCIDExist = IRDBSrhCIdCntFrmChannelInfo + QString::number(channelId) +";";
+ QString updSqlStr;
+
+ /*
+ * if the function call isn't invoked from
+ * EIRDB IRDB::chgRowIRDB(QString aInsSqlStr, QString aUpdSqlStr, const QString& aCondStr),
+ * db connection should be opened again;
+ */
+ if(false == bPreHandle)
+ {
+ if(false == openIRDBConnection())
+ {
+ return IRDB_ERR_OPEN;
+ }
+ }
+
+ QSqlQuery iIRQuery(m_sqlDB);
+
+ /*If channelId isn't 0, then two cases should be checked.
+ * First, if channelId exists in the channelInfo, update operation will be excuted.
+ * Second, if channelId doesn't exists in channelInfo table, insert operation will be excuted.
+ */
+ if(false == iIRQuery.exec(strIsCIDExist))
+ {
+ iIRQuery.clear();
+ m_sqlDB.close();
+ return IRDB_ERR_SELECT;
+ }
+
+ iIRQuery.next();
+
+ /*if channelID existed, we need to get the preset data*/
+ if (0 != iIRQuery.value(0).toInt())
+ {
+ /*trigger the action,
+ * All the data recorded in CiRDB, its channelID equal to here ,
+ * will be composed to one row in IRBuff table;
+ */
+ if(false == iIRQuery.exec(IRDBInsertIRBuff + QString::number(channelId)+",1, 2)"))
+ {
+ ret = IRDB_ERR_INSERT;
+ }
+ else
+ {
+ if(aCondSqlStr.isEmpty())
+ {
+ updSqlStr = aUpdSqlStr + " where channelId = " + QString::number(channelId);
+ }
+ else
+ {
+ updSqlStr += aCondSqlStr;
+ }
+ if(NULL == apImgList)
+ {
+ if(false == iIRQuery.exec(aUpdSqlStr))
+ {
+ ret = IRDB_ERR_UPDATE;
+ }
+ }
+ else
+ {
+ iIRQuery.prepare(aUpdSqlStr);
+ iIRQuery.bindValue(strBLogo, apImgList->at(bLogoInsert));
+ iIRQuery.bindValue(strSLogo, apImgList->at(sLogoInsert));
+ if(false == iIRQuery.exec())
+ {
+ ret = IRDB_ERR_UPDATE;
+ }
+ }
+
+ }
+ }
+ else /*since there is not uid, we insert directly*/
+ {
+ if(NULL == apImgList)
+ {
+ if(false == iIRQuery.exec(aInsSqlStr))
+ {
+ ret = IRDB_ERR_INSERT;
+ }
+ }
+ else
+ {
+ iIRQuery.prepare(aInsSqlStr);
+ iIRQuery.bindValue(strBLogo, apImgList->at(bLogoInsert));
+ iIRQuery.bindValue(strSLogo, apImgList->at(sLogoInsert));
+ if(false == iIRQuery.exec())
+ {
+ ret = IRDB_ERR_UPDATE;
+ }
+ }
+ }
+
+ iIRQuery.clear();
+ m_sqlDB.close();
+
+ return ret;
+}
+
+IRDBCHAR IRDB::chgRowSongHistory(const QString& aInsSqlStr,
+ const QString& aUpdSqlStr,
+ const QString& aCondSqlStr,
+ const QString& aSongName,
+ const uint& channelId)
+{
+ QString strSltRecordFromSongHistory = IRDBSrhRecordCntFrmSongHistory + aCondSqlStr;
+ QString updStr;
+ bool bDone = false;
+ IRDBCHAR ret = IRDB_ERR_NONE;
+
+
+ if( (aSongName.isEmpty()) || (0 == channelId) )
+ {
+ return IRDB_ERR_ILLEGAL;
+ }
+
+ if(IRDB_CID_EXISTED != isChannelIdExisted(channelId))
+ {
+ return IRDB_ERR_ILLEGAL;
+ }
+
+ if(false == openIRDBConnection())
+ {
+ return IRDB_ERR_OPEN;
+ }
+
+ QSqlQuery iIRQuery(m_sqlDB);
+
+ //if update string is true, first excute update string;
+ if(false == aCondSqlStr.isEmpty())
+ {
+ if(false == iIRQuery.exec(strSltRecordFromSongHistory))
+ {
+ iIRQuery.clear();
+ m_sqlDB.close();
+ return IRDB_ERR_SELECT;
+ }
+
+ iIRQuery.next();
+ if (0 != iIRQuery.value(0).toInt())
+ {
+ /*
+ * if row can be selected from songHistory Table,
+ * it is a stirng which is to be updated.
+ */
+ bDone = true;
+ updStr = aUpdSqlStr + aCondSqlStr;
+ if( false == iIRQuery.exec(updStr) )
+ {
+ ret = IRDB_ERR_INSERT;
+ }
+ }
+ }
+
+ if(false == bDone)
+ {
+ if(false == iIRQuery.exec(aInsSqlStr))
+ {
+ ret = IRDB_ERR_UPDATE;
+ }
+ }
+
+ iIRQuery.clear();
+ m_sqlDB.close();
+
+ return ret;
+
+}
+
+
+IRDBCHAR IRDB::isChannelIdExisted(uint channelId)
+{
+ QString strIsCIDExist = IRDBSrhCIdCntFrmChannelInfo + QString::number(channelId);
+ IRDBCHAR ret = IRDB_ERR_NONE;
+
+ if(0 == channelId)
+ {
+ return IRDB_CID_UNEXISTED;
+ }
+
+ if(false == openIRDBConnection())
+ {
+ return IRDB_ERR_OPEN;
+ }
+
+ QSqlQuery iIRQuery(m_sqlDB);
+
+ //iIRQuery.clear();
+ if(false == iIRQuery.exec(strIsCIDExist))
+ {
+ ret = IRDB_ERR_SELECT;
+ }
+ else
+ {
+ iIRQuery.next();
+ if(0 != iIRQuery.value(0).toInt())
+ {
+ ret = IRDB_CID_EXISTED;
+ }
+ }
+
+ iIRQuery.clear();
+ m_sqlDB.close();
+
+ return ret ;
+}
+
+IRDBCHAR IRDB::chgRowFavorites(const QString& aInsSqlStr, const QString& aUpdSqlStr, const uint& channelId, bool& bNewRow)
+{
+ IRDBCHAR ret = IRDB_ERR_NONE;
+ QString strIsCIDExist = IRDBSrhCIdCntFrmChannelInfo + QString::number(channelId) +";";
+ QString strIsCIDFavorites = IRDBSrhCIdCntFrmFavorites + QString::number(channelId) +";";
+ QString updSqlStr = aUpdSqlStr + "where channelid = " + QString::number(channelId);
+
+ if(false == openIRDBConnection())
+ {
+ return IRDB_ERR_OPEN;
+ }
+
+ QSqlQuery iIRQuery(m_sqlDB);
+
+ if(false == iIRQuery.exec(strIsCIDExist))
+ {
+ iIRQuery.clear();
+ m_sqlDB.close();
+ ret = IRDB_ERR_SELECT;
+ }
+
+ if(ret != IRDB_ERR_NONE)
+ {
+ return ret;
+ }
+
+ iIRQuery.next();
+
+ /*if channelID existed in channelInfo*/
+ if (0 != iIRQuery.value(0).toInt())
+ {
+ if(false != iIRQuery.exec(strIsCIDFavorites))
+ {
+ //if this channelId is in Favorties, this is a row need to update;
+ iIRQuery.next();
+ if(0 != iIRQuery.value(0).toInt())
+ {
+ bNewRow = false;
+
+ if( false == iIRQuery.exec(updSqlStr) )
+ {
+ ret = IRDB_ERR_UPDATE;
+ }
+ }
+ else //this is a new row which need to be insert favorites;
+ {
+ bNewRow = true;
+
+ if( false == iIRQuery.exec(aInsSqlStr) )
+ {
+ ret = IRDB_ERR_INSERT;
+ }
+ }
+ }
+ else
+ {
+ ret = IRDB_ERR_SELECT;
+ }
+ }
+ else /*channelId don't be recorded in channelinfo, illegal data*/
+ {
+ ret = IRDB_ERR_ILLEGAL;
+ }
+
+ iIRQuery.clear();
+ m_sqlDB.close();
+
+ return ret ;
+}
+
+
+IRDBCHAR IRDB::deleteRow(const QString& aDltSqlStr)
+{
+ IRDBCHAR ret = IRDB_ERR_NONE;
+
+ /*rows in channelInfo and img can't be removed directly.*/
+ if( 0 == QString::compare("channelInfo", aDltSqlStr, Qt::CaseInsensitive) )
+ {
+ return IRDB_ERR_DELETE;
+ }
+
+ if( 0 == QString::compare("img", aDltSqlStr, Qt::CaseInsensitive) )
+ {
+ return IRDB_ERR_DELETE;
+ }
+
+ if(false == openIRDBConnection())
+ {
+ return IRDB_ERR_OPEN;
+ }
+
+ QSqlQuery iIRQuery(m_sqlDB);
+ if(false == iIRQuery.exec(aDltSqlStr))
+ {
+ ret = IRDB_ERR_DELETE;
+ }
+
+ iIRQuery.clear();
+ m_sqlDB.close();
+
+ return ret;
+}
+
+IRDBCHAR IRDB::selectRowIRDB(IRDBWrapper* const apWrapper, const QString& aCondStr, bool bIsSrhCid,
+ QList<uint>* pQListCIDSet, QList<QVariant*>* pIRDataSet)
+{
+ QString strSrhCid;
+ IRDBCHAR ret = IRDB_ERR_NONE;
+
+ if(true == bIsSrhCid)
+ {
+ strSrhCid = IRDBSrhCIdFrmView + aCondStr;
+ }
+ else
+ {
+ strSrhCid = IRDBSrhAllFrmView + aCondStr;
+ }
+
+ if(false == openIRDBConnection())
+ {
+ return IRDB_ERR_OPEN;
+ }
+
+ QSqlQuery iIRQuery(m_sqlDB);
+
+
+ if(false == iIRQuery.exec(strSrhCid))
+ {
+ iIRQuery.clear();
+ m_sqlDB.close();
+ ret = IRDB_ERR_SELECT;
+ }
+
+ if(ret != IRDB_ERR_NONE)
+ {
+ return ret;
+ }
+
+ if(!apWrapper)
+ {
+ iIRQuery.clear();
+ m_sqlDB.close();
+ ret = IRDB_ERR_SELECT;
+ }
+
+ if(true == bIsSrhCid)
+ {
+ if(false == apWrapper->loadDataOfChannelIdCB(iIRQuery, pQListCIDSet))
+ {
+ ret = IRDB_ERR_WRAPPER;
+ }
+ }
+ else
+ {
+ if(false == apWrapper->loadDataOfIRDBCB(iIRQuery, pIRDataSet))
+ {
+ ret = IRDB_ERR_WRAPPER;
+ }
+ }
+
+ iIRQuery.clear();
+ m_sqlDB.close();
+
+ return ret;
+}
+
+IRDBCHAR IRDB::selectRow(IRDBWrapper* const apWrapper, const QString& aCondStr, QList<QVariant*>* pDataSet)
+{
+ IRDBCHAR ret = IRDB_ERR_NONE;
+
+ if(!apWrapper)
+ {
+ ret = IRDB_ERR_SELECT;
+ }
+
+ if(false == openIRDBConnection())
+ {
+ return IRDB_ERR_OPEN;
+ }
+
+ QSqlQuery iIRQuery(m_sqlDB);
+
+
+ if(false == iIRQuery.exec(aCondStr))
+ {
+ iIRQuery.clear();
+ m_sqlDB.close();
+ ret = IRDB_ERR_SELECT;
+ }
+
+ if(ret != IRDB_ERR_NONE)
+ {
+ return ret;
+ }
+
+ if(false == apWrapper->getIRTableCB(iIRQuery, pDataSet))
+ {
+ ret = IRDB_ERR_WRAPPER;
+ }
+
+
+ iIRQuery.clear();
+ m_sqlDB.close();
+
+ return ret;
+}
+
+/*
+* INSERT/DELETE row, in urlInfo table;
+* step:
+* 1/ first delete all the rows whose channelID equals to input channelId,
+* 2/ insert all the rows belonged to one channelId to urlinfo
+*/
+IRDBCHAR IRDB::resetUrlInfo(const QStringList& aInsSqlList, const uint& channelId)
+{
+ QString strDltRow = IRDBDltRowFrmUrlInfoByCId + QString::number(channelId) +";";
+ QString strIsCIDExist = IRDBSrhCIdCntFrmChannelInfo + QString::number(channelId) +";";
+
+ IRDBCHAR ret = IRDB_ERR_NONE;
+
+ if(false == openIRDBConnection())
+ {
+ return IRDB_ERR_OPEN;
+ }
+
+ QSqlQuery iIRQuery(m_sqlDB);
+
+ if(false == iIRQuery.exec(strIsCIDExist))
+ {
+ iIRQuery.clear();
+ m_sqlDB.close();
+ return IRDB_ERR_SELECT;
+ }
+
+ iIRQuery.next();
+
+ /*if channelID existed in channelInfo*/
+ if (0 != iIRQuery.value(0).toInt())
+ {
+ if(false == iIRQuery.exec(strDltRow))
+ {
+ ret = IRDB_ERR_DELETE;
+ }
+ else
+ {
+ for(int i = 0; i<aInsSqlList.size();i++)
+ {
+ if(false == iIRQuery.exec(aInsSqlList.at(i)) )
+ {
+ ret = IRDB_ERR_INSERT;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ ret = IRDB_ERR_ILLEGAL;
+ }
+
+ iIRQuery.clear();
+ m_sqlDB.close();
+
+ return ret;
+}
+
+/*
+* only update imgUrl, imgLocalFile in img table;
+*/
+IRDBCHAR IRDB::updRowImg(const uint& channelId, const QString& updSqlStr, QList<QByteArray>* apImgList)
+{
+ QString strIsCIDExist = IRDBSrhCIdCntFrmChannelInfo + QString::number(channelId) +";";
+ IRDBCHAR ret = IRDB_ERR_NONE;
+
+ if(false == openIRDBConnection())
+ {
+ return IRDB_ERR_OPEN;
+ }
+
+ QSqlQuery iIRQuery(m_sqlDB);
+
+ if(false == iIRQuery.exec(strIsCIDExist))
+ {
+ iIRQuery.clear();
+ m_sqlDB.close();
+ return IRDB_ERR_SELECT;
+ }
+
+ iIRQuery.next();
+
+ /*if channelID existed in channelInfo*/
+ if (0 != iIRQuery.value(0).toInt())
+ {
+ if(NULL == apImgList)
+ {
+ if(false == iIRQuery.exec(updSqlStr))
+ {
+ ret = IRDB_ERR_UPDATE;
+ }
+ }
+ else
+ {
+ iIRQuery.prepare(updSqlStr);
+ iIRQuery.bindValue(strBLogo, apImgList->at(bLogoInsert));
+ iIRQuery.bindValue(strSLogo, apImgList->at(sLogoInsert));
+ if(false == iIRQuery.exec())
+ {
+ ret = IRDB_ERR_UPDATE;
+ }
+ }
+ }
+ else
+ {
+ ret = IRDB_ERR_ILLEGAL;
+ }
+
+ iIRQuery.clear();
+ m_sqlDB.close();
+
+ return ret;
+
+}
+
+IRDBCHAR IRDB::updRowChannelHistory(const uint& aChannelId)
+{
+ QString strIsCIDExist = IRDBSrhCIdCntFrmChannelHistory + QString::number(aChannelId) + ";";
+ QString updStr = "update channelHistory set channelId = " + QString::number(aChannelId) + "where channelId = " + QString::number(aChannelId) +";";
+ IRDBCHAR ret = IRDB_ERR_NONE;
+
+ if(false == openIRDBConnection())
+ {
+ return IRDB_ERR_OPEN;
+ }
+
+ //if channelId isn't in channelHistory, return;
+ QSqlQuery iIRQuery(m_sqlDB);
+
+ if(false == iIRQuery.exec(strIsCIDExist))
+ {
+ iIRQuery.clear();
+ m_sqlDB.close();
+ return IRDB_ERR_SELECT;
+ }
+
+ iIRQuery.next();
+
+ /*if channelID existed in channelHistory*/
+ if (0 != iIRQuery.value(0).toInt())
+ {
+ if(false == iIRQuery.exec(updStr))
+ {
+ ret = IRDB_ERR_DELETE;
+ }
+ }
+ else
+ {
+ ret = IRDB_ERR_ILLEGAL;
+ }
+
+ return ret;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/src/irdbwrapper.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,346 @@
+/*
+* 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 <QSqlQuery>
+#include <QVariant>
+#include "irdbwrapper.h"
+#include "irdb.h"
+
+
+IRDBWrapper::IRDBWrapper()//: m_BuffFlag(true)
+{
+ m_pIRDB = IRDB::getInstance();
+}
+
+
+IRDBWrapper::~IRDBWrapper()
+{
+ if(m_pIRDB)
+ {
+ m_pIRDB->releaseInstance();
+ m_pIRDB = NULL;
+ }
+}
+
+
+/*
+* If all parameters are default, all rows in IRDB will return;
+*/
+QList<QVariant*>* IRDBWrapper::getIRDB(const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ QString condSqlStr;
+ QList<QVariant*> *pIRDataSet = NULL;
+
+ combineCondStr(condAND, condOR, colNameView, condSqlStr);
+
+ if( (NULL != condAND)||(NULL != condOR) )
+ {
+ combineCondStr(condAND, condOR, colNameView, condSqlStr);
+ }
+ pIRDataSet = new QList<QVariant*>();
+ if( m_pIRDB->selectRowIRDB(this, condSqlStr, false, NULL, pIRDataSet) )
+ {
+ delete pIRDataSet;
+ pIRDataSet = NULL;
+ }
+
+ return pIRDataSet;
+}
+
+/*
+* If all parameters are default, all cid rows in IRDB will return;
+*/
+QList<uint>* IRDBWrapper::getChannelId(const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ QString condSqlStr;
+ QList<uint>* pQListCIDSet = NULL;
+ /*this case is wrong logic*/
+ if( (NULL != condAND)&&(NULL != condOR) )
+ {
+ return NULL;
+ }
+
+ if( (NULL != condAND)||(NULL != condOR) )
+ {
+ combineCondStr(condAND, condOR, colNameView, condSqlStr);
+ }
+ pQListCIDSet = new QList<uint>();
+ if( m_pIRDB->selectRowIRDB(this, condSqlStr, true, pQListCIDSet, NULL) )
+ {
+ delete pQListCIDSet;
+ pQListCIDSet = NULL;
+ }
+
+ return pQListCIDSet;
+}
+
+
+bool IRDBWrapper::loadDataOfChannelIdCB(QSqlQuery& aIRDataSet, QList<uint>* pQListCIDSet)
+{
+ while(aIRDataSet.next())
+ {
+ *pQListCIDSet<<aIRDataSet.value(0).toUInt();
+ }
+
+ return true;
+}
+
+
+bool IRDBWrapper::loadDataOfIRDBCB(QSqlQuery& aIRDataSet, QList<QVariant*>* pIRDataSet)
+{
+ while (aIRDataSet.next())
+ {
+ QVariant* const p = new QVariant[IRDB_CHANNELINFO_COLUMN];
+
+ *pIRDataSet<<p;
+
+ for(int i = 0; i < IRDB_CHANNELINFO_COLUMN; i++)
+ {
+ *(p+i) = aIRDataSet.value(i);
+ }
+ }
+
+ return true;
+}
+
+bool IRDBWrapper::getIRTableCB(QSqlQuery& aIRDataSet, QList<QVariant*>* p)
+{
+ Q_UNUSED(aIRDataSet);
+ Q_UNUSED(p);
+ return true;
+}
+
+
+void IRDBWrapper::combinePutStr(const columnMap* const RowData,
+ const QString* pArryColName,
+ QString& insSqlStr,
+ QString& updSqlStr,
+ const logoMap* const logoData,
+ QList<QByteArray>* logoArrayList)
+{
+ bool bContinue = false;
+ columnMap::const_iterator it;
+ logoMap::const_iterator itLogoMap;
+ QString escStr;
+ insSqlStr += "(";
+
+ if(NULL != RowData)
+ {
+ bContinue = true;
+ it = RowData->begin();
+ while(it != RowData->end())
+ {
+ if(it != RowData->begin())
+ {
+ insSqlStr += ",";
+ }
+
+ insSqlStr += pArryColName[it.key()];
+
+ ++it;
+ }
+ }
+
+ if(NULL != logoData)
+ {
+ itLogoMap = logoData->begin();
+ while(itLogoMap != logoData->end())
+ {
+ if( (false != bContinue)||(itLogoMap != logoData->begin()) )
+ {
+ insSqlStr += ",";
+ }
+
+ insSqlStr += colNameLogo[itLogoMap.key()];
+ ++itLogoMap;
+ }
+ }
+
+ insSqlStr += ") values(";
+ if(NULL != RowData)
+ {
+ it = RowData->begin();
+ while(it != RowData->end())
+ {
+ if(it != RowData->begin())
+ {
+ insSqlStr += ",";
+ }
+ //here for escape char,
+ escStr = it.value();
+ escStr.replace('\'', "\'\'");
+
+ insSqlStr = insSqlStr + "'"+ escStr+ "'";
+
+ ++it;
+ }
+ }
+
+
+ if(NULL != logoData)
+ {
+ itLogoMap = logoData->begin();
+ while(itLogoMap != logoData->end())
+ {
+ if( (false != bContinue)||(itLogoMap != logoData->begin()) )
+ {
+ insSqlStr += ",";
+ }
+ insSqlStr = insSqlStr + " :"+colNameLogo[itLogoMap.key()];
+ *logoArrayList<<itLogoMap.value();
+
+ ++itLogoMap;
+ }
+ }
+
+ insSqlStr += " )";
+
+ //part two, create update string;
+ if(NULL != RowData)
+ {
+ it = RowData->begin();
+
+ while( it != RowData->end())
+ {
+ if(it != RowData->begin())
+ {
+ updSqlStr += ", ";
+ }
+ if(pArryColName[it.key()] == "opt")
+ {
+ updSqlStr = updSqlStr + pArryColName[it.key()] + "=" + "'" + QString::number(IRDB_OPT_TRIGGER) + "'";
+ }
+ else
+ {
+ //here for escape char,
+ escStr = it.value();
+ escStr.replace('\'', "\'\'");
+ updSqlStr = updSqlStr + pArryColName[it.key()] + "=" + "'" + escStr + "'";
+ }
+ ++it;
+ }
+ }
+
+ if(NULL != logoData)
+ {
+ itLogoMap = logoData->begin();
+ while(itLogoMap != logoData->end())
+ {
+ if( (false != bContinue)||(itLogoMap != logoData->begin()) )
+ {
+ updSqlStr += ",";
+ }
+
+ updSqlStr = updSqlStr + colNameLogo[itLogoMap.key()] + "=:"+colNameLogo[itLogoMap.key()];
+ ++itLogoMap;
+ }
+ }
+
+ return;
+}
+
+
+
+void IRDBWrapper::combineCondStr(const columnMap* const condAND,
+ const columnMap* const condOR,
+ const QString* pArryColName,
+ QString& condSqlStr)
+{
+ bool bDone = false;
+ columnMap::const_iterator it;
+
+ if(NULL != condAND)
+ {
+ if( true != condAND->empty() )
+ {
+ it = condAND->begin();
+
+ condSqlStr = " where ";
+
+ while( it != condAND->end())
+ {
+ if(it != condAND->begin())
+ {
+ condSqlStr += " AND ";
+ }
+
+ condSqlStr = condSqlStr + pArryColName[it.key()] + "=" + "'" + it.value()+ "'" ;
+
+ ++it;
+ }
+
+ bDone = true;
+ }
+ }
+
+ if(true == bDone)
+ {
+ return;
+ }
+
+ if(NULL != condOR )
+ {
+ if( true != condOR->empty() )
+ {
+ it = condOR->begin();
+ condSqlStr = " where ";
+
+ while( it != condOR->end())
+ {
+ if(it != condOR->begin())
+ {
+ condSqlStr += " OR ";
+ }
+
+ condSqlStr = condSqlStr + pArryColName[it.key()] + "=" + "'" + it.value()+ "'" ;
+ ++it;
+ }
+ }
+ }
+
+ return;
+}
+
+
+void IRDBWrapper::combineGetStr(const columnMap* const condAND,
+ const columnMap* const condOR,
+ const QString* pArryColName,
+ QString& sltSqlStr)
+{
+ QString condStr;
+
+ combineCondStr(condAND, condOR, pArryColName, condStr);
+ sltSqlStr += condStr;
+
+ return;
+}
+
+void IRDBWrapper::combineDeleteStr(const columnMap* const condAND,
+ const columnMap* const condOR,
+ const QString* pArryColName,
+ QString& dltSqlStr)
+{
+ QString condStr;
+
+ combineCondStr(condAND, condOR, pArryColName, condStr);
+ dltSqlStr += condStr;
+
+ return;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/src/searchrltwrapper.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,254 @@
+/*
+* 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.
+*
+* Description:
+*
+*/
+
+#include <QSqlQuery>
+#include <QVariant>
+#include "searchrltwrapper.h"
+#include "irdb.h"
+
+searchRltWrapper::searchRltWrapper()
+{
+}
+
+searchRltWrapper::~searchRltWrapper()
+{
+}
+
+/*
+* this fuction don't suport "update" operation for mutliple records ;
+* if condAND != NULL AND condOR != NULL, illegal operation;
+* if condAND != NULL or condOR != NULL, it must be "update" operation.
+* if condAND == NULL AND condOR == NULL, it is "insert" or "update" operation;
+*
+*/
+bool searchRltWrapper::putSearchRlt(const columnMap* const RowData,
+ const logoMap* const logoData,
+ const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ uint uCid = 0;
+ QString insSqlStr;
+ QString updSqlStr;
+ QString condSqlStr;
+ QString condUserCidStr;
+ columnMap* const RowDataAppend = const_cast<columnMap*>(RowData);
+ QList<QByteArray>* pImgList = NULL;
+ bool ret = true;
+
+ if( NULL == RowData )
+ {
+ return false;
+ }
+
+ if(RowData->isEmpty())
+ {
+ return false;
+ }
+
+
+ if( (NULL != condAND)&&(NULL != condOR) )
+ {
+ return false;
+ }
+
+ if(condAND)
+ {
+ if(condAND->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ if(condOR)
+ {
+ if(condOR->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ insSqlStr = "insert into IRBuff ";
+ updSqlStr = "update IRBuff set ";
+ RowDataAppend->insert(dataSource, QString::number(DATA_OF_SEARCHRLT));
+ RowDataAppend->insert(opt, QString::number(IRDB_OPT_INSERT));
+
+ if(NULL != logoData)
+ {
+ pImgList = new QList<QByteArray>();
+ combinePutStr(RowDataAppend, colNameView, insSqlStr, updSqlStr, logoData, pImgList);
+
+ }
+ else
+ {
+ combinePutStr(RowDataAppend, colNameView, insSqlStr, updSqlStr);
+ }
+
+ if( (NULL == condAND)&&(NULL == condOR) )
+ {
+ uCid = srhChannelId(condUserCidStr,RowData);
+ }
+ else //here it must be "update" operation; condition string
+ {
+ uCid = srhChannelId(condUserCidStr,condAND, condOR);
+ combineCondStr(condAND, condOR, colNameView,condSqlStr);
+ }
+
+ if(uCid)
+ {
+ //updSqlStr += condSqlStr;
+ m_pIRDB->chgRowIRDB(insSqlStr, updSqlStr, uCid, condSqlStr, pImgList)? ret = false:true;
+ }
+ else //here deliver the updSqlstr and condSqlStr seperately.
+ {
+ m_pIRDB->chgRowIRDB(insSqlStr, updSqlStr, NULL, condSqlStr, condUserCidStr, pImgList)?ret = false:true;
+ }
+
+ if(pImgList)
+ {
+ delete pImgList;
+ pImgList = NULL;
+ }
+
+ return ret;
+}
+
+QList<QVariant*>* searchRltWrapper::getSearchRlt(const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ QString sltSqlStr = "select * from IRVIEW_searchRlt ";
+ QList<QVariant*>* pDataSet = NULL;
+
+ if( (NULL != condAND)&&(NULL != condOR) )
+ {
+ return NULL;
+ }
+
+ if(condAND)
+ {
+ if(condAND->isEmpty())
+ {
+ return NULL;
+ }
+ }
+
+ if(condOR)
+ {
+ if(condOR->isEmpty())
+ {
+ return NULL;
+ }
+ }
+
+ combineGetStr(condAND, condOR, colNameView, sltSqlStr);
+ pDataSet = new QList<QVariant*>();
+ if( m_pIRDB->selectRow(this, sltSqlStr, pDataSet) )
+ {
+ delete pDataSet;
+ pDataSet = NULL;
+ }
+
+ return pDataSet;
+}
+
+
+bool searchRltWrapper::deleteSearchRlt(const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ QString deleteSqlStr = "delete from searchRlt ";
+
+ if( (NULL != condAND)&&(NULL != condOR) )
+ {
+ return false;
+ }
+
+ if(condAND)
+ {
+ if(condAND->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ if(condOR)
+ {
+ if(condOR->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ combineDeleteStr(condAND, condOR, colNameView, deleteSqlStr);
+ return m_pIRDB->deleteRow(deleteSqlStr)? false:true;
+}
+
+
+bool searchRltWrapper::getIRTableCB(QSqlQuery& aIRDataSet, QList<QVariant*>* pDataSet)
+{
+
+ while (aIRDataSet.next())
+ {
+ QVariant* const p = new QVariant[IRDB_SEARCHRLT_COLUMN];
+
+ *pDataSet<<p;
+
+ for(int i = 0; i < IRDB_SEARCHRLT_COLUMN; i++)
+ {
+ *(p+i) = aIRDataSet.value(i);
+ }
+ }
+
+ return true;
+}
+
+uint searchRltWrapper::srhChannelId(QString& condUserCidStr,
+ const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ uint srhCID = 0;
+
+ //if condAND or condOR has channeld,
+ if(condAND != NULL)
+ {
+ srhCID = (condAND->value(channelId)).toUInt();
+ }
+ else if(condOR != NULL)
+ {
+ srhCID = (condOR->value(channelId)).toUInt();
+ }
+
+ if(srhCID)
+ {
+ return srhCID ;
+ }
+
+ //channelId column is false
+ //only one case, go to station view, channelUrl and channelNickName
+ //search channelId according to urlinof and channelNickName;
+ QString srhStr;
+ if(condAND != NULL)
+ {
+ if( ( !(condAND->value(channelUrl).isEmpty()) )&&( !(condAND->value(channelNickName).isEmpty()) ) )
+ {
+ srhStr = "where "+ colNameView[channelUrl] + " = ";
+ srhStr = srhStr + "'" + condAND->value(channelUrl) + "' AND " ;
+ srhStr = srhStr + colNameView[channelNickName] + " = ";
+ srhStr = srhStr + "'" + condAND->value(channelNickName) + "'";
+ }
+ condUserCidStr = srhStr;
+ }
+
+ return srhCID;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/src/songhistorywrapper.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,219 @@
+/*
+* 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.
+*
+* Description:
+*
+*/
+
+#include <QSqlQuery>
+#include <QVariant>
+#include "songhistorywrapper.h"
+#include "irdb.h"
+
+songHistoryWrapper::songHistoryWrapper()
+{
+}
+
+songHistoryWrapper::~songHistoryWrapper()
+{
+}
+
+bool songHistoryWrapper::putSongHistory(const columnMap* const RowData,
+ const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ QString sSongName;
+ QString sArtistName;
+ uint uCid = 0;
+ QString insSqlStr;
+ QString updSqlStr;
+ QString condSqlStr;
+
+
+ if( NULL == RowData )
+ {
+ return false;
+ }
+
+ if(RowData->isEmpty())
+ {
+ return false;
+ }
+
+ if(NULL != condOR)
+ {
+ return false;
+ }
+
+ if(condAND)
+ {
+ if(condAND->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ insSqlStr = "insert into songHistory ";
+ updSqlStr = "update songHistory set ";
+ combinePutStr(RowData,colNameView, insSqlStr, updSqlStr);
+
+ if(condAND == NULL) //for update or insert;
+ {
+ /*
+ * insert string, there must be have songName and ChannelId;
+ * update string, there must have songName, channelId and artistname.
+ */
+ sSongName = RowData->value(songName);
+ uCid = (RowData->value(channelId)).toUInt();
+ sArtistName = (RowData->value(artistName));
+
+ if( (sSongName.isEmpty()) || (0 == uCid) )
+ {
+ return false;
+ }
+ if(sArtistName.isEmpty())
+ {
+ /*
+ * In songhistorywrapper.cpp,
+ * if (songname not change && artistname not change && channeled not change) then update,
+ * otherwise insert a new one.
+ */
+ updSqlStr.clear();
+ }
+ else
+ {
+ //combine cond str;
+ //combineCondStr(RowData, NULL, colNameSongHistory, condSqlStr);
+ condSqlStr = "where songName = '" + sSongName +"'";
+ condSqlStr += " AND ";
+ condSqlStr = condSqlStr + "channelId = " + QString::number(uCid);
+ condSqlStr += " AND ";
+ condSqlStr = condSqlStr + "artistName = '" + sArtistName+"'";
+ }
+
+ }
+ else //if condtion isn't null, it is update. for update, songName must be in condAND or condOR;
+ {
+ /*
+ * if cond != NULL,
+ * there must have songname and channelId and artistName in cond AND
+ * there must have not channelId in Rowdata
+ */
+ if(!(RowData->value(channelId)).isEmpty())
+ {
+ return false;
+ }
+ sSongName = condAND->value(songName);
+ uCid = (condAND->value(channelId)).toUInt();
+ sArtistName = (condAND->value(artistName));
+
+ if( ( sSongName.isEmpty()) || (0 == uCid) || (sArtistName.isEmpty()) )
+ {
+ return false;
+ }
+
+ //combine update string;
+ combineCondStr(condAND, NULL, colNameView, condSqlStr);
+ insSqlStr.clear();
+ //updSqlStr += condSqlStr;
+ }
+
+ return m_pIRDB->chgRowSongHistory(insSqlStr, updSqlStr, condSqlStr, sSongName, uCid)? false:true;
+}
+
+bool songHistoryWrapper::deleteSongHistory(const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ QString deleteSqlStr = "delete from SongHistory ";
+
+ if( (NULL != condAND)&&(NULL != condOR) )
+ {
+ return false;
+ }
+
+ if(condAND)
+ {
+ if(condAND->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ if(condOR)
+ {
+ if(condOR->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ combineDeleteStr(condAND, condOR, colNameView, deleteSqlStr);
+ return m_pIRDB->deleteRow(deleteSqlStr)? false:true;
+}
+
+
+QList<QVariant*>* songHistoryWrapper::getSongHistory(const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ QString sltSqlStr = "select * from songHistory ";
+ QList<QVariant*>* pDataSet = NULL;
+
+ if( (NULL != condAND)&&(NULL != condOR) )
+ {
+ return NULL;
+ }
+
+ if(condAND)
+ {
+ if(condAND->isEmpty())
+ {
+ return NULL;
+ }
+ }
+
+ if(condOR)
+ {
+ if(condOR->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ combineGetStr(condAND, condOR, colNameView, sltSqlStr);
+ sltSqlStr = sltSqlStr + " order by songPlaySeq desc ";
+ pDataSet = new QList<QVariant*>();
+ if( m_pIRDB->selectRow(this, sltSqlStr, pDataSet) )
+ {
+ delete pDataSet;
+ pDataSet = NULL;
+ }
+
+ return pDataSet;
+}
+
+bool songHistoryWrapper::getIRTableCB(QSqlQuery& aIRDataSet, QList<QVariant*>* pDataSet)
+{
+ while (aIRDataSet.next())
+ {
+ QVariant* const p = new QVariant[IRDB_SONGHISTORY_COLUMN];
+ *pDataSet<<p;
+
+ for(int i = 0; i < IRDB_SONGHISTORY_COLUMN; i++)
+ {
+ *(p+i) = aIRDataSet.value(i);
+ }
+ }
+
+ return true;
+
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/irdb/src/urlinfowrapper.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* 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.
+*
+* Description:
+*
+*/
+
+#include <QSqlQuery>
+#include <QVariant>
+#include <QStringList>
+
+#include "urlinfowrapper.h"
+#include "irdb.h"
+
+urlInfoWrapper::urlInfoWrapper()
+{
+}
+
+urlInfoWrapper::~urlInfoWrapper()
+{
+}
+
+bool urlInfoWrapper::resetUrlInfo(const columnUrlInfoInsertMap* const RowData,
+ const uint& channelId)
+{
+ QStringList insSqlStrList;
+
+ if(!channelId)
+ {
+ return false;
+ }
+
+ if( NULL == RowData )
+ {
+ return false;
+ }
+
+ if(RowData->isEmpty())
+ {
+ return false;
+ }
+
+ combineInsertStr(RowData, channelId, insSqlStrList);
+ return m_pIRDB->resetUrlInfo(insSqlStrList, channelId)? false:true;
+}
+
+void urlInfoWrapper::combineInsertStr(const columnUrlInfoInsertMap* const RowData,
+ const uint& channelId,
+ QStringList& insSqlStrList)
+{
+ columnUrlInfoInsertMap::const_iterator it;
+ QString insSqlStr;
+ it = RowData->begin();
+ while(it != RowData->end())
+ {
+ insSqlStr = "Insert into urlinfo(channelUrl, channelId, bitrate) values(";
+ insSqlStr += "'" +it.key()+ "'" +", ";
+ insSqlStr += QString::number(channelId);
+ insSqlStr += ", ";
+ insSqlStr += QString::number(it.value());
+ insSqlStr += " )" ;
+
+ insSqlStrList<<insSqlStr;
+
+ ++it;
+ }
+
+ return;
+}
+
+QList<QVariant*>* urlInfoWrapper::getUrlInfo(const columnMap* const condAND,
+ const columnMap* const condOR)
+{
+ QString sltSqlStr = "select channelUrl, channelId, bitRate from urlInfo ";
+ QList<QVariant*>* pDataSet = NULL;
+
+ if( (NULL != condAND)&&(NULL != condOR) )
+ {
+ return NULL;
+ }
+
+ if(condAND)
+ {
+ if(condAND->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ if(condOR)
+ {
+ if(condOR->isEmpty())
+ {
+ return false;
+ }
+ }
+
+ combineGetStr(condAND, condOR, colNameView, sltSqlStr);
+ pDataSet = new QList<QVariant*>();
+ if( m_pIRDB->selectRow(this, sltSqlStr, pDataSet) )
+ {
+ delete pDataSet;
+ pDataSet = NULL;
+ }
+
+ return pDataSet;
+}
+
+bool urlInfoWrapper::getIRTableCB(QSqlQuery& aIRDataSet, QList<QVariant*>* pDataSet)
+{
+ while (aIRDataSet.next())
+ {
+ QVariant* const p = new QVariant[IRDB_URLINFO_COLUMN];
+ *pDataSet<<p;
+
+ for(int i = 0; i < IRDB_URLINFO_COLUMN; i++)
+ {
+ *(p+i) = aIRDataSet.value(i);
+ }
+ }
+
+ return true;
+}
+
+
--- a/qtinternetradio/irqcommon/inc/irqisdsdatastructure.h Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/irqcommon/inc/irqisdsdatastructure.h Fri Sep 17 08:27:59 2010 +0300
@@ -111,8 +111,7 @@
QString countryName;//preset country of origin
QString lastModified;//preset last modified
QString musicStoreStatus;//musicStoreEnabled value
- //QByteArray logoData;//Logo Data
- RBuf8 logoData;
+ QByteArray logoData;//Logo Data
QString description;//channel description
QString shortDesc;//channel short desription
QString genreName;//channel genre name
--- a/qtinternetradio/irqcommon/src/irqisdsdatastructure.cpp Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/irqcommon/src/irqisdsdatastructure.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -40,7 +40,6 @@
IRQPreset::~IRQPreset()
{
urlArray.clear();
- logoData.Close();
}
IRQPreset& IRQPreset::operator =(const IRQPreset& aOther)
@@ -67,8 +66,7 @@
this->genreName = aOther.genreName;
this->shortDesc = aOther.shortDesc;
this->description = aOther.description;
- this->logoData.Close();
- this->logoData.Create(aOther.logoData);
+ this->logoData = aOther.logoData;
this->musicStoreStatus = aOther.musicStoreStatus;
this->lastModified = aOther.lastModified;
this->countryCode = aOther.countryCode;
--- a/qtinternetradio/irqcommon/src/irqutility.cpp Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/irqcommon/src/irqutility.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -14,11 +14,6 @@
* Description:
*
*/
-#include <QString>
-#include <QByteArray>
-#include <QFile>
-#include <QTextStream>
-#include <QStringList>
#include <xqsettingsmanager.h>
#include <xqsettingskey.h>
@@ -69,9 +64,7 @@
aQIRPreset.advertisementInUse = QString::fromUtf16(aCIRIsdsPreset.GetAdvertisementInUse().Ptr(),aCIRIsdsPreset.GetAdvertisementInUse().Length());
aQIRPreset.imgUrl = QString::fromUtf16(aCIRIsdsPreset.GetImgUrl().Ptr(), aCIRIsdsPreset.GetImgUrl().Length());
- aQIRPreset.logoData.Close();
- TRAP_IGNORE(aQIRPreset.logoData.CreateL(aCIRIsdsPreset.GetLogoData()));
-
+ aQIRPreset.logoData = QByteArray((const char*)aCIRIsdsPreset.GetLogoData().Ptr(), aCIRIsdsPreset.GetLogoData().Length());
aQIRPreset.musicStoreStatus = QString::fromUtf16(aCIRIsdsPreset.GetMusicStoreStatus().Ptr(), aCIRIsdsPreset.GetMusicStoreStatus().Length());
aQIRPreset.clearChannelServerList();
@@ -139,7 +132,6 @@
TPtrC16 musicStoreStatus(reinterpret_cast<const TUint16*>(aQIRPreset.musicStoreStatus.utf16()));
TRAP_IGNORE(aCIRIsdsPreset.SetMusicStoreStatusL(musicStoreStatus));
- TRAP_IGNORE(aCIRIsdsPreset.SetLogoDataL(aQIRPreset.logoData));
TRAP_IGNORE(appendURLL(aQIRPreset, aCIRIsdsPreset));
}
--- a/qtinternetradio/irqlogger/inc/irqlogger.h Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/irqlogger/inc/irqlogger.h Fri Sep 17 08:27:59 2010 +0300
@@ -26,7 +26,7 @@
static const char* KTraceOutputFile = "c:/logs/internetradio/iruilog.txt";
#define FILTER_BY_LOGMARKER true
-#ifdef LOGGING_ENABLED
+#if defined(LOGGING_ENABLED) && !defined(QT_NO_DEBUG)
#ifdef COMBINE_WITH_ENGINE_LOGGER
#define WRITELOG(msg) \
@@ -101,7 +101,7 @@
} \
}
-#else // LOGGING_ENABLED
+#else // LOGGING_ENABLED && QT_NO_DEBUG
#define LOG(string)
#define STRING2CHAR(qstring)
#define LOG_FORMAT(fmt,args...)
@@ -110,7 +110,7 @@
#define LOG_ASSERT(cond,expr)
#define LOG_SLOT_CALLER
#define INSTALL_MESSAGE_HANDLER
-#endif // LOGGING_ENABLED
+#endif // LOGGING_ENABLED && QT_NO_DEBUG
--- a/qtinternetradio/irqlogger/src/irqlogger.cpp Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/irqlogger/src/irqlogger.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -52,7 +52,7 @@
// ============================================================================
// MethodLogger Defenition
// ============================================================================
-#ifdef LOGGING_ENABLED
+#if defined(LOGGING_ENABLED) && !defined(QT_NO_DEBUG)
const char* KLogEnter = "--> %s";
const char* KLogExit = "<-- %s";
@@ -82,7 +82,7 @@
}
}
-#else // LOGGING_ENABLED
+#else // LOGGING_ENABLED && QT_NO_DEBUG
MethodLogger::MethodLogger( const char* aFunction ) :
iFunction( aFunction )
@@ -93,7 +93,7 @@
{
}
-#endif // LOGGING_ENABLED
+#endif // LOGGING_ENABLED && QT_NO_DEBUG
// ============================================================================
@@ -102,7 +102,7 @@
QFile gDebugFile;
bool gFilterByLogMarker = false;
-#if defined LOGGING_ENABLED && defined TRACE_TO_FILE && !defined COMBINE_WITH_ENGINE_LOGGER
+#if defined LOGGING_ENABLED && defined TRACE_TO_FILE && !defined COMBINE_WITH_ENGINE_LOGGER && !defined(QT_NO_DEBUG)
FileLogger::FileLogger(const QString& aFileName, bool aFilterByMarker)
{
@@ -114,7 +114,7 @@
uninstallMessageHandler();
}
-#else // LOGGING_ENABLED && TRACE_TO_FILE && !COMBINE_WITH_ENGINE_LOGGER
+#else // LOGGING_ENABLED && TRACE_TO_FILE && !COMBINE_WITH_ENGINE_LOGGER && QT_NO_DEBUG
FileLogger::FileLogger(const QString& aFileName, bool aFilterByMarker)
{
@@ -126,7 +126,7 @@
{
}
-#endif // LOGGING_ENABLED && TRACE_TO_FILE && !COMBINE_WITH_ENGINE_LOGGER
+#endif // LOGGING_ENABLED && TRACE_TO_FILE && !COMBINE_WITH_ENGINE_LOGGER && QT_NO_DEBUG
void FileLogger::installMessageHandler( const QString& aFileName, bool aFilterByMarker )
{
--- a/qtinternetradio/rom/qtinternetradio.iby Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/rom/qtinternetradio.iby Fri Sep 17 08:27:59 2010 +0300
@@ -33,6 +33,7 @@
file=ABI_DIR\BUILD_DIR\irqstatisticsreporter.dll SHARED_LIB_DIR\irqstatisticsreporter.dll
file=ABI_DIR\BUILD_DIR\irqsystemeventhandler.dll SHARED_LIB_DIR\irqsystemeventhandler.dll
file=ABI_DIR\BUILD_DIR\irqlogger.dll SHARED_LIB_DIR\irqlogger.dll
+file=ABI_DIR\BUILD_DIR\irdb.dll SHARED_LIB_DIR\irdb.dll
data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\internet_radio_10_1_reg.rsc Private\10003a3f\import\apps\internet_radio_10_1_reg.rsc
--- a/qtinternetradio/ui/inc/irapplication.h Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/ui/inc/irapplication.h Fri Sep 17 08:27:59 2010 +0300
@@ -99,7 +99,6 @@
signals:
void quit();
- void applicationReady();
private slots:
//connect to signal 'networkEventNotified' from IRQNetworkController
--- a/qtinternetradio/ui/inc/ircategoryview.h Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/ui/inc/ircategoryview.h Fri Sep 17 08:27:59 2010 +0300
@@ -30,9 +30,6 @@
~IRCategoryView();
void loadCategory(IRQIsdsClient::IRQIsdsClientInterfaceIDs aCategory);
-
-signals:
- void applicationReady();
protected:
IRCategoryView(IRApplication* aApplication, TIRViewId aViewId);
--- a/qtinternetradio/ui/inc/irfavoritesview.h Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/ui/inc/irfavoritesview.h Fri Sep 17 08:27:59 2010 +0300
@@ -31,9 +31,6 @@
public:
~IRFavoritesView();
-
-signals:
- void applicationReady();
protected:
IRFavoritesView(IRApplication *aApplication, TIRViewId aViewId);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/ui/inc/irhbapplication.h Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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 IRHBAPPLICATION_H_
+#define IRHBAPPLICATION_H_
+
+#include <HbApplication>
+
+class IRHbApplication : public HbApplication
+{
+ Q_OBJECT
+public:
+ IRHbApplication(int &argc, char *argv[], Hb::ApplicationFlags flags = Hb::DefaultApplicationFlags);
+ void initMattiAutomation();
+
+private slots:
+ void handleAppReady();
+
+signals:
+ void applicationReady();
+};
+
+#endif /* IRHBAPPLICATION_H_ */
--- a/qtinternetradio/ui/inc/irmainview.h Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/ui/inc/irmainview.h Fri Sep 17 08:27:59 2010 +0300
@@ -27,9 +27,6 @@
Q_OBJECT
public:
~IRMainView();
-
-signals:
- void applicationReady();
protected:
//only friend class IRViewManager can create this view
--- a/qtinternetradio/ui/inc/irnowplayingview.h Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/ui/inc/irnowplayingview.h Fri Sep 17 08:27:59 2010 +0300
@@ -40,9 +40,6 @@
public:
~IRNowPlayingView();
-
-signals:
- void applicationReady();
protected:
IRNowPlayingView(IRApplication* aApplication, TIRViewId aViewId);
--- a/qtinternetradio/ui/src/irapplication.cpp Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/ui/src/irapplication.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -648,8 +648,6 @@
}
}
#endif
-
- emit applicationReady();
}
bool IRApplication::event(QEvent* e)
--- a/qtinternetradio/ui/src/ircategoryview.cpp Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/ui/src/ircategoryview.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -382,6 +382,11 @@
{
getViewManager()->activateView(EIRView_MainView);
}
+ if((getViewManager()->currentViewId() == EIRView_MainView) || (getViewManager()->currentViewId() == EIRView_FavoritesView))
+ {
+ IRBaseView *baseView = static_cast<IRBaseView*>(getViewManager()->currentView());
+ baseView->updateView();
+ }
}
/*
@@ -407,6 +412,11 @@
{
getViewManager()->activateView(EIRView_MainView);
}
+ if((getViewManager()->currentViewId() == EIRView_MainView) || (getViewManager()->currentViewId() == EIRView_FavoritesView))
+ {
+ IRBaseView *baseView = static_cast<IRBaseView*>(getViewManager()->currentView());
+ baseView->updateView();
+ }
}
// private functions
--- a/qtinternetradio/ui/src/irchanneldataprovider.cpp Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/ui/src/irchanneldataprovider.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -196,11 +196,10 @@
delete iLogoPreset;
iLogoPreset = aPreset;
- if (iLogoPreset->logoData != KNullDesC8)
+ if (iLogoPreset->logoData.size() > 0)
{
- QPixmap tempMap;
- const unsigned char * logoData = iLogoPreset->logoData.Ptr();
- bool ret = tempMap.loadFromData(logoData, iLogoPreset->logoData.Length());
+ QPixmap tempMap;
+ bool ret = tempMap.loadFromData((const unsigned char*)iLogoPreset->logoData.constData(), iLogoPreset->logoData.size());
if( ret )
{
--- a/qtinternetradio/ui/src/irfavoritesview.cpp Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/ui/src/irfavoritesview.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -281,11 +281,10 @@
delete iLogoPreset;
iLogoPreset = aPreset;
- if (iLogoPreset->logoData != KNullDesC8)
+ if (iLogoPreset->logoData.size() > 0)
{
- const unsigned char * logoData = iLogoPreset->logoData.Ptr();
QPixmap tempMap;
- bool ret = tempMap.loadFromData(logoData,iLogoPreset->logoData.Length());
+ bool ret = tempMap.loadFromData((const unsigned char*)iLogoPreset->logoData.constData(), iLogoPreset->logoData.size());
if( ret )
{
QIcon convertIcon(tempMap);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/ui/src/irhbapplication.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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 <HbInstance>
+#include "irhbapplication.h"
+
+IRHbApplication::IRHbApplication(int &argc, char *argv[], Hb::ApplicationFlags flags)
+ : HbApplication(argc, argv, flags)
+{
+
+}
+
+void IRHbApplication::initMattiAutomation()
+{
+ HbMainWindow *window = hbInstance->allMainWindows().first();
+ connect(window, SIGNAL(viewReady()), this, SLOT(handleAppReady()));
+}
+
+void IRHbApplication::handleAppReady()
+{
+ HbMainWindow *window = hbInstance->allMainWindows().first();
+ if (NULL != window->currentView())
+ {
+ emit applicationReady();
+ disconnect(window, SIGNAL(viewReady()), this, SLOT(handleAppReady()));
+ }
+}
--- a/qtinternetradio/ui/src/irhistoryview.cpp Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/ui/src/irhistoryview.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -293,11 +293,10 @@
delete iLogoPreset;
iLogoPreset = aPreset;
- if (iLogoPreset->logoData != KNullDesC8)
+ if (iLogoPreset->logoData.size() > 0)
{
- const unsigned char * logoData = iLogoPreset->logoData.Ptr();
QPixmap tempMap;
- bool ret = tempMap.loadFromData(logoData,iLogoPreset->logoData.Length());
+ bool ret = tempMap.loadFromData((const unsigned char*)iLogoPreset->logoData.constData(), iLogoPreset->logoData.size());
if( ret )
{
QIcon convertIcon(tempMap);
@@ -384,6 +383,7 @@
HbNotificationDialog *add2FavNote = new HbNotificationDialog();
add2FavNote->setModal(true);
+ add2FavNote->setTimeout(HbPopup::ConfirmationNoteTimeout);
add2FavNote->setAttribute(Qt::WA_DeleteOnClose);
switch (retValue)
--- a/qtinternetradio/ui/src/irnowplayingview.cpp Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/ui/src/irnowplayingview.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -15,6 +15,7 @@
*
*/
#include <QPixmap>
+#include <hbmenu.h>
#include <hbaction.h>
#include <hblabel.h>
#include <hbmarqueeitem.h>
@@ -204,6 +205,17 @@
connect(settings, SIGNAL(triggered()), this, SLOT(handleSettingAction()));
connect(exitAction, SIGNAL(triggered()), iApplication, SIGNAL(quit()));
connect(songRecAction, SIGNAL(triggered()), this, SLOT(handleIdentifySongAction()));
+
+ if(iApplication->isEmbeddedInstance())
+ {
+ HbMenu *viewMenu = menu();
+ disconnect(openWebAddressAction, SIGNAL(triggered()), this, SLOT(handleGoToStationAction()));
+ disconnect(settings, SIGNAL(triggered()), this, SLOT(handleSettingAction()));
+ disconnect(songRecAction, SIGNAL(triggered()), this, SLOT(handleIdentifySongAction()));
+ viewMenu->removeAction(openWebAddressAction);
+ viewMenu->removeAction(settings);
+ viewMenu->removeAction(songRecAction);
+ }
}
/*
@@ -537,9 +549,8 @@
- const unsigned char * logoRawData = aPreset->logoData.Ptr();
QPixmap logoPixmap;
- if( logoPixmap.loadFromData(logoRawData, aPreset->logoData.Length()) )
+ if( logoPixmap.loadFromData((const unsigned char*)aPreset->logoData.constData(), aPreset->logoData.size()) )
{
if( EDownloadLogo == iLogoDownloadState )
{
@@ -836,6 +847,7 @@
int retValue = iFavorites->addPreset(*nowPlayingPreset);
HbNotificationDialog *add2FavNote = new HbNotificationDialog();
add2FavNote->setModal(true);
+ add2FavNote->setTimeout(HbPopup::ConfirmationNoteTimeout);
add2FavNote->setAttribute(Qt::WA_DeleteOnClose);
switch (retValue)
{
--- a/qtinternetradio/ui/src/irsearchchannelsview.cpp Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/ui/src/irsearchchannelsview.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -434,11 +434,10 @@
delete iLogoPreset;
iLogoPreset = aPreset;
- if (iLogoPreset->logoData != KNullDesC8)
+ if (iLogoPreset->logoData.size() > 0)
{
- QPixmap tempMap;
- const unsigned char * logoData = iLogoPreset->logoData.Ptr();
- bool ret = tempMap.loadFromData(logoData, iLogoPreset->logoData.Length());
+ QPixmap tempMap;
+ bool ret = tempMap.loadFromData((const unsigned char*)iLogoPreset->logoData.constData(), iLogoPreset->logoData.size());
QIcon convertIcon(tempMap);
if( ret )
--- a/qtinternetradio/ui/src/main.cpp Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/ui/src/main.cpp Fri Sep 17 08:27:59 2010 +0300
@@ -15,14 +15,11 @@
*
*/
-#include <hbapplication.h>
#include <hbdevicemessagebox.h>
-#include <QLocalSocket>
#include <hbsplashscreen.h>
#include <hbtranslator.h>
-#include <xqserviceutil.h>
-
+#include "irhbapplication.h"
#include "irviewmanager.h"
#include "irapplication.h"
#include "irmemorycollector.h"
@@ -45,7 +42,7 @@
installLogDir();
INSTALL_MESSAGE_HANDLER;
- HbApplication app(argc, argv, Hb::NoSplash);
+ IRHbApplication app(argc, argv, Hb::NoSplash);
HbTranslator* translator = new HbTranslator();
Q_ASSERT( NULL != translator );
translator->loadCommon();
@@ -70,6 +67,7 @@
IRApplication *irapp = new IRApplication(mainWindow, systemEventHandler);
IRMemoryCollector mc(irapp);
+ app.initMattiAutomation();
if(!mainWindow->isExiting())
{
result = app.exec();
--- a/qtinternetradio/ui/ui.pro Thu Sep 02 20:17:46 2010 +0300
+++ b/qtinternetradio/ui/ui.pro Fri Sep 17 08:27:59 2010 +0300
@@ -136,7 +136,8 @@
inc/irplaylist.h \
inc/irsearchresultdb.h \
inc/irfileviewservice.h \
- inc/irplayingbanner.h
+ inc/irplayingbanner.h \
+ inc/irhbapplication.h
#source files list
SOURCES += main.cpp \
@@ -176,7 +177,8 @@
irplaylist.cpp \
irsearchresultdb.cpp \
irfileviewservice.cpp \
- irplayingbanner.cpp
+ irplayingbanner.cpp \
+ irhbapplication.cpp
#docml
DOCML += resources/layout/abstractlistviewbase.docml \