Merge lp:~schwann/gallery-app/gallery-event-qt-style into lp:gallery-app

Proposed by Günter Schwann
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 701
Merged at revision: 703
Proposed branch: lp:~schwann/gallery-app/gallery-event-qt-style
Merge into: lp:gallery-app
Prerequisite: lp:~schwann/gallery-app/gallery-database-qt-style
Diff against target: 321 lines (+49/-62)
7 files modified
src/event/event-collection.cpp (+20/-20)
src/event/event-collection.h (+7/-10)
src/event/event.cpp (+10/-18)
src/event/event.h (+8/-10)
src/gallery-application.cpp (+1/-1)
src/media/media-source.cpp (+1/-1)
src/qml/qml-event-overview-model.cpp (+2/-2)
To merge this branch: bzr merge lp:~schwann/gallery-app/gallery-event-qt-style
Reviewer Review Type Date Requested Status
Olivier Tilloy Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+168373@code.launchpad.net

Commit message

Use Qt coding style for event

Description of the change

Use Qt coding style for event

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
701. By Günter Schwann

Trunk merged

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/event/event-collection.cpp'
2--- src/event/event-collection.cpp 2013-06-10 09:09:31 +0000
3+++ src/event/event-collection.cpp 2013-06-10 09:09:31 +0000
4@@ -36,7 +36,7 @@
5 EventCollection::EventCollection()
6 : SourceCollection("EventCollection")
7 {
8- setComparator(Comparator);
9+ setComparator(comparator);
10
11 // Monitor MediaCollection to create/destroy Events, one for each day of
12 // media found
13@@ -44,28 +44,28 @@
14 GalleryManager::instance()->media_collection(),
15 SIGNAL(contentsChanged(const QSet<DataObject*>*,const QSet<DataObject*>*)),
16 this,
17- SLOT(on_media_added_removed(const QSet<DataObject*>*,const QSet<DataObject*>*)));
18+ SLOT(onMediaAddedRemoved(const QSet<DataObject*>*,const QSet<DataObject*>*)));
19
20 // seed what's already present
21- on_media_added_removed(&GalleryManager::instance()->media_collection()->getAsSet(), NULL);
22+ onMediaAddedRemoved(&GalleryManager::instance()->media_collection()->getAsSet(), NULL);
23 }
24
25 /*!
26- * \brief EventCollection::EventForDate
27+ * \brief EventCollection::eventForDate
28 * \param date
29 * \return
30 */
31-Event* EventCollection::EventForDate(const QDate& date) const
32+Event* EventCollection::eventForDate(const QDate& date) const
33 {
34- return date_map_.value(date);
35+ return m_dateMap.value(date);
36 }
37
38 /*!
39- * \brief EventCollection::EventForMediaSource
40+ * \brief EventCollection::eventForMediaSource
41 * \param media
42 * \return
43 */
44-Event* EventCollection::EventForMediaSource(MediaSource* media) const
45+Event* EventCollection::eventForMediaSource(MediaSource* media) const
46 {
47 // TODO: Could use lookup table here, but this is fine for now
48 Event* event;
49@@ -78,12 +78,12 @@
50 }
51
52 /*!
53- * \brief EventCollection::Comparator sorts Events in reverse chronological order
54+ * \brief EventCollection::comparator sorts Events in reverse chronological order
55 * \param a
56 * \param b
57 * \return
58 */
59-bool EventCollection::Comparator(DataObject* a, DataObject* b)
60+bool EventCollection::comparator(DataObject* a, DataObject* b)
61 {
62 Event* eventa = qobject_cast<Event*>(a);
63 Q_ASSERT(eventa != NULL);
64@@ -95,12 +95,12 @@
65 }
66
67 /*!
68- * \brief EventCollection::on_media_added_removed
69+ * \brief EventCollection::onMediaAddedRemoved
70 * \param added
71 * \param removed
72 */
73-void EventCollection::on_media_added_removed(const QSet<DataObject *> *added,
74- const QSet<DataObject *> *removed)
75+void EventCollection::onMediaAddedRemoved(const QSet<DataObject *> *added,
76+ const QSet<DataObject *> *removed)
77 {
78 if (added != NULL) {
79 DataObject* object;
80@@ -108,7 +108,7 @@
81 MediaSource* media = qobject_cast<MediaSource*>(object);
82 Q_ASSERT(media != NULL);
83
84- Event* existing = date_map_.value(media->exposureDate());
85+ Event* existing = m_dateMap.value(media->exposureDate());
86 if (existing == NULL) {
87 existing = new Event(this, media->exposureDate());
88
89@@ -125,7 +125,7 @@
90 MediaSource* media = qobject_cast<MediaSource*>(object);
91 Q_ASSERT(media != NULL);
92
93- Event* event = date_map_.value(media->exposureDate());
94+ Event* event = m_dateMap.value(media->exposureDate());
95 Q_ASSERT(event != NULL);
96
97 event->detach(media);
98@@ -142,7 +142,7 @@
99 * \param removed
100 */
101 void EventCollection::notifyContentsChanged(const QSet<DataObject *> *added,
102- const QSet<DataObject *> *removed)
103+ const QSet<DataObject *> *removed)
104 {
105 if (added != NULL) {
106 DataObject* object;
107@@ -151,8 +151,8 @@
108 Q_ASSERT(event != NULL);
109
110 // One Event per day
111- Q_ASSERT(!date_map_.contains(event->date()));
112- date_map_.insert(event->date(), event);
113+ Q_ASSERT(!m_dateMap.contains(event->date()));
114+ m_dateMap.insert(event->date(), event);
115 }
116 }
117
118@@ -162,8 +162,8 @@
119 Event* event = qobject_cast<Event*>(object);
120 Q_ASSERT(event != NULL);
121
122- Q_ASSERT(date_map_.contains(event->date()));
123- date_map_.remove(event->date());
124+ Q_ASSERT(m_dateMap.contains(event->date()));
125+ m_dateMap.remove(event->date());
126 }
127 }
128
129
130=== modified file 'src/event/event-collection.h'
131--- src/event/event-collection.h 2013-06-10 09:09:31 +0000
132+++ src/event/event-collection.h 2013-06-10 09:09:31 +0000
133@@ -37,27 +37,24 @@
134 {
135 Q_OBJECT
136
137-signals:
138- void all_changed();
139-
140 public:
141 EventCollection();
142
143- Event* EventForDate(const QDate& date) const;
144- Event* EventForMediaSource(MediaSource* media) const;
145+ Event* eventForDate(const QDate& date) const;
146+ Event* eventForMediaSource(MediaSource* media) const;
147
148 protected:
149 virtual void notifyContentsChanged(const QSet<DataObject *> *added,
150- const QSet<DataObject *> *removed);
151+ const QSet<DataObject *> *removed);
152
153 private slots:
154- void on_media_added_removed(const QSet<DataObject*>* added,
155- const QSet<DataObject*>* removed);
156+ void onMediaAddedRemoved(const QSet<DataObject*>* added,
157+ const QSet<DataObject*>* removed);
158
159 private:
160- QHash<QDate, Event*> date_map_;
161+ static bool comparator(DataObject* a, DataObject* b);
162
163- static bool Comparator(DataObject* a, DataObject* b);
164+ QHash<QDate, Event*> m_dateMap;
165 };
166
167 #endif // GALLERY_EVENT_COLLECTION_H_
168
169=== modified file 'src/event/event.cpp'
170--- src/event/event.cpp 2013-06-10 09:09:31 +0000
171+++ src/event/event.cpp 2013-06-10 09:09:31 +0000
172@@ -40,16 +40,8 @@
173 */
174 Event::Event(QObject* parent, const QDate& date)
175 : ContainerSource(parent, QString("Event for ") + date.toString(),
176- MediaCollection::exposureDateTimeDescendingComparator), date_(date)
177-{
178-}
179-
180-/*!
181- * \brief Event::RegisterType
182- */
183-void Event::RegisterType()
184-{
185- qmlRegisterType<Event>("Gallery", 1, 0, "Event");
186+ MediaCollection::exposureDateTimeDescendingComparator), m_date(date)
187+{
188 }
189
190 /*!
191@@ -58,33 +50,33 @@
192 */
193 const QDate& Event::date() const
194 {
195- return date_;
196+ return m_date;
197 }
198
199 /*!
200- * \brief Event::start_date_time
201+ * \brief Event::startDateTime
202 * \return
203 */
204-QDateTime Event::start_date_time() const
205+QDateTime Event::startDateTime() const
206 {
207 return QDateTime(date());
208 }
209
210 /*!
211- * \brief Event::end_date_time
212+ * \brief Event::endDateTime
213 * \return
214 */
215-QDateTime Event::end_date_time() const
216+QDateTime Event::endDateTime() const
217 {
218 return QDateTime(date(), QTime(23, 59, 59, 999));
219 }
220
221 /*!
222 * \brief Event::DestroySource \reimp
223- * \param destroy_backing
224- * \param as_orphan
225+ * \param destroyBacking
226+ * \param asOrphan
227 */
228-void Event::destroySource(bool destroy_backing, bool as_orphan)
229+void Event::destroySource(bool destroyBacking, bool asOrphan)
230 {
231 // Event is a virtual DataSource generated as a result of MediaSources added
232 // and removed from the system, so nothing to destroy
233
234=== modified file 'src/event/event.h'
235--- src/event/event.h 2013-06-10 09:09:31 +0000
236+++ src/event/event.h 2013-06-10 09:09:31 +0000
237@@ -36,28 +36,26 @@
238 class Event : public ContainerSource
239 {
240 Q_OBJECT
241- Q_PROPERTY(QDate date READ date NOTIFY date_altered)
242- Q_PROPERTY(QDateTime startDateTime READ start_date_time NOTIFY date_altered)
243- Q_PROPERTY(QDateTime endDateTime READ end_date_time NOTIFY date_altered)
244+ Q_PROPERTY(QDate date READ date NOTIFY dateChanged)
245+ Q_PROPERTY(QDateTime startDateTime READ startDateTime NOTIFY dateChanged)
246+ Q_PROPERTY(QDateTime endDateTime READ endDateTime NOTIFY dateChanged)
247
248 signals:
249- void date_altered();
250+ void dateChanged();
251
252 public:
253 Event(QObject* parent = 0);
254 explicit Event(QObject* parent, const QDate &date);
255
256- static void RegisterType();
257-
258 const QDate& date() const;
259- QDateTime start_date_time() const;
260- QDateTime end_date_time() const;
261+ QDateTime startDateTime() const;
262+ QDateTime endDateTime() const;
263
264 protected:
265- virtual void destroySource(bool destroy_backing, bool as_orphan);
266+ virtual void destroySource(bool destroyBacking, bool asOrphan);
267
268 private:
269- QDate date_;
270+ QDate m_date;
271 };
272
273 QML_DECLARE_TYPE(Event)
274
275=== modified file 'src/gallery-application.cpp'
276--- src/gallery-application.cpp 2013-06-10 09:09:31 +0000
277+++ src/gallery-application.cpp 2013-06-10 09:09:31 +0000
278@@ -123,7 +123,7 @@
279 {
280 qmlRegisterType<Album>("Gallery", 1, 0, "Album");
281 qmlRegisterType<AlbumPage>("Gallery", 1, 0, "AlbumPage");
282- Event::RegisterType();
283+ qmlRegisterType<Event>("Gallery", 1, 0, "Event");
284 qmlRegisterType<MediaSource>("Gallery", 1, 0, "MediaSource");
285 QmlAlbumCollectionModel::RegisterType();
286 QmlEventCollectionModel::RegisterType();
287
288=== modified file 'src/media/media-source.cpp'
289--- src/media/media-source.cpp 2013-06-10 09:09:31 +0000
290+++ src/media/media-source.cpp 2013-06-10 09:09:31 +0000
291@@ -271,7 +271,7 @@
292 */
293 Event* MediaSource::FindEvent()
294 {
295- return GalleryManager::instance()->event_collection()->EventForMediaSource(this);
296+ return GalleryManager::instance()->event_collection()->eventForMediaSource(this);
297 }
298
299 /*!
300
301=== modified file 'src/qml/qml-event-overview-model.cpp'
302--- src/qml/qml-event-overview-model.cpp 2013-06-10 09:09:31 +0000
303+++ src/qml/qml-event-overview-model.cpp 2013-06-10 09:09:31 +0000
304@@ -179,7 +179,7 @@
305 continue;
306
307 QDate source_date = source->exposureDateTime().date();
308- Event* event = GalleryManager::instance()->event_collection()->EventForDate(source_date);
309+ Event* event = GalleryManager::instance()->event_collection()->eventForDate(source_date);
310 Q_ASSERT(event != NULL);
311
312 if (!view->contains(event))
313@@ -363,7 +363,7 @@
314 // times to ensure that
315 Event* event = qobject_cast<Event*>(object);
316 if (event != NULL)
317- return asc ? event->start_date_time() : event->end_date_time();
318+ return asc ? event->startDateTime() : event->endDateTime();
319
320 return QDateTime();
321 }

Subscribers

People subscribed via source and target branches