summaryrefslogtreecommitdiffstats
path: root/demos/qmediaplayer
diff options
context:
space:
mode:
authorRuth Sadler <ext-ruth.sadler@nokia.com>2011-01-11 10:32:46 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2011-01-13 12:28:38 (GMT)
commit6f1f46c78ad43cad41d062efb96319c0548a6dbc (patch)
tree4cdf9c8f49f99911471b7fac3e634b8c7f0888ec /demos/qmediaplayer
parentb2e59b7340b1198cc9eacca51172d51e8048d2a7 (diff)
downloadQt-6f1f46c78ad43cad41d062efb96319c0548a6dbc.zip
Qt-6f1f46c78ad43cad41d062efb96319c0548a6dbc.tar.gz
Qt-6f1f46c78ad43cad41d062efb96319c0548a6dbc.tar.bz2
Allow IAP to be selected in Phonon MMF backend
The Phonon API does not provide any way for the client to specify which network connection should be used for streaming playback. If the application already has a connection open, using a bearer other than the default (e.g. using WiFi when the device default is GPRS), it may be desirable to use it for streaming, rather than allowing the Phonon backend to open a second connection on the default bearer. This patch adds a custom property on the Phonon::MediaObject, called InternetAccessPointName. The client can specify the IAP which Phonon should use by setting this property. Note that support for this property is only provided in the Phonon MMF backend. Task-number: QTBUG-11436 Reviewed-by: Gareth Stockwell (cherry picked from commit 1640acce5ca8f49c5655edffa2a1108048c5a414)
Diffstat (limited to 'demos/qmediaplayer')
-rw-r--r--demos/qmediaplayer/mediaplayer.cpp43
-rw-r--r--demos/qmediaplayer/mediaplayer.h6
-rw-r--r--demos/qmediaplayer/qmediaplayer.pro2
3 files changed, 51 insertions, 0 deletions
diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp
index 126031e..68752a0 100644
--- a/demos/qmediaplayer/mediaplayer.cpp
+++ b/demos/qmediaplayer/mediaplayer.cpp
@@ -46,6 +46,11 @@
#include "mediaplayer.h"
#include "ui_settings.h"
+#ifdef Q_OS_SYMBIAN
+#include <cdbcols.h>
+#include <cdblen.h>
+#include <commdb.h>
+#endif
MediaVideoWidget::MediaVideoWidget(MediaPlayer *player, QWidget *parent) :
Phonon::VideoWidget(parent), m_player(player), m_action(this)
@@ -269,6 +274,10 @@ MediaPlayer::MediaPlayer() :
fileMenu = new QMenu(this);
QAction *openFileAction = fileMenu->addAction(tr("Open &File..."));
QAction *openUrlAction = fileMenu->addAction(tr("Open &Location..."));
+#ifdef Q_OS_SYMBIAN
+ QAction *selectIAPAction = fileMenu->addAction(tr("Select &IAP..."));
+ connect(selectIAPAction, SIGNAL(triggered(bool)), this, SLOT(selectIAP()));
+#endif
QAction *const openLinkAction = fileMenu->addAction(tr("Open &RAM File..."));
connect(openLinkAction, SIGNAL(triggered(bool)), this, SLOT(openRamFile()));
@@ -949,3 +958,37 @@ void MediaPlayer::hasVideoChanged(bool bHasVideo)
m_videoWindow.setVisible(bHasVideo);
m_fullScreenAction->setEnabled(bHasVideo);
}
+
+#ifdef Q_OS_SYMBIAN
+void MediaPlayer::selectIAP()
+{
+ TRAPD(err, selectIAPL());
+ if (KErrNone != err)
+ QMessageBox::warning(this, "Phonon Mediaplayer", "Error selecting IAP", QMessageBox::Close);
+}
+
+void MediaPlayer::selectIAPL()
+{
+ QVariant currentIAPValue = m_MediaObject.property("InternetAccessPointName");
+ QString currentIAPString = currentIAPValue.toString();
+ bool ok = false;
+ CCommsDatabase *commsDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
+ CleanupStack::PushL(commsDb);
+ commsDb->ShowHiddenRecords();
+ CCommsDbTableView* view = commsDb->OpenTableLC(TPtrC(IAP));
+ QStringList items;
+ TInt currentIAP = 0;
+ for (TInt l = view->GotoFirstRecord(), i = 0; l != KErrNotFound; l = view->GotoNextRecord(), i++) {
+ TBuf<KCommsDbSvrMaxColumnNameLength> iapName;
+ view->ReadTextL(TPtrC(COMMDB_NAME), iapName);
+ QString iapString = QString::fromUtf16(iapName.Ptr(), iapName.Length());
+ items << iapString;
+ if (iapString == currentIAPString)
+ currentIAP = i;
+ }
+ currentIAPString = QInputDialog::getItem(this, tr("Select Access Point"), tr("Select Access Point"), items, currentIAP, false, &ok);
+ if (ok)
+ m_MediaObject.setProperty("InternetAccessPointName", currentIAPString);
+ CleanupStack::PopAndDestroy(2); //commsDB, view
+}
+#endif
diff --git a/demos/qmediaplayer/mediaplayer.h b/demos/qmediaplayer/mediaplayer.h
index 7803321..7ddb7ae 100644
--- a/demos/qmediaplayer/mediaplayer.h
+++ b/demos/qmediaplayer/mediaplayer.h
@@ -141,12 +141,18 @@ private slots:
void showContextMenu(const QPoint& point);
void bufferStatus(int percent);
void openUrl();
+#ifdef Q_OS_SYMBIAN
+ void selectIAP();
+#endif
void openRamFile();
void configureEffect();
void hasVideoChanged(bool);
private:
bool playPauseForDialog();
+#ifdef Q_OS_SYMBIAN
+ void selectIAPL();
+#endif
QIcon playIcon;
QIcon pauseIcon;
diff --git a/demos/qmediaplayer/qmediaplayer.pro b/demos/qmediaplayer/qmediaplayer.pro
index 9407a81..d283ec8 100644
--- a/demos/qmediaplayer/qmediaplayer.pro
+++ b/demos/qmediaplayer/qmediaplayer.pro
@@ -33,5 +33,7 @@ symbian {
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
+ LIBS += -lCommDb
+
TARGET.CAPABILITY="NetworkServices"
}