[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [phonon/five] demos/phota: Redo phota open dialog methods
From: Casian Andrei <skeletk13 () gmail ! com>
Date: 2014-07-10 8:16:40
Message-ID: E1X59Wy-0001A7-KJ () scm ! kde ! org
[Download RAW message or body]
Git commit 2e9da30162e764451bafd72e0f5948066f2aad6c by Casian Andrei.
Committed on 10/07/2014 at 08:11.
Pushed by casianandrei into branch 'five'.
Redo phota open dialog methods
Replace openFile with openUrl, openUrl was previously not implemented.
M +0 -1 demos/phota/mainwindow.cpp
M +10 -12 demos/phota/mediacontroller.cpp
M +0 -1 demos/phota/mediacontroller.h
http://commits.kde.org/phonon/2e9da30162e764451bafd72e0f5948066f2aad6c
diff --git a/demos/phota/mainwindow.cpp b/demos/phota/mainwindow.cpp
index 77d0b1d..7621b7f 100644
--- a/demos/phota/mainwindow.cpp
+++ b/demos/phota/mainwindow.cpp
@@ -42,7 +42,6 @@ MainWindow::MainWindow(QWidget *parent) :
void MainWindow::contextMenuEvent(QContextMenuEvent *e)
{
QMenu menu(tr("Control Menu"), this);
- menu.addAction(tr("Open a file"), m_mediaControl, SLOT(openFile()));
menu.addAction(tr("Open a URL"), m_mediaControl, SLOT(openURL()));
menu.addSeparator();
menu.addAction(tr("Video Effects"), this, SLOT(effectsDialog()));
diff --git a/demos/phota/mediacontroller.cpp b/demos/phota/mediacontroller.cpp
index 5f1fee0..8cb75c9 100644
--- a/demos/phota/mediacontroller.cpp
+++ b/demos/phota/mediacontroller.cpp
@@ -37,22 +37,20 @@ Phonon::Player *MediaController::player() const
return m_player;
}
-void MediaController::openFile()
-{
- QString file = QFileDialog::getOpenFileName(0, tr("Open a new file to play"), "");
- if (!file.isEmpty()) {
- Phonon::Source s(file);
- playSource(s);
- }
-}
-
void MediaController::openURL()
{
-
+ QUrl homeDirUrl = QUrl::fromLocalFile(QDir::homePath());
+ QUrl url = QFileDialog::getOpenFileUrl(
+ qobject_cast<QWidget*>(parent()),
+ tr("Open a new file to play"), homeDirUrl);
+ if (!url.isEmpty()) {
+ Phonon::Source source(url);
+ playSource(source);
+ }
}
-void MediaController::playSource(const Phonon::Source &s)
+void MediaController::playSource(const Phonon::Source &source)
{
- m_player->setSource(s);
+ m_player->setSource(source);
m_player->play();
}
diff --git a/demos/phota/mediacontroller.h b/demos/phota/mediacontroller.h
index 8f953d8..554a182 100644
--- a/demos/phota/mediacontroller.h
+++ b/demos/phota/mediacontroller.h
@@ -39,7 +39,6 @@ public:
Phonon::Player *player() const;
public slots:
- void openFile();
void openURL();
private:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic