Merge lp:~renatofilho/mediaplayer-app/open-file-dialog into lp:mediaplayer-app
- open-file-dialog
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Francis Ginther |
Approved revision: | 195 |
Merged at revision: | 192 |
Proposed branch: | lp:~renatofilho/mediaplayer-app/open-file-dialog |
Merge into: | lp:mediaplayer-app |
Prerequisite: | lp:~renatofilho/mediaplayer-app/no-fullscreen |
Diff against target: |
212 lines (+64/-9) 6 files modified
src/CMakeLists.txt (+1/-1) src/mediaplayer.cpp (+33/-2) src/mediaplayer.h (+6/-2) src/qml/player.qml (+10/-2) src/qml/player/Controls.qml (+3/-2) src/qml/player/VideoPlayer.qml (+11/-0) |
To merge this branch: | bzr merge lp:~renatofilho/mediaplayer-app/open-file-dialog |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Bill Filler (community) | Approve | ||
Review via email:
|
This proposal supersedes a proposal from 2014-01-07.
Commit message
Implemented open file dialog to open a new video.
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:191
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:192
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:193
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Bill Filler (bfiller) wrote : | # |
works much better, but weird now the file dialog looks much different than before. it's not the system one anymore but instead the Qt looking one. Not sure why this happened, maybe it happened because of add the additional file name filter?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:194
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Bill Filler (bfiller) wrote : | # |
moving back to the QFileDialog:
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:195
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'src/CMakeLists.txt' | |||
2 | --- src/CMakeLists.txt 2013-09-25 23:08:08 +0000 | |||
3 | +++ src/CMakeLists.txt 2014-01-08 13:41:19 +0000 | |||
4 | @@ -24,7 +24,7 @@ | |||
5 | 24 | ${mediaplayer_SRCS} | 24 | ${mediaplayer_SRCS} |
6 | 25 | ) | 25 | ) |
7 | 26 | 26 | ||
9 | 27 | qt5_use_modules(${MEDIAPLAYER} Gui Core Qml Quick Multimedia) | 27 | qt5_use_modules(${MEDIAPLAYER} Gui Widgets Core Qml Quick Multimedia) |
10 | 28 | 28 | ||
11 | 29 | target_link_libraries(${MEDIAPLAYER} | 29 | target_link_libraries(${MEDIAPLAYER} |
12 | 30 | sdkhelper | 30 | sdkhelper |
13 | 31 | 31 | ||
14 | === modified file 'src/mediaplayer.cpp' | |||
15 | --- src/mediaplayer.cpp 2014-01-07 23:19:30 +0000 | |||
16 | +++ src/mediaplayer.cpp 2014-01-08 13:41:19 +0000 | |||
17 | @@ -24,6 +24,8 @@ | |||
18 | 24 | #include <QtCore/QStringList> | 24 | #include <QtCore/QStringList> |
19 | 25 | #include <QtCore/QLibrary> | 25 | #include <QtCore/QLibrary> |
20 | 26 | #include <QtCore/QTimer> | 26 | #include <QtCore/QTimer> |
21 | 27 | #include <QtCore/QStandardPaths> | ||
22 | 28 | #include <QtWidgets/QFileDialog> | ||
23 | 27 | #include <QtQml/QQmlContext> | 29 | #include <QtQml/QQmlContext> |
24 | 28 | #include <QtQml/QQmlEngine> | 30 | #include <QtQml/QQmlEngine> |
25 | 29 | #include <QtQuick/QQuickItem> | 31 | #include <QtQuick/QQuickItem> |
26 | @@ -43,7 +45,7 @@ | |||
27 | 43 | } | 45 | } |
28 | 44 | 46 | ||
29 | 45 | MediaPlayer::MediaPlayer(int &argc, char **argv) | 47 | MediaPlayer::MediaPlayer(int &argc, char **argv) |
31 | 46 | : QGuiApplication(argc, argv), m_view(0) | 48 | : QApplication(argc, argv), m_view(0), m_fileChooser(0) |
32 | 47 | { | 49 | { |
33 | 48 | } | 50 | } |
34 | 49 | 51 | ||
35 | @@ -116,7 +118,7 @@ | |||
36 | 116 | connect(m_view->engine(), SIGNAL(quit()), SLOT(quit())); | 118 | connect(m_view->engine(), SIGNAL(quit()), SLOT(quit())); |
37 | 117 | 119 | ||
38 | 118 | // Set the orientation changes that this app is interested in being signaled about | 120 | // Set the orientation changes that this app is interested in being signaled about |
40 | 119 | QGuiApplication::primaryScreen()->setOrientationUpdateMask(Qt::PortraitOrientation | | 121 | QApplication::primaryScreen()->setOrientationUpdateMask(Qt::PortraitOrientation | |
41 | 120 | Qt::LandscapeOrientation | | 122 | Qt::LandscapeOrientation | |
42 | 121 | Qt::InvertedPortraitOrientation | | 123 | Qt::InvertedPortraitOrientation | |
43 | 122 | Qt::InvertedLandscapeOrientation); | 124 | Qt::InvertedLandscapeOrientation); |
44 | @@ -139,6 +141,10 @@ | |||
45 | 139 | if (m_view) { | 141 | if (m_view) { |
46 | 140 | delete m_view; | 142 | delete m_view; |
47 | 141 | } | 143 | } |
48 | 144 | if (m_fileChooser) { | ||
49 | 145 | delete m_fileChooser; | ||
50 | 146 | m_fileChooser = 0; | ||
51 | 147 | } | ||
52 | 142 | } | 148 | } |
53 | 143 | 149 | ||
54 | 144 | void | 150 | void |
55 | @@ -175,3 +181,28 @@ | |||
56 | 175 | { | 181 | { |
57 | 176 | return (qEnvironmentVariableIsSet("DESKTOP_MODE") && (qgetenv("DESKTOP_MODE") == "1")); | 182 | return (qEnvironmentVariableIsSet("DESKTOP_MODE") && (qgetenv("DESKTOP_MODE") == "1")); |
58 | 177 | } | 183 | } |
59 | 184 | |||
60 | 185 | QUrl MediaPlayer::chooseFile() | ||
61 | 186 | { | ||
62 | 187 | QUrl fileName; | ||
63 | 188 | if (!m_fileChooser) { | ||
64 | 189 | m_fileChooser = new QFileDialog(0, | ||
65 | 190 | tr("Open Video"), | ||
66 | 191 | QStandardPaths::writableLocation(QStandardPaths::MoviesLocation), | ||
67 | 192 | tr("Video files (*.avi *.mov *.mp4 *.divx *.ogg *.ogv *.mpeg);;All files (*)")); | ||
68 | 193 | m_fileChooser->setModal(true); | ||
69 | 194 | int result = m_fileChooser->exec(); | ||
70 | 195 | if (result == QDialog::Accepted) { | ||
71 | 196 | QStringList selectedFiles = m_fileChooser->selectedFiles(); | ||
72 | 197 | if (selectedFiles.count() > 0) { | ||
73 | 198 | fileName = selectedFiles[0]; | ||
74 | 199 | } | ||
75 | 200 | } | ||
76 | 201 | delete m_fileChooser; | ||
77 | 202 | m_fileChooser = 0; | ||
78 | 203 | } else { | ||
79 | 204 | m_fileChooser->raise(); | ||
80 | 205 | } | ||
81 | 206 | |||
82 | 207 | return fileName; | ||
83 | 208 | } | ||
84 | 178 | 209 | ||
85 | === modified file 'src/mediaplayer.h' | |||
86 | --- src/mediaplayer.h 2014-01-07 23:19:30 +0000 | |||
87 | +++ src/mediaplayer.h 2014-01-08 13:41:19 +0000 | |||
88 | @@ -18,9 +18,11 @@ | |||
89 | 18 | #define MEDIAPLAYER_H | 18 | #define MEDIAPLAYER_H |
90 | 19 | 19 | ||
91 | 20 | #include <QtQuick/QQuickView> | 20 | #include <QtQuick/QQuickView> |
93 | 21 | #include <QGuiApplication> | 21 | #include <QtWidgets/QApplication> |
94 | 22 | #include <QtWidgets/QFileDialog> | ||
95 | 23 | #include <QUrl> | ||
96 | 22 | 24 | ||
98 | 23 | class MediaPlayer : public QGuiApplication | 25 | class MediaPlayer : public QApplication |
99 | 24 | { | 26 | { |
100 | 25 | Q_OBJECT | 27 | Q_OBJECT |
101 | 26 | Q_PROPERTY(bool desktopMode READ isDesktopMode) | 28 | Q_PROPERTY(bool desktopMode READ isDesktopMode) |
102 | @@ -37,9 +39,11 @@ | |||
103 | 37 | void onWidthChanged(int); | 39 | void onWidthChanged(int); |
104 | 38 | void onHeightChanged(int); | 40 | void onHeightChanged(int); |
105 | 39 | bool isDesktopMode() const; | 41 | bool isDesktopMode() const; |
106 | 42 | QUrl chooseFile(); | ||
107 | 40 | 43 | ||
108 | 41 | private: | 44 | private: |
109 | 42 | QQuickView *m_view; | 45 | QQuickView *m_view; |
110 | 46 | QFileDialog *m_fileChooser; | ||
111 | 43 | }; | 47 | }; |
112 | 44 | 48 | ||
113 | 45 | #endif // MEDIAPLAYER_H | 49 | #endif // MEDIAPLAYER_H |
114 | 46 | 50 | ||
115 | === modified file 'src/qml/player.qml' | |||
116 | --- src/qml/player.qml 2014-01-07 17:28:00 +0000 | |||
117 | +++ src/qml/player.qml 2014-01-08 13:41:19 +0000 | |||
118 | @@ -26,6 +26,7 @@ | |||
119 | 26 | import Ubuntu.Components 0.1 | 26 | import Ubuntu.Components 0.1 |
120 | 27 | import Ubuntu.Components.Popups 0.1 as Popups | 27 | import Ubuntu.Components.Popups 0.1 as Popups |
121 | 28 | 28 | ||
122 | 29 | |||
123 | 29 | Rectangle { | 30 | Rectangle { |
124 | 30 | id: mediaPlayer | 31 | id: mediaPlayer |
125 | 31 | width: screenWidth | 32 | width: screenWidth |
126 | @@ -76,6 +77,7 @@ | |||
127 | 76 | 77 | ||
128 | 77 | Loader { | 78 | Loader { |
129 | 78 | id: playerLoader | 79 | id: playerLoader |
130 | 80 | |||
131 | 79 | source: "player/VideoPlayer.qml" | 81 | source: "player/VideoPlayer.qml" |
132 | 80 | focus: true | 82 | focus: true |
133 | 81 | anchors.fill: parent | 83 | anchors.fill: parent |
134 | @@ -86,12 +88,18 @@ | |||
135 | 86 | if (playUri != "") { | 88 | if (playUri != "") { |
136 | 87 | item.playUri(playUri) | 89 | item.playUri(playUri) |
137 | 88 | } else { | 90 | } else { |
139 | 89 | PopupUtils.open(dialogNoUrl, null) | 91 | if (mpApplication.desktopMode) { |
140 | 92 | var videoFile = mpApplication.chooseFile() | ||
141 | 93 | if (videoFile != "") { | ||
142 | 94 | item.playUri(videoFile) | ||
143 | 95 | } | ||
144 | 96 | } else { | ||
145 | 97 | PopupUtils.open(dialogNoUrl, null) | ||
146 | 98 | } | ||
147 | 90 | } | 99 | } |
148 | 91 | } | 100 | } |
149 | 92 | 101 | ||
150 | 93 | state: mediaPlayer.orientation != "" ? mediaPlayer.orientation : (screenHeight <= screenWidth ? "0" : "270") | 102 | state: mediaPlayer.orientation != "" ? mediaPlayer.orientation : (screenHeight <= screenWidth ? "0" : "270") |
151 | 94 | |||
152 | 95 | Component.onCompleted: { | 103 | Component.onCompleted: { |
153 | 96 | state = Qt.binding(function () { | 104 | state = Qt.binding(function () { |
154 | 97 | return mediaPlayer.orientation != "" ? mediaPlayer.orientation : (screenHeight <= screenWidth ? "0" : "270") | 105 | return mediaPlayer.orientation != "" ? mediaPlayer.orientation : (screenHeight <= screenWidth ? "0" : "270") |
155 | 98 | 106 | ||
156 | === modified file 'src/qml/player/Controls.qml' | |||
157 | --- src/qml/player/Controls.qml 2013-12-20 20:04:41 +0000 | |||
158 | +++ src/qml/player/Controls.qml 2014-01-08 13:41:19 +0000 | |||
159 | @@ -30,6 +30,8 @@ | |||
160 | 30 | property alias sceneSelectorVisible: _sceneSelector.visible | 30 | property alias sceneSelectorVisible: _sceneSelector.visible |
161 | 31 | property int heightOffset: 0 | 31 | property int heightOffset: 0 |
162 | 32 | 32 | ||
163 | 33 | property alias settingsEnabled: _settingsButton.enabled | ||
164 | 34 | |||
165 | 33 | signal fullscreenClicked | 35 | signal fullscreenClicked |
166 | 34 | signal playbackClicked | 36 | signal playbackClicked |
167 | 35 | signal settingsClicked | 37 | signal settingsClicked |
168 | @@ -188,7 +190,6 @@ | |||
169 | 188 | maximumValue: video ? video.duration / 1000 : 0 | 190 | maximumValue: video ? video.duration / 1000 : 0 |
170 | 189 | value: video ? video.position / 1000 : 0 | 191 | value: video ? video.position / 1000 : 0 |
171 | 190 | 192 | ||
172 | 191 | |||
173 | 192 | // pause the video during the seek | 193 | // pause the video during the seek |
174 | 193 | onPressedChanged: { | 194 | onPressedChanged: { |
175 | 194 | if (!pressed && seeking) { | 195 | if (!pressed && seeking) { |
176 | @@ -255,7 +256,7 @@ | |||
177 | 255 | width: units.gu(9) | 256 | width: units.gu(9) |
178 | 256 | height: units.gu(3) | 257 | height: units.gu(3) |
179 | 257 | enabled: false | 258 | enabled: false |
181 | 258 | opacity: 0.2 | 259 | opacity: enabled ? 1.0 : 0.2 |
182 | 259 | 260 | ||
183 | 260 | onClicked: settingsClicked() | 261 | onClicked: settingsClicked() |
184 | 261 | } | 262 | } |
185 | 262 | 263 | ||
186 | === modified file 'src/qml/player/VideoPlayer.qml' | |||
187 | --- src/qml/player/VideoPlayer.qml 2014-01-07 23:19:30 +0000 | |||
188 | +++ src/qml/player/VideoPlayer.qml 2014-01-08 13:41:19 +0000 | |||
189 | @@ -101,6 +101,8 @@ | |||
190 | 101 | 101 | ||
191 | 102 | property bool isPaused: false | 102 | property bool isPaused: false |
192 | 103 | 103 | ||
193 | 104 | settingsEnabled: mpApplication.desktopMode | ||
194 | 105 | |||
195 | 104 | objectName: "controls" | 106 | objectName: "controls" |
196 | 105 | state: player.state | 107 | state: player.state |
197 | 106 | video: player.video | 108 | video: player.video |
198 | @@ -139,6 +141,15 @@ | |||
199 | 139 | } | 141 | } |
200 | 140 | 142 | ||
201 | 141 | onShareClicked: player.startSharing() | 143 | onShareClicked: player.startSharing() |
202 | 144 | onSettingsClicked: { | ||
203 | 145 | if (mpApplication.desktopMode) { | ||
204 | 146 | var videoFile = mpApplication.chooseFile() | ||
205 | 147 | if (videoFile != "") { | ||
206 | 148 | player.stop() | ||
207 | 149 | item.playUri(videoFile) | ||
208 | 150 | } | ||
209 | 151 | } | ||
210 | 152 | } | ||
211 | 142 | } | 153 | } |
212 | 143 | } | 154 | } |
213 | 144 | 155 |
PASSED: Continuous integration, rev:191 jenkins. qa.ubuntu. com/job/ mediaplayer- app-ci/ 165/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty/ 2060 jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty- touch/1966 jenkins. qa.ubuntu. com/job/ mediaplayer- app-trusty- amd64-ci/ 21 jenkins. qa.ubuntu. com/job/ mediaplayer- app-trusty- armhf-ci/ 21 jenkins. qa.ubuntu. com/job/ mediaplayer- app-trusty- armhf-ci/ 21/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mediaplayer- app-trusty- i386-ci/ 21 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-trusty/ 1808 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- amd64/2060 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- amd64/2060/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- armhf/1966 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- armhf/1966/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- mako/4440 s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 2789
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mediaplayer -app-ci/ 165/rebuild
http://