on xenial help sign in
Require Qt 5.6 & misc fixes
47b643aAlbert Astals Cid
CMakeLists.txt+7−7
@@ -62,13 +62,13 @@ add_custom_target(cppcheck COMMAND cppcheck --enable=all -q --error-exitcode=2
62 ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
62 ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
63
63
64include(FindPkgConfig)
64include(FindPkgConfig)
65−find_package(Qt5Core 5.4 REQUIRED)
65+find_package(Qt5Core 5.6 REQUIRED)
66−find_package(Qt5Qml 5.4 REQUIRED)
66+find_package(Qt5Qml 5.6 REQUIRED)
67−find_package(Qt5Quick 5.4 REQUIRED)
67+find_package(Qt5Quick 5.6 REQUIRED)
68−find_package(Qt5Gui 5.4 REQUIRED)
68+find_package(Qt5Gui 5.6 REQUIRED)
69−find_package(Qt5DBus 5.4 REQUIRED)
69+find_package(Qt5DBus 5.6 REQUIRED)
70−find_package(Qt5Concurrent 5.4 REQUIRED)
70+find_package(Qt5Concurrent 5.6 REQUIRED)
71−find_package(Qt5Sql 5.4 REQUIRED)
71+find_package(Qt5Sql 5.6 REQUIRED)
72
72
73pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=23)
73pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=23)
74pkg_check_modules(GEONAMES REQUIRED geonames>=0.2)
74pkg_check_modules(GEONAMES REQUIRED geonames>=0.2)
debian/control+5−5
@@ -51,7 +51,7 @@ Build-Depends: cmake,
51 qml-module-qt-labs-folderlistmodel,
51 qml-module-qt-labs-folderlistmodel,
52 qml-module-qt-labs-settings,
52 qml-module-qt-labs-settings,
53 qml-module-qtqml-statemachine,
53 qml-module-qtqml-statemachine,
54− qml-module-qtmultimedia (>= 5.4.1-1ubuntu19~overlay2),
54+ qml-module-qtmultimedia (>= 5.6),
55 qml-module-qtquick-layouts,
55 qml-module-qtquick-layouts,
56 qml-module-qtquick-xmllistmodel,
56 qml-module-qtquick-xmllistmodel,
57 qml-module-qtquick2,
57 qml-module-qtquick2,
@@ -60,12 +60,12 @@ Build-Depends: cmake,
60 qml-module-ubuntu-components (>= 1.3.2030) | qml-module-ubuntu-components-gles (>= 1.3.2030),
60 qml-module-ubuntu-components (>= 1.3.2030) | qml-module-ubuntu-components-gles (>= 1.3.2030),
61 qml-module-ubuntu-web,
61 qml-module-ubuntu-web,
62 qt5-default,
62 qt5-default,
63− qtbase5-dev (>= 5.4),
63+ qtbase5-dev (>= 5.6),
64 qtbase5-dev-tools,
64 qtbase5-dev-tools,
65− qtbase5-private-dev (>= 5.4),
65+ qtbase5-private-dev (>= 5.6),
66− qtdeclarative5-dev (>= 5.4),
66+ qtdeclarative5-dev (>= 5.6),
67 qtdeclarative5-dev-tools,
67 qtdeclarative5-dev-tools,
68− qtdeclarative5-private-dev (>= 5.4),
68+ qtdeclarative5-private-dev (>= 5.6),
69 qtdeclarative5-ubuntu-content1,
69 qtdeclarative5-ubuntu-content1,
70 qtdeclarative5-ubuntu-settings-components (>= 0.11),
70 qtdeclarative5-ubuntu-settings-components (>= 0.11),
71 ttf-ubuntu-font-family,
71 ttf-ubuntu-font-family,
plugins/AccountsService/AccountsService.h+1−1
@@ -29,7 +29,6 @@ class QDBusInterface;
29class AccountsService: public QObject
29class AccountsService: public QObject
30{
30{
31 Q_OBJECT
31 Q_OBJECT
32− Q_ENUMS(PasswordDisplayHint)
33 Q_PROPERTY (QString user
32 Q_PROPERTY (QString user
34 READ user
33 READ user
35 WRITE setUser
34 WRITE setUser
@@ -86,6 +85,7 @@ public:
86 Keyboard,
85 Keyboard,
87 Numeric,
86 Numeric,
88 };
87 };
88+ Q_ENUM(PasswordDisplayHint)
89
89
90 explicit AccountsService(QObject *parent = 0, const QString & user = QString());
90 explicit AccountsService(QObject *parent = 0, const QString & user = QString());
91 ~AccountsService() = default;
91 ~AccountsService() = default;
plugins/Cursor/CursorImageInfo.cpp+1−2
@@ -108,8 +108,7 @@ int CursorImageInfo::frameDuration() const
108QUrl CursorImageInfo::imageSource() const
108QUrl CursorImageInfo::imageSource() const
109{
109{
110 auto urlString = QString("image://cursor/%1/%2/%3")
110 auto urlString = QString("image://cursor/%1/%2/%3")
111− .arg(m_themeName)
111+ .arg(m_themeName, m_cursorName)
112− .arg(m_cursorName)
113 .arg(m_cursorHeight);
112 .arg(m_cursorHeight);
114
113
115 return QUrl(urlString);
114 return QUrl(urlString);
plugins/Dash/abstractdashview.cpp+1−1
@@ -23,7 +23,7 @@ AbstractDashView::AbstractDashView()
23 , m_asyncRequestedIndex(-1)
23 , m_asyncRequestedIndex(-1)
24 , m_columnSpacing(0)
24 , m_columnSpacing(0)
25 , m_rowSpacing(0)
25 , m_rowSpacing(0)
26− , m_buffer(320) // Same value used in qquickitemview.cpp in Qt 5.4
26+ , m_buffer(320) // Same value as QML_VIEW_DEFAULTCACHEBUFFER in qquickitemview.cpp (Qt 5.6)
27 , m_displayMarginBeginning(0)
27 , m_displayMarginBeginning(0)
28 , m_displayMarginEnd(0)
28 , m_displayMarginEnd(0)
29 , m_needsRelayout(false)
29 , m_needsRelayout(false)
plugins/LightDM/IntegratedLightDM/liblightdm/Greeter.h+2−2
@@ -46,18 +46,18 @@ class Q_DECL_EXPORT Greeter : public QObject
46 Q_PROPERTY(QString hostname READ hostname CONSTANT)
46 Q_PROPERTY(QString hostname READ hostname CONSTANT)
47 Q_PROPERTY(bool hasGuestAccount READ hasGuestAccountHint CONSTANT)
47 Q_PROPERTY(bool hasGuestAccount READ hasGuestAccountHint CONSTANT)
48
48
49− Q_ENUMS(PromptType MessageType)
50−
51public:
49public:
52 enum PromptType {
50 enum PromptType {
53 PromptTypeQuestion,
51 PromptTypeQuestion,
54 PromptTypeSecret
52 PromptTypeSecret
55 };
53 };
54+ Q_ENUM(PromptType)
56
55
57 enum MessageType {
56 enum MessageType {
58 MessageTypeInfo,
57 MessageTypeInfo,
59 MessageTypeError
58 MessageTypeError
60 };
59 };
60+ Q_ENUM(MessageType)
61
61
62 explicit Greeter(QObject* parent=0);
62 explicit Greeter(QObject* parent=0);
63 virtual ~Greeter();
63 virtual ~Greeter();
plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp−1
@@ -38,7 +38,6 @@ SessionsModel::SessionsModel(QObject* parent) :
38 QAbstractListModel(parent),
38 QAbstractListModel(parent),
39 d_ptr(new SessionsModelPrivate(this))
39 d_ptr(new SessionsModelPrivate(this))
40{
40{
41− Q_D(SessionsModel);
42 m_roleNames = QAbstractListModel::roleNames();
41 m_roleNames = QAbstractListModel::roleNames();
43 m_roleNames[KeyRole] = "key";
42 m_roleNames[KeyRole] = "key";
44 m_roleNames[TypeRole] = "type";
43 m_roleNames[TypeRole] = "type";
plugins/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h+2−2
@@ -35,8 +35,6 @@ class Q_DECL_EXPORT SessionsModel : public QAbstractListModel
35 {
35 {
36 Q_OBJECT
36 Q_OBJECT
37
37
38− Q_ENUMS(SessionModelRoles SessionType)
39−
40 public:
38 public:
41
39
42 enum SessionModelRoles {
40 enum SessionModelRoles {
@@ -46,11 +44,13 @@ class Q_DECL_EXPORT SessionsModel : public QAbstractListModel
46 IdRole = KeyRole, /** Deprecated */
44 IdRole = KeyRole, /** Deprecated */
47 TypeRole
45 TypeRole
48 };
46 };
47+ Q_ENUM(SessionModelRoles)
49
48
50 enum SessionType {
49 enum SessionType {
51 LocalSessions,
50 LocalSessions,
52 RemoteSessions
51 RemoteSessions
53 };
52 };
53+ Q_ENUM(SessionType)
54
54
55 explicit SessionsModel(QObject* parent=0); /** Deprecated. Loads local sessions*/
55 explicit SessionsModel(QObject* parent=0); /** Deprecated. Loads local sessions*/
56 explicit SessionsModel(SessionsModel::SessionType, QObject* parent=0);
56 explicit SessionsModel(SessionsModel::SessionType, QObject* parent=0);
plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.h+1−2
@@ -37,8 +37,6 @@ class Q_DECL_EXPORT UsersModel : public QAbstractListModel
37{
37{
38 Q_OBJECT
38 Q_OBJECT
39
39
40− Q_ENUMS(UserModelRoles)
41−
42public:
40public:
43 explicit UsersModel(QObject *parent = 0);
41 explicit UsersModel(QObject *parent = 0);
44 virtual ~UsersModel() = default;
42 virtual ~UsersModel() = default;
@@ -53,6 +51,7 @@ public:
53 BackgroundPathRole,
51 BackgroundPathRole,
54 UidRole
52 UidRole
55 };
53 };
54+ Q_ENUM(UserModelRoles)
56
55
57 int rowCount(const QModelIndex &parent) const override;
56 int rowCount(const QModelIndex &parent) const override;
58 QVariant data(const QModelIndex &index, int role) const override;
57 QVariant data(const QModelIndex &index, int role) const override;
plugins/LightDM/SessionsModel.h+1−2
@@ -28,8 +28,6 @@ class SessionsModel : public UnitySortFilterProxyModelQML
28{
28{
29 Q_OBJECT
29 Q_OBJECT
30
30
31− Q_ENUMS(SessionModelRoles)
32−
33 Q_PROPERTY(QList<QUrl> iconSearchDirectories READ iconSearchDirectories
31 Q_PROPERTY(QList<QUrl> iconSearchDirectories READ iconSearchDirectories
34 WRITE setIconSearchDirectories NOTIFY iconSearchDirectoriesChanged)
32 WRITE setIconSearchDirectories NOTIFY iconSearchDirectoriesChanged)
35Q_SIGNALS:
33Q_SIGNALS:
@@ -45,6 +43,7 @@ public:
45 TypeRole = QLightDM::SessionsModel::SessionModelRoles::TypeRole,
43 TypeRole = QLightDM::SessionsModel::SessionModelRoles::TypeRole,
46 IconRole
44 IconRole
47 };
45 };
46+ Q_ENUM(SessionModelRoles)
48
47
49 explicit SessionsModel(QObject* parent=nullptr);
48 explicit SessionsModel(QObject* parent=nullptr);
50
49
plugins/Lights/Lights.h+1−1
@@ -27,7 +27,6 @@ struct light_device_t;
27class Lights: public QObject
27class Lights: public QObject
28{
28{
29 Q_OBJECT
29 Q_OBJECT
30− Q_ENUMS(State)
31 Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged)
30 Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged)
32 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
31 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
33 Q_PROPERTY(int onMillisec READ onMillisec WRITE setOnMillisec NOTIFY onMillisecChanged)
32 Q_PROPERTY(int onMillisec READ onMillisec WRITE setOnMillisec NOTIFY onMillisecChanged)
@@ -38,6 +37,7 @@ public:
38 Off,
37 Off,
39 On,
38 On,
40 };
39 };
40+ Q_ENUM(State)
41
41
42 explicit Lights(QObject *parent = 0);
42 explicit Lights(QObject *parent = 0);
43 ~Lights();
43 ~Lights();
plugins/Powerd/Powerd.h+2−2
@@ -27,8 +27,6 @@
27class Powerd: public QObject
27class Powerd: public QObject
28{
28{
29 Q_OBJECT
29 Q_OBJECT
30− Q_ENUMS(Status)
31− Q_ENUMS(DisplayStateChangeReason)
32 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
30 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
33
31
34public:
32public:
@@ -41,11 +39,13 @@ public:
41 SnapDecision = 5, // Display changed state due to snap decision prompt
39 SnapDecision = 5, // Display changed state due to snap decision prompt
42 CallDone = 6, // Display changed state due to voice call end
40 CallDone = 6, // Display changed state due to voice call end
43 };
41 };
42+ Q_ENUM(DisplayStateChangeReason)
44
43
45 enum Status {
44 enum Status {
46 Off,
45 Off,
47 On,
46 On,
48 };
47 };
48+ Q_ENUM(Status)
49
49
50 explicit Powerd(QObject *parent = 0);
50 explicit Powerd(QObject *parent = 0);
51 ~Powerd();
51 ~Powerd();
plugins/UInput/uinput.h+1−1
@@ -27,7 +27,6 @@
27class UInput : public QObject
27class UInput : public QObject
28{
28{
29 Q_OBJECT
29 Q_OBJECT
30− Q_ENUMS(Button)
31
30
32public:
31public:
33 enum Button {
32 enum Button {
@@ -35,6 +34,7 @@ public:
35 ButtonRight,
34 ButtonRight,
36 ButtonMiddle
35 ButtonMiddle
37 };
36 };
37+ Q_ENUM(Button)
38
38
39 explicit UInput(QObject *parent = nullptr);
39 explicit UInput(QObject *parent = nullptr);
40 ~UInput();
40 ~UInput();
plugins/Ubuntu/Gestures/Direction.h+1−1
@@ -26,7 +26,6 @@
26 */
26 */
27class UBUNTUGESTURESQML_EXPORT Direction : public QObject {
27class UBUNTUGESTURESQML_EXPORT Direction : public QObject {
28 Q_OBJECT
28 Q_OBJECT
29− Q_ENUMS(Type)
30
29
31public:
30public:
32 // Make sure it is kept synchronized with SDK UCSwipeArea::Direction
31 // Make sure it is kept synchronized with SDK UCSwipeArea::Direction
@@ -38,6 +37,7 @@ public:
38 Horizontal, // Along the X axis, in any direction
37 Horizontal, // Along the X axis, in any direction
39 Vertical // Along the Y axis, in any direction
38 Vertical // Along the Y axis, in any direction
40 };
39 };
40+ Q_ENUM(Type)
41
41
42 Q_INVOKABLE static bool isHorizontal(Direction::Type type);
42 Q_INVOKABLE static bool isHorizontal(Direction::Type type);
43 Q_INVOKABLE static bool isVertical(Direction::Type type);
43 Q_INVOKABLE static bool isVertical(Direction::Type type);
plugins/Ubuntu/Gestures/TouchGestureArea.h+1−1
@@ -114,7 +114,6 @@ private:
114class UBUNTUGESTURESQML_EXPORT TouchGestureArea : public QQuickItem
114class UBUNTUGESTURESQML_EXPORT TouchGestureArea : public QQuickItem
115{
115{
116 Q_OBJECT
116 Q_OBJECT
117− Q_ENUMS(Status)
118
117
119 Q_PROPERTY(int status READ status NOTIFY statusChanged)
118 Q_PROPERTY(int status READ status NOTIFY statusChanged)
120 Q_PROPERTY(bool dragging READ dragging NOTIFY draggingChanged)
119 Q_PROPERTY(bool dragging READ dragging NOTIFY draggingChanged)
@@ -137,6 +136,7 @@ public:
137 Recognized,
136 Recognized,
138 Rejected
137 Rejected
139 };
138 };
139+ Q_ENUM(Status)
140 TouchGestureArea(QQuickItem* parent = nullptr);
140 TouchGestureArea(QQuickItem* parent = nullptr);
141 ~TouchGestureArea();
141 ~TouchGestureArea();
142
142
plugins/Unity/DashCommunicator/CMakeLists.txt+1
@@ -1,5 +1,6 @@
1include_directories(
1include_directories(
2 ${CMAKE_CURRENT_SOURCE_DIR}
2 ${CMAKE_CURRENT_SOURCE_DIR}
3+ ${CMAKE_CURRENT_BINARY_DIR}
3 ${libunity8-private_SOURCE_DIR}
4 ${libunity8-private_SOURCE_DIR}
4)
5)
5
6
plugins/Unity/DashCommunicator/dashconnection.cpp+3
@@ -32,6 +32,7 @@
32 */
32 */
33class AsyncDBusInterface : public QDBusAbstractInterface
33class AsyncDBusInterface : public QDBusAbstractInterface
34{
34{
35+ Q_OBJECT
35public:
36public:
36 AsyncDBusInterface(const QString &service, const QString &path,
37 AsyncDBusInterface(const QString &service, const QString &path,
37 const QString &interface, const QDBusConnection &connection,
38 const QString &interface, const QDBusConnection &connection,
@@ -61,3 +62,5 @@ void DashConnection::setCurrentScope(int index, bool animate, bool isSwipe)
61 dbusInterface()->asyncCall(QStringLiteral("SetCurrentScope"), index, animate, isSwipe);
62 dbusInterface()->asyncCall(QStringLiteral("SetCurrentScope"), index, animate, isSwipe);
62 }
63 }
63}
64}
65+
66+#include "dashconnection.moc"
plugins/Unity/Indicators/indicators.h+5−5
@@ -27,13 +27,13 @@ class UNITYINDICATORS_EXPORT ActionState : public QObject
27{
27{
28 Q_OBJECT
28 Q_OBJECT
29public:
29public:
30− Q_ENUMS(ActionStates)
31 enum ActionStates {
30 enum ActionStates {
32 Label = 0x00,
31 Label = 0x00,
33 IconSource = 0x01,
32 IconSource = 0x01,
34 AccessableName = 0x02,
33 AccessableName = 0x02,
35 Visible = 0x03,
34 Visible = 0x03,
36 };
35 };
36+ Q_ENUM(ActionStates)
37
37
38 ActionState(QObject*parent=0):QObject(parent) {}
38 ActionState(QObject*parent=0):QObject(parent) {}
39};
39};
@@ -42,11 +42,11 @@ class UNITYINDICATORS_EXPORT NetworkActionState : public QObject
42{
42{
43 Q_OBJECT
43 Q_OBJECT
44public:
44public:
45− Q_ENUMS(NetworkActionStates)
46 enum NetworkActionStates {
45 enum NetworkActionStates {
47 Connection = 0x01,
46 Connection = 0x01,
48 SignalStrength = 0x02,
47 SignalStrength = 0x02,
49 };
48 };
49+ Q_ENUM(NetworkActionStates)
50
50
51 NetworkActionState(QObject*parent=0):QObject(parent) {}
51 NetworkActionState(QObject*parent=0):QObject(parent) {}
52};
52};
@@ -55,13 +55,13 @@ class UNITYINDICATORS_EXPORT NetworkConnection : public QObject
55{
55{
56 Q_OBJECT
56 Q_OBJECT
57public:
57public:
58− Q_ENUMS(NetworkConnectionStates)
59 enum NetworkConnectionStates {
58 enum NetworkConnectionStates {
60 Initial = 0x00,
59 Initial = 0x00,
61 Activating = 0x01,
60 Activating = 0x01,
62 Activated = 0x02,
61 Activated = 0x02,
63 Deactivating = 0x03,
62 Deactivating = 0x03,
64 };
63 };
64+ Q_ENUM(NetworkConnectionStates)
65
65
66 NetworkConnection(QObject*parent=0):QObject(parent) {}
66 NetworkConnection(QObject*parent=0):QObject(parent) {}
67};
67};
@@ -70,12 +70,12 @@ class UNITYINDICATORS_EXPORT IndicatorsModelRole : public QObject
70{
70{
71 Q_OBJECT
71 Q_OBJECT
72public:
72public:
73− Q_ENUMS(Roles)
74 enum Roles {
73 enum Roles {
75 Identifier = 0,
74 Identifier = 0,
76 Position,
75 Position,
77 IndicatorProperties
76 IndicatorProperties
78 };
77 };
78+ Q_ENUM(Roles)
79
79
80 IndicatorsModelRole(QObject*parent=0):QObject(parent) {}
80 IndicatorsModelRole(QObject*parent=0):QObject(parent) {}
81};
81};
@@ -84,7 +84,6 @@ class UNITYINDICATORS_EXPORT FlatMenuProxyModelRole : public QObject
84{
84{
85 Q_OBJECT
85 Q_OBJECT
86public:
86public:
87− Q_ENUMS(Roles)
88 enum Roles {
87 enum Roles {
89 Action = Qt::DisplayRole + 1,
88 Action = Qt::DisplayRole + 1,
90 Label,
89 Label,
@@ -93,6 +92,7 @@ public:
93 hasSection,
92 hasSection,
94 hasSubMenu
93 hasSubMenu
95 };
94 };
95+ Q_ENUM(Roles)
96
96
97 FlatMenuProxyModelRole(QObject*parent=0):QObject(parent) {}
97 FlatMenuProxyModelRole(QObject*parent=0):QObject(parent) {}
98};
98};
plugins/Unity/Indicators/indicatorsmodel.h−1
@@ -32,7 +32,6 @@ class IndicatorsManager;
32class UNITYINDICATORS_EXPORT IndicatorsModel : public QAbstractListModel
32class UNITYINDICATORS_EXPORT IndicatorsModel : public QAbstractListModel
33{
33{
34 Q_OBJECT
34 Q_OBJECT
35− Q_ENUMS(Roles)
36 Q_PROPERTY(int count READ count NOTIFY countChanged)
35 Q_PROPERTY(int count READ count NOTIFY countChanged)
37 Q_PROPERTY(QString profile READ profile WRITE setProfile NOTIFY profileChanged)
36 Q_PROPERTY(QString profile READ profile WRITE setProfile NOTIFY profileChanged)
38
37
plugins/Unity/InputInfo/qinputinfo.h+2−3
@@ -57,8 +57,6 @@ class QInputDeviceManager;
57class QInputDevice : public QObject
57class QInputDevice : public QObject
58{
58{
59 Q_OBJECT
59 Q_OBJECT
60− Q_ENUMS(InputType)
61− Q_FLAGS(InputType InputTypeFlags)
62 friend class QInputDeviceManagerPrivate;
60 friend class QInputDeviceManagerPrivate;
63
61
64public:
62public:
@@ -72,8 +70,9 @@ public:
72 Keyboard = 16,
70 Keyboard = 16,
73 Switch = 32
71 Switch = 32
74 };
72 };
75− Q_ENUMS(InputType)
73+ Q_FLAG(InputType)
76 Q_DECLARE_FLAGS(InputTypeFlags, InputType)
74 Q_DECLARE_FLAGS(InputTypeFlags, InputType)
75+ Q_FLAG(InputTypeFlags)
77
76
78 explicit QInputDevice(QObject *parent = 0);
77 explicit QInputDevice(QObject *parent = 0);
79 QString name() const;
78 QString name() const;
plugins/Utils/appdrawerproxymodel.cpp+2−2
@@ -157,8 +157,8 @@ bool AppDrawerProxyModel::filterAcceptsRow(int source_row, const QModelIndex &so
157 QStringList allWords = m_source->data(m_source->index(source_row, 0), AppDrawerModelInterface::RoleKeywords).toStringList();
157 QStringList allWords = m_source->data(m_source->index(source_row, 0), AppDrawerModelInterface::RoleKeywords).toStringList();
158 allWords.prepend(m_source->data(m_source->index(source_row, 0), AppDrawerModelInterface::RoleName).toString());
158 allWords.prepend(m_source->data(m_source->index(source_row, 0), AppDrawerModelInterface::RoleName).toString());
159 bool found = false;
159 bool found = false;
160− Q_FOREACH (const QString currentWord, allWords) {
160+ Q_FOREACH (const QString &currentWord, allWords) {
161− if (currentWord.toLower().startsWith(m_filterString.toLower())) {
161+ if (currentWord.startsWith(m_filterString, Qt::CaseInsensitive)) {
162 found = true;
162 found = true;
163 break;
163 break;
164 }
164 }
plugins/Utils/appdrawerproxymodel.h+2−2
@@ -23,8 +23,6 @@ using namespace unity::shell::launcher;
23class AppDrawerProxyModel: public QSortFilterProxyModel
23class AppDrawerProxyModel: public QSortFilterProxyModel
24{
24{
25 Q_OBJECT
25 Q_OBJECT
26− Q_ENUMS(GroupBy)
27− Q_ENUMS(SortBy)
28 Q_PROPERTY(QAbstractItemModel* source READ source WRITE setSource NOTIFY sourceChanged)
26 Q_PROPERTY(QAbstractItemModel* source READ source WRITE setSource NOTIFY sourceChanged)
29 Q_PROPERTY(GroupBy group READ group WRITE setGroup NOTIFY groupChanged)
27 Q_PROPERTY(GroupBy group READ group WRITE setGroup NOTIFY groupChanged)
30 Q_PROPERTY(QString filterLetter READ filterLetter WRITE setFilterLetter NOTIFY filterLetterChanged)
28 Q_PROPERTY(QString filterLetter READ filterLetter WRITE setFilterLetter NOTIFY filterLetterChanged)
@@ -38,10 +36,12 @@ public:
38 GroupByAll,
36 GroupByAll,
39 GroupByAToZ
37 GroupByAToZ
40 };
38 };
39+ Q_ENUM(GroupBy)
41 enum SortBy {
40 enum SortBy {
42 SortByAToZ,
41 SortByAToZ,
43 SortByUsage
42 SortByUsage
44 };
43 };
44+ Q_ENUM(SortBy)
45
45
46 AppDrawerProxyModel(QObject* parent = nullptr);
46 AppDrawerProxyModel(QObject* parent = nullptr);
47
47
plugins/Utils/easingcurve.h−1
@@ -36,7 +36,6 @@
36class EasingCurve: public QObject
36class EasingCurve: public QObject
37{
37{
38 Q_OBJECT
38 Q_OBJECT
39− Q_ENUMS(QEasingCurve::Type)
40 Q_PROPERTY(QEasingCurve::Type type READ type WRITE setType NOTIFY typeChanged)
39 Q_PROPERTY(QEasingCurve::Type type READ type WRITE setType NOTIFY typeChanged)
41 Q_PROPERTY(qreal period READ period WRITE setPeriod NOTIFY periodChanged)
40 Q_PROPERTY(qreal period READ period WRITE setPeriod NOTIFY periodChanged)
42 Q_PROPERTY(qreal progress READ progress WRITE setProgress NOTIFY progressChanged)
41 Q_PROPERTY(qreal progress READ progress WRITE setProgress NOTIFY progressChanged)
plugins/Utils/unitysortfilterproxymodelqml.h+5
@@ -38,6 +38,11 @@ public:
38 Q_INVOKABLE int mapRowToSource(int row);
38 Q_INVOKABLE int mapRowToSource(int row);
39 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
39 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
40
40
41+ // Make the QSortFilterProxyModel variants also accessible
42+ using QSortFilterProxyModel::data;
43+ using QSortFilterProxyModel::mapFromSource;
44+ using QSortFilterProxyModel::mapToSource;
45+
41 /* getters */
46 /* getters */
42 int totalCount() const;
47 int totalCount() const;
43 bool invertMatch() const;
48 bool invertMatch() const;
plugins/Utils/windowstatestorage.h+1−3
@@ -25,7 +25,6 @@
25class WindowStateStorage: public QObject
25class WindowStateStorage: public QObject
26{
26{
27 Q_OBJECT
27 Q_OBJECT
28− Q_ENUMS(WindowState)
29public:
28public:
30 enum WindowState {
29 enum WindowState {
31 WindowStateNormal = 1 << 0,
30 WindowStateNormal = 1 << 0,
@@ -42,10 +41,9 @@ public:
42 WindowStateMaximizedBottomRight = 1 << 11,
41 WindowStateMaximizedBottomRight = 1 << 11,
43 WindowStateRestored = 1 << 12
42 WindowStateRestored = 1 << 12
44 };
43 };
44+ Q_ENUM(WindowState)
45 Q_DECLARE_FLAGS(WindowStates, WindowState)
45 Q_DECLARE_FLAGS(WindowStates, WindowState)
46−#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
47 Q_FLAG(WindowStates)
46 Q_FLAG(WindowStates)
48−#endif
49
47
50 WindowStateStorage(QObject *parent = 0);
48 WindowStateStorage(QObject *parent = 0);
51 virtual ~WindowStateStorage();
49 virtual ~WindowStateStorage();
plugins/Wizard/PageList.cpp+2−5
@@ -73,11 +73,8 @@ PageList::PageList(QObject *parent)
73 // If there was a system update installed, skip until the last page to just greet the user
73 // If there was a system update installed, skip until the last page to just greet the user
74 QSettings settings;
74 QSettings settings;
75 if (settings.value(QStringLiteral("Wizard/SkipUntilFinishedPage")).toBool()) {
75 if (settings.value(QStringLiteral("Wizard/SkipUntilFinishedPage")).toBool()) {
76− const QString lastPage = m_pages.lastKey();
76+ while (m_pages.count() > 1) {
77− Q_FOREACH(const QString &page, m_pages.keys()) {
77+ m_pages.erase(m_pages.begin());
78− if (Q_UNLIKELY(page != lastPage)) {
79− m_pages.remove(page);
80− }
81 }
78 }
82
79
83 // ... and reset it again for the next run
80 // ... and reset it again for the next run
plugins/Wizard/timezonemodel.h+1−1
@@ -27,7 +27,6 @@ class TimeZoneLocationModel: public QAbstractListModel
27 Q_PROPERTY(bool listUpdating READ listUpdating NOTIFY listUpdatingChanged)
27 Q_PROPERTY(bool listUpdating READ listUpdating NOTIFY listUpdatingChanged)
28 Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged)
28 Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged)
29 Q_PROPERTY(QString country READ country WRITE setCountry NOTIFY countryChanged)
29 Q_PROPERTY(QString country READ country WRITE setCountry NOTIFY countryChanged)
30− Q_ENUMS(Roles)
31
30
32public:
31public:
33 explicit TimeZoneLocationModel(QObject *parent = nullptr);
32 explicit TimeZoneLocationModel(QObject *parent = nullptr);
@@ -42,6 +41,7 @@ public:
42 LatitudeRole,
41 LatitudeRole,
43 LongitudeRole
42 LongitudeRole
44 };
43 };
44+ Q_ENUM(Roles)
45
45
46 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
46 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
47 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
47 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
src/libunity8-private/abstractdbusservicemonitor.h+1−1
@@ -30,7 +30,6 @@ class QDBusServiceWatcher;
30class Q_DECL_EXPORT AbstractDBusServiceMonitor : public QObject
30class Q_DECL_EXPORT AbstractDBusServiceMonitor : public QObject
31{
31{
32 Q_OBJECT
32 Q_OBJECT
33− Q_ENUMS(Bus)
34 Q_PROPERTY(bool serviceAvailable READ serviceAvailable NOTIFY serviceAvailableChanged)
33 Q_PROPERTY(bool serviceAvailable READ serviceAvailable NOTIFY serviceAvailableChanged)
35
34
36public:
35public:
@@ -38,6 +37,7 @@ public:
38 SessionBus,
37 SessionBus,
39 SystemBus,
38 SystemBus,
40 };
39 };
40+ Q_ENUM(Bus)
41
41
42 explicit AbstractDBusServiceMonitor(const QString &service, const QString &path, const QString &interface,
42 explicit AbstractDBusServiceMonitor(const QString &service, const QString &path, const QString &interface,
43 const Bus bus = SessionBus,
43 const Bus bus = SessionBus,
tests/mocks/AccountsService/AccountsService.h+1−1
@@ -27,7 +27,6 @@ class MockUsersModel;
27class AccountsService: public QObject
27class AccountsService: public QObject
28{
28{
29 Q_OBJECT
29 Q_OBJECT
30− Q_ENUMS(PasswordDisplayHint)
31 Q_PROPERTY (QString user
30 Q_PROPERTY (QString user
32 READ user
31 READ user
33 WRITE setUser
32 WRITE setUser
@@ -94,6 +93,7 @@ public:
94 Keyboard,
93 Keyboard,
95 Numeric
94 Numeric
96 };
95 };
96+ Q_ENUM(PasswordDisplayHint)
97
97
98 explicit AccountsService(QObject *parent = 0);
98 explicit AccountsService(QObject *parent = 0);
99
99
tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp+1−1
@@ -173,7 +173,7 @@ void Greeter::respond(const QString &response)
173
173
174void Greeter::sendAuthenticationComplete()
174void Greeter::sendAuthenticationComplete()
175{
175{
176− if (qgetenv("UNITY_TESTING").isEmpty()) {
176+ if (qEnvironmentVariableIsEmpty("UNITY_TESTING")) {
177 // simulate PAM's delay
177 // simulate PAM's delay
178 QTimer::singleShot(1000, this, &Greeter::authenticationComplete);
178 QTimer::singleShot(1000, this, &Greeter::authenticationComplete);
179 } else {
179 } else {
tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h+2−2
@@ -42,8 +42,6 @@ class Q_DECL_EXPORT Greeter : public QObject
42 Q_PROPERTY(QString hostname READ hostname CONSTANT)
42 Q_PROPERTY(QString hostname READ hostname CONSTANT)
43 Q_PROPERTY(bool hasGuestAccount READ hasGuestAccountHint CONSTANT)
43 Q_PROPERTY(bool hasGuestAccount READ hasGuestAccountHint CONSTANT)
44
44
45− Q_ENUMS(PromptType MessageType)
46−
47 //Mock-only API for testing purposes
45 //Mock-only API for testing purposes
48 Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
46 Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
49
47
@@ -52,11 +50,13 @@ public:
52 PromptTypeQuestion,
50 PromptTypeQuestion,
53 PromptTypeSecret
51 PromptTypeSecret
54 };
52 };
53+ Q_ENUM(PromptType)
55
54
56 enum MessageType {
55 enum MessageType {
57 MessageTypeInfo,
56 MessageTypeInfo,
58 MessageTypeError
57 MessageTypeError
59 };
58 };
59+ Q_ENUM(MessageType)
60
60
61 explicit Greeter(QObject* parent=0);
61 explicit Greeter(QObject* parent=0);
62 virtual ~Greeter();
62 virtual ~Greeter();
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp−1
@@ -33,7 +33,6 @@ SessionsModel::SessionsModel(QObject* parent) :
33 QAbstractListModel(parent),
33 QAbstractListModel(parent),
34 d_ptr(new SessionsModelPrivate(this))
34 d_ptr(new SessionsModelPrivate(this))
35{
35{
36− Q_D(SessionsModel);
37 m_roleNames = QAbstractListModel::roleNames();
36 m_roleNames = QAbstractListModel::roleNames();
38 m_roleNames[KeyRole] = "key";
37 m_roleNames[KeyRole] = "key";
39 m_roleNames[TypeRole] = "type";
38 m_roleNames[TypeRole] = "type";
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h+2−2
@@ -29,8 +29,6 @@ class Q_DECL_EXPORT SessionsModel : public QAbstractListModel
29 {
29 {
30 Q_OBJECT
30 Q_OBJECT
31
31
32− Q_ENUMS(SessionModelRoles SessionType)
33−
34 public:
32 public:
35
33
36 enum SessionModelRoles {
34 enum SessionModelRoles {
@@ -40,11 +38,13 @@ class Q_DECL_EXPORT SessionsModel : public QAbstractListModel
40 IdRole = KeyRole, /** Deprecated */
38 IdRole = KeyRole, /** Deprecated */
41 TypeRole
39 TypeRole
42 };
40 };
41+ Q_ENUM(SessionModelRoles)
43
42
44 enum SessionType {
43 enum SessionType {
45 LocalSessions,
44 LocalSessions,
46 RemoteSessions
45 RemoteSessions
47 };
46 };
47+ Q_ENUM(SessionType)
48
48
49 explicit SessionsModel(QObject* parent=nullptr); /** Deprecated. Loads local sessions*/
49 explicit SessionsModel(QObject* parent=nullptr); /** Deprecated. Loads local sessions*/
50 explicit SessionsModel(SessionsModel::SessionType, QObject* parent=nullptr);
50 explicit SessionsModel(SessionsModel::SessionType, QObject* parent=nullptr);
tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp−2
@@ -34,8 +34,6 @@ UsersModel::UsersModel(QObject *parent) :
34 QAbstractListModel(parent),
34 QAbstractListModel(parent),
35 d_ptr(new UsersModelPrivate(this))
35 d_ptr(new UsersModelPrivate(this))
36{
36{
37− Q_D(UsersModel);
38−
39 // Extend roleNames (we want to keep the "display" role)
37 // Extend roleNames (we want to keep the "display" role)
40 QHash<int, QByteArray> roles = roleNames();
38 QHash<int, QByteArray> roles = roleNames();
41 roles[NameRole] = "name";
39 roles[NameRole] = "name";
tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.h+1−2
@@ -31,8 +31,6 @@ class Q_DECL_EXPORT UsersModel : public QAbstractListModel
31{
31{
32 Q_OBJECT
32 Q_OBJECT
33
33
34− Q_ENUMS(UserModelRoles)
35−
36 //Mock-only API for testing purposes
34 //Mock-only API for testing purposes
37 Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
35 Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
38
36
@@ -53,6 +51,7 @@ public:
53 BackgroundPathRole,
51 BackgroundPathRole,
54 UidRole
52 UidRole
55 };
53 };
54+ Q_ENUM(UserModelRoles)
56
55
57 int rowCount(const QModelIndex &parent) const override;
56 int rowCount(const QModelIndex &parent) const override;
58 QVariant data(const QModelIndex &index, int role) const override;
57 QVariant data(const QModelIndex &index, int role) const override;
tests/mocks/Lights/Lights.h+1−1
@@ -23,7 +23,6 @@
23class Lights: public QObject
23class Lights: public QObject
24{
24{
25 Q_OBJECT
25 Q_OBJECT
26− Q_ENUMS(State)
27 Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged)
26 Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged)
28 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
27 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
29 Q_PROPERTY(int onMillisec READ onMillisec WRITE setOnMillisec NOTIFY onMillisecChanged)
28 Q_PROPERTY(int onMillisec READ onMillisec WRITE setOnMillisec NOTIFY onMillisecChanged)
@@ -34,6 +33,7 @@ public:
34 Off,
33 Off,
35 On,
34 On,
36 };
35 };
36+ Q_ENUM(State)
37
37
38 explicit Lights(QObject *parent = 0);
38 explicit Lights(QObject *parent = 0);
39 ~Lights();
39 ~Lights();
tests/mocks/Powerd/Powerd.h+2−2
@@ -24,8 +24,6 @@
24class Powerd: public QObject
24class Powerd: public QObject
25{
25{
26 Q_OBJECT
26 Q_OBJECT
27− Q_ENUMS(Status)
28− Q_ENUMS(DisplayStateChangeReason)
29 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
27 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
30
28
31public:
29public:
@@ -35,11 +33,13 @@ public:
35 PowerKey = 2, // Display changed state due to user pressing power key
33 PowerKey = 2, // Display changed state due to user pressing power key
36 Proximity = 3, // Display changed state due to proximity events
34 Proximity = 3, // Display changed state due to proximity events
37 };
35 };
36+ Q_ENUM(DisplayStateChangeReason)
38
37
39 enum Status {
38 enum Status {
40 Off,
39 Off,
41 On,
40 On,
42 };
41 };
42+ Q_ENUM(Status)
43
43
44 explicit Powerd(QObject *parent = 0);
44 explicit Powerd(QObject *parent = 0);
45
45
tests/mocks/QMenuModel/dbus-enums.h+2−3
@@ -28,9 +28,6 @@ class DBusEnums : public QObject
28{
28{
29 Q_OBJECT
29 Q_OBJECT
30
30
31− Q_ENUMS(BusType)
32− Q_ENUMS(ConnectionStatus)
33−
34public:
31public:
35 enum BusType {
32 enum BusType {
36 None = 0,
33 None = 0,
@@ -38,12 +35,14 @@ public:
38 SystemBus,
35 SystemBus,
39 LastBusType
36 LastBusType
40 };
37 };
38+ Q_ENUM(BusType)
41
39
42 enum ConnectionStatus {
40 enum ConnectionStatus {
43 Disconnected = 0,
41 Disconnected = 0,
44 Connecting,
42 Connecting,
45 Connected
43 Connected
46 };
44 };
45+ Q_ENUM(ConnectionStatus)
47
46
48private:
47private:
49 DBusEnums() {}
48 DBusEnums() {}
tests/mocks/QMenuModel/unitymenumodel.cpp+3−3
@@ -249,9 +249,9 @@ QVariant UnityMenuModel::get(int row, const QByteArray &role)
249{
249{
250 static QHash<QByteArray, int> roles;
250 static QHash<QByteArray, int> roles;
251 if (roles.isEmpty()) {
251 if (roles.isEmpty()) {
252− QHash<int, QByteArray> names = roleNames();
252+ const QHash<int, QByteArray> names = roleNames();
253− Q_FOREACH (int role, names.keys())
253+ for(auto it = names.begin(); it != names.end(); ++it)
254− roles.insert(names[role], role);
254+ roles.insert(it.value(), it.key());
255 }
255 }
256
256
257 return data(index(row, 0), roles[role]);
257 return data(index(row, 0), roles[role]);
tests/mocks/QtMultimedia/mediaplayer.cpp+2−2
@@ -58,7 +58,7 @@ MediaPlayer::MediaPlayer(QObject* parent)
58{
58{
59 qsrand(time(nullptr));
59 qsrand(time(nullptr));
60 m_timer.setInterval(100);
60 m_timer.setInterval(100);
61− connect(&m_timer, &QTimer::timeout, this, &MediaPlayer::timerEvent);
61+ connect(&m_timer, &QTimer::timeout, this, &MediaPlayer::processTimer);
62
62
63 connect(MediaPlayerDataController::instance(), &MediaPlayerDataController::sourceAboutToBeRemoved,
63 connect(MediaPlayerDataController::instance(), &MediaPlayerDataController::sourceAboutToBeRemoved,
64 this, [this](const QUrl& source) {
64 this, [this](const QUrl& source) {
@@ -188,7 +188,7 @@ void MediaPlayer::seek(int position)
188 }
188 }
189}
189}
190
190
191−void MediaPlayer::timerEvent()
191+void MediaPlayer::processTimer()
192{
192{
193 if (m_position + m_timer.interval() < duration()) {
193 if (m_position + m_timer.interval() < duration()) {
194 m_position += m_timer.interval();
194 m_position += m_timer.interval();
tests/mocks/QtMultimedia/mediaplayer.h+6−6
@@ -45,17 +45,13 @@ class MediaPlayer: public QObject
45 Q_PROPERTY(QObject *metaData READ metaData CONSTANT)
45 Q_PROPERTY(QObject *metaData READ metaData CONSTANT)
46 Q_PROPERTY(DeclarativePlaylist *playlist READ playlist WRITE setPlaylist NOTIFY playlistChanged)
46 Q_PROPERTY(DeclarativePlaylist *playlist READ playlist WRITE setPlaylist NOTIFY playlistChanged)
47
47
48− Q_ENUMS(PlaybackState)
49− Q_ENUMS(AudioRole)
50− Q_ENUMS(Availability)
51− Q_ENUMS(Status)
52− Q_ENUMS(Error)
53public:
48public:
54 enum PlaybackState {
49 enum PlaybackState {
55 PlayingState,
50 PlayingState,
56 PausedState,
51 PausedState,
57 StoppedState
52 StoppedState
58 };
53 };
54+ Q_ENUM(PlaybackState)
59
55
60 enum AudioRole {
56 enum AudioRole {
61 UnknownRole,
57 UnknownRole,
@@ -69,6 +65,7 @@ public:
69 SonificationRole,
65 SonificationRole,
70 GameRole
66 GameRole
71 };
67 };
68+ Q_ENUM(AudioRole)
72
69
73 enum Availability {
70 enum Availability {
74 Available,
71 Available,
@@ -76,6 +73,7 @@ public:
76 Unavailable,
73 Unavailable,
77 ResourceMissing
74 ResourceMissing
78 };
75 };
76+ Q_ENUM(Availability)
79
77
80 enum Status {
78 enum Status {
81 UnknownStatus,
79 UnknownStatus,
@@ -88,6 +86,7 @@ public:
88 EndOfMedia,
86 EndOfMedia,
89 InvalidMedia
87 InvalidMedia
90 };
88 };
89+ Q_ENUM(Status)
91
90
92 enum Error {
91 enum Error {
93 NoError,
92 NoError,
@@ -97,6 +96,7 @@ public:
97 AccessDeniedError,
96 AccessDeniedError,
98 ServiceMissingError
97 ServiceMissingError
99 };
98 };
99+ Q_ENUM(Error)
100
100
101 explicit MediaPlayer(QObject *parent = nullptr);
101 explicit MediaPlayer(QObject *parent = nullptr);
102
102
@@ -145,7 +145,7 @@ Q_SIGNALS:
145 void error(Error error, const QString &errorString);
145 void error(Error error, const QString &errorString);
146
146
147private Q_SLOTS:
147private Q_SLOTS:
148− void timerEvent();
148+ void processTimer();
149
149
150private:
150private:
151 QUrl m_source;
151 QUrl m_source;
tests/mocks/UInput/mockuinput.h+1−1
@@ -27,7 +27,6 @@
27class MockUInput : public QObject
27class MockUInput : public QObject
28{
28{
29 Q_OBJECT
29 Q_OBJECT
30− Q_ENUMS(Button)
31
30
32public:
31public:
33 enum Button {
32 enum Button {
@@ -35,6 +34,7 @@ public:
35 ButtonRight,
34 ButtonRight,
36 ButtonMiddle
35 ButtonMiddle
37 };
36 };
37+ Q_ENUM(Button)
38
38
39 explicit MockUInput(QObject *parent = nullptr);
39 explicit MockUInput(QObject *parent = nullptr);
40 ~MockUInput();
40 ~MockUInput();
tests/mocks/Ubuntu/Connectivity/networking-status.h+2−3
@@ -26,9 +26,6 @@ class Q_DECL_EXPORT NetworkingStatus : public QObject
26 Q_OBJECT
26 Q_OBJECT
27 Q_DISABLE_COPY(NetworkingStatus)
27 Q_DISABLE_COPY(NetworkingStatus)
28
28
29− Q_ENUMS(Limitations)
30− Q_ENUMS(Status)
31−
32 Q_PROPERTY(QVector<Limitations> limitations READ limitations NOTIFY limitationsChanged)
29 Q_PROPERTY(QVector<Limitations> limitations READ limitations NOTIFY limitationsChanged)
33 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
30 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
34 Q_PROPERTY(bool online READ online NOTIFY onlineChanged)
31 Q_PROPERTY(bool online READ online NOTIFY onlineChanged)
@@ -41,12 +38,14 @@ public:
41 enum Limitations {
38 enum Limitations {
42 Bandwith
39 Bandwith
43 };
40 };
41+ Q_ENUM(Limitations)
44
42
45 enum Status {
43 enum Status {
46 Offline,
44 Offline,
47 Connecting,
45 Connecting,
48 Online
46 Online
49 };
47 };
48+ Q_ENUM(Status)
50
49
51 QVector<Limitations> limitations() const;
50 QVector<Limitations> limitations() const;
52 Status status() const;
51 Status status() const;
tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/MockSecurityPrivacy.h+1−1
@@ -22,7 +22,6 @@
22class MockSecurityPrivacy : public QObject
22class MockSecurityPrivacy : public QObject
23{
23{
24 Q_OBJECT
24 Q_OBJECT
25− Q_ENUMS(SecurityType)
26 Q_PROPERTY (SecurityType securityType
25 Q_PROPERTY (SecurityType securityType
27 READ getSecurityType
26 READ getSecurityType
28 NOTIFY securityTypeChanged)
27 NOTIFY securityTypeChanged)
@@ -33,6 +32,7 @@ public:
33 Passcode,
32 Passcode,
34 Passphrase,
33 Passphrase,
35 };
34 };
35+ Q_ENUM(SecurityType)
36
36
37 MockSecurityPrivacy(QObject *parent = 0);
37 MockSecurityPrivacy(QObject *parent = 0);
38
38
tests/mocks/Unity/Application/ApplicationInfo.h+1−1
@@ -112,7 +112,7 @@ public:
112
112
113 //////
113 //////
114 // internal mock stuff
114 // internal mock stuff
115− void close();
115+ void close() override;
116 void requestFocus();
116 void requestFocus();
117
117
118Q_SIGNALS:
118Q_SIGNALS:
tests/mocks/Unity/Application/MirSurfaceItem.cpp+1−1
@@ -216,7 +216,7 @@ void MirSurfaceItem::touchEvent(QTouchEvent * event)
216 Q_EMIT touchReleaseCountChanged(m_touchReleaseCount);
216 Q_EMIT touchReleaseCountChanged(m_touchReleaseCount);
217 }
217 }
218
218
219− Q_FOREACH(QTouchEvent::TouchPoint touchPoint, event->touchPoints()) {
219+ Q_FOREACH(const QTouchEvent::TouchPoint &touchPoint, event->touchPoints()) {
220 QString id(touchPoint.id());
220 QString id(touchPoint.id());
221 QVariantList list = m_touchTrail[id].toList();
221 QVariantList list = m_touchTrail[id].toList();
222 list.append(QVariant::fromValue(touchPoint.pos()));
222 list.append(QVariant::fromValue(touchPoint.pos()));
tests/mocks/Unity/Indicators/fakeindicatorsmodel.h−1
@@ -25,7 +25,6 @@
25class FakeIndicatorsModel : public QAbstractListModel
25class FakeIndicatorsModel : public QAbstractListModel
26{
26{
27 Q_OBJECT
27 Q_OBJECT
28− Q_ENUMS(Roles)
29 Q_PROPERTY(int count READ count NOTIFY countChanged)
28 Q_PROPERTY(int count READ count NOTIFY countChanged)
30 Q_PROPERTY(QString profile READ profile WRITE setProfile NOTIFY profileChanged)
29 Q_PROPERTY(QString profile READ profile WRITE setProfile NOTIFY profileChanged)
31 Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData NOTIFY modelDataChanged)
30 Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData NOTIFY modelDataChanged)
tests/mocks/Unity/InputInfo/qinputdeviceinfo_mock.cpp+6−2
@@ -43,10 +43,14 @@ QInputDevice *QInputDeviceManagerPrivate::addMockDevice(const QString &devicePat
43
43
44void QInputDeviceManagerPrivate::removeDevice(const QString &path)
44void QInputDeviceManagerPrivate::removeDevice(const QString &path)
45{
45{
46+ auto it = deviceMap.begin();
47+ while (it != deviceMap.end()) {
46− Q_FOREACH (const QString devicePath, deviceMap.keys()) {
48+ const QString devicePath = it.key();
47 if (devicePath.contains(path)) {
49 if (devicePath.contains(path)) {
48− deviceMap.remove(devicePath);
50+ it = deviceMap.erase(it);
49 Q_EMIT deviceRemoved(devicePath);
51 Q_EMIT deviceRemoved(devicePath);
52+ } else {
53+ ++it;
50 }
54 }
51 }
55 }
52}
56}
tests/mocks/Unity/Launcher/MockAppDrawerModel.cpp+1−1
@@ -53,7 +53,7 @@ MockAppDrawerModel::MockAppDrawerModel(QObject *parent):
53 qsrand(QDateTime::currentMSecsSinceEpoch() / 1000);
53 qsrand(QDateTime::currentMSecsSinceEpoch() / 1000);
54}
54}
55
55
56−int MockAppDrawerModel::rowCount(const QModelIndex &parent) const
56+int MockAppDrawerModel::rowCount(const QModelIndex & /*parent*/) const
57{
57{
58 return m_list.count();
58 return m_list.count();
59}
59}
tests/mocks/Unity/Notifications/MockActionModel.h+1−1
@@ -36,11 +36,11 @@ public:
36 QVariant data(const QModelIndex &index, int role) const override;
36 QVariant data(const QModelIndex &index, int role) const override;
37 QHash<int, QByteArray> roleNames() const override;
37 QHash<int, QByteArray> roleNames() const override;
38
38
39− Q_ENUMS(ActionsRoles)
40 enum ActionsRoles {
39 enum ActionsRoles {
41 RoleActionLabel = Qt::UserRole + 1,
40 RoleActionLabel = Qt::UserRole + 1,
42 RoleActionId = Qt::UserRole + 2
41 RoleActionId = Qt::UserRole + 2
43 };
42 };
43+ Q_ENUM(ActionsRoles)
44 Q_INVOKABLE QVariant data(int row, int role) const;
44 Q_INVOKABLE QVariant data(int row, int role) const;
45
45
46 Q_INVOKABLE void append(const QString &id, const QString &label);
46 Q_INVOKABLE void append(const QString &id, const QString &label);
tests/mocks/Unity/Notifications/MockNotification.h+2−1
@@ -30,7 +30,6 @@ struct MockNotificationPrivate;
30
30
31class MockNotification : public QObject {
31class MockNotification : public QObject {
32 Q_OBJECT
32 Q_OBJECT
33− Q_ENUMS(Type Urgency)
34 Q_PROPERTY(QString summary READ getSummary WRITE setSummary NOTIFY summaryChanged)
33 Q_PROPERTY(QString summary READ getSummary WRITE setSummary NOTIFY summaryChanged)
35 Q_PROPERTY(QString body READ getBody WRITE setBody NOTIFY bodyChanged)
34 Q_PROPERTY(QString body READ getBody WRITE setBody NOTIFY bodyChanged)
36 Q_PROPERTY(int nid READ getID WRITE setID NOTIFY idChanged)
35 Q_PROPERTY(int nid READ getID WRITE setID NOTIFY idChanged)
@@ -48,7 +47,9 @@ private:
48
47
49public:
48public:
50 enum Urgency { Low, Normal, Critical };
49 enum Urgency { Low, Normal, Critical };
50+ Q_ENUM(Urgency)
51 enum Type { PlaceHolder, Confirmation, Ephemeral, Interactive, SnapDecision };
51 enum Type { PlaceHolder, Confirmation, Ephemeral, Interactive, SnapDecision };
52+ Q_ENUM(Type)
52
53
53Q_SIGNALS:
54Q_SIGNALS:
54 void summaryChanged(const QString &summary);
55 void summaryChanged(const QString &summary);
tests/mocks/Unity/Screens/screens.cpp+1−1
@@ -30,7 +30,7 @@ Screens::Screens(QObject *parent) :
30 m_screenList.append(new Screen());
30 m_screenList.append(new Screen());
31}
31}
32
32
33−Screens::~Screens()
33+Screens::~Screens() noexcept
34{
34{
35 qDeleteAll(m_screenList);
35 qDeleteAll(m_screenList);
36 m_screenList.clear();
36 m_screenList.clear();
tests/mocks/Unity/Screens/screens.h+1−1
@@ -25,7 +25,6 @@ class Screen;
25class Screens : public QAbstractListModel
25class Screens : public QAbstractListModel
26{
26{
27 Q_OBJECT
27 Q_OBJECT
28− Q_ENUMS(OutputTypes)
29
28
30 Q_PROPERTY(int count READ count NOTIFY countChanged)
29 Q_PROPERTY(int count READ count NOTIFY countChanged)
31
30
@@ -52,6 +51,7 @@ public:
52 TV,
51 TV,
53 EDP
52 EDP
54 };
53 };
54+ Q_ENUM(OutputTypes)
55
55
56 explicit Screens(QObject *parent = 0);
56 explicit Screens(QObject *parent = 0);
57 virtual ~Screens() noexcept;
57 virtual ~Screens() noexcept;
tests/mocks/Unity/fake_previewwidgetmodel.h+1−1
@@ -23,7 +23,7 @@
23#include <QSharedPointer>
23#include <QSharedPointer>
24#include <QVariantMap>
24#include <QVariantMap>
25
25
26−class PreviewData;
26+struct PreviewData;
27
27
28class PreviewWidgetModel : public unity::shell::scopes::PreviewWidgetModelInterface
28class PreviewWidgetModel : public unity::shell::scopes::PreviewWidgetModelInterface
29{
29{
tests/mocks/Unity/fake_scopes.cpp+1−1
@@ -272,7 +272,7 @@ void Scopes::addScope(Scope* scope)
272 beginInsertRows(QModelIndex(), index, index);
272 beginInsertRows(QModelIndex(), index, index);
273 m_scopes.append(scope);
273 m_scopes.append(scope);
274 endInsertRows();
274 endInsertRows();
275− connect(scope, &Scope::favoriteChanged, [this, scope]{
275+ connect(scope, &Scope::favoriteChanged, this, [this, scope]{
276 setFavorite(scope->id(), scope->favorite());
276 setFavorite(scope->id(), scope->favorite());
277 });
277 });
278 }
278 }
tests/mocks/Unity/fake_scopesoverview.h+2
@@ -34,6 +34,8 @@ public:
34 void setSearchQuery(const QString& search_query) override;
34 void setSearchQuery(const QString& search_query) override;
35 Q_INVOKABLE void activate(QVariant const& result, QString const& categoryId) override;
35 Q_INVOKABLE void activate(QVariant const& result, QString const& categoryId) override;
36
36
37+ using Scope::setFavorite;
38+
37 // This is implementation detail
39 // This is implementation detail
38 void setFavorite(Scope *scope, bool favorite);
40 void setFavorite(Scope *scope, bool favorite);
39 void moveFavoriteTo(Scope *scope, int index);
41 void moveFavoriteTo(Scope *scope, int index);
tests/mocks/Utils/windowstatestorage.h+1−3
@@ -25,7 +25,6 @@ class WindowStateStorage: public QObject
25{
25{
26 Q_OBJECT
26 Q_OBJECT
27 Q_PROPERTY(QVariantMap geometry READ geometry WRITE setGeometry NOTIFY geometryChanged)
27 Q_PROPERTY(QVariantMap geometry READ geometry WRITE setGeometry NOTIFY geometryChanged)
28− Q_ENUMS(WindowState)
29public:
28public:
30 enum WindowState {
29 enum WindowState {
31 WindowStateNormal = 1 << 0,
30 WindowStateNormal = 1 << 0,
@@ -42,10 +41,9 @@ public:
42 WindowStateMaximizedBottomRight = 1 << 11,
41 WindowStateMaximizedBottomRight = 1 << 11,
43 WindowStateRestored = 1 << 12
42 WindowStateRestored = 1 << 12
44 };
43 };
44+ Q_ENUM(WindowState)
45 Q_DECLARE_FLAGS(WindowStates, WindowState)
45 Q_DECLARE_FLAGS(WindowStates, WindowState)
46−#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
47 Q_FLAG(WindowStates)
46 Q_FLAG(WindowStates)
48−#endif
49
47
50 WindowStateStorage(QObject *parent = 0);
48 WindowStateStorage(QObject *parent = 0);
51
49
tests/mocks/libusermetrics/CMakeLists.txt+1
@@ -10,6 +10,7 @@ qt5_use_modules(MockUserMetrics Gui)
10
10
11include_directories(
11include_directories(
12 ${CMAKE_SOURCE_DIR}/plugins/Utils
12 ${CMAKE_SOURCE_DIR}/plugins/Utils
13+ ${CMAKE_CURRENT_BINARY_DIR}
13)
14)
14
15
15set_target_properties(MockUserMetrics PROPERTIES
16set_target_properties(MockUserMetrics PROPERTIES
tests/mocks/libusermetrics/ColorTheme.cpp+4
@@ -30,6 +30,8 @@ namespace UserMetricsOutput
30
30
31class ColorThemePrivate: QObject
31class ColorThemePrivate: QObject
32{
32{
33+ Q_OBJECT
34+
33public:
35public:
34 explicit ColorThemePrivate(ColorTheme *parent = 0);
36 explicit ColorThemePrivate(ColorTheme *parent = 0);
35
37
@@ -126,3 +128,5 @@ QColor ColorTheme::end() const
126{
128{
127 return d_ptr->m_end;
129 return d_ptr->m_end;
128}
130}
131+
132+#include "ColorTheme.moc"
tests/mocks/libusermetrics/UserMetrics.cpp+5
@@ -36,6 +36,7 @@ class UserMetricsPrivate;
36
36
37class Q_DECL_EXPORT UserMetricsData: public QObject
37class Q_DECL_EXPORT UserMetricsData: public QObject
38{
38{
39+ Q_OBJECT
39public:
40public:
40 explicit UserMetricsData(QObject *parent);
41 explicit UserMetricsData(QObject *parent);
41
42
@@ -64,6 +65,7 @@ private:
64
65
65class UserMetricsPrivate: QObject
66class UserMetricsPrivate: QObject
66{
67{
68+ Q_OBJECT
67public:
69public:
68 explicit UserMetricsPrivate(UserMetrics *parent);
70 explicit UserMetricsPrivate(UserMetrics *parent);
69
71
@@ -106,6 +108,7 @@ private:
106
108
107class UserMetricsDataPrivate: QObject
109class UserMetricsDataPrivate: QObject
108{
110{
111+ Q_OBJECT
109public:
112public:
110 explicit UserMetricsDataPrivate(UserMetricsData *parent);
113 explicit UserMetricsDataPrivate(UserMetricsData *parent);
111
114
@@ -492,3 +495,5 @@ UserMetrics * UserMetrics::getInstance()
492{
495{
493 return new UserMetrics();
496 return new UserMetrics();
494}
497}
498+
499+#include "UserMetrics.moc"
tests/plugins/Dash/horizontaljournaltest.cpp+2−1
@@ -30,6 +30,7 @@
30#include <paths.h>
30#include <paths.h>
31
31
32class WidthModel : public QAbstractListModel {
32class WidthModel : public QAbstractListModel {
33+ Q_OBJECT
33public:
34public:
34 QHash<int, QByteArray> roleNames() const override
35 QHash<int, QByteArray> roleNames() const override
35 {
36 {
@@ -87,7 +88,7 @@ private:
87 {
88 {
88 QTRY_COMPARE(item->x(), x);
89 QTRY_COMPARE(item->x(), x);
89 QTRY_COMPARE(item->y(), y);
90 QTRY_COMPARE(item->y(), y);
90− QTRY_COMPARE(item->width(), model->stringList()[modelIndex].toDouble());
91+ QTRY_COMPARE(item->width(), model->stringList().at(modelIndex).toDouble());
91 QTRY_COMPARE(QQuickItemPrivate::get(item)->culled, !visible);
92 QTRY_COMPARE(QQuickItemPrivate::get(item)->culled, !visible);
92 }
93 }
93
94
tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp+1
@@ -30,6 +30,7 @@
30
30
31class StringListModel : public QAbstractListModel
31class StringListModel : public QAbstractListModel
32{
32{
33+ Q_OBJECT
33public:
34public:
34 StringListModel()
35 StringListModel()
35 {
36 {
tests/plugins/Dash/organicgridtest.cpp+1
@@ -30,6 +30,7 @@
30#include <paths.h>
30#include <paths.h>
31
31
32class DummyModel : public QAbstractListModel {
32class DummyModel : public QAbstractListModel {
33+ Q_OBJECT
33public:
34public:
34 DummyModel() : m_count(0) {}
35 DummyModel() : m_count(0) {}
35
36
tests/plugins/Dash/verticaljournaltest.cpp+2−1
@@ -30,6 +30,7 @@
30#include <paths.h>
30#include <paths.h>
31
31
32class HeightModel : public QAbstractListModel {
32class HeightModel : public QAbstractListModel {
33+ Q_OBJECT
33public:
34public:
34 QHash<int, QByteArray> roleNames() const override
35 QHash<int, QByteArray> roleNames() const override
35 {
36 {
@@ -102,7 +103,7 @@ private:
102 QTRY_COMPARE(item.m_modelIndex, modelIndex);
103 QTRY_COMPARE(item.m_modelIndex, modelIndex);
103 QTRY_COMPARE(item.x(), x);
104 QTRY_COMPARE(item.x(), x);
104 QTRY_COMPARE(item.y(), y);
105 QTRY_COMPARE(item.y(), y);
105− QTRY_COMPARE(item.height(), model->stringList()[modelIndex].toDouble());
106+ QTRY_COMPARE(item.height(), model->stringList().at(modelIndex).toDouble());
106 QTRY_COMPARE(QQuickItemPrivate::get(item.m_item)->culled, !visible);
107 QTRY_COMPARE(QQuickItemPrivate::get(item.m_item)->culled, !visible);
107 }
108 }
108
109
tests/plugins/Greeter/Unity/Launcher/launchermodelastest.cpp−1
@@ -35,7 +35,6 @@ class LauncherModelASTest : public QObject
35 Q_OBJECT
35 Q_OBJECT
36
36
37private:
37private:
38− LauncherModel *launcherModel;
39 QStringList users;
38 QStringList users;
40 QHash<QString, QList<QVariantMap>> mockProperties;
39 QHash<QString, QList<QVariantMap>> mockProperties;
41
40
tests/plugins/Unity/Launcher/launchermodeltest.cpp+5−5
@@ -102,7 +102,7 @@ public:
102 }
102 }
103 return nullptr;
103 return nullptr;
104 }
104 }
105− unityapi::ApplicationInfoInterface *findApplicationWithSurface(unityapi::MirSurfaceInterface* surface) const override {
105+ unityapi::ApplicationInfoInterface *findApplicationWithSurface(unityapi::MirSurfaceInterface* /*surface*/) const override {
106 return nullptr;
106 return nullptr;
107 }
107 }
108 unity::shell::application::ApplicationInfoInterface *startApplication(const QString &, const QStringList &) override { return nullptr; }
108 unity::shell::application::ApplicationInfoInterface *startApplication(const QString &, const QStringList &) override { return nullptr; }
@@ -518,14 +518,14 @@ private Q_SLOTS:
518 QCOMPARE(spy.count(), 2);
518 QCOMPARE(spy.count(), 2);
519
519
520 QVariantList countEmissionArgs = spy.takeFirst();
520 QVariantList countEmissionArgs = spy.takeFirst();
521− QCOMPARE(countEmissionArgs.at(0).value<QModelIndex>().row(), index);
521+ QCOMPARE(countEmissionArgs.at(0).toModelIndex().row(), index);
522− QCOMPARE(countEmissionArgs.at(1).value<QModelIndex>().row(), index);
522+ QCOMPARE(countEmissionArgs.at(1).toModelIndex().row(), index);
523 QVector<int> roles = countEmissionArgs.at(2).value<QVector<int> >();
523 QVector<int> roles = countEmissionArgs.at(2).value<QVector<int> >();
524 QCOMPARE(roles.first(), (int)LauncherModel::RoleCount);
524 QCOMPARE(roles.first(), (int)LauncherModel::RoleCount);
525
525
526 QVariantList countVisibleEmissionArgs = spy.takeFirst();
526 QVariantList countVisibleEmissionArgs = spy.takeFirst();
527− QCOMPARE(countVisibleEmissionArgs.at(0).value<QModelIndex>().row(), index);
527+ QCOMPARE(countVisibleEmissionArgs.at(0).toModelIndex().row(), index);
528− QCOMPARE(countVisibleEmissionArgs.at(1).value<QModelIndex>().row(), index);
528+ QCOMPARE(countVisibleEmissionArgs.at(1).toModelIndex().row(), index);
529 roles = countVisibleEmissionArgs.at(2).value<QVector<int> >();
529 roles = countVisibleEmissionArgs.at(2).value<QVector<int> >();
530 QVERIFY(roles.contains(LauncherModel::RoleCountVisible));
530 QVERIFY(roles.contains(LauncherModel::RoleCountVisible));
531 QVERIFY(roles.contains(LauncherModel::RoleAlerting));
531 QVERIFY(roles.contains(LauncherModel::RoleAlerting));
tests/uqmlscene/main.cpp+3−3
@@ -245,7 +245,7 @@ static int displayOptionsDialog(Options *options)
245
245
246static bool checkVersion(const QUrl &url)
246static bool checkVersion(const QUrl &url)
247{
247{
248− if (!qgetenv("QMLSCENE_IMPORT_NAME").isEmpty())
248+ if (!qEnvironmentVariableIsEmpty("QMLSCENE_IMPORT_NAME"))
249 qWarning("QMLSCENE_IMPORT_NAME is no longer supported.");
249 qWarning("QMLSCENE_IMPORT_NAME is no longer supported.");
250
250
251 QString fileName = url.toLocalFile();
251 QString fileName = url.toLocalFile();
@@ -389,9 +389,9 @@ int main(int argc, char ** argv)
389 Options options;
389 Options options;
390
390
391 QStringList imports;
391 QStringList imports;
392− QList<QPair<QString, QString> > bundles;
392+ QVector<QPair<QString, QString> > bundles;
393 for (int i = 1; i < argc; ++i) {
393 for (int i = 1; i < argc; ++i) {
394− if (*argv[i] != '-' && QFileInfo(QFile::decodeName(argv[i])).exists()) {
394+ if (*argv[i] != '-' && QFileInfo::exists(QFile::decodeName(argv[i]))) {
395 options.file = QUrl::fromLocalFile(argv[i]);
395 options.file = QUrl::fromLocalFile(argv[i]);
396 } else {
396 } else {
397 const QString lowerArgument = QString::fromLatin1(argv[i]).toLower();
397 const QString lowerArgument = QString::fromLatin1(argv[i]).toLower();
tests/utils/modules/Unity/Test/testutil.cpp+1−1
@@ -103,7 +103,7 @@ TouchEventSequenceWrapper *TestUtil::touchEvent(QQuickItem *item)
103void TestUtil::ensureTargetWindow()
103void TestUtil::ensureTargetWindow()
104{
104{
105 if (!m_targetWindow && !QGuiApplication::topLevelWindows().isEmpty())
105 if (!m_targetWindow && !QGuiApplication::topLevelWindows().isEmpty())
106− m_targetWindow = QGuiApplication::topLevelWindows()[0];
106+ m_targetWindow = QGuiApplication::topLevelWindows().at(0);
107}
107}
108
108
109void TestUtil::ensureTouchDevice()
109void TestUtil::ensureTouchDevice()