Merge lp:~osomon/webbrowser-app/remove-qquickshortcut-source into lp:webbrowser-app/staging

Proposed by Olivier Tilloy
Status: Merged
Approved by: Florian Boucault
Approved revision: 1644
Merged at revision: 1643
Proposed branch: lp:~osomon/webbrowser-app/remove-qquickshortcut-source
Merge into: lp:webbrowser-app/staging
Diff against target: 535 lines (+9/-406)
9 files modified
README (+1/-1)
debian/control (+2/-3)
src/app/CMakeLists.txt (+1/-3)
src/app/browserapplication.cpp (+1/-3)
src/app/qquickshortcut.cpp (+0/-283)
src/app/qquickshortcut_p.h (+0/-109)
src/app/webbrowser/Browser.qml (+1/-1)
src/app/webbrowser/webbrowser-app.qml (+1/-1)
src/app/webcontainer/WebApp.qml (+2/-2)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/remove-qquickshortcut-source
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team Pending
Review via email: mp+321882@code.launchpad.net

Commit message

Use the Shortcut QML type provided by QtQuick 2.5 instead of embedding a source copy.
This is okay now since the lowest target is xenial+overlay, which has Qt 5.6.

To post a comment you must log in.
1644. By Olivier Tilloy

Updated README.

Revision history for this message
Florian Boucault (fboucault) wrote :

Looks good. Only one question, qml-module-qtquick2 in Build-Depends: shouldn't it be bumped also? For the tests perhaps?

Revision history for this message
Olivier Tilloy (osomon) wrote :

The QML unit tests don't test keyboard shortcuts (they do test key presses, but no Shortcut item is involved). So the build dependency doesn't need to be bumped.

This will change once the qmltests branch lands though.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README'
2--- README 2016-03-15 16:03:19 +0000
3+++ README 2017-04-05 06:09:00 +0000
4@@ -1,6 +1,6 @@
5 webbrowser-app is a lightweight web browser tailored for Ubuntu,
6 based on the Oxide web engine and using the Ubuntu UI components.
7-It requires Qt 5.4 to build and run.
8+It requires Qt 5.5 to build and run.
9
10
11 = Building =
12
13=== modified file 'debian/control'
14--- debian/control 2017-03-07 20:13:27 +0000
15+++ debian/control 2017-04-05 06:09:00 +0000
16@@ -25,7 +25,6 @@
17 qt5-default,
18 qtbase5-dev (>= 5.4),
19 qtbase5-dev-tools,
20- qtbase5-private-dev,
21 qtdeclarative5-dev,
22 qtdeclarative5-ubuntu-ui-extras0.2,
23 qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 1.3) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 1.3),
24@@ -48,7 +47,7 @@
25 libqt5sql5-sqlite,
26 qml-module-qt-labs-folderlistmodel,
27 qml-module-qt-labs-settings,
28- qml-module-qtquick2 (>= 5.4),
29+ qml-module-qtquick2 (>= 5.5),
30 qml-module-qtquick-layouts,
31 qml-module-qtquick-window2 (>= 5.3),
32 qml-module-qtsysteminfo,
33@@ -75,7 +74,7 @@
34 fonts-liberation,
35 liboxideqt-qmlplugin (>= 1.19),
36 libqt5sql5-sqlite,
37- qml-module-qtquick2 (>= 5.4),
38+ qml-module-qtquick2 (>= 5.5),
39 qml-module-qtquick-window2 (>= 5.3),
40 qml-module-ubuntu-onlineaccounts,
41 qml-module-ubuntu-web (= ${binary:Version}),
42
43=== modified file 'src/app/CMakeLists.txt'
44--- src/app/CMakeLists.txt 2016-10-31 10:53:51 +0000
45+++ src/app/CMakeLists.txt 2017-04-05 06:09:00 +0000
46@@ -24,13 +24,11 @@
47 mime-database.cpp
48 session-storage.cpp
49 single-instance-manager.cpp
50- qquickshortcut.cpp
51 )
52
53 add_library(${COMMONLIB} STATIC ${COMMONLIB_SRC})
54
55-include_directories(${LIBAPPARMOR_INCLUDE_DIRS}
56- ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
57+include_directories(${LIBAPPARMOR_INCLUDE_DIRS})
58 target_link_libraries(${COMMONLIB}
59 Qt5::Core
60 Qt5::Gui
61
62=== modified file 'src/app/browserapplication.cpp'
63--- src/app/browserapplication.cpp 2016-10-31 10:53:51 +0000
64+++ src/app/browserapplication.cpp 2017-04-05 06:09:00 +0000
65@@ -1,5 +1,5 @@
66 /*
67- * Copyright 2013-2016 Canonical Ltd.
68+ * Copyright 2013-2017 Canonical Ltd.
69 *
70 * This file is part of webbrowser-app.
71 *
72@@ -38,7 +38,6 @@
73 #include "favicon-fetcher.h"
74 #include "meminfo.h"
75 #include "mime-database.h"
76-#include "qquickshortcut_p.h"
77 #include "session-storage.h"
78
79 BrowserApplication::BrowserApplication(int& argc, char** argv)
80@@ -176,7 +175,6 @@
81 qmlRegisterSingletonType<MemInfo>(uri, 0, 1, "MemInfo", MemInfo_singleton_factory);
82 qmlRegisterSingletonType<MimeDatabase>(uri, 0, 1, "MimeDatabase", MimeDatabase_singleton_factory);
83 qmlRegisterType<SessionStorage>(uri, 0, 1, "SessionStorage");
84- qmlRegisterType<QQuickShortcut>(uri, 0, 1, "Shortcut");
85
86 m_engine = new QQmlEngine;
87 connect(m_engine, SIGNAL(quit()), SLOT(quit()));
88
89=== removed file 'src/app/qquickshortcut.cpp'
90--- src/app/qquickshortcut.cpp 2016-03-29 11:01:18 +0000
91+++ src/app/qquickshortcut.cpp 1970-01-01 00:00:00 +0000
92@@ -1,283 +0,0 @@
93-/****************************************************************************
94-**
95-** Copyright (C) 2015 The Qt Company Ltd.
96-** Contact: http://www.qt.io/licensing/
97-**
98-** This file is part of the QtQuick module of the Qt Toolkit.
99-**
100-** $QT_BEGIN_LICENSE:LGPL21$
101-** Commercial License Usage
102-** Licensees holding valid commercial Qt licenses may use this file in
103-** accordance with the commercial license agreement provided with the
104-** Software or, alternatively, in accordance with the terms contained in
105-** a written agreement between you and The Qt Company. For licensing terms
106-** and conditions see http://www.qt.io/terms-conditions. For further
107-** information use the contact form at http://www.qt.io/contact-us.
108-**
109-** GNU Lesser General Public License Usage
110-** Alternatively, this file may be used under the terms of the GNU Lesser
111-** General Public License version 2.1 or version 3 as published by the Free
112-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
113-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
114-** following information to ensure the GNU Lesser General Public License
115-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
116-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
117-**
118-** As a special exception, The Qt Company gives you certain additional
119-** rights. These rights are described in The Qt Company LGPL Exception
120-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
121-**
122-** $QT_END_LICENSE$
123-**
124-****************************************************************************/
125-
126-#include "qquickshortcut_p.h"
127-
128-#include <QtQuick/qquickitem.h>
129-#include <QtQuick/qquickwindow.h>
130-#include <QtGui/private/qguiapplication_p.h>
131-
132-QT_BEGIN_NAMESPACE
133-
134-/*!
135- \qmltype Shortcut
136- \instantiates QQuickShortcut
137- \inqmlmodule QtQuick
138- \since 5.5
139- \ingroup qtquick-input
140- \brief Provides keyboard shortcuts
141-
142- The Shortcut type provides a way of handling keyboard shortcuts. The shortcut can
143- be set to one of the \l{QKeySequence::StandardKey}{standard keyboard shortcuts},
144- or it can be described with a string containing a sequence of up to four key
145- presses that are needed to \l{Shortcut::activated}{activate} the shortcut.
146-
147- \qml
148- Item {
149- id: view
150-
151- property int currentIndex
152-
153- Shortcut {
154- sequence: StandardKey.NextChild
155- onActivated: view.currentIndex++
156- }
157- }
158- \endqml
159-
160- \sa Keys
161-*/
162-
163-/*! \qmlsignal QtQuick::Shortcut::activated()
164-
165- This signal is emitted when the shortcut is activated.
166-
167- The corresponding handler is \c onActivated.
168-*/
169-
170-/*! \qmlsignal QtQuick::Shortcut::activatedAmbiguously()
171-
172- This signal is emitted when the shortcut is activated ambigously,
173- meaning that it matches the start of more than one shortcut.
174-
175- The corresponding handler is \c onActivatedAmbiguously.
176-*/
177-
178-QQuickShortcut::QQuickShortcut(QObject *parent) : QObject(parent), m_id(0),
179- m_enabled(true), m_completed(false), m_autorepeat(true), m_context(Qt::WindowShortcut)
180-{
181-}
182-
183-QQuickShortcut::~QQuickShortcut()
184-{
185- ungrabShortcut();
186-}
187-
188-/*!
189- \qmlproperty keysequence QtQuick::Shortcut::sequence
190-
191- This property holds the shortcut's key sequence. The key sequence can be set
192- to one of the \l{QKeySequence::StandardKey}{standard keyboard shortcuts}, or
193- it can be described with a string containing a sequence of up to four key
194- presses that are needed to \l{Shortcut::activated}{activate} the shortcut.
195-
196- The default value is an empty key sequence.
197-
198- \qml
199- Shortcut {
200- sequence: "Ctrl+E,Ctrl+W"
201- onActivated: edit.wrapMode = TextEdit.Wrap
202- }
203- \endqml
204-*/
205-QVariant QQuickShortcut::sequence() const
206-{
207- return m_sequence;
208-}
209-
210-void QQuickShortcut::setSequence(const QVariant &sequence)
211-{
212- if (sequence == m_sequence)
213- return;
214-
215- QKeySequence shortcut;
216- if (sequence.type() == QVariant::Int)
217- shortcut = QKeySequence(static_cast<QKeySequence::StandardKey>(sequence.toInt()));
218- else
219- shortcut = QKeySequence::fromString(sequence.toString());
220-
221- grabShortcut(shortcut, m_context);
222-
223- m_sequence = sequence;
224- m_shortcut = shortcut;
225- emit sequenceChanged();
226-}
227-
228-/*!
229- \qmlproperty bool QtQuick::Shortcut::enabled
230-
231- This property holds whether the shortcut is enabled.
232-
233- The default value is \c true.
234-*/
235-bool QQuickShortcut::isEnabled() const
236-{
237- return m_enabled;
238-}
239-
240-void QQuickShortcut::setEnabled(bool enabled)
241-{
242- if (enabled == m_enabled)
243- return;
244-
245- if (m_id)
246- QGuiApplicationPrivate::instance()->shortcutMap.setShortcutEnabled(enabled, m_id, this);
247-
248- m_enabled = enabled;
249- emit enabledChanged();
250-}
251-
252-/*!
253- \qmlproperty bool QtQuick::Shortcut::autoRepeat
254-
255- This property holds whether the shortcut can auto repeat.
256-
257- The default value is \c true.
258-*/
259-bool QQuickShortcut::autoRepeat() const
260-{
261- return m_autorepeat;
262-}
263-
264-void QQuickShortcut::setAutoRepeat(bool repeat)
265-{
266- if (repeat == m_autorepeat)
267- return;
268-
269- if (m_id)
270- QGuiApplicationPrivate::instance()->shortcutMap.setShortcutAutoRepeat(repeat, m_id, this);
271-
272- m_autorepeat = repeat;
273- emit autoRepeatChanged();
274-}
275-
276-/*!
277- \qmlproperty enumeration QtQuick::Shortcut::context
278-
279- This property holds the \l{Qt::ShortcutContext}{shortcut context}.
280-
281- Supported values are:
282- \list
283- \li \c Qt.WindowShortcut (default) - The shortcut is active when its parent item is in an active top-level window.
284- \li \c Qt.ApplicationShortcut - The shortcut is active when one of the application's windows are active.
285- \endlist
286-
287- \qml
288- Shortcut {
289- sequence: StandardKey.Quit
290- context: Qt.ApplicationShortcut
291- onActivated: Qt.quit()
292- }
293- \endqml
294-*/
295-Qt::ShortcutContext QQuickShortcut::context() const
296-{
297- return m_context;
298-}
299-
300-void QQuickShortcut::setContext(Qt::ShortcutContext context)
301-{
302- if (context == m_context)
303- return;
304-
305- grabShortcut(m_shortcut, context);
306-
307- m_context = context;
308- emit contextChanged();
309-}
310-
311-void QQuickShortcut::classBegin()
312-{
313-}
314-
315-void QQuickShortcut::componentComplete()
316-{
317- m_completed = true;
318- grabShortcut(m_shortcut, m_context);
319-}
320-
321-bool QQuickShortcut::event(QEvent *event)
322-{
323- if (m_enabled && event->type() == QEvent::Shortcut) {
324- QShortcutEvent *se = static_cast<QShortcutEvent *>(event);
325- if (se->shortcutId() == m_id && se->key() == m_shortcut){
326- if (se->isAmbiguous())
327- emit activatedAmbiguously();
328- else
329- emit activated();
330- return true;
331- }
332- }
333- return false;
334-}
335-
336-static bool qQuickShortcutContextMatcher(QObject *obj, Qt::ShortcutContext context)
337-{
338- switch (context) {
339- case Qt::ApplicationShortcut:
340- return true;
341- case Qt::WindowShortcut:
342- while (obj && !obj->isWindowType()) {
343- obj = obj->parent();
344- if (QQuickItem *item = qobject_cast<QQuickItem *>(obj))
345- obj = item->window();
346- }
347- return obj && obj == QGuiApplication::focusWindow();
348- default:
349- return false;
350- }
351-}
352-
353-void QQuickShortcut::grabShortcut(const QKeySequence &sequence, Qt::ShortcutContext context)
354-{
355- ungrabShortcut();
356-
357- if (m_completed && !sequence.isEmpty()) {
358- QGuiApplicationPrivate *pApp = QGuiApplicationPrivate::instance();
359- m_id = pApp->shortcutMap.addShortcut(this, sequence, context, qQuickShortcutContextMatcher);
360- if (!m_enabled)
361- pApp->shortcutMap.setShortcutEnabled(false, m_id, this);
362- if (!m_autorepeat)
363- pApp->shortcutMap.setShortcutAutoRepeat(false, m_id, this);
364- }
365-}
366-
367-void QQuickShortcut::ungrabShortcut()
368-{
369- if (m_id) {
370- QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(m_id, this);
371- m_id = 0;
372- }
373-}
374-
375-QT_END_NAMESPACE
376
377=== removed file 'src/app/qquickshortcut_p.h'
378--- src/app/qquickshortcut_p.h 2016-03-29 11:01:18 +0000
379+++ src/app/qquickshortcut_p.h 1970-01-01 00:00:00 +0000
380@@ -1,109 +0,0 @@
381-/****************************************************************************
382-**
383-** Copyright (C) 2015 The Qt Company Ltd.
384-** Contact: http://www.qt.io/licensing/
385-**
386-** This file is part of the QtQuick module of the Qt Toolkit.
387-**
388-** $QT_BEGIN_LICENSE:LGPL21$
389-** Commercial License Usage
390-** Licensees holding valid commercial Qt licenses may use this file in
391-** accordance with the commercial license agreement provided with the
392-** Software or, alternatively, in accordance with the terms contained in
393-** a written agreement between you and The Qt Company. For licensing terms
394-** and conditions see http://www.qt.io/terms-conditions. For further
395-** information use the contact form at http://www.qt.io/contact-us.
396-**
397-** GNU Lesser General Public License Usage
398-** Alternatively, this file may be used under the terms of the GNU Lesser
399-** General Public License version 2.1 or version 3 as published by the Free
400-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
401-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
402-** following information to ensure the GNU Lesser General Public License
403-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
404-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
405-**
406-** As a special exception, The Qt Company gives you certain additional
407-** rights. These rights are described in The Qt Company LGPL Exception
408-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
409-**
410-** $QT_END_LICENSE$
411-**
412-****************************************************************************/
413-
414-#ifndef QQUICKSHORTCUT_P_H
415-#define QQUICKSHORTCUT_P_H
416-
417-//
418-// W A R N I N G
419-// -------------
420-//
421-// This file is not part of the Qt API. It exists purely as an
422-// implementation detail. This header file may change from version to
423-// version without notice, or even be removed.
424-//
425-// We mean it.
426-//
427-
428-#include <QtCore/qobject.h>
429-#include <QtCore/qvariant.h>
430-#include <QtGui/qkeysequence.h>
431-#include <QtQml/qqmlparserstatus.h>
432-
433-QT_BEGIN_NAMESPACE
434-
435-class QQuickShortcut : public QObject, public QQmlParserStatus
436-{
437- Q_OBJECT
438- Q_INTERFACES(QQmlParserStatus)
439- Q_PROPERTY(QVariant sequence READ sequence WRITE setSequence NOTIFY sequenceChanged FINAL)
440- Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL)
441- Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL)
442- Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext NOTIFY contextChanged FINAL)
443-
444-public:
445- explicit QQuickShortcut(QObject *parent = Q_NULLPTR);
446- ~QQuickShortcut();
447-
448- QVariant sequence() const;
449- void setSequence(const QVariant &sequence);
450-
451- bool isEnabled() const;
452- void setEnabled(bool enabled);
453-
454- bool autoRepeat() const;
455- void setAutoRepeat(bool repeat);
456-
457- Qt::ShortcutContext context() const;
458- void setContext(Qt::ShortcutContext context);
459-
460-Q_SIGNALS:
461- void sequenceChanged();
462- void enabledChanged();
463- void autoRepeatChanged();
464- void contextChanged();
465-
466- void activated();
467- void activatedAmbiguously();
468-
469-protected:
470- void classBegin() Q_DECL_OVERRIDE;
471- void componentComplete() Q_DECL_OVERRIDE;
472- bool event(QEvent *event) Q_DECL_OVERRIDE;
473-
474- void grabShortcut(const QKeySequence &sequence, Qt::ShortcutContext context);
475- void ungrabShortcut();
476-
477-private:
478- int m_id;
479- bool m_enabled;
480- bool m_completed;
481- bool m_autorepeat;
482- QKeySequence m_shortcut;
483- Qt::ShortcutContext m_context;
484- QVariant m_sequence;
485-};
486-
487-QT_END_NAMESPACE
488-
489-#endif // QQUICKSHORTCUT_P_H
490
491=== modified file 'src/app/webbrowser/Browser.qml'
492--- src/app/webbrowser/Browser.qml 2017-03-28 11:20:46 +0000
493+++ src/app/webbrowser/Browser.qml 2017-04-05 06:09:00 +0000
494@@ -16,7 +16,7 @@
495 * along with this program. If not, see <http://www.gnu.org/licenses/>.
496 */
497
498-import QtQuick 2.4
499+import QtQuick 2.5
500 import QtQuick.Window 2.2
501 import QtSystemInfo 5.5
502 import Qt.labs.settings 1.0
503
504=== modified file 'src/app/webbrowser/webbrowser-app.qml'
505--- src/app/webbrowser/webbrowser-app.qml 2017-02-23 09:53:09 +0000
506+++ src/app/webbrowser/webbrowser-app.qml 2017-04-05 06:09:00 +0000
507@@ -16,7 +16,7 @@
508 * along with this program. If not, see <http://www.gnu.org/licenses/>.
509 */
510
511-import QtQuick 2.4
512+import QtQuick 2.5
513 import QtQuick.Window 2.2
514 import Qt.labs.settings 1.0
515 import Ubuntu.Components 1.3
516
517=== modified file 'src/app/webcontainer/WebApp.qml'
518--- src/app/webcontainer/WebApp.qml 2016-12-19 16:44:04 +0000
519+++ src/app/webcontainer/WebApp.qml 2017-04-05 06:09:00 +0000
520@@ -1,5 +1,5 @@
521 /*
522- * Copyright 2013-2016 Canonical Ltd.
523+ * Copyright 2013-2017 Canonical Ltd.
524 *
525 * This file is part of webbrowser-app.
526 *
527@@ -16,7 +16,7 @@
528 * along with this program. If not, see <http://www.gnu.org/licenses/>.
529 */
530
531-import QtQuick 2.4
532+import QtQuick 2.5
533 import webbrowsercommon.private 0.1
534 import com.canonical.Oxide 1.19 as Oxide
535 import Ubuntu.Components 1.3

Subscribers

People subscribed via source and target branches