Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/demos/qmediaplayer/mediaplayer.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4747#include "ui_settings.h"
    4848
     49#ifdef Q_OS_SYMBIAN
     50#include <cdbcols.h>
     51#include <cdblen.h>
     52#include <commdb.h>
     53#endif
    4954
    5055MediaVideoWidget::MediaVideoWidget(MediaPlayer *player, QWidget *parent) :
     
    153158
    154159
    155 MediaPlayer::MediaPlayer(const QString &filePath,
    156                          const bool hasSmallScreen) :
     160MediaPlayer::MediaPlayer() :
    157161        playButton(0), nextEffect(0), settingsDialog(0), ui(0),
    158162            m_AudioOutput(Phonon::VideoCategory),
    159             m_videoWidget(new MediaVideoWidget(this)),
    160             m_hasSmallScreen(hasSmallScreen)
     163            m_videoWidget(new MediaVideoWidget(this))
    161164{
    162165    setWindowTitle(tr("Media Player"));
     
    272275    QAction *openFileAction = fileMenu->addAction(tr("Open &File..."));
    273276    QAction *openUrlAction = fileMenu->addAction(tr("Open &Location..."));
     277#ifdef Q_OS_SYMBIAN
     278    QAction *selectIAPAction = fileMenu->addAction(tr("Select &IAP..."));
     279    connect(selectIAPAction, SIGNAL(triggered(bool)), this, SLOT(selectIAP()));
     280#endif
    274281    QAction *const openLinkAction = fileMenu->addAction(tr("Open &RAM File..."));
    275282
     
    347354    Phonon::createPath(&m_MediaObject, m_videoWidget);
    348355
    349     if (!filePath.isEmpty())
    350         setFile(filePath);
    351356    resize(minimumSizeHint());
    352357}
     
    359364        QRect videoHintRect = QRect(QPoint(0, 0), m_videoWindow.sizeHint());
    360365        QRect newVideoRect = QApplication::desktop()->screenGeometry().intersected(videoHintRect);
    361         if (!m_hasSmallScreen) {
     366        if (!m_smallScreen) {
    362367            if (m_MediaObject.hasVideo()) {
    363368                // Flush event que so that sizeHint takes the
     
    467472}
    468473
     474void MediaPlayer::setVolume(qreal volume)
     475{
     476    m_AudioOutput.setVolume(volume);
     477}
     478
     479void MediaPlayer::setSmallScreen(bool smallScreen)
     480{
     481    m_smallScreen = smallScreen;
     482}
     483
    469484void MediaPlayer::effectChanged()
    470485{
     
    590605
    591606        if (effectDialog.result() != QDialog::Accepted) {
    592             //we need to restore the paramaters values
     607            //we need to restore the parameters values
    593608            int currentIndex = 0;
    594609            foreach(Phonon::EffectParameter param, nextEffect->parameters()) {
     
    686701    // popping up dialogs. We neither want to tamper with the state if the
    687702    // user has paused.
    688     if (m_hasSmallScreen && m_MediaObject.hasVideo()) {
     703    if (m_smallScreen && m_MediaObject.hasVideo()) {
    689704        if (Phonon::PlayingState == m_MediaObject.state()) {
    690705            m_MediaObject.pause();
     
    717732void MediaPlayer::bufferStatus(int percent)
    718733{
    719     if (percent == 0 || percent == 100)
     734    if (percent == 100)
    720735        progressLabel->setText(QString());
    721736    else {
     
    944959    m_fullScreenAction->setEnabled(bHasVideo);
    945960}
     961
     962#ifdef Q_OS_SYMBIAN
     963void MediaPlayer::selectIAP()
     964{
     965    TRAPD(err, selectIAPL());
     966    if (KErrNone != err)
     967        QMessageBox::warning(this, "Phonon Mediaplayer", "Error selecting IAP", QMessageBox::Close);
     968}
     969
     970void MediaPlayer::selectIAPL()
     971{
     972    QVariant currentIAPValue = m_MediaObject.property("InternetAccessPointName");
     973    QString currentIAPString = currentIAPValue.toString();
     974    bool ok = false;
     975    CCommsDatabase *commsDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
     976    CleanupStack::PushL(commsDb);
     977    commsDb->ShowHiddenRecords();
     978    CCommsDbTableView* view = commsDb->OpenTableLC(TPtrC(IAP));
     979    QStringList items;
     980    TInt currentIAP = 0;
     981    for (TInt l = view->GotoFirstRecord(), i = 0; l != KErrNotFound; l = view->GotoNextRecord(), i++) {
     982       TBuf<KCommsDbSvrMaxColumnNameLength> iapName;
     983       view->ReadTextL(TPtrC(COMMDB_NAME), iapName);
     984       QString iapString = QString::fromUtf16(iapName.Ptr(), iapName.Length());
     985       items << iapString;
     986       if (iapString == currentIAPString)
     987           currentIAP = i;
     988    }
     989    currentIAPString = QInputDialog::getItem(this, tr("Select Access Point"), tr("Select Access Point"), items, currentIAP, false, &ok);
     990    if (ok)
     991        m_MediaObject.setProperty("InternetAccessPointName", currentIAPString);
     992    CleanupStack::PopAndDestroy(2); //commsDB, view
     993}
     994#endif
Note: See TracChangeset for help on using the changeset viewer.