Merge lp:~mzanetti/qtubuntu/drop-appmanager into lp:qtubuntu
- drop-appmanager
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~mzanetti/qtubuntu/drop-appmanager |
Merge into: | lp:qtubuntu |
Diff against target: |
2071 lines (+14/-1903) 24 files modified
debian/changelog (+6/-0) debian/control (+7/-7) debian/qtubuntu-android.install (+0/-1) debian/qtubuntu-desktop.install (+0/-1) deploy.sh (+0/-2) src/modules/application/OSKController.qml (+0/-21) src/modules/application/application.cc (+0/-123) src/modules/application/application.h (+0/-71) src/modules/application/application.pro (+0/-45) src/modules/application/application_image.cc (+0/-205) src/modules/application/application_image.h (+0/-71) src/modules/application/application_manager.cc (+0/-612) src/modules/application/application_manager.h (+0/-139) src/modules/application/application_window.cc (+0/-45) src/modules/application/application_window.h (+0/-44) src/modules/application/desktopdata.cpp (+0/-157) src/modules/application/desktopdata.h (+0/-56) src/modules/application/input_filter_area.cc (+0/-144) src/modules/application/input_filter_area.h (+0/-59) src/modules/application/logging.h (+0/-38) src/modules/application/plugin.cc (+0/-55) src/modules/application/qmldir (+0/-3) src/modules/modules.pro (+0/-3) src/src.pro (+1/-1) |
To merge this branch: | bzr merge lp:~mzanetti/qtubuntu/drop-appmanager |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gerry Boland (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+212697@code.launchpad.net |
This proposal has been superseded by a proposal from 2014-04-01.
Commit message
drop applicationmanager module from qtubuntu.
It won't work any more with upcoming changes in unity-api.
Description of the change
* Are there any related MPs required for this MP to build/function as expected? Please list.
N/A
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Yes (version bump only)
* If you changed the UI, has there been a design review?
N/A
PS Jenkins bot (ps-jenkins) wrote : | # |
Gerry Boland (gerboland) wrote : | # |
Please remove libunity-api-dev from the list of dependencies (are all the others necessary? libdbus-1-dev? qtdeclarative5-
README contains obsolete info now, best update it. The deploy.sh script too. And bits in tests/ could also go.
Since this breaks SF support, packaging changes are probably needed. Bumping the version number maybe. Good to ask a packaging expert about this.
- 215. By Michael Zanetti
-
drop unity-api from depends
- 216. By Michael Zanetti
-
bump changelog
Michael Zanetti (mzanetti) wrote : | # |
> Please remove libunity-api-dev from the list of dependencies (are all the
> others necessary? libdbus-1-dev? qtdeclarative5-
done. the others seem to be required still.
>
> README contains obsolete info now, best update it. The deploy.sh script too.
> And bits in tests/ could also go.
Couldn't find anything in the README. deploy.sh should be clean already.
>
> Since this breaks SF support, packaging changes are probably needed. Bumping
> the version number maybe. Good to ask a packaging expert about this.
done
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:216
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Gerry Boland (gerboland) wrote : | # |
Yay for deleting obsolete code! Approved
* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes
* Did CI run pass? If not, please explain why.
Is fine
- 217. By Michael Zanetti
-
drop qtutubutu-shell from provides
- 218. By Michael Zanetti
-
break unity8 << 7.85
- 219. By Michael Zanetti
-
also break old versions of ubuntu-
touch-session
Unmerged revisions
Preview Diff
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2014-03-18 20:20:51 +0000 |
3 | +++ debian/changelog 2014-03-31 15:14:06 +0000 |
4 | @@ -1,3 +1,9 @@ |
5 | +qtubuntu (0.54-0ubuntu1) trusty; urgency=medium |
6 | + |
7 | + * Drop Unity.Application module. |
8 | + |
9 | + -- Michael Zanetti <michael.zanetti@canonical.com> Tue, 25 Mar 2014 20:30:15 +0100 |
10 | + |
11 | qtubuntu (0.53+14.04.20140318-0ubuntu1) trusty; urgency=low |
12 | |
13 | [ Chris Coulson ] |
14 | |
15 | === modified file 'debian/control' |
16 | --- debian/control 2014-01-09 15:12:01 +0000 |
17 | +++ debian/control 2014-03-31 15:14:06 +0000 |
18 | @@ -12,7 +12,6 @@ |
19 | libhybris-dev, |
20 | libplatform-api1-dev (>= 0.20), |
21 | libudev-dev, |
22 | - libunity-api-dev, |
23 | libxrender-dev, |
24 | libxkbcommon-dev, |
25 | qt5-default, |
26 | @@ -34,9 +33,10 @@ |
27 | Replaces: qthybris (<< 0.37), |
28 | qtubuntu (<< 0.52), |
29 | qtubuntu-desktop |
30 | -Breaks: qthybris (<< 0.37) |
31 | -Provides: qtubuntu-shell, |
32 | - qtubuntu, |
33 | +Breaks: qthybris (<< 0.37), |
34 | + unity8 (<< 7.85), |
35 | + ubuntu-touch-session (<< 0.107), |
36 | +Provides: qtubuntu, |
37 | Depends: ${misc:Depends}, |
38 | ${shlibs:Depends}, |
39 | libqt5sensors5, |
40 | @@ -56,9 +56,9 @@ |
41 | Conflicts: qtubuntu-android |
42 | Replaces: qtubuntu (<< 0.52), |
43 | qtubuntu-android |
44 | -Breaks: qthybris (<< 0.37) |
45 | -Provides: qtubuntu-shell, |
46 | - qtubuntu, |
47 | +Breaks: qthybris (<< 0.37), |
48 | + unity8 (<< 7.85), |
49 | +Provides: qtubuntu, |
50 | Depends: ${misc:Depends}, |
51 | ${shlibs:Depends}, |
52 | libqt5sensors5, |
53 | |
54 | === modified file 'debian/qtubuntu-android.install' |
55 | --- debian/qtubuntu-android.install 2013-08-30 14:32:02 +0000 |
56 | +++ debian/qtubuntu-android.install 2014-03-31 15:14:06 +0000 |
57 | @@ -1,2 +1,1 @@ |
58 | usr/lib/*/qt5/plugins/platforms/* |
59 | -usr/lib/*/qt5/imports/Unity/* |
60 | |
61 | === modified file 'debian/qtubuntu-desktop.install' |
62 | --- debian/qtubuntu-desktop.install 2013-12-09 17:31:20 +0000 |
63 | +++ debian/qtubuntu-desktop.install 2014-03-31 15:14:06 +0000 |
64 | @@ -1,2 +1,1 @@ |
65 | usr/lib/*/qt5/plugins/platforms/* |
66 | -usr/lib/*/qt5/imports/Unity/* |
67 | |
68 | === modified file 'deploy.sh' |
69 | --- deploy.sh 2013-06-19 22:37:32 +0000 |
70 | +++ deploy.sh 2014-03-31 15:14:06 +0000 |
71 | @@ -4,8 +4,6 @@ |
72 | adb push src/platforms/ubuntu/libqubuntumir.so /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/plugins/platforms |
73 | adb push src/platforms/ubuntu/libqubuntumirserver.so /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/plugins/platforms |
74 | adb push src/platforms/ubuntulegacy/libqubuntulegacy.so /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/plugins/platforms |
75 | -adb push src/modules/application/libubuntuapplicationplugin.so /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/imports/Ubuntu/Application |
76 | -adb push src/modules/application/qmldir /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/imports/Ubuntu/Application |
77 | adb push tests/qmlscene_ubuntu/qmlscene-ubuntu /data/ubuntu/usr/bin |
78 | adb push tests/clipboard/clipboard /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/tests |
79 | adb push tests/Logo.qml /data/ubuntu/usr/lib/arm-linux-gnueabihf/qt5/tests |
80 | |
81 | === removed directory 'src/modules' |
82 | === removed directory 'src/modules/application' |
83 | === removed file 'src/modules/application/OSKController.qml' |
84 | --- src/modules/application/OSKController.qml 2013-09-05 16:30:22 +0000 |
85 | +++ src/modules/application/OSKController.qml 1970-01-01 00:00:00 +0000 |
86 | @@ -1,21 +0,0 @@ |
87 | -/* |
88 | - * Copyright (C) 2013 Canonical, Ltd. |
89 | - * |
90 | - * This program is free software: you can redistribute it and/or modify it under |
91 | - * the terms of the GNU Lesser General Public License version 3, as published by |
92 | - * the Free Software Foundation. |
93 | - * |
94 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
95 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
96 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
97 | - * Lesser General Public License for more details. |
98 | - * |
99 | - * You should have received a copy of the GNU Lesser General Public License |
100 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
101 | - */ |
102 | - |
103 | -import QtQuick 2.0 |
104 | - |
105 | -Item { |
106 | - // this is a fake OSKController, only for compatibility with Unity-Mir |
107 | -} |
108 | |
109 | === removed file 'src/modules/application/application.cc' |
110 | --- src/modules/application/application.cc 2013-09-12 15:45:12 +0000 |
111 | +++ src/modules/application/application.cc 1970-01-01 00:00:00 +0000 |
112 | @@ -1,123 +0,0 @@ |
113 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
114 | -// Copyright © 2013 Canonical Ltd. |
115 | -// |
116 | -// This program is free software: you can redistribute it and/or modify it under |
117 | -// the terms of the GNU Lesser General Public License version 3, as published by |
118 | -// the Free Software Foundation. |
119 | -// |
120 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
121 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
122 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
123 | -// Lesser General Public License for more details. |
124 | -// |
125 | -// You should have received a copy of the GNU Lesser General Public License |
126 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
127 | - |
128 | -#include "application.h" |
129 | -#include "desktopdata.h" |
130 | -#include "logging.h" |
131 | - |
132 | -using namespace unity::shell::application; |
133 | - |
134 | -Application::Application( |
135 | - DesktopData* desktopData, qint64 pid, Application::Stage stage, Application::State state, |
136 | - int timerId) |
137 | - : ApplicationInfoInterface(desktopData->appId()) |
138 | - , desktopData_(desktopData) |
139 | - , pid_(pid) |
140 | - , stage_(stage) |
141 | - , state_(state) |
142 | - , focused_(false) |
143 | - , fullscreen_(false) |
144 | - , timerId_(timerId) { |
145 | - DASSERT(desktopData != NULL); |
146 | - DLOG("Application::Application (this=%p, desktopData=%p, pid=%lld, stage=%d, state=%d, " |
147 | - "timerId=%d)", this, desktopData, pid, static_cast<int>(stage), static_cast<int>(state), |
148 | - timerId); |
149 | -} |
150 | - |
151 | -Application::~Application() { |
152 | - DLOG("Application::~Application"); |
153 | - delete desktopData_; |
154 | -} |
155 | - |
156 | -QString Application::appId() const { |
157 | - return desktopData_->appId(); |
158 | -} |
159 | - |
160 | -QString Application::name() const { |
161 | - return desktopData_->name(); |
162 | -} |
163 | - |
164 | -QString Application::comment() const { |
165 | - return desktopData_->comment(); |
166 | -} |
167 | - |
168 | -QUrl Application::icon() const { |
169 | - QString iconString = desktopData_->icon().toString(); |
170 | - QString pathString = desktopData_->path(); |
171 | - |
172 | - if (QFileInfo(iconString).exists()) { |
173 | - return desktopData_->icon(); |
174 | - } else if (QFileInfo(pathString + '/' + iconString).exists()) { |
175 | - return QUrl(pathString + '/' + iconString); |
176 | - } else { |
177 | - return QUrl("image://theme/" + iconString); |
178 | - } |
179 | -} |
180 | - |
181 | -QString Application::exec() const { |
182 | - return desktopData_->exec(); |
183 | -} |
184 | - |
185 | -qint64 Application::pid() const { |
186 | - return pid_; |
187 | -} |
188 | - |
189 | -Application::Stage Application::stage() const { |
190 | - return stage_; |
191 | -} |
192 | - |
193 | -Application::State Application::state() const { |
194 | - return state_; |
195 | -} |
196 | - |
197 | -bool Application::focused() const { |
198 | - return focused_; |
199 | -} |
200 | - |
201 | -bool Application::fullscreen() const { |
202 | - return fullscreen_; |
203 | -} |
204 | - |
205 | -void Application::setStage(Application::Stage stage) { |
206 | - DLOG("Application::setStage (this=%p, stage=%d)", this, static_cast<int>(stage)); |
207 | - if (stage_ != stage) { |
208 | - stage_ = stage; |
209 | - emit stageChanged(stage); |
210 | - } |
211 | -} |
212 | - |
213 | -void Application::setState(Application::State state) { |
214 | - DLOG("Application::setState (this=%p, state=%d)", this, static_cast<int>(state)); |
215 | - if (state_ != state) { |
216 | - state_ = state; |
217 | - emit stateChanged(state); |
218 | - } |
219 | -} |
220 | - |
221 | -void Application::setFocused(bool focused) { |
222 | - DLOG("Application::setFocused (this=%p, focused=%d)", this, static_cast<int>(focused)); |
223 | - if (focused_ != focused) { |
224 | - focused_ = focused; |
225 | - emit focusedChanged(focused); |
226 | - } |
227 | -} |
228 | - |
229 | -void Application::setFullscreen(bool fullscreen) { |
230 | - DLOG("Application::setFullscreen (this=%p, fullscreen=%s)", this, fullscreen ? "yes" : "no"); |
231 | - if (fullscreen_ != fullscreen) { |
232 | - fullscreen_ = fullscreen; |
233 | - emit fullscreenChanged(fullscreen); |
234 | - } |
235 | -} |
236 | |
237 | === removed file 'src/modules/application/application.h' |
238 | --- src/modules/application/application.h 2013-09-05 14:56:54 +0000 |
239 | +++ src/modules/application/application.h 1970-01-01 00:00:00 +0000 |
240 | @@ -1,71 +0,0 @@ |
241 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
242 | -// Copyright © 2013 Canonical Ltd. |
243 | -// |
244 | -// This program is free software: you can redistribute it and/or modify it under |
245 | -// the terms of the GNU Lesser General Public License version 3, as published by |
246 | -// the Free Software Foundation. |
247 | -// |
248 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
249 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
250 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
251 | -// Lesser General Public License for more details. |
252 | -// |
253 | -// You should have received a copy of the GNU Lesser General Public License |
254 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
255 | - |
256 | -#ifndef APPLICATION_H |
257 | -#define APPLICATION_H |
258 | - |
259 | -#include <QtCore/QtCore> |
260 | - |
261 | -// unity-api |
262 | -#include <unity/shell/application/ApplicationInfoInterface.h> |
263 | - |
264 | -class DesktopData; |
265 | - |
266 | -class Application : public unity::shell::application::ApplicationInfoInterface { |
267 | - Q_OBJECT |
268 | - |
269 | - Q_PROPERTY(bool fullscreen READ fullscreen NOTIFY fullscreenChanged) |
270 | - |
271 | - public: |
272 | - Application(DesktopData* desktopData, qint64 pid, Stage stage, State state, int timerId); |
273 | - ~Application(); |
274 | - |
275 | - QString appId() const override; |
276 | - QString name() const override; |
277 | - QString comment() const override; |
278 | - QUrl icon() const override; |
279 | - Stage stage() const override; |
280 | - State state() const override; |
281 | - bool focused() const override; |
282 | - bool fullscreen() const; |
283 | - |
284 | - // used internally, not for QML |
285 | - QString exec() const; |
286 | - qint64 pid() const; |
287 | - |
288 | - Q_SIGNALS: |
289 | - void fullscreenChanged(bool fullscreen); |
290 | - |
291 | - private: |
292 | - void setStage(Stage stage); |
293 | - void setState(State state); |
294 | - void setFocused(bool focused); |
295 | - void setFullscreen(bool fullscreen); |
296 | - int timerId() const { return timerId_; } |
297 | - |
298 | - DesktopData* desktopData_; |
299 | - qint64 pid_; |
300 | - Stage stage_; |
301 | - State state_; |
302 | - bool focused_; |
303 | - bool fullscreen_; |
304 | - int timerId_; |
305 | - |
306 | - friend class ApplicationManager; |
307 | -}; |
308 | - |
309 | -Q_DECLARE_METATYPE(Application*) |
310 | - |
311 | -#endif // APPLICATION_H |
312 | |
313 | === removed file 'src/modules/application/application.pro' |
314 | --- src/modules/application/application.pro 2014-01-30 14:57:43 +0000 |
315 | +++ src/modules/application/application.pro 1970-01-01 00:00:00 +0000 |
316 | @@ -1,45 +0,0 @@ |
317 | -TARGET = unityapplicationplugin |
318 | -TEMPLATE = lib |
319 | - |
320 | -QT += quick |
321 | -CONFIG += link_pkgconfig |
322 | - |
323 | -# CONFIG += c++11 # only enables C++0x |
324 | -QMAKE_CXXFLAGS += -std=c++11 -fvisibility=hidden -fvisibility-inlines-hidden |
325 | -QMAKE_CXXFLAGS_RELEASE += -Werror # so no stop on warning in debug builds |
326 | -QMAKE_LFLAGS = -std=c++11 -Wl,-no-undefined |
327 | - |
328 | -PKGCONFIG += unity-shell-application |
329 | - |
330 | -CONFIG(debug) { |
331 | - QMAKE_CXXFLAGS_DEBUG += -Werror |
332 | -} |
333 | - |
334 | -SOURCES = plugin.cc \ |
335 | - application_manager.cc \ |
336 | - application_image.cc \ |
337 | - application_window.cc \ |
338 | - application.cc \ |
339 | - input_filter_area.cc \ |
340 | - desktopdata.cpp |
341 | - |
342 | -HEADERS = application_manager.h \ |
343 | - application_image.h \ |
344 | - application_window.h \ |
345 | - application.h \ |
346 | - input_filter_area.h \ |
347 | - desktopdata.h \ |
348 | - logging.h \ |
349 | - /usr/include/unity/shell/application/ApplicationInfoInterface.h \ |
350 | - /usr/include/unity/shell/application/ApplicationManagerInterface.h |
351 | - |
352 | -CONFIG += plugin |
353 | - |
354 | -LIBS += -lubuntu_application_api |
355 | - |
356 | -target.path += $$[QT_INSTALL_IMPORTS]/Unity/Application |
357 | -INSTALLS += target |
358 | - |
359 | -assets.files = qmldir OSKController.qml |
360 | -assets.path = $$[QT_INSTALL_IMPORTS]/Unity/Application |
361 | -INSTALLS += assets |
362 | |
363 | === removed file 'src/modules/application/application_image.cc' |
364 | --- src/modules/application/application_image.cc 2013-08-30 16:33:16 +0000 |
365 | +++ src/modules/application/application_image.cc 1970-01-01 00:00:00 +0000 |
366 | @@ -1,205 +0,0 @@ |
367 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
368 | -// Copyright © 2013 Canonical Ltd. |
369 | -// |
370 | -// This program is free software: you can redistribute it and/or modify it under |
371 | -// the terms of the GNU Lesser General Public License version 3, as published by |
372 | -// the Free Software Foundation. |
373 | -// |
374 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
375 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
376 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
377 | -// Lesser General Public License for more details. |
378 | -// |
379 | -// You should have received a copy of the GNU Lesser General Public License |
380 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
381 | - |
382 | -#include "application_image.h" |
383 | -#include "application.h" |
384 | -#include "logging.h" |
385 | -#include <QtGui/QPainter> |
386 | -#include <QtCore/QCoreApplication> |
387 | -#include <QtCore/QThread> |
388 | -#include <ubuntu/ui/ubuntu_ui_session_service.h> |
389 | - |
390 | -class ApplicationImageEvent : public QEvent { |
391 | - public: |
392 | - ApplicationImageEvent(QEvent::Type type, QImage image, const QRect& sourceRect) |
393 | - : QEvent(type) |
394 | - , image_(image) |
395 | - , sourceRect_(sourceRect) { |
396 | - DLOG("ApplicationImageEvent::ApplicationImageEvent (this=%p, type=%d)", this, type); |
397 | - } |
398 | - ~ApplicationImageEvent() { |
399 | - DLOG("ApplicationImageEvent::~ApplicationImageEvent"); |
400 | - } |
401 | - static const QEvent::Type type_; |
402 | - QImage image_; |
403 | - QRect sourceRect_; |
404 | -}; |
405 | - |
406 | -const QEvent::Type ApplicationImageEvent::type_ = |
407 | - static_cast<QEvent::Type>(QEvent::registerEventType()); |
408 | - |
409 | -static void snapshotCallback(const void* pixels, unsigned int bufferWidth, unsigned int bufferHeight, |
410 | - unsigned int sourceX, unsigned int sourceY, |
411 | - unsigned int sourceWidth, unsigned int sourceHeight, |
412 | - unsigned int stride, void* context) { |
413 | - // FIXME(loicm) stride from Ubuntu Platform API is wrong. |
414 | - Q_UNUSED(stride); |
415 | - DLOG("snapshotCallback (pixels=%p, bufferWidth=%u, bufferHeight=%u, sourceX=%u, sourceY=%u, sourceWidth=%u, sourceHeight=%u, stride=%u, context=%p)", |
416 | - pixels, bufferWidth, bufferHeight, sourceX, sourceY, sourceHeight, sourceHeight, stride, context); |
417 | - DASSERT(context != NULL); |
418 | - // Copy the pixels and post an event to the GUI thread so that we can safely schedule an update. |
419 | - ApplicationImage* applicationImage = static_cast<ApplicationImage*>(context); |
420 | - |
421 | - if (pixels == NULL || bufferWidth == 0 || bufferHeight == 0) { |
422 | - QCoreApplication::postEvent(applicationImage, new ApplicationImageEvent( |
423 | - ApplicationImageEvent::type_, QImage(), QRect())); |
424 | - } else { |
425 | - QRect sourceRect(sourceX, sourceY, sourceWidth, sourceHeight); |
426 | - QImage image(static_cast<const uchar*>(pixels), bufferWidth, bufferHeight, bufferWidth * 4, |
427 | - QImage::Format_ARGB32_Premultiplied); |
428 | - QCoreApplication::postEvent(applicationImage, new ApplicationImageEvent( |
429 | - ApplicationImageEvent::type_, image.rgbSwapped(), sourceRect)); |
430 | - } |
431 | -} |
432 | - |
433 | -QHash<Application*, QPair<QImage, QRect> > ApplicationImage::imageCache_; |
434 | - |
435 | -ApplicationImage::ApplicationImage(QQuickPaintedItem* parent) |
436 | - : QQuickPaintedItem(parent) |
437 | - , source_(NULL) |
438 | - , fillMode_(Stretch) |
439 | - , ready_(false) { |
440 | - DLOG("ApplicationImage::ApplicationImage (this=%p, parent=%p)", this, parent); |
441 | - setRenderTarget(QQuickPaintedItem::FramebufferObject); |
442 | - setFillColor(QColor(0, 0, 0, 255)); |
443 | - setOpaquePainting(true); |
444 | -} |
445 | - |
446 | -ApplicationImage::~ApplicationImage() { |
447 | - DLOG("ApplicationImage::~ApplicationImage"); |
448 | -} |
449 | - |
450 | -void ApplicationImage::customEvent(QEvent* event) { |
451 | - DLOG("ApplicationImage::customEvent (this=%p, event=%p)", this, event); |
452 | - DASSERT(QThread::currentThread() == thread()); |
453 | - ApplicationImageEvent* imageEvent = static_cast<ApplicationImageEvent*>(event); |
454 | - // Store the new image and schedule an update. |
455 | - image_ = imageEvent->image_; |
456 | - sourceRect_ = imageEvent->sourceRect_; |
457 | - DLOG("ApplicationImage: inserted image in cache (this=%p)", this); |
458 | - imageCache_.insert(source_, QPair<QImage, QRect>(image_, sourceRect_)); |
459 | - connect(source_, &Application::destroyed, |
460 | - this, &ApplicationImage::onSourceDestroyed, Qt::UniqueConnection); |
461 | - update(); |
462 | - if (!ready_) { |
463 | - ready_ = true; |
464 | - emit readyChanged(); |
465 | - } |
466 | -} |
467 | - |
468 | -void ApplicationImage::setSource(Application* source) { |
469 | - DLOG("ApplicationImage::setApplication (this=%p, source=%p)", this, source); |
470 | - if (source_ != source) { |
471 | - source_ = source; |
472 | - image_ = QImage(); |
473 | - sourceRect_ = QRect(); |
474 | - if (ready_) { |
475 | - ready_ = false; |
476 | - emit readyChanged(); |
477 | - } |
478 | - emit sourceChanged(); |
479 | - } |
480 | -} |
481 | - |
482 | -void ApplicationImage::setFillMode(FillMode fillMode) { |
483 | - DLOG("ApplicationImage::setApplication (this=%p, fillMode=%d)", this, fillMode); |
484 | - if (fillMode_ != fillMode) { |
485 | - fillMode_ = fillMode; |
486 | - update(); |
487 | - emit fillModeChanged(); |
488 | - } |
489 | -} |
490 | - |
491 | -void ApplicationImage::scheduleUpdate() { |
492 | - DLOG("ApplicationImage::scheduleUpdate (this=%p)", this); |
493 | - if (ready_) { |
494 | - ready_ = false; |
495 | - emit readyChanged(); |
496 | - } |
497 | - if (source_ != NULL && source_->state() == Application::Running) |
498 | - ubuntu_ui_session_snapshot_running_session_with_id(source_->pid(), snapshotCallback, this); |
499 | - else { |
500 | - update(); |
501 | - } |
502 | -} |
503 | - |
504 | -void ApplicationImage::updateFromCache() { |
505 | - DLOG("ApplicationImage::updateFromCache (this=%p)", this); |
506 | - if (imageCache_.contains(source_)) { |
507 | - DLOG("ApplicationImage: using image from cache (this=%p)", this); |
508 | - QPair<QImage, QRect> value = imageCache_.value(source_); |
509 | - if (image_ != value.first || sourceRect_ != value.second) { |
510 | - image_ = value.first; |
511 | - sourceRect_ = value.second; |
512 | - update(); |
513 | - } |
514 | - if (!ready_) { |
515 | - ready_ = true; |
516 | - emit readyChanged(); |
517 | - } |
518 | - } |
519 | -} |
520 | - |
521 | - |
522 | -void ApplicationImage::paint(QPainter* painter) { |
523 | - DLOG("ApplicationImage::paint (this=%p, painter=%p)", this, painter); |
524 | - if (source_ != NULL && !image_.isNull() && sourceRect_.isValid() |
525 | - && source_->state() == Application::Running) { |
526 | - painter->setCompositionMode(QPainter::CompositionMode_Source); |
527 | - |
528 | - QRect targetRect; |
529 | - QRect sourceRect; |
530 | - |
531 | - switch(fillMode_) { |
532 | - case Stretch: |
533 | - targetRect = QRect(0, 0, width(), height()); |
534 | - sourceRect = sourceRect_; |
535 | - break; |
536 | - case PreserveAspectCrop: |
537 | - // assume AlignTop and AlignLeft alignment |
538 | - targetRect = QRect(0, 0, width(), height()); |
539 | - float widthScale = width() / float(sourceRect_.width()); |
540 | - float heightScale = height() / float(sourceRect_.height()); |
541 | - |
542 | - if (widthScale > heightScale) { |
543 | - int croppedHeight = height() / widthScale; |
544 | - sourceRect = QRect(sourceRect_.x(), sourceRect_.y(), sourceRect_.width(), croppedHeight); |
545 | - } else { |
546 | - int croppedWidth = width() / heightScale; |
547 | - sourceRect = QRect(sourceRect_.x(), sourceRect_.y(), croppedWidth, sourceRect_.height()); |
548 | - } |
549 | - break; |
550 | - } |
551 | - |
552 | - painter->drawImage(targetRect, image_, sourceRect); |
553 | - } |
554 | -} |
555 | - |
556 | -void ApplicationImage::onSourceDestroyed() { |
557 | - DLOG("ApplicationImage::onSourceDestroyed (this=%p)", this); |
558 | - if (imageCache_.remove(source_) != 0) { |
559 | - DLOG("ApplicationImage: removed image from cache (this=%p)", this); |
560 | - } |
561 | - image_ = QImage(); |
562 | - sourceRect_ = QRect(); |
563 | - if (ready_) { |
564 | - ready_ = false; |
565 | - emit readyChanged(); |
566 | - } |
567 | - if (source_ != NULL) { |
568 | - source_ = NULL; |
569 | - emit sourceChanged(); |
570 | - } |
571 | -} |
572 | |
573 | === removed file 'src/modules/application/application_image.h' |
574 | --- src/modules/application/application_image.h 2013-02-26 01:03:00 +0000 |
575 | +++ src/modules/application/application_image.h 1970-01-01 00:00:00 +0000 |
576 | @@ -1,71 +0,0 @@ |
577 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
578 | -// Copyright © 2013 Canonical Ltd. |
579 | -// |
580 | -// This program is free software: you can redistribute it and/or modify it under |
581 | -// the terms of the GNU Lesser General Public License version 3, as published by |
582 | -// the Free Software Foundation. |
583 | -// |
584 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
585 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
586 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
587 | -// Lesser General Public License for more details. |
588 | -// |
589 | -// You should have received a copy of the GNU Lesser General Public License |
590 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
591 | - |
592 | -#ifndef APPLICATION_IMAGE_H |
593 | -#define APPLICATION_IMAGE_H |
594 | - |
595 | -#include <QtQuick/QQuickPaintedItem> |
596 | -#include <QtGui/QImage> |
597 | - |
598 | -class Application; |
599 | - |
600 | -class ApplicationImage : public QQuickPaintedItem { |
601 | - Q_OBJECT |
602 | - Q_ENUMS(FillMode) |
603 | - Q_PROPERTY(Application* source READ source WRITE setSource NOTIFY sourceChanged) |
604 | - Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) |
605 | - Q_PROPERTY(bool ready READ ready NOTIFY readyChanged) |
606 | - |
607 | - public: |
608 | - explicit ApplicationImage(QQuickPaintedItem* parent = 0); |
609 | - ~ApplicationImage(); |
610 | - |
611 | - enum FillMode { Stretch, PreserveAspectCrop }; |
612 | - |
613 | - // QObject methods. |
614 | - void customEvent(QEvent* event); |
615 | - |
616 | - // QQuickPaintedItem methods. |
617 | - void paint(QPainter* painter); |
618 | - |
619 | - // ApplicationImage methods. |
620 | - Application* source() const { return source_; } |
621 | - void setSource(Application* source); |
622 | - FillMode fillMode() const { return fillMode_; } |
623 | - void setFillMode(FillMode); |
624 | - bool ready() const { return ready_; } |
625 | - Q_INVOKABLE void scheduleUpdate(); |
626 | - Q_INVOKABLE void updateFromCache(); |
627 | - |
628 | - Q_SIGNALS: |
629 | - void sourceChanged(); |
630 | - void fillModeChanged(); |
631 | - void readyChanged(); |
632 | - |
633 | - private Q_SLOTS: |
634 | - void onSourceDestroyed(); |
635 | - |
636 | - private: |
637 | - QImage image_; |
638 | - Application* source_; |
639 | - FillMode fillMode_; |
640 | - bool ready_; |
641 | - QRect sourceRect_; |
642 | - // cache of application screenshots keeping pairs of image and source rectangle |
643 | - // for applications that are alive |
644 | - static QHash<Application*, QPair<QImage, QRect> > imageCache_; |
645 | -}; |
646 | - |
647 | -#endif // APPLICATION_IMAGE_H |
648 | |
649 | === removed file 'src/modules/application/application_manager.cc' |
650 | --- src/modules/application/application_manager.cc 2013-09-05 19:01:56 +0000 |
651 | +++ src/modules/application/application_manager.cc 1970-01-01 00:00:00 +0000 |
652 | @@ -1,612 +0,0 @@ |
653 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
654 | -// Copyright © 2013 Canonical Ltd. |
655 | -// |
656 | -// This program is free software: you can redistribute it and/or modify it under |
657 | -// the terms of the GNU Lesser General Public License version 3, as published by |
658 | -// the Free Software Foundation. |
659 | -// |
660 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
661 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
662 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
663 | -// Lesser General Public License for more details. |
664 | -// |
665 | -// You should have received a copy of the GNU Lesser General Public License |
666 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
667 | - |
668 | -// FIXME(loicm) Desktop file loading should be executed on a dedicated I/O thread. |
669 | - |
670 | -#include "application_manager.h" |
671 | -#include "application.h" |
672 | -#include "desktopdata.h" |
673 | -#include "logging.h" |
674 | -#include <sys/types.h> |
675 | -#include <signal.h> |
676 | -#include <unistd.h> |
677 | -#include <errno.h> |
678 | -#include <pwd.h> |
679 | - |
680 | -#include <QRegularExpression> |
681 | - |
682 | -using namespace unity::shell::application; |
683 | - |
684 | -// Size of the side stage in grid units. |
685 | -const int kSideStageWidth = 40; |
686 | - |
687 | -// The time (in ms) to wait before closing a process that's not been matched by a new session. |
688 | -const int kTimeBeforeClosingProcess = 10000; |
689 | - |
690 | -class TaskEvent : public QEvent { |
691 | - public: |
692 | - enum Task { kAddApplication = 0, kRemoveApplication, kUnfocusApplication, kFocusApplication, |
693 | - kRequestFocus, kRequestFullscreen }; |
694 | - TaskEvent(QString appId, int id, int stage, int task, QEvent::Type type) |
695 | - : QEvent(type) |
696 | - , appId_(appId) |
697 | - , id_(id) |
698 | - , stage_(stage) |
699 | - , task_(task) { |
700 | - DLOG("TaskEvent::TaskEvent (this=%p, appId='%s', id=%d, stage=%d, task=%d, type=%d)", |
701 | - this, qPrintable(appId), id, stage, task, type); |
702 | - } |
703 | - ~TaskEvent() { |
704 | - DLOG("TaskEvent::~TaskEvent"); |
705 | - } |
706 | - QString appId_; |
707 | - int id_; |
708 | - int stage_; |
709 | - int task_; |
710 | -}; |
711 | - |
712 | -// FIXME(kaleo, loicm): If we keep that keyboard geometry/visibilty API, we should integrate that |
713 | -// event type in the existing task event system. |
714 | -class KeyboardGeometryEvent : public QEvent { |
715 | - public: |
716 | - KeyboardGeometryEvent(QRect geometry, QEvent::Type type) |
717 | - : QEvent(type) |
718 | - , geometry_(geometry) { |
719 | - DLOG("KeyboardGeometryEvent::KeyboardGeometryEvent (this=%p, type=%d)", this, type); |
720 | - } |
721 | - ~KeyboardGeometryEvent() { |
722 | - DLOG("KeyboardGeometryEvent::~KeyboardGeometryEvent"); |
723 | - } |
724 | - |
725 | - QRect geometry_; |
726 | -}; |
727 | - |
728 | -static void continueTask(int pid, void* context) |
729 | -{ |
730 | - DLOG("continueTask(pid=%d, context=%p)", pid, context); |
731 | - Q_UNUSED(context) |
732 | - kill(pid, SIGCONT); |
733 | -} |
734 | - |
735 | -static void suspendTask(int pid, void* context) |
736 | -{ |
737 | - DLOG("suspendTask(pid=%d, context=%p)", pid, context); |
738 | - Q_UNUSED(context) |
739 | - kill(pid, SIGSTOP); |
740 | -} |
741 | - |
742 | -static void sessionBornCallback(ubuntu_ui_session_properties session, void* context) { |
743 | - DLOG("sessionBornCallback (session=%p, context=%p)", session, context); |
744 | - DASSERT(context != NULL); |
745 | - // Post a task to be executed on the ApplicationManager thread (GUI thread). |
746 | - ApplicationManager* manager = static_cast<ApplicationManager*>(context); |
747 | - |
748 | - // Determine appId from the absolute path to the desktop file of the application |
749 | - QString appId = QString(ubuntu_ui_session_properties_get_desktop_file_hint(session)) |
750 | - .split(QLatin1String("/")) |
751 | - .last() |
752 | - .remove(QRegularExpression("\\.desktop$")); |
753 | - |
754 | - QCoreApplication::postEvent(manager, new TaskEvent( |
755 | - appId, |
756 | - ubuntu_ui_session_properties_get_application_instance_id(session), |
757 | - ubuntu_ui_session_properties_get_application_stage_hint(session), |
758 | - TaskEvent::kAddApplication, manager->eventType())); |
759 | -} |
760 | - |
761 | -static void sessionDiedCallback(ubuntu_ui_session_properties session, void* context) { |
762 | - DLOG("sessionDiedCallback (session=%p, context=%p)", session, context); |
763 | - DASSERT(context != NULL); |
764 | - // Post a task to be executed on the ApplicationManager thread (GUI thread). |
765 | - ApplicationManager* manager = static_cast<ApplicationManager*>(context); |
766 | - QCoreApplication::postEvent(manager, new TaskEvent( |
767 | - QString(), ubuntu_ui_session_properties_get_application_instance_id(session), |
768 | - ubuntu_ui_session_properties_get_application_stage_hint(session), |
769 | - TaskEvent::kRemoveApplication, manager->eventType())); |
770 | -} |
771 | - |
772 | -static void sessionUnfocusedCallback(ubuntu_ui_session_properties session, void* context) { |
773 | - DLOG("sessionUnfocusedCallback (session=%p, context=%p)", session, context); |
774 | - DASSERT(context != NULL); |
775 | - // Post a task to be executed on the ApplicationManager thread (GUI thread). |
776 | - ApplicationManager* manager = static_cast<ApplicationManager*>(context); |
777 | - QCoreApplication::postEvent(manager, new TaskEvent( |
778 | - QString(), ubuntu_ui_session_properties_get_application_instance_id(session), |
779 | - ubuntu_ui_session_properties_get_application_stage_hint(session), |
780 | - TaskEvent::kUnfocusApplication, manager->eventType())); |
781 | -} |
782 | - |
783 | -static void sessionFocusedCallback(ubuntu_ui_session_properties session, void* context) { |
784 | - DLOG("sessionFocusedCallback (session=%p, context=%p)", session, context); |
785 | - DASSERT(context != NULL); |
786 | - // Post a task to be executed on the ApplicationManager thread (GUI thread). |
787 | - ApplicationManager* manager = static_cast<ApplicationManager*>(context); |
788 | - QCoreApplication::postEvent(manager, new TaskEvent( |
789 | - QString(), ubuntu_ui_session_properties_get_application_instance_id(session), |
790 | - ubuntu_ui_session_properties_get_application_stage_hint(session), |
791 | - TaskEvent::kFocusApplication, manager->eventType())); |
792 | -} |
793 | - |
794 | -static void sessionRequestedFullscreenCallback( |
795 | - ubuntu_ui_session_properties session, void* context) { |
796 | - DLOG("sessionRequestedFullscreenCallback (session=%p, context=%p)", session, context); |
797 | - DASSERT(context != NULL); |
798 | - // Post a task to be executed on the ApplicationManager thread (GUI thread). |
799 | - ApplicationManager* manager = static_cast<ApplicationManager*>(context); |
800 | - QCoreApplication::postEvent(manager, new TaskEvent( |
801 | - QString(), ubuntu_ui_session_properties_get_application_instance_id(session), 0, |
802 | - TaskEvent::kRequestFullscreen, manager->eventType())); |
803 | -} |
804 | - |
805 | -static void sessionRequestedCallback(ubuntu_ui_well_known_application application, void* context) { |
806 | - DLOG("sessionRequestedCallback (application=%d, context=%p)", application, context); |
807 | - DASSERT(context != NULL); |
808 | - // Post a task to be executed on the ApplicationManager thread (GUI thread). |
809 | - ApplicationManager* manager = static_cast<ApplicationManager*>(context); |
810 | - QCoreApplication::postEvent(manager, new TaskEvent( |
811 | - QString(), static_cast<int>(application), 0, TaskEvent::kRequestFocus, manager->eventType())); |
812 | -} |
813 | - |
814 | -static void keyboardGeometryChanged(int x, int y, int width, int height, void* context) { |
815 | - DLOG("keyboardGeometryChanged (x=%d, y=%d, width=%d, height=%d, context=%p)", x, y, width, height, context); |
816 | - DASSERT(context != NULL); |
817 | - // Post a task to be executed on the ApplicationManager thread (GUI thread). |
818 | - ApplicationManager* manager = static_cast<ApplicationManager*>(context); |
819 | - QCoreApplication::postEvent(manager, |
820 | - new KeyboardGeometryEvent(QRect(x, y, width, height), |
821 | - manager->keyboardGeometryEventType())); |
822 | -} |
823 | - |
824 | -ApplicationManager::ApplicationManager(QObject* parent) |
825 | - : ApplicationManagerInterface(parent) |
826 | - , keyboardHeight_(0) |
827 | - , keyboardVisible_(false) |
828 | - , pidHash_() |
829 | - , eventType_(static_cast<QEvent::Type>(QEvent::registerEventType())) |
830 | - , keyboardGeometryEventType_(static_cast<QEvent::Type>(QEvent::registerEventType())) { |
831 | - static int once = false; |
832 | - if (!once) { |
833 | - DLOG("starting application watcher"); |
834 | - static ubuntu_ui_session_lifecycle_observer watcher = { |
835 | - sessionRequestedCallback, sessionBornCallback, sessionUnfocusedCallback, |
836 | - sessionFocusedCallback, keyboardGeometryChanged, sessionRequestedFullscreenCallback, |
837 | - sessionDiedCallback, this |
838 | - }; |
839 | - ubuntu_ui_session_install_session_lifecycle_observer(&watcher); |
840 | - |
841 | - static ubuntu_ui_task_controller controller = { |
842 | - continueTask, suspendTask, this |
843 | - }; |
844 | - ubuntu_ui_install_task_controller(&controller); |
845 | - |
846 | - once = true; |
847 | - } |
848 | - DLOG("ApplicationManager::ApplicationManager (this=%p)", this); |
849 | -} |
850 | - |
851 | -ApplicationManager::~ApplicationManager() { |
852 | - DLOG("ApplicationManager::~ApplicationManager"); |
853 | - pidHash_.clear(); |
854 | - for (auto app : applications_) { |
855 | - delete app; |
856 | - } |
857 | - applications_.clear(); |
858 | -} |
859 | - |
860 | -int ApplicationManager::rowCount(const QModelIndex& parent) const { |
861 | - DLOG("ApplicationManager::rowCount (this=%p)", this); |
862 | - return !parent.isValid() ? applications_.size() : 0; |
863 | -} |
864 | - |
865 | -QVariant ApplicationManager::data(const QModelIndex& index, int role) const { |
866 | - DLOG("ApplicationManager::data (this=%p, role=%d)", this, role); |
867 | - if (index.row() < 0 || index.row() >= applications_.size()) |
868 | - return QVariant(); |
869 | - |
870 | - auto app = applications_.at(index.row()); |
871 | - switch(role) { |
872 | - case RoleAppId: |
873 | - return app->appId(); |
874 | - case RoleName: |
875 | - return app->name(); |
876 | - case RoleComment: |
877 | - return app->comment(); |
878 | - case RoleIcon: |
879 | - return app->icon(); |
880 | - case RoleStage: |
881 | - return app->stage(); |
882 | - case RoleState: |
883 | - return app->state(); |
884 | - case RoleFocused: |
885 | - return app->focused(); |
886 | - default: |
887 | - return QVariant(); |
888 | - } |
889 | -} |
890 | - |
891 | -Application *ApplicationManager::get(int row) const { |
892 | - DLOG("ApplicationManager::get (this=%p, row=%d)", this, row); |
893 | - if (row < 0 || row >= applications_.size()) |
894 | - return nullptr; |
895 | - |
896 | - return applications_.at(row); |
897 | -} |
898 | - |
899 | -Application *ApplicationManager::findApplication(const QString &appId) const { |
900 | - DLOG("ApplicationManager::findApplication (this=%p, appId=%s)", this, qPrintable(appId)); |
901 | - for (Application *app : applications_) { |
902 | - if (app->appId() == appId) { |
903 | - return app; |
904 | - } |
905 | - } |
906 | - return nullptr; |
907 | -} |
908 | - |
909 | -void ApplicationManager::move(int from, int to) { |
910 | - DLOG("ApplicationManager::move (this=%p, from=%d, to=%d)", this, from, to); |
911 | - if (from == to) return; |
912 | - |
913 | - if (from >= 0 && from < applications_.size() && to >= 0 && to < applications_.size()) { |
914 | - QModelIndex parent; |
915 | - /* When moving an item down, the destination index needs to be incremented |
916 | - by one, as explained in the documentation: |
917 | - http://qt-project.org/doc/qt-5.0/qtcore/qabstractitemmodel.html#beginMoveRows */ |
918 | - beginMoveRows(parent, from, from, parent, to + (to > from ? 1 : 0)); |
919 | - applications_.move(from, to); |
920 | - endMoveRows(); |
921 | - } |
922 | -} |
923 | - |
924 | -void ApplicationManager::killProcess(qint64 pid) { |
925 | - DLOG("ApplicationManager::kill (this=%p, pid=%lld)", this, pid); |
926 | -#if !defined(QT_NO_DEBUG) |
927 | - int result = kill(static_cast<pid_t>(pid), SIGKILL); |
928 | - if (result != -1) { |
929 | - LOG("killed process with pid %lld", pid); |
930 | - } else { |
931 | - LOG("couldn't kill process with pid %lld: %s", pid, strerror(errno)); |
932 | - } |
933 | -#else |
934 | - kill(static_cast<pid_t>(pid), SIGKILL); |
935 | -#endif |
936 | -} |
937 | - |
938 | -void ApplicationManager::customEvent(QEvent* event) { |
939 | - DLOG("ApplicationManager::customEvent (this=%p, event=%p)", this, event); |
940 | - DASSERT(QThread::currentThread() == thread()); |
941 | - |
942 | - // FIXME(kaleo, loicm) If we keep that keyboard geometry/visibilty API, we should integrate that |
943 | - // event type in the existing task event system. Moreover, Qt code shouldn't use C++ RTTI |
944 | - // (which is slow) but the Qt meta object implementation. |
945 | - KeyboardGeometryEvent* keyboardGeometryEvent = dynamic_cast<KeyboardGeometryEvent*>(event); |
946 | - if (keyboardGeometryEvent != NULL) { |
947 | - bool visible = keyboardGeometryEvent->geometry_.isValid(); |
948 | - int height = keyboardGeometryEvent->geometry_.height(); |
949 | - if (height != keyboardHeight_) { |
950 | - keyboardHeight_ = height; |
951 | - emit keyboardHeightChanged(); |
952 | - } |
953 | - if (visible != keyboardVisible_) { |
954 | - keyboardVisible_ = visible; |
955 | - emit keyboardVisibleChanged(); |
956 | - } |
957 | - return; |
958 | - } |
959 | - |
960 | - TaskEvent* taskEvent = static_cast<TaskEvent*>(event); |
961 | - switch (taskEvent->task_) { |
962 | - |
963 | - case TaskEvent::kAddApplication: { |
964 | - DLOG("handling add application task"); |
965 | - const int kPid = taskEvent->id_; |
966 | - Application* application = pidHash_.value(kPid, NULL); |
967 | - if (application) { |
968 | - DLOG("got a match in the application lists, setting '%s' (%d) to running", qPrintable(application->name()), kPid); |
969 | -#if !defined(QT_NO_DEBUG) |
970 | - // Ensure we're in sync with Ubuntu Platform. |
971 | - ASSERT(applications_.contains(application)); |
972 | -#endif |
973 | - application->setState(Application::Running); |
974 | - killTimer(application->timerId()); |
975 | - } else { |
976 | - DLOG("didn't get a match in the application lists, loading the desktop file"); |
977 | - DesktopData* desktopData = new DesktopData(taskEvent->appId_); |
978 | - if (desktopData->loaded()) { |
979 | - Application* application = new Application( |
980 | - desktopData, kPid, Application::MainStage, Application::Running, -1); |
981 | - pidHash_.insert(kPid, application); |
982 | - DLOG("desktopFile loaded, storing '%s' (%d) in the application list", qPrintable(desktopData->name()), kPid); |
983 | - add(application); |
984 | - } else { |
985 | - DLOG("unknown application, not storing in the application lists"); |
986 | - delete desktopData; |
987 | - } |
988 | - } |
989 | - break; |
990 | - } |
991 | - |
992 | - case TaskEvent::kRemoveApplication: { |
993 | - DLOG("handling remove application task"); |
994 | - const int kPid = taskEvent->id_; |
995 | - Application* application = pidHash_.take(kPid); |
996 | - if (application != NULL) { |
997 | - DLOG("removing application '%s' (%d) from the application lists", qPrintable(application->name()), kPid); |
998 | - if (application->state() == Application::Starting) { |
999 | - killTimer(application->timerId()); |
1000 | - } |
1001 | - |
1002 | - remove(application); |
1003 | - if (application->focused()) { |
1004 | - emit focusedApplicationIdChanged(); |
1005 | - } |
1006 | - application->deleteLater(); |
1007 | - } else { |
1008 | - DLOG("Unknown application, not stored in the application lists"); |
1009 | - } |
1010 | - break; |
1011 | - } |
1012 | - |
1013 | - case TaskEvent::kUnfocusApplication: { |
1014 | - DLOG("handling unfocus application task"); |
1015 | - // Reset the currently focused application. |
1016 | - Application* application = pidHash_.value(taskEvent->id_); |
1017 | - if (application != NULL) { |
1018 | - application->setFocused(false); |
1019 | - emit focusedApplicationIdChanged(); |
1020 | - } |
1021 | - break; |
1022 | - } |
1023 | - |
1024 | - case TaskEvent::kFocusApplication: { |
1025 | - DLOG("handling focus application task"); |
1026 | - // Update the currently focused application. |
1027 | - Application* application = pidHash_.value(taskEvent->id_); |
1028 | - if (application != NULL) { |
1029 | - application->setFocused(true); |
1030 | - //move application to top of applications_ list |
1031 | - int index = applications_.indexOf(application); |
1032 | - this->move(index, 0); |
1033 | - emit focusedApplicationIdChanged(); |
1034 | - } |
1035 | - break; |
1036 | - } |
1037 | - |
1038 | - case TaskEvent::kRequestFullscreen: { |
1039 | - DLOG("handling request fullscreen task"); |
1040 | - Application* application = pidHash_.value(taskEvent->id_); |
1041 | - if (application != NULL) { |
1042 | - application->setFullscreen(true); |
1043 | - } |
1044 | - break; |
1045 | - } |
1046 | - |
1047 | - case TaskEvent::kRequestFocus: { |
1048 | - DLOG("handling request focus task"); |
1049 | - emit focusRequested(static_cast<FavoriteApplication>(taskEvent->id_)); |
1050 | - break; |
1051 | - } |
1052 | - |
1053 | - default: { |
1054 | - DNOT_REACHED(); |
1055 | - break; |
1056 | - } |
1057 | - } |
1058 | -} |
1059 | - |
1060 | -void ApplicationManager::timerEvent(QTimerEvent* event) { |
1061 | - DLOG("ApplicationManager::timerEvent (this=%p, event=%p)", this, event); |
1062 | - |
1063 | - const int kTimerId = event->timerId(); |
1064 | - Application* application = findFromTimerId(kTimerId); |
1065 | - |
1066 | - // Remove application from list and kill it. |
1067 | - if (application != NULL) { |
1068 | - const qint64 kPid = application->pid(); |
1069 | - DLOG("application '%s' (%lld) hasn't been matched, killing it", qPrintable(application->name()), kPid); |
1070 | - DASSERT(pidHash_.contains(kPid)); |
1071 | - pidHash_.remove(kPid); |
1072 | - remove(application); |
1073 | - delete application; |
1074 | - killProcess(kPid); |
1075 | - } |
1076 | - killTimer(kTimerId); |
1077 | -} |
1078 | - |
1079 | -int ApplicationManager::keyboardHeight() const { |
1080 | - DLOG("ApplicationManager::keyboardHeight (this=%p)", this); |
1081 | - return keyboardHeight_; |
1082 | -} |
1083 | - |
1084 | -bool ApplicationManager::keyboardVisible() const { |
1085 | - DLOG("ApplicationManager::keyboardVisible (this=%p)", this); |
1086 | - return keyboardVisible_; |
1087 | -} |
1088 | - |
1089 | -int ApplicationManager::sideStageWidth() const { |
1090 | - DLOG("ApplicationManager::sideStageWidth (this=%p)", this); |
1091 | - return kSideStageWidth; |
1092 | -} |
1093 | - |
1094 | -bool ApplicationManager::focusApplication(const QString &appId) { |
1095 | - Application *application = this->findApplication(appId); |
1096 | - if (application == nullptr) |
1097 | - return false; |
1098 | - |
1099 | - DLOG("ApplicationManager::focusApplication (this=%p, app_pid=%lld)", this, application->pid()); |
1100 | - ubuntu_ui_session_focus_running_session_with_id(application->pid()); |
1101 | - return true; |
1102 | -} |
1103 | - |
1104 | -void ApplicationManager::focusFavoriteApplication( |
1105 | - ApplicationManager::FavoriteApplication application) { |
1106 | - DLOG("ApplicationManager::focusFavoriteApplication (this=%p, application=%d)", |
1107 | - this, static_cast<int>(application)); |
1108 | - ubuntu_ui_session_trigger_switch_to_well_known_application( |
1109 | - static_cast<ubuntu_ui_well_known_application>(application)); |
1110 | -} |
1111 | - |
1112 | -void ApplicationManager::unfocusCurrentApplication() { |
1113 | - DLOG("ApplicationManager::unfocusCurrentApplication (this=%p)", this); |
1114 | - // FIXME(loicm): Add that once supported in Ubuntu Platform API. |
1115 | - // ubuntu_ui_session_unfocus_running_sessions(static_cast<StageHint>(stageHint)); |
1116 | - ubuntu_ui_session_unfocus_running_sessions(); |
1117 | -} |
1118 | - |
1119 | -QString ApplicationManager::focusedApplicationId() const { |
1120 | - for (Application *app : applications_) { |
1121 | - if (app->focused()) |
1122 | - return app->appId(); |
1123 | - } |
1124 | - return QString(); |
1125 | -} |
1126 | - |
1127 | -Application *ApplicationManager::startApplication(const QString &appId, const QStringList &arguments) { |
1128 | - return startApplication(appId, NoFlag, arguments); |
1129 | -} |
1130 | - |
1131 | -Application *ApplicationManager::startApplication(const QString &appId, ApplicationManager::ExecFlags flags, |
1132 | - const QStringList &arguments) { |
1133 | - DLOG("ApplicationManager::startProcess (this=%p, flags=%d)", this, (int) flags); |
1134 | - // Load desktop file. |
1135 | - DesktopData* desktopData = new DesktopData(appId); |
1136 | - if (!desktopData->loaded()) { |
1137 | - delete desktopData; |
1138 | - return NULL; |
1139 | - } |
1140 | - |
1141 | - QStringList argumentsCopy = arguments; |
1142 | - |
1143 | - // Format arguments. |
1144 | - // FIXME(loicm) Special field codes are simply ignored for now. |
1145 | - // http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html |
1146 | - QStringList execArguments = desktopData->exec().split(" ", QString::SkipEmptyParts); |
1147 | - DASSERT(execArguments.size() > 0); |
1148 | - QString exec(execArguments[0]); |
1149 | - const int kSize = execArguments.size(); |
1150 | - for (int i = kSize - 1; i > 0; i--) { |
1151 | - if ((execArguments[i].size() == 2) && (execArguments[i][0].toLatin1() == '%')) { |
1152 | - const char kChar = execArguments[i][1].toLatin1(); |
1153 | - if (kChar == 'F' || kChar == 'u' || kChar == 'U' || kChar == 'd' || kChar == 'D' |
1154 | - || kChar == 'n' || kChar == 'N' || kChar == 'i' || kChar == 'c' || kChar == 'k' |
1155 | - || kChar == 'v' || kChar == 'm') { |
1156 | - continue; |
1157 | - } |
1158 | - } |
1159 | - argumentsCopy.prepend(execArguments[i]); |
1160 | - } |
1161 | - argumentsCopy.append(QString("--desktop_file_hint=") + desktopData->file()); |
1162 | - if (flags.testFlag(ApplicationManager::ForceMainStage)) |
1163 | - argumentsCopy.append(QString("--stage_hint=main_stage")); |
1164 | - else if (desktopData->stageHint() == "SideStage") |
1165 | - argumentsCopy.append(QString("--stage_hint=side_stage")); |
1166 | - |
1167 | -#if !defined(QT_NO_DEBUG) |
1168 | - LOG("starting process '%s' with arguments:", qPrintable(exec)); |
1169 | - for (int i = 0; i < argumentsCopy.size(); i++) |
1170 | - LOG(" '%s'", qPrintable(argumentsCopy[i])); |
1171 | -#endif |
1172 | - |
1173 | - // Start process. |
1174 | - bool result; |
1175 | - qint64 pid = 0; |
1176 | - QString path = "/"; |
1177 | - // respect Path from .desktop file |
1178 | - if (desktopData->path() != "") { |
1179 | - path = desktopData->path(); |
1180 | - } else { |
1181 | - struct passwd* passwd = getpwuid(getuid()); |
1182 | - if (passwd) |
1183 | - path = passwd->pw_dir; |
1184 | - } |
1185 | - DLOG("current working directory: '%s'", qPrintable(path)); |
1186 | - QByteArray envSetAppId = QString("APP_ID=%1").arg(appId).toLocal8Bit(); |
1187 | - putenv(envSetAppId.data()); // envSetAppId must be available and unmodified until the env var is unset |
1188 | - result = QProcess::startDetached(exec, argumentsCopy, path, &pid); |
1189 | - QByteArray envClearAppId = QString("APP_ID").toLocal8Bit(); |
1190 | - putenv(envClearAppId.data()); // now it's safe to deallocate envSetAppId. |
1191 | - DLOG_IF(result == false, "process failed to start"); |
1192 | - if (result == true) { |
1193 | - DLOG("started process with pid %lld, adding '%s' to application lists", pid, qPrintable(desktopData->name())); |
1194 | - |
1195 | - //decide stage |
1196 | - Application::Stage stage = Application::MainStage; |
1197 | - if (desktopData->stageHint() == "SideStage" && !flags.testFlag(ApplicationManager::ForceMainStage)) { |
1198 | - stage = Application::SideStage; |
1199 | - } |
1200 | - |
1201 | - Application* application = new Application( |
1202 | - desktopData, pid, stage, Application::Starting, |
1203 | - startTimer(kTimeBeforeClosingProcess)); |
1204 | - pidHash_.insert(pid, application); |
1205 | - |
1206 | - add(application); |
1207 | - return application; |
1208 | - } else { |
1209 | - return nullptr; |
1210 | - } |
1211 | -} |
1212 | - |
1213 | -bool ApplicationManager::stopApplication(const QString &appId) { |
1214 | - DLOG("ApplicationManager::stopProcess (this=%p, application=%p)", this, qPrintable(appId)); |
1215 | - |
1216 | - Application *application = this->findApplication(appId); |
1217 | - if (application == nullptr) |
1218 | - return false; |
1219 | - |
1220 | - const qint64 kPid = application->pid(); |
1221 | - if (pidHash_.remove(kPid) > 0) { |
1222 | - remove(application); |
1223 | - application->deleteLater(); |
1224 | - killProcess(kPid); |
1225 | - } |
1226 | - return true; |
1227 | -} |
1228 | - |
1229 | -void ApplicationManager::add(Application* application) { |
1230 | - DASSERT(application != NULL); |
1231 | - DLOG("ApplicationManager::add (this=%p, application='%s')", this, qPrintable(application->name())); |
1232 | - |
1233 | -#if !defined(QT_NO_DEBUG) |
1234 | - for (int i = 0; i < applications_.size(); i++) |
1235 | - ASSERT(applications_.at(i) != application); |
1236 | -#endif |
1237 | - beginInsertRows(QModelIndex(), applications_.size(), applications_.size()); |
1238 | - applications_.append(application); |
1239 | - endInsertRows(); |
1240 | - emit countChanged(); |
1241 | -} |
1242 | - |
1243 | -void ApplicationManager::remove(Application *application) { |
1244 | - DASSERT(application != NULL); |
1245 | - DLOG("ApplicationManager::remove (this=%p, application='%s')", this, qPrintable(application->name())); |
1246 | - |
1247 | - int i = applications_.indexOf(application); |
1248 | - if (i != -1) { |
1249 | - beginRemoveRows(QModelIndex(), i, i); |
1250 | - applications_.removeAt(i); |
1251 | - endRemoveRows(); |
1252 | - emit countChanged(); |
1253 | - } |
1254 | -} |
1255 | - |
1256 | -Application* ApplicationManager::findFromTimerId(int timerId) { |
1257 | - DLOG("ApplicationManager::findFromTimerId (this=%p, timerId=%d)", this, timerId); |
1258 | - |
1259 | - const int kSize = applications_.size(); |
1260 | - for (int i = 0; i < kSize; i++) |
1261 | - if (applications_[i]->timerId() == timerId) |
1262 | - return applications_[i]; |
1263 | - return NULL; |
1264 | -} |
1265 | |
1266 | === removed file 'src/modules/application/application_manager.h' |
1267 | --- src/modules/application/application_manager.h 2013-09-09 11:26:44 +0000 |
1268 | +++ src/modules/application/application_manager.h 1970-01-01 00:00:00 +0000 |
1269 | @@ -1,139 +0,0 @@ |
1270 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
1271 | -// Copyright © 2013 Canonical Ltd. |
1272 | -// |
1273 | -// This program is free software: you can redistribute it and/or modify it under |
1274 | -// the terms of the GNU Lesser General Public License version 3, as published by |
1275 | -// the Free Software Foundation. |
1276 | -// |
1277 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
1278 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1279 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1280 | -// Lesser General Public License for more details. |
1281 | -// |
1282 | -// You should have received a copy of the GNU Lesser General Public License |
1283 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
1284 | - |
1285 | -#ifndef APPLICATION_MANAGER_H |
1286 | -#define APPLICATION_MANAGER_H |
1287 | - |
1288 | -#include <QtCore/QtCore> |
1289 | -#include <ubuntu/application/ui/window.h> |
1290 | -#include <ubuntu/application/ui/options.h> |
1291 | -#include <ubuntu/application/ui/input/event.h> |
1292 | -#include <ubuntu/ui/ubuntu_ui_session_service.h> |
1293 | - |
1294 | -/* FIXME: undef required so that this class compiles properly. |
1295 | - '#define Bool int' is part of <X11/Xlib.h> which is included |
1296 | - by the following chain of includes: |
1297 | - - <EGL/eglplatform.h> included by |
1298 | - - <EGL/egl.h> included by |
1299 | - - <ubuntu/application/ui/window.h> |
1300 | -*/ |
1301 | -#undef Bool |
1302 | - |
1303 | -// unity-api |
1304 | -#include <unity/shell/application/ApplicationManagerInterface.h> |
1305 | - |
1306 | -// local |
1307 | -#include "application.h" |
1308 | - |
1309 | -class ApplicationManager : public unity::shell::application::ApplicationManagerInterface { |
1310 | - Q_OBJECT |
1311 | - Q_ENUMS(SurfaceRole) |
1312 | - Q_ENUMS(StageHint) |
1313 | - Q_ENUMS(FormFactorHint) |
1314 | - Q_ENUMS(FavoriteApplication) |
1315 | - Q_FLAGS(ExecFlags) |
1316 | - |
1317 | - // FIXME(kaleo, loicm): That keyboard API might need a cleaner design. |
1318 | - Q_PROPERTY(int keyboardHeight READ keyboardHeight NOTIFY keyboardHeightChanged) |
1319 | - Q_PROPERTY(bool keyboardVisible READ keyboardVisible NOTIFY keyboardVisibleChanged) |
1320 | - |
1321 | - Q_PROPERTY(int sideStageWidth READ sideStageWidth CONSTANT) |
1322 | - |
1323 | - public: |
1324 | - ApplicationManager(QObject *parent = nullptr); |
1325 | - ~ApplicationManager(); |
1326 | - |
1327 | - // Mapping enums to Ubuntu Platform API enums. |
1328 | - enum SurfaceRole { |
1329 | - Dash = U_DASH_ROLE, Default = U_MAIN_ROLE, Indicators = U_INDICATOR_ROLE, |
1330 | - Notifications = U_NOTIFICATIONS_ROLE, Greeter = U_GREETER_ROLE, |
1331 | - Launcher = U_LAUNCHER_ROLE, OnScreenKeyboard = U_ON_SCREEN_KEYBOARD_ROLE, |
1332 | - ShutdownDialog = U_SHUTDOWN_DIALOG_ROLE |
1333 | - }; |
1334 | - enum StageHint { |
1335 | - MainStage = U_MAIN_STAGE, IntegrationStage = U_INTEGRATION_STAGE, |
1336 | - ShareStage = U_SHARE_STAGE, ContentPickingStage = U_CONTENT_PICKING_STAGE, |
1337 | - SideStage = U_SIDE_STAGE, ConfigurationStage = U_CONFIGURATION_STAGE |
1338 | - }; |
1339 | - enum FormFactorHint { |
1340 | - DesktopFormFactor = U_DESKTOP, PhoneFormFactor = U_PHONE, |
1341 | - TabletFormFactor = U_TABLET |
1342 | - }; |
1343 | - enum FavoriteApplication { |
1344 | - CameraApplication = CAMERA_APP, GalleryApplication = GALLERY_APP, |
1345 | - BrowserApplication = BROWSER_APP, ShareApplication = SHARE_APP, |
1346 | - PhoneApplication = PHONE_APP, DialerApplication = DIALER_APP, |
1347 | - MessagingApplication = MESSAGING_APP, AddressbookApplication = ADDRESSBOOK_APP |
1348 | - }; |
1349 | - enum Flag { |
1350 | - NoFlag = 0x0, |
1351 | - ForceMainStage = 0x1, |
1352 | - }; |
1353 | - Q_DECLARE_FLAGS(ExecFlags, Flag) |
1354 | - |
1355 | - // QObject methods. |
1356 | - void customEvent(QEvent* event); |
1357 | - void timerEvent(QTimerEvent* event); |
1358 | - |
1359 | - int keyboardHeight() const; |
1360 | - bool keyboardVisible() const; |
1361 | - int sideStageWidth() const; |
1362 | - |
1363 | - // QAbstractItemModel methods. |
1364 | - int rowCount(const QModelIndex& parent = QModelIndex()) const override; |
1365 | - QVariant data(const QModelIndex& index, int role) const override; |
1366 | - Q_INVOKABLE Application *get(int index) const override; |
1367 | - Q_INVOKABLE Application *findApplication(const QString &appId) const override; |
1368 | - |
1369 | - Q_INVOKABLE void move(int from, int to); |
1370 | - |
1371 | - // Application control methods |
1372 | - Q_INVOKABLE bool focusApplication(const QString &appId) override; |
1373 | - Q_INVOKABLE void focusFavoriteApplication(FavoriteApplication application); |
1374 | - Q_INVOKABLE void unfocusCurrentApplication() override; |
1375 | - Q_INVOKABLE Application *startApplication(const QString &appId, const QStringList &arguments = QStringList()) override; |
1376 | - Q_INVOKABLE Application *startApplication(const QString &appId, ExecFlags flags, const QStringList &arguments = QStringList()); |
1377 | - Q_INVOKABLE bool stopApplication(const QString &appId) override; |
1378 | - |
1379 | - QString focusedApplicationId() const override; |
1380 | - |
1381 | - QEvent::Type eventType() { return eventType_; } |
1382 | - QEvent::Type keyboardGeometryEventType() { return keyboardGeometryEventType_; } |
1383 | - |
1384 | - Q_SIGNALS: |
1385 | - void keyboardHeightChanged(); |
1386 | - void keyboardVisibleChanged(); |
1387 | - void focusRequested(FavoriteApplication favoriteApplication); |
1388 | - |
1389 | - private: |
1390 | - void killProcess(qint64 pid); |
1391 | - |
1392 | - void add(Application *application); |
1393 | - void remove(Application* application); |
1394 | - Application* findFromTimerId(int timerId); |
1395 | - |
1396 | - int keyboardHeight_; |
1397 | - bool keyboardVisible_; |
1398 | - QList<Application*> applications_; |
1399 | - QHash<int,Application*> pidHash_; |
1400 | - QEvent::Type eventType_; |
1401 | - QEvent::Type keyboardGeometryEventType_; |
1402 | -}; |
1403 | - |
1404 | -Q_DECLARE_OPERATORS_FOR_FLAGS(ApplicationManager::ExecFlags) |
1405 | - |
1406 | -Q_DECLARE_METATYPE(ApplicationManager*) |
1407 | - |
1408 | -#endif // APPLICATION_MANAGER_H |
1409 | |
1410 | === removed file 'src/modules/application/application_window.cc' |
1411 | --- src/modules/application/application_window.cc 2013-02-14 16:31:33 +0000 |
1412 | +++ src/modules/application/application_window.cc 1970-01-01 00:00:00 +0000 |
1413 | @@ -1,45 +0,0 @@ |
1414 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
1415 | -// Copyright © 2013 Canonical Ltd. |
1416 | -// |
1417 | -// This program is free software: you can redistribute it and/or modify it under |
1418 | -// the terms of the GNU Lesser General Public License version 3, as published by |
1419 | -// the Free Software Foundation. |
1420 | -// |
1421 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
1422 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1423 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1424 | -// Lesser General Public License for more details. |
1425 | -// |
1426 | -// You should have received a copy of the GNU Lesser General Public License |
1427 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
1428 | - |
1429 | -#include "application_window.h" |
1430 | -#include "application_manager.h" |
1431 | -#include "logging.h" |
1432 | - |
1433 | -ApplicationWindow::ApplicationWindow(QObject* parent) |
1434 | - : QObject(parent) |
1435 | - , role_(static_cast<int>(ApplicationManager::Default)) |
1436 | - , opaque_(0) { |
1437 | - DLOG("ApplicationWindow::ApplicationWindow (this=%p)", this); |
1438 | -} |
1439 | - |
1440 | -ApplicationWindow::~ApplicationWindow() { |
1441 | - DLOG("ApplicationWindow::~ApplicationWindow"); |
1442 | -} |
1443 | - |
1444 | -void ApplicationWindow::setRole(int role) { |
1445 | - DLOG("ApplicationWindow::setRole (this=%p, role=%d)", this, role); |
1446 | - if (role_ != role) { |
1447 | - role_ = role; |
1448 | - emit roleChanged(); |
1449 | - } |
1450 | -} |
1451 | - |
1452 | -void ApplicationWindow::setOpaque(bool opaque) { |
1453 | - DLOG("ApplicationWindow::setOpaque (this=%p, opaque=%d)", this, static_cast<int>(opaque)); |
1454 | - if (opaque_ != static_cast<int>(opaque)) { |
1455 | - opaque_ = static_cast<int>(opaque); |
1456 | - emit opaqueChanged(); |
1457 | - } |
1458 | -} |
1459 | |
1460 | === removed file 'src/modules/application/application_window.h' |
1461 | --- src/modules/application/application_window.h 2013-02-14 16:31:33 +0000 |
1462 | +++ src/modules/application/application_window.h 1970-01-01 00:00:00 +0000 |
1463 | @@ -1,44 +0,0 @@ |
1464 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
1465 | -// Copyright © 2013 Canonical Ltd. |
1466 | -// |
1467 | -// This program is free software: you can redistribute it and/or modify it under |
1468 | -// the terms of the GNU Lesser General Public License version 3, as published by |
1469 | -// the Free Software Foundation. |
1470 | -// |
1471 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
1472 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1473 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1474 | -// Lesser General Public License for more details. |
1475 | -// |
1476 | -// You should have received a copy of the GNU Lesser General Public License |
1477 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
1478 | - |
1479 | -#ifndef APPLICATION_WINDOW_H |
1480 | -#define APPLICATION_WINDOW_H |
1481 | - |
1482 | -#include <QtCore/QtCore> |
1483 | - |
1484 | -class ApplicationWindow : public QObject { |
1485 | - Q_OBJECT |
1486 | - Q_PROPERTY(int role READ role WRITE setRole NOTIFY roleChanged) |
1487 | - Q_PROPERTY(int opaque READ opaque WRITE setOpaque NOTIFY opaqueChanged) |
1488 | - |
1489 | - public: |
1490 | - explicit ApplicationWindow(QObject* parent); |
1491 | - ~ApplicationWindow(); |
1492 | - |
1493 | - int role() const { return role_; } |
1494 | - void setRole(int role); |
1495 | - bool opaque() const { return static_cast<bool>(opaque_); } |
1496 | - void setOpaque(bool opaque); |
1497 | - |
1498 | - Q_SIGNALS: |
1499 | - void roleChanged(); |
1500 | - void opaqueChanged(); |
1501 | - |
1502 | - private: |
1503 | - int role_; |
1504 | - int opaque_; |
1505 | -}; |
1506 | - |
1507 | -#endif // APPLICATION_WINDOW_H |
1508 | |
1509 | === removed file 'src/modules/application/desktopdata.cpp' |
1510 | --- src/modules/application/desktopdata.cpp 2013-09-12 13:22:35 +0000 |
1511 | +++ src/modules/application/desktopdata.cpp 1970-01-01 00:00:00 +0000 |
1512 | @@ -1,157 +0,0 @@ |
1513 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
1514 | -// Copyright © 2013 Canonical Ltd. |
1515 | -// |
1516 | -// This program is free software: you can redistribute it and/or modify it under |
1517 | -// the terms of the GNU Lesser General Public License version 3, as published by |
1518 | -// the Free Software Foundation. |
1519 | -// |
1520 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
1521 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1522 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1523 | -// Lesser General Public License for more details. |
1524 | -// |
1525 | -// You should have received a copy of the GNU Lesser General Public License |
1526 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
1527 | - |
1528 | -#include "desktopdata.h" |
1529 | - |
1530 | -#include <QFile> |
1531 | -#include <QDir> |
1532 | - |
1533 | -#include "logging.h" |
1534 | - |
1535 | -// Retrieves the size of an array at compile time. |
1536 | -#define ARRAY_SIZE(a) \ |
1537 | - ((sizeof(a) / sizeof(*(a))) / static_cast<size_t>(!(sizeof(a) % sizeof(*(a))))) |
1538 | - |
1539 | -DesktopData::DesktopData(QString appId) |
1540 | - : appId_(appId) |
1541 | - , file_(findDesktopFile(appId)) |
1542 | - , entries_(DesktopData::kNumberOfEntries, "") { |
1543 | - DLOG("DesktopData::DesktopData (this=%p, appId='%s')", this, appId.toLatin1().data()); |
1544 | - DASSERT(appId != NULL); |
1545 | - loaded_ = load(); |
1546 | -} |
1547 | - |
1548 | -DesktopData::~DesktopData() { |
1549 | - DLOG("DesktopData::~DesktopData"); |
1550 | - entries_.clear(); |
1551 | -} |
1552 | - |
1553 | -QString DesktopData::findDesktopFile(const QString &appId) const |
1554 | -{ |
1555 | - int dashPos = -1; |
1556 | - QString helper = appId; |
1557 | - |
1558 | - QStringList searchDirs; |
1559 | - searchDirs << QDir::homePath() + "/.local/share/applications"; |
1560 | - searchDirs << "/usr/share/applications"; |
1561 | - |
1562 | -#ifdef TEST_MODE |
1563 | - searchDirs << ""; |
1564 | -#endif |
1565 | - |
1566 | - do { |
1567 | - if (dashPos != -1) { |
1568 | - helper = helper.replace(dashPos, 1, '/'); |
1569 | - } |
1570 | - |
1571 | - Q_FOREACH(const QString &searchDir, searchDirs) { |
1572 | - QFileInfo fileInfo(QDir(searchDir), helper + ".desktop"); |
1573 | - if (fileInfo.exists()) { |
1574 | - return fileInfo.absoluteFilePath(); |
1575 | - } |
1576 | - } |
1577 | - |
1578 | - dashPos = helper.indexOf("-"); |
1579 | - } while (dashPos != -1); |
1580 | - |
1581 | - return QString(); |
1582 | -} |
1583 | - |
1584 | -bool DesktopData::load() { |
1585 | - DLOG("DesktopData::load (this=%p, appId='%s')", this, qPrintable(appId_)); |
1586 | - |
1587 | - if (this->file().isNull() || this->file().isEmpty()) { |
1588 | - DLOG("No desktop file found for appId: %s", qPrintable(appId_)); |
1589 | - return false; |
1590 | - } |
1591 | - |
1592 | - const struct { const char* const name; int size; unsigned int flag; } kEntryNames[] = { |
1593 | - { "Name=", sizeof("Name=") - 1, 1 << DesktopData::kNameIndex }, |
1594 | - { "Comment=", sizeof("Comment=") - 1, 1 << DesktopData::kCommentIndex }, |
1595 | - { "Icon=", sizeof("Icon=") - 1, 1 << DesktopData::kIconIndex }, |
1596 | - { "Exec=", sizeof("Exec=") - 1, 1 << DesktopData::kExecIndex }, |
1597 | - { "Path=", sizeof("Path=") - 1, 1 << DesktopData::kPathIndex }, |
1598 | - { "X-Ubuntu-StageHint=", sizeof("X-Ubuntu-StageHint=") - 1, 1 << DesktopData::kStageHintIndex } |
1599 | - }; |
1600 | - const unsigned int kAllEntriesMask = |
1601 | - (1 << DesktopData::kNameIndex) | (1 << DesktopData::kCommentIndex) |
1602 | - | (1 << DesktopData::kIconIndex) | (1 << DesktopData::kExecIndex) |
1603 | - | (1 << DesktopData::kPathIndex) | (1 << DesktopData::kStageHintIndex); |
1604 | - const unsigned int kMandatoryEntriesMask = |
1605 | - (1 << DesktopData::kNameIndex) | (1 << DesktopData::kIconIndex) |
1606 | - | (1 << DesktopData::kExecIndex); |
1607 | - const int kEntriesCount = ARRAY_SIZE(kEntryNames); |
1608 | - const int kBufferSize = 256; |
1609 | - static char buffer[kBufferSize]; |
1610 | - |
1611 | - QFile file(this->file()); |
1612 | - |
1613 | - // Open file. |
1614 | - if (!file.open(QFile::ReadOnly | QIODevice::Text)) { |
1615 | - DLOG("can't open file: %s", file.errorString().toLatin1().data()); |
1616 | - return false; |
1617 | - } |
1618 | - |
1619 | - // Validate "magic key" (standard group header). |
1620 | - if (file.readLine(buffer, kBufferSize) != -1) { |
1621 | - if (strncmp(buffer, "[Desktop Entry]", sizeof("[Desktop Entry]" - 1))) { |
1622 | - DLOG("not a desktop file"); |
1623 | - return false; |
1624 | - } |
1625 | - } |
1626 | - |
1627 | - int length; |
1628 | - unsigned int entryFlags = 0; |
1629 | - while ((length = file.readLine(buffer, kBufferSize)) != -1) { |
1630 | - // Skip empty lines. |
1631 | - if (length > 1) { |
1632 | - // Stop when reaching unsupported next group header. |
1633 | - if (buffer[0] == '[') { |
1634 | - DLOG("reached next group header, leaving loop"); |
1635 | - break; |
1636 | - } |
1637 | - // Lookup entries ignoring duplicates if any. |
1638 | - for (int i = 0; i < kEntriesCount; i++) { |
1639 | - if (!strncmp(buffer, kEntryNames[i].name, kEntryNames[i].size)) { |
1640 | - if (~entryFlags & kEntryNames[i].flag) { |
1641 | - buffer[length-1] = '\0'; |
1642 | - entries_[i] = QString::fromLatin1(&buffer[kEntryNames[i].size]); |
1643 | - entryFlags |= kEntryNames[i].flag; |
1644 | - break; |
1645 | - } |
1646 | - } |
1647 | - } |
1648 | - // Stop when matching the right number of entries. |
1649 | - if (entryFlags == kAllEntriesMask) { |
1650 | - break; |
1651 | - } |
1652 | - } |
1653 | - } |
1654 | - |
1655 | - // Check that the mandatory entries are set. |
1656 | - if ((entryFlags & kMandatoryEntriesMask) == kMandatoryEntriesMask) { |
1657 | - DLOG("loaded desktop file with name='%s', comment='%s', icon='%s', exec='%s', path='%s', stagehint='%s'", |
1658 | - entries_[DesktopData::kNameIndex].toLatin1().data(), |
1659 | - entries_[DesktopData::kCommentIndex].toLatin1().data(), |
1660 | - entries_[DesktopData::kIconIndex].toLatin1().data(), |
1661 | - entries_[DesktopData::kExecIndex].toLatin1().data(), |
1662 | - entries_[DesktopData::kPathIndex].toLatin1().data(), |
1663 | - entries_[DesktopData::kStageHintIndex].toLatin1().data()); |
1664 | - return true; |
1665 | - } else { |
1666 | - DLOG("not a valid desktop file, missing mandatory entries in the standard group header"); |
1667 | - return false; |
1668 | - } |
1669 | -} |
1670 | |
1671 | === removed file 'src/modules/application/desktopdata.h' |
1672 | --- src/modules/application/desktopdata.h 2013-09-12 13:22:35 +0000 |
1673 | +++ src/modules/application/desktopdata.h 1970-01-01 00:00:00 +0000 |
1674 | @@ -1,56 +0,0 @@ |
1675 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
1676 | -// Copyright © 2013 Canonical Ltd. |
1677 | -// |
1678 | -// This program is free software: you can redistribute it and/or modify it under |
1679 | -// the terms of the GNU Lesser General Public License version 3, as published by |
1680 | -// the Free Software Foundation. |
1681 | -// |
1682 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
1683 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1684 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1685 | -// Lesser General Public License for more details. |
1686 | -// |
1687 | -// You should have received a copy of the GNU Lesser General Public License |
1688 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
1689 | - |
1690 | -#ifndef DESKTOPDATA_H |
1691 | -#define DESKTOPDATA_H |
1692 | - |
1693 | -#include <QString> |
1694 | -#include <QVector> |
1695 | -#include <QUrl> |
1696 | - |
1697 | -class DesktopData { |
1698 | -public: |
1699 | - DesktopData(QString appId); |
1700 | - ~DesktopData(); |
1701 | - |
1702 | - QString appId() const { return appId_; } |
1703 | - QString file() const { return file_; }; |
1704 | - QString name() const { return entries_[kNameIndex]; } |
1705 | - QString comment() const { return entries_[kCommentIndex]; } |
1706 | - QUrl icon() const { return QUrl(entries_[kIconIndex]); } |
1707 | - QString exec() const { return entries_[kExecIndex]; } |
1708 | - QString path() const { return entries_[kPathIndex]; } |
1709 | - QString stageHint() const { return entries_[kStageHintIndex]; } |
1710 | - bool loaded() const { return loaded_; } |
1711 | - QString findDesktopFile(const QString &appId) const; |
1712 | - |
1713 | -private: |
1714 | - static const int kNameIndex = 0, |
1715 | - kCommentIndex = 1, |
1716 | - kIconIndex = 2, |
1717 | - kExecIndex = 3, |
1718 | - kPathIndex = 4, |
1719 | - kStageHintIndex = 5, |
1720 | - kNumberOfEntries = 6; |
1721 | - |
1722 | - bool load(); |
1723 | - |
1724 | - QString appId_; |
1725 | - QString file_; |
1726 | - QVector<QString> entries_; |
1727 | - bool loaded_; |
1728 | -}; |
1729 | - |
1730 | -#endif // DESKTOPDATA_H |
1731 | |
1732 | === removed file 'src/modules/application/input_filter_area.cc' |
1733 | --- src/modules/application/input_filter_area.cc 2013-11-06 12:21:46 +0000 |
1734 | +++ src/modules/application/input_filter_area.cc 1970-01-01 00:00:00 +0000 |
1735 | @@ -1,144 +0,0 @@ |
1736 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
1737 | -// Copyright © 2013 Canonical Ltd. |
1738 | -// |
1739 | -// This program is free software: you can redistribute it and/or modify it under |
1740 | -// the terms of the GNU Lesser General Public License version 3, as published by |
1741 | -// the Free Software Foundation. |
1742 | -// |
1743 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
1744 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1745 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1746 | -// Lesser General Public License for more details. |
1747 | -// |
1748 | -// You should have received a copy of the GNU Lesser General Public License |
1749 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
1750 | - |
1751 | -#include "input_filter_area.h" |
1752 | -#include "logging.h" |
1753 | -#include <ubuntu/ui/ubuntu_ui_session_service.h> |
1754 | - |
1755 | -InputFilterArea::InputFilterArea(QQuickItem* parent) |
1756 | - : QQuickItem(parent) |
1757 | - , blockInput_(false) |
1758 | - , trapHandle_(0) { |
1759 | - DLOG("InputFilterArea::InputFilterArea (this=%p, parent=%p)", this, parent); |
1760 | -} |
1761 | - |
1762 | -InputFilterArea::~InputFilterArea() { |
1763 | - DLOG("InputFilterArea::~InputFilterArea"); |
1764 | - |
1765 | - disableInputTrap(); |
1766 | -} |
1767 | - |
1768 | -void InputFilterArea::setBlockInput(bool blockInput) { |
1769 | - DLOG("InputFilterArea::setBlockInput (this=%p, blockInput=%d)", this, blockInput); |
1770 | - |
1771 | - if (blockInput_ != blockInput) { |
1772 | - blockInput_ = blockInput; |
1773 | - if (blockInput) { |
1774 | - enableInputTrap(); |
1775 | - } else { |
1776 | - disableInputTrap(); |
1777 | - } |
1778 | - emit blockInputChanged(); |
1779 | - } |
1780 | -} |
1781 | - |
1782 | -void InputFilterArea::geometryChanged(const QRectF & newGeometry, const QRectF & oldGeometry) { |
1783 | - DLOG("InputFilterArea::geometryChanged (this=%p)", this); |
1784 | - |
1785 | - if (newGeometry != oldGeometry) { |
1786 | - geometry_ = newGeometry; |
1787 | - if (blockInput_) { |
1788 | - setInputTrap(relativeToAbsoluteGeometry(geometry_)); |
1789 | - } |
1790 | - } |
1791 | - QQuickItem::geometryChanged(newGeometry, oldGeometry); |
1792 | -} |
1793 | - |
1794 | -void InputFilterArea::onAscendantChanged() { |
1795 | - DLOG("InputFilterArea::onAscendantChanged (this=%p)", this); |
1796 | - |
1797 | - listenToAscendantsChanges(); |
1798 | - setInputTrap(relativeToAbsoluteGeometry(geometry_)); |
1799 | -} |
1800 | - |
1801 | -void InputFilterArea::onAscendantGeometryChanged() { |
1802 | - DLOG("InputFilterArea::onAscendantGeometryChanged (this=%p)", this); |
1803 | - |
1804 | - setInputTrap(relativeToAbsoluteGeometry(geometry_)); |
1805 | -} |
1806 | - |
1807 | -void InputFilterArea::listenToAscendantsChanges() { |
1808 | - DLOG("InputFilterArea::listenToAscendantsChanges (this=%p)", this); |
1809 | - |
1810 | - disconnectFromAscendantsChanges(); |
1811 | - |
1812 | - /* FIXME: Listen to geometry changes and parent changes on all the ascendants. |
1813 | - Listening on x, y, width, height changes on all the ascendants is |
1814 | - necessary because there is no API that notifies of absolute geometry |
1815 | - changes. |
1816 | - Ref.: https://bugreports.qt-project.org/browse/QTBUG-19746 |
1817 | - */ |
1818 | - connections_.append(connect(this, &QQuickItem::parentChanged, this, &InputFilterArea::onAscendantChanged)); |
1819 | - QQuickItem* parent = parentItem(); |
1820 | - while (parent != NULL) { |
1821 | - connections_.append(connect(parent, &QQuickItem::parentChanged, this, &InputFilterArea::onAscendantChanged)); |
1822 | - connections_.append(connect(parent, &QQuickItem::xChanged, this, &InputFilterArea::onAscendantGeometryChanged)); |
1823 | - connections_.append(connect(parent, &QQuickItem::yChanged, this, &InputFilterArea::onAscendantGeometryChanged)); |
1824 | - connections_.append(connect(parent, &QQuickItem::widthChanged, this, &InputFilterArea::onAscendantGeometryChanged)); |
1825 | - connections_.append(connect(parent, &QQuickItem::heightChanged, this, &InputFilterArea::onAscendantGeometryChanged)); |
1826 | - parent = parent->parentItem(); |
1827 | - } |
1828 | -} |
1829 | - |
1830 | -void InputFilterArea::disconnectFromAscendantsChanges() { |
1831 | - DLOG("InputFilterArea::disconnectFromAscendantsChanges (this=%p)", this); |
1832 | - |
1833 | - // disconnect all previously connected signals |
1834 | - Q_FOREACH (QMetaObject::Connection connection, connections_) { |
1835 | - disconnect(connection); |
1836 | - } |
1837 | - connections_.clear(); |
1838 | -} |
1839 | - |
1840 | -void InputFilterArea::setInputTrap(const QRect & geometry) { |
1841 | - DLOG("InputFilterArea::setInputTrap (this=%p)", this); |
1842 | - |
1843 | - if (geometry != trapGeometry_) { |
1844 | - trapGeometry_ = geometry; |
1845 | - if (trapHandle_ != 0) { |
1846 | - ubuntu_ui_unset_surface_trap(trapHandle_); |
1847 | - trapHandle_ = 0; |
1848 | - } |
1849 | - if (geometry.isValid()) { |
1850 | - trapHandle_ = ubuntu_ui_set_surface_trap(geometry.x(), geometry.y(), geometry.width(), geometry.height()); |
1851 | - } |
1852 | - } |
1853 | -} |
1854 | - |
1855 | -void InputFilterArea::enableInputTrap() { |
1856 | - DLOG("InputFilterArea::enableInputTrap (this=%p)", this); |
1857 | - |
1858 | - setInputTrap(relativeToAbsoluteGeometry(geometry_)); |
1859 | - listenToAscendantsChanges(); |
1860 | -} |
1861 | - |
1862 | -void InputFilterArea::disableInputTrap() { |
1863 | - DLOG("InputFilterArea::disableInputTrap (this=%p)", this); |
1864 | - |
1865 | - if (trapHandle_ != 0) { |
1866 | - ubuntu_ui_unset_surface_trap(trapHandle_); |
1867 | - trapHandle_ = 0; |
1868 | - } |
1869 | - trapGeometry_ = QRect(); |
1870 | - disconnectFromAscendantsChanges(); |
1871 | -} |
1872 | - |
1873 | -QRect InputFilterArea::relativeToAbsoluteGeometry(const QRectF & relativeGeometry) { |
1874 | - if (parentItem()) { |
1875 | - return parentItem()->mapRectToScene(relativeGeometry).toRect(); |
1876 | - } else { |
1877 | - return relativeGeometry.toRect(); |
1878 | - } |
1879 | -} |
1880 | |
1881 | === removed file 'src/modules/application/input_filter_area.h' |
1882 | --- src/modules/application/input_filter_area.h 2013-11-06 12:21:46 +0000 |
1883 | +++ src/modules/application/input_filter_area.h 1970-01-01 00:00:00 +0000 |
1884 | @@ -1,59 +0,0 @@ |
1885 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
1886 | -// Copyright © 2013 Canonical Ltd. |
1887 | -// |
1888 | -// This program is free software: you can redistribute it and/or modify it under |
1889 | -// the terms of the GNU Lesser General Public License version 3, as published by |
1890 | -// the Free Software Foundation. |
1891 | -// |
1892 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
1893 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1894 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1895 | -// Lesser General Public License for more details. |
1896 | -// |
1897 | -// You should have received a copy of the GNU Lesser General Public License |
1898 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
1899 | - |
1900 | -#ifndef INPUT_FILTER_AREA_H |
1901 | -#define INPUT_FILTER_AREA_H |
1902 | - |
1903 | -#include <QtQuick/QQuickItem> |
1904 | -#include <QtCore/QLinkedList> |
1905 | -#include <QtCore/QMetaObject> |
1906 | - |
1907 | -class InputFilterArea : public QQuickItem { |
1908 | - Q_OBJECT |
1909 | - Q_PROPERTY(bool blockInput READ blockInput WRITE setBlockInput NOTIFY blockInputChanged) |
1910 | - |
1911 | - public: |
1912 | - explicit InputFilterArea(QQuickItem* parent = 0); |
1913 | - ~InputFilterArea(); |
1914 | - |
1915 | - bool blockInput() const { return blockInput_; } |
1916 | - void setBlockInput(bool blockInput); |
1917 | - |
1918 | - Q_SIGNALS: |
1919 | - void blockInputChanged(); |
1920 | - |
1921 | - protected: |
1922 | - virtual void geometryChanged(const QRectF & newGeometry, const QRectF & oldGeometry); |
1923 | - |
1924 | - private Q_SLOTS: |
1925 | - void onAscendantChanged(); |
1926 | - void onAscendantGeometryChanged(); |
1927 | - |
1928 | - private: |
1929 | - void listenToAscendantsChanges(); |
1930 | - void disconnectFromAscendantsChanges(); |
1931 | - void setInputTrap(const QRect & geometry); |
1932 | - void enableInputTrap(); |
1933 | - void disableInputTrap(); |
1934 | - QRect relativeToAbsoluteGeometry(const QRectF &relativeGeometry); |
1935 | - |
1936 | - bool blockInput_; |
1937 | - unsigned int trapHandle_; |
1938 | - QRectF geometry_; |
1939 | - QRect trapGeometry_; |
1940 | - QLinkedList<QMetaObject::Connection> connections_; |
1941 | -}; |
1942 | - |
1943 | -#endif // INPUT_FILTER_AREA_H |
1944 | |
1945 | === removed file 'src/modules/application/logging.h' |
1946 | --- src/modules/application/logging.h 2013-02-14 16:31:33 +0000 |
1947 | +++ src/modules/application/logging.h 1970-01-01 00:00:00 +0000 |
1948 | @@ -1,38 +0,0 @@ |
1949 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
1950 | -// Copyright © 2013 Canonical Ltd. |
1951 | -// |
1952 | -// This program is free software: you can redistribute it and/or modify it under |
1953 | -// the terms of the GNU Lesser General Public License version 3, as published by |
1954 | -// the Free Software Foundation. |
1955 | -// |
1956 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
1957 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
1958 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1959 | -// Lesser General Public License for more details. |
1960 | -// |
1961 | -// You should have received a copy of the GNU Lesser General Public License |
1962 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
1963 | - |
1964 | -#ifndef UBUNTU_APPLICATION_PLUGIN_LOGGING_H |
1965 | -#define UBUNTU_APPLICATION_PLUGIN_LOGGING_H |
1966 | - |
1967 | -// Logging and assertion macros. |
1968 | -#define LOG(...) qDebug(__VA_ARGS__) |
1969 | -#define LOG_IF(cond,...) do { if (cond) qDebug(__VA_ARGS__); } while(0) |
1970 | -#define ASSERT(cond) ((!(cond)) ? qt_assert(#cond,__FILE__,__LINE__) : qt_noop()) |
1971 | -#define NOT_REACHED() qt_assert("Not reached!",__FILE__,__LINE__) |
1972 | - |
1973 | -// Logging and assertion macros are compiled out for release builds. |
1974 | -#if !defined(QT_NO_DEBUG) |
1975 | -#define DLOG(...) LOG(__VA_ARGS__) |
1976 | -#define DLOG_IF(cond,...) LOG_IF((cond), __VA_ARGS__) |
1977 | -#define DASSERT(cond) ASSERT((cond)) |
1978 | -#define DNOT_REACHED() NOT_REACHED() |
1979 | -#else |
1980 | -#define DLOG(...) qt_noop() |
1981 | -#define DLOG_IF(cond,...) qt_noop() |
1982 | -#define DASSERT(cond) qt_noop() |
1983 | -#define DNOT_REACHED() qt_noop() |
1984 | -#endif |
1985 | - |
1986 | -#endif // UBUNTU_APPLICATION_PLUGIN_LOGGING_H |
1987 | |
1988 | === removed file 'src/modules/application/plugin.cc' |
1989 | --- src/modules/application/plugin.cc 2013-11-19 17:17:37 +0000 |
1990 | +++ src/modules/application/plugin.cc 1970-01-01 00:00:00 +0000 |
1991 | @@ -1,55 +0,0 @@ |
1992 | -// This file is part of QtUbuntu, a set of Qt components for Ubuntu. |
1993 | -// Copyright © 2013 Canonical Ltd. |
1994 | -// |
1995 | -// This program is free software: you can redistribute it and/or modify it under |
1996 | -// the terms of the GNU Lesser General Public License version 3, as published by |
1997 | -// the Free Software Foundation. |
1998 | -// |
1999 | -// This program is distributed in the hope that it will be useful, but WITHOUT |
2000 | -// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
2001 | -// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2002 | -// Lesser General Public License for more details. |
2003 | -// |
2004 | -// You should have received a copy of the GNU Lesser General Public License |
2005 | -// along with this program. If not, see <http://www.gnu.org/licenses/>. |
2006 | - |
2007 | -#include <qqmlcomponent.h> |
2008 | -#include <qqmlextensionplugin.h> |
2009 | - |
2010 | -#include <QtQuick/QQuickWindow> |
2011 | -#include "application.h" |
2012 | -#include "application_manager.h" |
2013 | -#include "application_image.h" |
2014 | -#include "application_window.h" |
2015 | -#include "input_filter_area.h" |
2016 | -#include "logging.h" |
2017 | - |
2018 | -static QObject* applicationManagerSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) { |
2019 | - Q_UNUSED(engine); |
2020 | - Q_UNUSED(scriptEngine); |
2021 | - DLOG("applicationManagerSingleton (engine=%p, scriptEngine=%p)", engine, scriptEngine); |
2022 | - return new ApplicationManager(); |
2023 | -} |
2024 | - |
2025 | -class UbuntuApplicationPlugin : public QQmlExtensionPlugin { |
2026 | - Q_OBJECT |
2027 | - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0") |
2028 | - |
2029 | - virtual void registerTypes(const char* uri) { |
2030 | - DLOG("UbuntuApplicationPlugin::registerTypes (this=%p, uri='%s')", this, uri); |
2031 | - ASSERT(QLatin1String(uri) == QLatin1String("Unity.Application")); |
2032 | - qmlRegisterUncreatableType<unity::shell::application::ApplicationManagerInterface>( |
2033 | - uri, 0, 1, "ApplicationManagerInterface", "Abstract Interface. Cannot be created in QML"); |
2034 | - qmlRegisterSingletonType<ApplicationManager>( |
2035 | - uri, 0, 1, "ApplicationManager", applicationManagerSingleton); |
2036 | - qmlRegisterUncreatableType<unity::shell::application::ApplicationInfoInterface>( |
2037 | - uri, 0, 1, "ApplicationInfoInterface", "Abstract Interface. Cannot be created in QML"); |
2038 | - qmlRegisterUncreatableType<Application>( |
2039 | - uri, 0, 1, "ApplicationInfo", "ApplicationInfo can't be instantiated"); |
2040 | - qmlRegisterExtendedType<QQuickWindow, ApplicationWindow>(uri, 0, 1, "Window"); |
2041 | - qmlRegisterType<ApplicationImage>(uri, 0, 1, "ApplicationImage"); |
2042 | - qmlRegisterType<InputFilterArea>(uri, 0, 1, "InputFilterArea"); |
2043 | - } |
2044 | -}; |
2045 | - |
2046 | -#include "plugin.moc" |
2047 | |
2048 | === removed file 'src/modules/application/qmldir' |
2049 | --- src/modules/application/qmldir 2013-09-06 16:04:58 +0000 |
2050 | +++ src/modules/application/qmldir 1970-01-01 00:00:00 +0000 |
2051 | @@ -1,3 +0,0 @@ |
2052 | -module Unity.Application |
2053 | -plugin unityapplicationplugin |
2054 | -OSKController 0.1 OSKController.qml |
2055 | |
2056 | === removed file 'src/modules/modules.pro' |
2057 | --- src/modules/modules.pro 2012-11-30 16:33:11 +0000 |
2058 | +++ src/modules/modules.pro 1970-01-01 00:00:00 +0000 |
2059 | @@ -1,3 +0,0 @@ |
2060 | -TEMPLATE = subdirs |
2061 | - |
2062 | -SUBDIRS += application |
2063 | |
2064 | === modified file 'src/src.pro' |
2065 | --- src/src.pro 2013-09-03 18:03:17 +0000 |
2066 | +++ src/src.pro 2014-03-31 15:14:06 +0000 |
2067 | @@ -1,3 +1,3 @@ |
2068 | TEMPLATE = subdirs |
2069 | |
2070 | -SUBDIRS += platforms modules |
2071 | +SUBDIRS += platforms |
PASSED: Continuous integration, rev:214 jenkins. qa.ubuntu. com/job/ qtubuntu- ci/131/ jenkins. qa.ubuntu. com/job/ qtubuntu- trusty- armhf-ci/ 42 jenkins. qa.ubuntu. com/job/ qtubuntu- trusty- armhf-ci/ 42/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/qtubuntu- ci/131/ rebuild
http://