2 * Copyright (C) 2013 Canonical, Ltd.
5 * Pawel Stolowski <pawel.stolowski@canonical.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22#include "genericpreview.h"
23#include "applicationpreview.h"
24#include "moviepreview.h"
25#include "musicpreview.h"
26#include "variantutils.h"
31#include <UnityCore/GenericPreview.h>
32#include <UnityCore/ApplicationPreview.h>
33#include <UnityCore/MoviePreview.h>
34#include <UnityCore/MusicPreview.h>
36Preview::Preview(QObject *parent):
41QString Preview::rendererName() const
44 return QString::fromStdString(m_unityPreview->renderer_name());
46 qWarning() << "Preview not set";
51QString Preview::title() const
54 return QString::fromStdString(m_unityPreview->title());
56 qWarning() << "Preview not set";
61QString Preview::subtitle () const
64 return QString::fromStdString(m_unityPreview->subtitle());
66 qWarning() << "Preview not set";
71PreviewActionList Preview::actions()
73 PreviewActionList alist;
75 for (auto unityAction: m_unityPreview->GetActions()) {
76 auto action = new PreviewAction(this);
77 action->setUnityAction(unityAction);
81 qWarning() << "Preview not set";
86Preview* Preview::newFromUnityPreview(unity::dash::Preview::Ptr unityPreview)
88 Preview* preview = nullptr;
90 if (typeid(*unityPreview) == typeid(unity::dash::GenericPreview)) {
91 preview = new GenericPreview();
93 else if (typeid(*unityPreview) == typeid(unity::dash::MusicPreview)) {
94 preview = new GenericPreview();
96 else if (typeid(*unityPreview) == typeid(unity::dash::MoviePreview)) {
97 preview = new MoviePreview();
99 else if (typeid(*unityPreview) == typeid(unity::dash::ApplicationPreview)) {
100 preview = new ApplicationPreview();
102 qWarning() << "Unknown preview type: " << typeid(*unityPreview).name();
103 preview = new GenericPreview();
105 preview->m_unityPreview = unityPreview;
106 preview->setUnityPreview(unityPreview);
111void Preview::setUnityPreview(unity::dash::Preview::Ptr /* unityPreview */)
113 // default implementation does nothing
116void Preview::execute(const QString& actionId, const QHash<QString, QVariant>& hints)
118 if (m_unityPreview) {
119 auto unityHints = convertToHintsMap(hints);
120 m_unityPreview->PerformAction(actionId.toStdString(), unityHints);
122 qWarning() << "Preview not set";
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list