2 * Copyright (C) 2016 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/>.
19#include "ualwrapper.h"
21#include <ubuntu-app-launch/registry.h>
22using namespace ubuntu::app_launch;
24UalWrapper::UalWrapper(QObject *parent):
28 Registry::appAdded().connect([this](const std::shared_ptr<Application>&app) {
29 Q_EMIT appAdded(QString::fromStdString(app->appId()));
31 Registry::appRemoved().connect([this](const AppID &appId) {
32 Q_EMIT appRemoved(QString::fromStdString(appId));
34 Registry::appInfoUpdated().connect([this](const std::shared_ptr<Application>&app){
35 Q_EMIT appInfoChanged(QString::fromStdString(app->appId()));
40QStringList UalWrapper::installedApps()
44 for (const std::shared_ptr<Application> &app : Registry::installedApps()) {
45 if (!app->appId().package.value().empty()) {
46 appIds << QString::fromStdString(app->appId().package.value() + "_" + app->appId().appname.value());
48 appIds << QString::fromStdString(app->appId().appname);
51 } catch (const std::runtime_error &e) {
52 qWarning() << "ubuntu-app-launch threw an exception listing apps:" << e.what();
58UalWrapper::AppInfo UalWrapper::getApplicationInfo(const QString &appId)
63 AppID ualAppId = AppID::find(appId.toStdString());
64 if (ualAppId.empty()) {
65 qWarning() << "Empty ualAppId result for" << appId;
69 std::shared_ptr<Application> ualApp;
70 ualApp = Application::create(ualAppId, Registry::getDefault());
73 info.name = QString::fromStdString(ualApp->info()->name());
74 info.icon = QString::fromStdString(ualApp->info()->iconPath());
75 for (const std::string &keyword : ualApp->info()->keywords().value()) {
76 info.keywords << QString::fromStdString(keyword);
78 //info.popularity = ualApp->info()->popularity();
80 } catch (const std::runtime_error &e) {
81 qWarning() << "ubuntu-app-launch threw an exception getting app info for appId:" << appId << ":" << e.what();
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