Changeset 846 for trunk/demos/qmediaplayer/mediaplayer.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/demos/qmediaplayer/mediaplayer.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 47 47 #include "ui_settings.h" 48 48 49 #ifdef Q_OS_SYMBIAN 50 #include <cdbcols.h> 51 #include <cdblen.h> 52 #include <commdb.h> 53 #endif 49 54 50 55 MediaVideoWidget::MediaVideoWidget(MediaPlayer *player, QWidget *parent) : … … 153 158 154 159 155 MediaPlayer::MediaPlayer(const QString &filePath, 156 const bool hasSmallScreen) : 160 MediaPlayer::MediaPlayer() : 157 161 playButton(0), nextEffect(0), settingsDialog(0), ui(0), 158 162 m_AudioOutput(Phonon::VideoCategory), 159 m_videoWidget(new MediaVideoWidget(this)), 160 m_hasSmallScreen(hasSmallScreen) 163 m_videoWidget(new MediaVideoWidget(this)) 161 164 { 162 165 setWindowTitle(tr("Media Player")); … … 272 275 QAction *openFileAction = fileMenu->addAction(tr("Open &File...")); 273 276 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 274 281 QAction *const openLinkAction = fileMenu->addAction(tr("Open &RAM File...")); 275 282 … … 347 354 Phonon::createPath(&m_MediaObject, m_videoWidget); 348 355 349 if (!filePath.isEmpty())350 setFile(filePath);351 356 resize(minimumSizeHint()); 352 357 } … … 359 364 QRect videoHintRect = QRect(QPoint(0, 0), m_videoWindow.sizeHint()); 360 365 QRect newVideoRect = QApplication::desktop()->screenGeometry().intersected(videoHintRect); 361 if (!m_ hasSmallScreen) {366 if (!m_smallScreen) { 362 367 if (m_MediaObject.hasVideo()) { 363 368 // Flush event que so that sizeHint takes the … … 467 472 } 468 473 474 void MediaPlayer::setVolume(qreal volume) 475 { 476 m_AudioOutput.setVolume(volume); 477 } 478 479 void MediaPlayer::setSmallScreen(bool smallScreen) 480 { 481 m_smallScreen = smallScreen; 482 } 483 469 484 void MediaPlayer::effectChanged() 470 485 { … … 590 605 591 606 if (effectDialog.result() != QDialog::Accepted) { 592 //we need to restore the param aters values607 //we need to restore the parameters values 593 608 int currentIndex = 0; 594 609 foreach(Phonon::EffectParameter param, nextEffect->parameters()) { … … 686 701 // popping up dialogs. We neither want to tamper with the state if the 687 702 // user has paused. 688 if (m_ hasSmallScreen && m_MediaObject.hasVideo()) {703 if (m_smallScreen && m_MediaObject.hasVideo()) { 689 704 if (Phonon::PlayingState == m_MediaObject.state()) { 690 705 m_MediaObject.pause(); … … 717 732 void MediaPlayer::bufferStatus(int percent) 718 733 { 719 if (percent == 0 || percent ==100)734 if (percent == 100) 720 735 progressLabel->setText(QString()); 721 736 else { … … 944 959 m_fullScreenAction->setEnabled(bHasVideo); 945 960 } 961 962 #ifdef Q_OS_SYMBIAN 963 void MediaPlayer::selectIAP() 964 { 965 TRAPD(err, selectIAPL()); 966 if (KErrNone != err) 967 QMessageBox::warning(this, "Phonon Mediaplayer", "Error selecting IAP", QMessageBox::Close); 968 } 969 970 void 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.