on xenial help sign in
Use QVariantList for actions property.
1e5f741Pawel Stolowski
plugins/Unity/plugin.cpp+1
@@ -25,6 +25,7 @@
25
25
26// local
26// local
27#include "preview.h"
27#include "preview.h"
28+#include "previewaction.h"
28#include "scope.h"
29#include "scope.h"
29#include "scopes.h"
30#include "scopes.h"
30#include "categories.h"
31#include "categories.h"
plugins/Unity/preview.cpp+7−4
@@ -19,6 +19,7 @@
19
19
20// local
20// local
21#include "preview.h"
21#include "preview.h"
22+#include "previewaction.h"
22#include "genericpreview.h"
23#include "genericpreview.h"
23#include "applicationpreview.h"
24#include "applicationpreview.h"
24#include "moviepreview.h"
25#include "moviepreview.h"
@@ -68,14 +69,16 @@ QString Preview::subtitle () const
68 return "";
69 return "";
69}
70}
70
71
71−PreviewActionList Preview::actions()
72+QVariantList Preview::actions()
72{
73{
73− PreviewActionList alist;
74+ QVariantList alist;
74 if (m_unityPreview) {
75 if (m_unityPreview) {
75 for (auto unityAction: m_unityPreview->GetActions()) {
76 for (auto unityAction: m_unityPreview->GetActions()) {
76− auto action = new PreviewAction(this);
77+ auto action = new PreviewAction(this); // preview is the owner of actions
77 action->setUnityAction(unityAction);
78 action->setUnityAction(unityAction);
79+ QVariant v;
80+ v.setValue(action);
78− alist.append(action);
81+ alist.append(v);
79 }
82 }
80 } else {
83 } else {
81 qWarning() << "Preview not set";
84 qWarning() << "Preview not set";
plugins/Unity/preview.h+2−2
@@ -38,7 +38,7 @@ class Preview : public QObject
38 Q_PROPERTY(QString rendererName READ rendererName NOTIFY rendererNameChanged)
38 Q_PROPERTY(QString rendererName READ rendererName NOTIFY rendererNameChanged)
39 Q_PROPERTY(QString title READ title NOTIFY titleChanged)
39 Q_PROPERTY(QString title READ title NOTIFY titleChanged)
40 Q_PROPERTY(QString subtitle READ subtitle NOTIFY subtitleChanged)
40 Q_PROPERTY(QString subtitle READ subtitle NOTIFY subtitleChanged)
41− Q_PROPERTY(PreviewActionList actions READ actions NOTIFY actionsChanged)
41+ Q_PROPERTY(QVariantList actions READ actions NOTIFY actionsChanged)
42
42
43public:
43public:
44 explicit Preview(QObject *parent = 0);
44 explicit Preview(QObject *parent = 0);
@@ -47,7 +47,7 @@ public:
47 QString rendererName() const;
47 QString rendererName() const;
48 QString title() const;
48 QString title() const;
49 QString subtitle () const;
49 QString subtitle () const;
50− PreviewActionList actions();
50+ QVariantList actions();
51
51
52public Q_SLOTS:
52public Q_SLOTS:
53 void execute(const QString& actionId, const QHash<QString, QVariant>& hints);
53 void execute(const QString& actionId, const QHash<QString, QVariant>& hints);
plugins/Unity/previewaction.h+2−2
@@ -65,9 +65,9 @@ private:
65 unity::dash::Preview::ActionPtr m_unityAction;
65 unity::dash::Preview::ActionPtr m_unityAction;
66};
66};
67
67
68−typedef QList<PreviewAction *> PreviewActionList;
68+//typedef QList<PreviewAction *> PreviewActionList;
69Q_DECLARE_METATYPE(PreviewAction *)
69Q_DECLARE_METATYPE(PreviewAction *)
70−Q_DECLARE_METATYPE(PreviewActionList *)
70+//Q_DECLARE_METATYPE(PreviewActionList *)
71Q_DECLARE_METATYPE(LayoutHint)
71Q_DECLARE_METATYPE(LayoutHint)
72
72
73#endif
73#endif