2
* Copyright 2016 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as published
6
* by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License along
14
* with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Ted Gould <ted.gould@canonical.com>
21
#include "libubuntu-app-launch/application.h"
22
#include "libubuntu-app-launch/registry.h"
24
int main(int argc, char* argv[])
27
std::cerr << "Usage: " << argv[0] << " (appid)" << std::endl;
31
auto appid = ubuntu::app_launch::AppID::find(argv[1]);
33
std::cerr << "Unable to find app for appid: " << argv[1] << std::endl;
37
std::shared_ptr<ubuntu::app_launch::Application> app;
39
app = ubuntu::app_launch::Application::create(appid, ubuntu::app_launch::Registry::getDefault());
41
throw std::runtime_error("Application object is nullptr");
42
} catch (std::runtime_error &e) {
43
std::cerr << "Unable to find application for AppID: " << argv[1] << std::endl;
48
auto info = app->info();
50
std::cout << "Name: " << info->name().value() << std::endl;
51
std::cout << "Description: " << info->description().value() << std::endl;
52
std::cout << "Icon Path: " << info->iconPath().value() << std::endl;
53
std::cout << "Splash: " << std::endl;
54
std::cout << " Title: " << info->splash().title.value() << std::endl;
55
std::cout << " Image: " << info->splash().image.value() << std::endl;
56
std::cout << " BG Color: " << info->splash().backgroundColor.value() << std::endl;
57
std::cout << " Header Color: " << info->splash().headerColor.value() << std::endl;
58
std::cout << " Footer Color: " << info->splash().footerColor.value() << std::endl;
59
std::cout << " Show Header: " << info->splash().showHeader.value() << std::endl;
60
std::cout << "Orientations: " << std::endl;
61
std::cout << " Portrait: " << info->supportedOrientations().portrait << std::endl;
62
std::cout << " Landscape: " << info->supportedOrientations().landscape << std::endl;
63
std::cout << " Inv Portrait: " << info->supportedOrientations().invertedPortrait << std::endl;
64
std::cout << " Inv Landscape: " << info->supportedOrientations().invertedLandscape << std::endl;
65
std::cout << "Rotates: " << info->rotatesWindowContents().value() << std::endl;
66
std::cout << "Ubuntu Lifecycle: " << info->supportsUbuntuLifecycle().value() << std::endl;
67
} catch (std::runtime_error &e) {
68
std::cerr << "Unable to parse Application info for application '" << std::string(appid) << "': " << e.what() << std::endl;