2 * Copyright (C) 2013-2014 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17#include "ApplicationInfo.h"
19#include "SessionManager.h"
23#include <QGuiApplication>
26#include <QQmlComponent>
29ApplicationInfo::ApplicationInfo(const QString &appId, QObject *parent)
30 : ApplicationInfoInterface(appId, parent)
37 , m_manualSurfaceCreation(false)
41ApplicationInfo::ApplicationInfo(QObject *parent)
42 : ApplicationInfoInterface(QString(), parent)
48 , m_manualSurfaceCreation(false)
52ApplicationInfo::~ApplicationInfo()
57void ApplicationInfo::createSession()
59 if (m_session || state() == ApplicationInfo::Stopped) { return; }
61 QUrl screenshotUrl = QString("file://%1").arg(m_screenshotFileName);
62 setSession(SessionManager::singleton()->createSession(appId(), screenshotUrl));
65void ApplicationInfo::setSession(Session* session)
67 qDebug() << "Application::setSession - appId=" << appId() << "session=" << session;
68 if (m_session == session)
72 disconnect(this, 0, m_session, 0);
73 m_session->setApplication(nullptr);
74 m_session->setParent(nullptr);
75 Q_EMIT m_session->deregister();
81 m_session->setApplication(this);
82 m_session->setParent(this);
83 SessionManager::singleton()->registerSession(m_session);
85 if (!m_manualSurfaceCreation) {
86 QTimer::singleShot(500, m_session, SLOT(createSurface()));
90 Q_EMIT sessionChanged(m_session);
93void ApplicationInfo::setIconId(const QString &iconId)
95 setIcon(QString("file://%1/graphics/applicationIcons/%2@18.png")
100void ApplicationInfo::setScreenshotId(const QString &screenshotId)
102 QString screenshotFileName = QString("%1/Dash/graphics/phone/screenshots/%2@12.png")
106 if (screenshotFileName != m_screenshotFileName) {
107 m_screenshotFileName = screenshotFileName;
109 QUrl screenshotUrl = QString("file://%1").arg(m_screenshotFileName);
111 m_session->setScreenshot(screenshotUrl);
116void ApplicationInfo::setName(const QString &value)
118 if (value != m_name) {
120 Q_EMIT nameChanged(value);
124void ApplicationInfo::setIcon(const QUrl &value)
126 if (value != m_icon) {
128 Q_EMIT iconChanged(value);
132void ApplicationInfo::setStage(Stage value)
134 if (value != m_stage) {
136 Q_EMIT stageChanged(value);
140void ApplicationInfo::setState(State value)
142 if (value != m_state) {
144 Q_EMIT stateChanged(value);
146 if (!m_manualSurfaceCreation && m_state == ApplicationInfo::Running) {
147 QTimer::singleShot(500, this, SLOT(createSession()));
152void ApplicationInfo::setFocused(bool value)
154 if (value != m_focused) {
156 Q_EMIT focusedChanged(value);
160void ApplicationInfo::setFullscreen(bool value)
162 if (value != m_fullscreen) {
163 m_fullscreen = value;
164 Q_EMIT fullscreenChanged(value);
168void ApplicationInfo::setManualSurfaceCreation(bool value)
170 if (value != m_manualSurfaceCreation) {
171 m_manualSurfaceCreation = value;
172 Q_EMIT manualSurfaceCreationChanged(value);
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