Merge lp:~artmello/gallery-app/gallery-app-open_photo_not_in_collection into lp:gallery-app

Proposed by Arthur Mello
Status: Merged
Approved by: Bill Filler
Approved revision: 1112
Merged at revision: 1112
Proposed branch: lp:~artmello/gallery-app/gallery-app-open_photo_not_in_collection
Merge into: lp:gallery-app
Diff against target: 77 lines (+20/-1)
2 files modified
src/gallery-application.cpp (+16/-1)
src/gallery-application.h (+4/-0)
To merge this branch: bzr merge lp:~artmello/gallery-app/gallery-app-open_photo_not_in_collection
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+241145@code.launchpad.net

Commit message

Delay the opening photo process until all media files are loaded when called by url handler

Description of the change

Delay the opening photo process until all media files are loaded when called by url handler

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

tested, works

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/gallery-application.cpp'
2--- src/gallery-application.cpp 2014-09-23 18:08:10 +0000
3+++ src/gallery-application.cpp 2014-11-07 21:12:02 +0000
4@@ -69,7 +69,9 @@
5 m_pickModeEnabled(false),
6 m_defaultUiMode(BrowseContentMode),
7 m_mediaTypeFilter(MediaSource::None),
8- m_mediaFile("")
9+ m_mediaFile(""),
10+ m_mediaLoadedTimer(this),
11+ m_mediaLoaded(false)
12 {
13 m_bguSize = QProcessEnvironment::systemEnvironment().value("GRID_UNIT_PX", "8").toInt();
14 if (m_bguSize <= 0)
15@@ -117,6 +119,10 @@
16
17 if (m_cmdLineParser->startupTimer())
18 qDebug() << "Construct GalleryApplication" << m_timer->elapsed() << "ms";
19+
20+ m_mediaLoadedTimer.setSingleShot(false);
21+ m_mediaLoadedTimer.setInterval(100);
22+ QObject::connect(&m_mediaLoadedTimer, SIGNAL(timeout()), this, SLOT(onMediaLoaded()));
23 }
24
25 /*!
26@@ -258,6 +264,7 @@
27 qDebug() << "GalleryManager initialized" << m_timer->elapsed() << "ms";
28
29 emit mediaLoaded();
30+ m_mediaLoaded = true;
31
32 if (m_cmdLineParser->startupTimer()) {
33 qDebug() << "MainView loaded" << m_timer->elapsed() << "ms";
34@@ -352,6 +359,14 @@
35 {
36 if(!mediaFile.isEmpty()) {
37 m_mediaFile = "file://" + mediaFile;
38+ m_mediaLoadedTimer.start();
39+ }
40+}
41+
42+void GalleryApplication::onMediaLoaded()
43+{
44+ if (m_mediaLoaded) {
45+ m_mediaLoadedTimer.stop();
46 Q_EMIT mediaFileChanged();
47 }
48 }
49
50=== modified file 'src/gallery-application.h'
51--- src/gallery-application.h 2014-09-23 13:30:29 +0000
52+++ src/gallery-application.h 2014-11-07 21:12:02 +0000
53@@ -23,6 +23,7 @@
54 #include <QApplication>
55 #include <QElapsedTimer>
56 #include <QFileInfo>
57+#include <QTimer>
58
59 #include "media-source.h"
60
61@@ -84,6 +85,7 @@
62 void setFullScreen(bool fullScreen);
63 void consistencyCheckFinished();
64 void setMediaFile(const QString &mediaFile);
65+ void onMediaLoaded();
66
67 private:
68 void registerQML();
69@@ -100,6 +102,8 @@
70 UiMode m_defaultUiMode;
71 MediaSource::MediaType m_mediaTypeFilter;
72 QString m_mediaFile;
73+ QTimer m_mediaLoadedTimer;
74+ bool m_mediaLoaded;
75
76 static QElapsedTimer *m_timer;
77 };

Subscribers

People subscribed via source and target branches