on xenial help sign in
Minor fixes.
0bfbf81Pawel Stolowski
plugins/Unity/applicationpreview.cpp+2−1
@@ -23,7 +23,8 @@
23#include <QDebug>
23#include <QDebug>
24
24
25ApplicationPreview::ApplicationPreview(QObject *parent):
25ApplicationPreview::ApplicationPreview(QObject *parent):
26− Preview(parent)
26+ Preview(parent),
27+ m_unityAppPreview(nullptr)
27{
28{
28}
29}
29
30
plugins/Unity/moviepreview.cpp+6−1
@@ -24,7 +24,8 @@
24#include <QDebug>
24#include <QDebug>
25
25
26MoviePreview::MoviePreview(QObject *parent):
26MoviePreview::MoviePreview(QObject *parent):
27− Preview(parent)
27+ Preview(parent),
28+ m_unityMoviePreview(nullptr)
28{
29{
29}
30}
30
31
@@ -61,4 +62,8 @@ unsigned int MoviePreview::numRatings() const
61void MoviePreview::setUnityPreview(unity::dash::Preview::Ptr unityPreview)
62void MoviePreview::setUnityPreview(unity::dash::Preview::Ptr unityPreview)
62{
63{
63 m_unityMoviePreview = std::dynamic_pointer_cast<unity::dash::MoviePreview>(unityPreview);
64 m_unityMoviePreview = std::dynamic_pointer_cast<unity::dash::MoviePreview>(unityPreview);
65+
66+ Q_EMIT yearChanged();
67+ Q_EMIT ratingChanged();
68+ Q_EMIT numRatingsChanged();
64}
69}
plugins/Unity/moviepreview.h+8−3
@@ -34,9 +34,9 @@ class MoviePreview: public Preview
34{
34{
35 Q_OBJECT
35 Q_OBJECT
36
36
37− Q_PROPERTY(QString year READ year)
37+ Q_PROPERTY(QString year READ year NOTIFY yearChanged)
38− Q_PROPERTY(float rating READ rating)
38+ Q_PROPERTY(float rating READ rating NOTIFY ratingChanged)
39− Q_PROPERTY(unsigned int numRatings READ numRatings)
39+ Q_PROPERTY(unsigned int numRatings READ numRatings NOTIFY numRatingsChanged)
40
40
41public:
41public:
42 explicit MoviePreview(QObject *parent = 0);
42 explicit MoviePreview(QObject *parent = 0);
@@ -45,6 +45,11 @@ public:
45 float rating() const;
45 float rating() const;
46 unsigned int numRatings() const;
46 unsigned int numRatings() const;
47
47
48+Q_SIGNALS:
49+ void yearChanged();
50+ void ratingChanged();
51+ void numRatingsChanged();
52+
48protected:
53protected:
49 void setUnityPreview(unity::dash::Preview::Ptr unityPreview) override;
54 void setUnityPreview(unity::dash::Preview::Ptr unityPreview) override;
50
55
plugins/Unity/musicpreview.cpp+10−1
@@ -21,7 +21,8 @@
21#include <QDebug>
21#include <QDebug>
22
22
23MusicPreview::MusicPreview(QObject *parent):
23MusicPreview::MusicPreview(QObject *parent):
24− Preview(parent)
24+ Preview(parent),
25+ m_unityMusicPreview(nullptr)
25{
26{
26 m_tracks = new DeeListModel(this);
27 m_tracks = new DeeListModel(this);
27}
28}
@@ -30,6 +31,9 @@ void MusicPreview::setUnityPreview(unity::dash::Preview::Ptr unityPreview)
30{
31{
31 m_unityMusicPreview = std::dynamic_pointer_cast<unity::dash::MusicPreview>(unityPreview);
32 m_unityMusicPreview = std::dynamic_pointer_cast<unity::dash::MusicPreview>(unityPreview);
32 m_tracks->setModel(m_unityMusicPreview->GetTracksModel()->model());
33 m_tracks->setModel(m_unityMusicPreview->GetTracksModel()->model());
34+ m_unityMusicPreview->GetTracksModel()->model.changed.connect(sigc::mem_fun(this, &MusicPreview::onTracksModelChanged));
35+
36+ Q_EMIT tracksChanged();
33}
37}
34
38
35DeeListModel* MusicPreview::tracks() const
39DeeListModel* MusicPreview::tracks() const
@@ -39,3 +43,8 @@ DeeListModel* MusicPreview::tracks() const
39 }
43 }
40 return m_tracks;
44 return m_tracks;
41}
45}
46+
47+void MusicPreview::onTracksModelChanged(unity::glib::Object<DeeModel> /* model */)
48+{
49+ m_tracks->setModel(m_unityMusicPreview->GetTracksModel()->model());
50+}
plugins/Unity/musicpreview.h+3
@@ -51,6 +51,9 @@ Q_SIGNALS:
51protected:
51protected:
52 void setUnityPreview(unity::dash::Preview::Ptr unityPreview) override;
52 void setUnityPreview(unity::dash::Preview::Ptr unityPreview) override;
53
53
54+private Q_SLOTS:
55+ void onTracksModelChanged(unity::glib::Object<DeeModel> model);
56+
54private:
57private:
55 unity::dash::MusicPreview::Ptr m_unityMusicPreview;
58 unity::dash::MusicPreview::Ptr m_unityMusicPreview;
56 DeeListModel *m_tracks;
59 DeeListModel *m_tracks;
plugins/Unity/preview.cpp+2−1
@@ -36,7 +36,8 @@
36#include <UnityCore/MusicPreview.h>
36#include <UnityCore/MusicPreview.h>
37
37
38Preview::Preview(QObject *parent):
38Preview::Preview(QObject *parent):
39− QObject(parent)
39+ QObject(parent),
40+ m_unityPreview(nullptr)
40{
41{
41}
42}
42
43
plugins/Unity/previewaction.cpp+2−1
@@ -20,7 +20,8 @@
20#include "previewaction.h"
20#include "previewaction.h"
21
21
22PreviewAction::PreviewAction(QObject *parent)
22PreviewAction::PreviewAction(QObject *parent)
23− : QObject(parent)
23+ : QObject(parent),
24+ m_unityAction(nullptr)
24{
25{
25}
26}
26
27