@@ -23,6 +23,7 @@
2323#include "applicationpreview.h"
2424#include "moviepreview.h"
2525#include "musicpreview.h"
26+#include "variantutils.h"
2627
2728// Qt
2829#include <QDebug>
@@ -39,22 +40,31 @@ Preview::Preview(QObject *parent):
3940
4041QString Preview::rendererName() const
4142{
42− if (m_unityPreview)
43+ if (m_unityPreview) {
4344 return QString::fromStdString(m_unityPreview->renderer_name());
45+ } else {
46+ qWarning() << "Preview not set";
47+ }
4448 return "";
4549}
4650
4751QString Preview::title() const
4852{
49− if (m_unityPreview)
53+ if (m_unityPreview) {
5054 return QString::fromStdString(m_unityPreview->title());
55+ } else {
56+ qWarning() << "Preview not set";
57+ }
5158 return "";
5259}
5360
5461QString Preview::subtitle () const
5562{
56− if (m_unityPreview)
63+ if (m_unityPreview) {
5764 return QString::fromStdString(m_unityPreview->subtitle());
65+ } else {
66+ qWarning() << "Preview not set";
67+ }
5868 return "";
5969}
6070
@@ -67,6 +77,8 @@ PreviewActionList Preview::actions()
6777 action->setUnityAction(unityAction);
6878 alist.append(action);
6979 }
80+ } else {
81+ qWarning() << "Preview not set";
7082 }
7183 return alist;
7284}
@@ -100,3 +112,13 @@ void Preview::setUnityPreview(unity::dash::Preview::Ptr /* unityPreview */)
100112{
101113 // default implementation does nothing
102114}
115+
116+void Preview::execute(const QString& actionId, const QHash<QString, QVariant>& hints)
117+{
118+ if (m_unityPreview) {
119+ auto unityHints = convertToHintsMap(hints);
120+ m_unityPreview->PerformAction(actionId.toStdString(), unityHints);
121+ } else {
122+ qWarning() << "Preview not set";
123+ }
124+}