summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2010-03-04 07:21:33 (GMT)
committerDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2010-03-04 07:21:33 (GMT)
commit787da2f188c34fd932662ee0229908bec8c4c91a (patch)
treeff4b219d05ab0e68debc06d12617bb72a5980881 /demos
parentf8bbe2b1b848cff3205cdcc2a8519cd98352f933 (diff)
downloadQt-787da2f188c34fd932662ee0229908bec8c4c91a.zip
Qt-787da2f188c34fd932662ee0229908bec8c4c91a.tar.gz
Qt-787da2f188c34fd932662ee0229908bec8c4c91a.tar.bz2
Added playlist playback modes combo box to player demo
Reviewed-by: Justin McPherson
Diffstat (limited to 'demos')
-rw-r--r--demos/multimedia/player/player.cpp28
-rw-r--r--demos/multimedia/player/player.h3
2 files changed, 30 insertions, 1 deletions
diff --git a/demos/multimedia/player/player.cpp b/demos/multimedia/player/player.cpp
index 49d18cb..af30a97 100644
--- a/demos/multimedia/player/player.cpp
+++ b/demos/multimedia/player/player.cpp
@@ -81,6 +81,22 @@ Player::Player(QWidget *parent)
connect(playlistView, SIGNAL(activated(QModelIndex)), this, SLOT(jump(QModelIndex)));
+ playbackModeBox = new QComboBox;
+ playbackModeBox->addItem(tr("Linear"),
+ QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::Linear));
+ playbackModeBox->addItem(tr("Loop"),
+ QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::Loop));
+ playbackModeBox->addItem(tr("Random"),
+ QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::Random));
+ playbackModeBox->addItem(tr("Current Item Once"),
+ QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::CurrentItemOnce));
+ playbackModeBox->addItem(tr("Current Item In Loop"),
+ QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::CurrentItemInLoop));
+ playbackModeBox->setCurrentIndex(0);
+
+ connect(playbackModeBox, SIGNAL(activated(int)), SLOT(updatePlaybackMode()));
+ updatePlaybackMode();
+
slider = new QSlider(Qt::Horizontal);
slider->setRange(0, player->duration() / 1000);
@@ -126,12 +142,16 @@ Player::Player(QWidget *parent)
else
colorButton->setEnabled(false);
+ QBoxLayout *playlistLayout = new QVBoxLayout;
+ playlistLayout->addWidget(playlistView);
+ playlistLayout->addWidget(playbackModeBox);
+
QBoxLayout *displayLayout = new QHBoxLayout;
if (videoWidget)
displayLayout->addWidget(videoWidget, 2);
else
displayLayout->addWidget(coverLabel, 2);
- displayLayout->addWidget(playlistView);
+ displayLayout->addLayout(playlistLayout);
QBoxLayout *controlLayout = new QHBoxLayout;
controlLayout->setMargin(0);
@@ -333,3 +353,9 @@ void Player::showColorDialog()
}
colorDialog->show();
}
+
+void Player::updatePlaybackMode()
+{
+ playlist->setPlaybackMode(
+ playbackModeBox->itemData(playbackModeBox->currentIndex()).value<QMediaPlaylist::PlaybackMode>());
+}
diff --git a/demos/multimedia/player/player.h b/demos/multimedia/player/player.h
index 1de8b1a..cda3eb9 100644
--- a/demos/multimedia/player/player.h
+++ b/demos/multimedia/player/player.h
@@ -57,6 +57,7 @@ class QAbstractItemView;
class QLabel;
class QModelIndex;
class QSlider;
+class QComboBox;
class QMediaPlayer;
class QVideoWidget;
class PlaylistModel;
@@ -87,6 +88,7 @@ private slots:
void bufferingProgress(int progress);
void showColorDialog();
+ void updatePlaybackMode();
private:
void setTrackInfo(const QString &info);
@@ -97,6 +99,7 @@ private:
QVideoWidget *videoWidget;
QLabel *coverLabel;
QSlider *slider;
+ QComboBox *playbackModeBox;
PlaylistModel *playlistModel;
QAbstractItemView *playlistView;
QDialog *colorDialog;