Debian Codegraph @

liblomiri-app-launch/application-info-desktop.h

raw
1 /*
2 * Copyright © 2016 Canonical Ltd.
3 *
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.
7 *
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.
12 *
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/>.
15 *
16 * Authors:
17 * Ted Gould <[email protected]>
18 */
19
20 #pragma once
21
22 #include "application.h"
23 #include "registry-impl.h"
24 #include "registry.h"
25 #include <bitset>
26 #include <glib.h>
27 #include <mutex>
28
29 namespace lomiri
30 {
31 namespace app_launch
32 {
33 namespace app_info
34 {
35
36 namespace DesktopFlags
37 {
38 static const std::bitset<3> NONE{"000"};
39 static const std::bitset<3> ALLOW_NO_DISPLAY{"001"};
40 static const std::bitset<3> XMIR_DEFAULT{"010"};
41 static const std::bitset<3> NO_SPLASH{"100"};
42 }
43
44 class Desktop : public Application::Info
45 {
46 public:
47 Desktop(const AppID& appid,
48 const std::shared_ptr<GKeyFile>& keyfile,
49 const std::string& basePath,
50 const std::string& rootDir,
51 std::bitset<3> flags,
52 const std::shared_ptr<Registry::Impl>& registry);
53
54 const Application::Info::Name& name() override
55 {
56 return _name;
57 }
58 const Application::Info::Description& description() override
59 {
60 return _description;
61 }
62 const Application::Info::IconPath& iconPath() override
63 {
64 return _iconPath;
65 }
66 const Application::Info::DefaultDepartment& defaultDepartment() override
67 {
68 return _defaultDepartment;
69 }
70 const Application::Info::IconPath& screenshotPath() override
71 {
72 return _screenshotPath;
73 }
74 const Application::Info::Keywords& keywords() override
75 {
76 return _keywords;
77 }
78 const Application::Info::Popularity& popularity() override
79 {
80 return _popularity;
81 }
82
83 Application::Info::Splash splash() override
84 {
85 return _splashInfo;
86 }
87
88 Application::Info::Orientations supportedOrientations() override
89 {
90 return _supportedOrientations;
91 }
92
93 Application::Info::RotatesWindow rotatesWindowContents() override
94 {
95 return _rotatesWindow;
96 }
97
98 Application::Info::LomiriLifecycle supportsLomiriLifecycle() override
99 {
100 return _lomiriLifecycle;
101 }
102
103 struct XMirEnableTag;
104 typedef TypeTagger<XMirEnableTag, bool> XMirEnable;
105 virtual XMirEnable xMirEnable()
106 {
107 return _xMirEnable;
108 }
109
110 struct ExecTag;
111 typedef TypeTagger<ExecTag, std::string> Exec;
112 virtual Exec execLine()
113 {
114 return _exec;
115 }
116
117 struct SingleInstanceTag;
118 typedef TypeTagger<SingleInstanceTag, bool> SingleInstance;
119 virtual SingleInstance singleInstance()
120 {
121 return _singleInstance;
122 }
123
124 protected:
125 std::shared_ptr<GKeyFile> _keyfile;
126 std::string _basePath;
127 std::string _rootDir;
128
129 Application::Info::Name _name;
130 Application::Info::Description _description;
131 Application::Info::IconPath _iconPath;
132 Application::Info::DefaultDepartment _defaultDepartment;
133 Application::Info::IconPath _screenshotPath;
134 Application::Info::Keywords _keywords;
135 Application::Info::Popularity _popularity;
136
137 Application::Info::Splash _splashInfo;
138 Application::Info::Orientations _supportedOrientations;
139 Application::Info::RotatesWindow _rotatesWindow;
140 Application::Info::LomiriLifecycle _lomiriLifecycle;
141
142 XMirEnable _xMirEnable;
143 Exec _exec;
144 SingleInstance _singleInstance;
145 };
146
147 } // namespace AppInfo
148 } // namespace AppLaunch
149 } // namespace Lomiri