on xenial help sign in
QSortFilterProxyModelQML -> UnitySortFilterProxyModelQML

Someone copied the class to the sdk (but with less features...) so we better rename, class and qml name collisions are not cool Fixes: #1403758 Approved by: Michael Zanetti, PS Jenkins bot

commite1c9b1abf2f1c92a487217420b0258994f413147 authorAlbert Astals <albert.astals@canonical.com> dateFri 9 Jan 2015, 10:39 (12 years ago) parent94796fd1d84651
15 files changed+50−50
plugins/LightDM/CMakeLists.txt+1−1 plugins/LightDM/UsersModel.cpp+1−1 plugins/LightDM/UsersModel.h+2−2 plugins/Utils/CMakeLists.txt+1−1 plugins/Utils/plugin.cpp+2−2 plugins/Utils/qsortfilterproxymodelqml.cpp → plugins/Utils/unitysortfilterproxymodelqml.cpp+15−15 plugins/Utils/qsortfilterproxymodelqml.h → plugins/Utils/unitysortfilterproxymodelqml.h+5−5 qml/Dash/GenericScopeView.qml+2−2 qml/Notifications/Notifications.qml+1−1 qml/Panel/Indicators/VisibleIndicators.qml+2−2 tests/mocks/LightDM/CMakeLists.txt+1−1 tests/plugins/Utils/CMakeLists.txt+1−1 tests/plugins/Utils/qsortfilterproxymodeltest.cpp → tests/plugins/Utils/unitysortfilterproxymodeltest.cpp+14−14 tests/qmltests/Components/tst_ResponsiveVerticalJournal.qml+1−1 tests/qmltests/tst_Shell.qml+1−1
plugins/LightDM/CMakeLists.txt+1−1
@@ -15,7 +15,7 @@ include_directories(
1515)
1616
1717set(QMLPLUGIN_SRC
18− ../Utils/qsortfilterproxymodelqml.cpp # FIXME evaluate a more generic approach for using other plugins
18+ ../Utils/unitysortfilterproxymodelqml.cpp # FIXME evaluate a more generic approach for using other plugins
1919 DBusGreeter.cpp
2020 DBusGreeterList.cpp
2121 Greeter.cpp
plugins/LightDM/UsersModel.cpp+1−1
@@ -58,7 +58,7 @@ QVariant MangleModel::data(const QModelIndex &index, int role) const
5858// **** Now we continue with actual UsersModel class ****
5959
6060UsersModel::UsersModel(QObject* parent)
61− : QSortFilterProxyModelQML(parent)
61+ : UnitySortFilterProxyModelQML(parent)
6262{
6363 setModel(new MangleModel(this));
6464 setSortCaseSensitivity(Qt::CaseInsensitive);
plugins/LightDM/UsersModel.h+2−2
@@ -23,10 +23,10 @@
2323#ifndef UNITY_USERSMODEL_H
2424#define UNITY_USERSMODEL_H
2525
26−#include <qsortfilterproxymodelqml.h>
26+#include <unitysortfilterproxymodelqml.h>
2727#include <QtCore/QObject>
2828
29−class UsersModel : public QSortFilterProxyModelQML
29+class UsersModel : public UnitySortFilterProxyModelQML
3030{
3131 Q_OBJECT
3232
plugins/Utils/CMakeLists.txt+1−1
@@ -12,7 +12,7 @@ include_directories(
1212
1313set(QMLPLUGIN_SRC
1414 qlimitproxymodelqml.cpp
15− qsortfilterproxymodelqml.cpp
15+ unitysortfilterproxymodelqml.cpp
1616 relativetimeformatter.cpp
1717 timeformatter.cpp
1818 unitymenumodelpaths.cpp
plugins/Utils/plugin.cpp+2−2
@@ -27,7 +27,7 @@
2727
2828// local
2929#include "qlimitproxymodelqml.h"
30−#include "qsortfilterproxymodelqml.h"
30+#include "unitysortfilterproxymodelqml.h"
3131#include "relativetimeformatter.h"
3232#include "timeformatter.h"
3333#include "unitymenumodelpaths.h"
@@ -39,7 +39,7 @@ void UtilsPlugin::registerTypes(const char *uri)
3939 Q_ASSERT(uri == QLatin1String("Utils"));
4040 qmlRegisterType<QAbstractItemModel>();
4141 qmlRegisterType<QLimitProxyModelQML>(uri, 0, 1, "LimitProxyModel");
42− qmlRegisterType<QSortFilterProxyModelQML>(uri, 0, 1, "SortFilterProxyModel");
42+ qmlRegisterType<UnitySortFilterProxyModelQML>(uri, 0, 1, "UnitySortFilterProxyModel");
4343 qmlRegisterType<UnityMenuModelPaths>(uri, 0, 1, "UnityMenuModelPaths");
4444 qmlRegisterType<TimeFormatter>(uri, 0, 1, "TimeFormatter");
4545 qmlRegisterType<WindowKeysFilter>(uri, 0, 1, "WindowKeysFilter");
plugins/Utils/qsortfilterproxymodelqml.cpp → plugins/Utils/unitysortfilterproxymodelqml.cpprenamed+15−15
@@ -15,12 +15,12 @@
1515 */
1616
1717// self
18−#include "qsortfilterproxymodelqml.h"
18+#include "unitysortfilterproxymodelqml.h"
1919
2020// Qt
2121#include <QDebug>
2222
23−QSortFilterProxyModelQML::QSortFilterProxyModelQML(QObject *parent)
23+UnitySortFilterProxyModelQML::UnitySortFilterProxyModelQML(QObject *parent)
2424 : QSortFilterProxyModel(parent)
2525 , m_invertMatch(false)
2626{
@@ -32,7 +32,7 @@ QSortFilterProxyModelQML::QSortFilterProxyModelQML(QObject *parent)
3232/*
3333 * Enter row index of filtered/sorted model, returns row index of source model
3434 */
35−int QSortFilterProxyModelQML::mapRowToSource(int row)
35+int UnitySortFilterProxyModelQML::mapRowToSource(int row)
3636{
3737 if (sourceModel() == nullptr)
3838 return -1;
@@ -40,13 +40,13 @@ int QSortFilterProxyModelQML::mapRowToSource(int row)
4040 return QSortFilterProxyModel::mapToSource(index(row, 0)).row();
4141}
4242
43−QHash<int, QByteArray> QSortFilterProxyModelQML::roleNames() const
43+QHash<int, QByteArray> UnitySortFilterProxyModelQML::roleNames() const
4444{
4545 return sourceModel() ? sourceModel()->roleNames() : QHash<int, QByteArray>();
4646}
4747
4848void
49−QSortFilterProxyModelQML::setModel(QAbstractItemModel *itemModel)
49+UnitySortFilterProxyModelQML::setModel(QAbstractItemModel *itemModel)
5050{
5151 if (itemModel == nullptr) {
5252 return;
@@ -69,7 +69,7 @@ QSortFilterProxyModelQML::setModel(QAbstractItemModel *itemModel)
6969}
7070
7171QVariantMap
72−QSortFilterProxyModelQML::get(int row)
72+UnitySortFilterProxyModelQML::get(int row)
7373{
7474 QVariantMap res;
7575 const QHash<int, QByteArray> roles = roleNames();
@@ -81,7 +81,7 @@ QSortFilterProxyModelQML::get(int row)
8181}
8282
8383QVariant
84−QSortFilterProxyModelQML::data(int row, int role)
84+UnitySortFilterProxyModelQML::data(int row, int role)
8585{
8686 if (sourceModel() == nullptr) {
8787 return QVariant();
@@ -91,7 +91,7 @@ QSortFilterProxyModelQML::data(int row, int role)
9191}
9292
9393int
94−QSortFilterProxyModelQML::totalCount() const
94+UnitySortFilterProxyModelQML::totalCount() const
9595{
9696 if (sourceModel() != nullptr) {
9797 return sourceModel()->rowCount();
@@ -101,19 +101,19 @@ QSortFilterProxyModelQML::totalCount() const
101101}
102102
103103int
104−QSortFilterProxyModelQML::count()
104+UnitySortFilterProxyModelQML::count()
105105{
106106 return rowCount();
107107}
108108
109109bool
110−QSortFilterProxyModelQML::invertMatch() const
110+UnitySortFilterProxyModelQML::invertMatch() const
111111{
112112 return m_invertMatch;
113113}
114114
115115void
116−QSortFilterProxyModelQML::setInvertMatch(bool invertMatch)
116+UnitySortFilterProxyModelQML::setInvertMatch(bool invertMatch)
117117{
118118 if (invertMatch != m_invertMatch) {
119119 m_invertMatch = invertMatch;
@@ -123,7 +123,7 @@ QSortFilterProxyModelQML::setInvertMatch(bool invertMatch)
123123}
124124
125125bool
126−QSortFilterProxyModelQML::filterAcceptsRow(int sourceRow,
126+UnitySortFilterProxyModelQML::filterAcceptsRow(int sourceRow,
127127 const QModelIndex &sourceParent) const
128128{
129129 // If there's no regexp set, always accept all rows indepenently of the invertMatch setting
@@ -136,7 +136,7 @@ QSortFilterProxyModelQML::filterAcceptsRow(int sourceRow,
136136}
137137
138138int
139−QSortFilterProxyModelQML::findFirst(int role, const QVariant& value) const
139+UnitySortFilterProxyModelQML::findFirst(int role, const QVariant& value) const
140140{
141141 QModelIndexList matches = match(index(0, 0), role, value, 1, Qt::MatchExactly);
142142 if (!matches.isEmpty()) {
@@ -147,7 +147,7 @@ QSortFilterProxyModelQML::findFirst(int role, const QVariant& value) const
147147}
148148
149149int
150−QSortFilterProxyModelQML::mapFromSource(int row)
150+UnitySortFilterProxyModelQML::mapFromSource(int row)
151151{
152152 if (sourceModel() != nullptr) {
153153 return QSortFilterProxyModel::mapFromSource(sourceModel()->index(row, 0)).row();
@@ -157,7 +157,7 @@ QSortFilterProxyModelQML::mapFromSource(int row)
157157}
158158
159159int
160−QSortFilterProxyModelQML::mapToSource(int row)
160+UnitySortFilterProxyModelQML::mapToSource(int row)
161161{
162162 if (sourceModel() != nullptr) {
163163 return QSortFilterProxyModel::mapToSource(index(row, 0)).row();
plugins/Utils/qsortfilterproxymodelqml.h → plugins/Utils/unitysortfilterproxymodelqml.hrenamed+5−5
@@ -14,12 +14,12 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#ifndef QSORTFILTERPROXYMODELQML_H
18−#define QSORTFILTERPROXYMODELQML_H
17+#ifndef UNITYSORTFILTERPROXYMODELQML_H
18+#define UNITYSORTFILTERPROXYMODELQML_H
1919
2020#include <QSortFilterProxyModel>
2121
22−class QSortFilterProxyModelQML : public QSortFilterProxyModel
22+class UnitySortFilterProxyModelQML : public QSortFilterProxyModel
2323{
2424 Q_OBJECT
2525
@@ -29,7 +29,7 @@ class QSortFilterProxyModelQML : public QSortFilterProxyModel
2929 Q_PROPERTY(bool invertMatch READ invertMatch WRITE setInvertMatch NOTIFY invertMatchChanged)
3030
3131public:
32− explicit QSortFilterProxyModelQML(QObject *parent = 0);
32+ explicit UnitySortFilterProxyModelQML(QObject *parent = 0);
3333
3434 Q_INVOKABLE QVariantMap get(int row); // Use with caution, it can be slow to query all the roles
3535 Q_INVOKABLE QVariant data(int row, int role);
@@ -60,4 +60,4 @@ private:
6060 bool m_invertMatch;
6161};
6262
63−#endif // QSORTFILTERPROXYMODELQML_H
63+#endif // UNITYSORTFILTERPROXYMODELQML_H
qml/Dash/GenericScopeView.qml+2−2
@@ -28,7 +28,7 @@ FocusScope {
2828 readonly property bool navigationShown: pageHeaderLoader.item ? pageHeaderLoader.item.bottomItem[0].openList : false
2929 property bool forceNonInteractive: false
3030 property var scope: null
31− property SortFilterProxyModel categories: categoryFilter
31+ property UnitySortFilterProxyModel categories: categoryFilter
3232 property bool isCurrent: false
3333 property alias moving: categoryView.moving
3434 property bool hasBackAction: false
@@ -106,7 +106,7 @@ FocusScope {
106106 value: isCurrent && !subPageLoader.open
107107 }
108108
109− SortFilterProxyModel {
109+ UnitySortFilterProxyModel {
110110 id: categoryFilter
111111 model: scope ? scope.categories : null
112112 dynamicSortFilter: true
qml/Notifications/Notifications.qml+1−1
@@ -29,7 +29,7 @@ ListView {
2929 property real margin
3030 property bool useModal: snapDecisionProxyModel.count > 0
3131
32− SortFilterProxyModel {
32+ UnitySortFilterProxyModel {
3333 id: snapDecisionProxyModel
3434 objectName: "snapDecisionProxyModel"
3535
qml/Panel/Indicators/VisibleIndicators.qml+2−2
@@ -22,13 +22,13 @@ import Unity.Indicators 0.1 as Indicators
2222import Utils 0.1
2323
2424Item {
25− property SortFilterProxyModel model: filterModel
25+ property UnitySortFilterProxyModel model: filterModel
2626
2727 function initialise(profile) {
2828 indicatorsModel.load(profile);
2929 }
3030
31− SortFilterProxyModel {
31+ UnitySortFilterProxyModel {
3232 id: filterModel
3333 filterRole: Indicators.IndicatorsModelRole.IsVisible
3434 filterRegExp: RegExp("^true$")
tests/mocks/LightDM/CMakeLists.txt+1−1
@@ -24,7 +24,7 @@ set(QMLPLUGIN_SRC
2424 ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
2525 ${CMAKE_SOURCE_DIR}/plugins/LightDM/plugin.cpp
2626 ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
27− ${CMAKE_SOURCE_DIR}/plugins/Utils/qsortfilterproxymodelqml.cpp
27+ ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
2828 )
2929
3030add_library(MockLightDM-qml MODULE
tests/plugins/Utils/CMakeLists.txt+1−1
@@ -23,7 +23,7 @@ endmacro(run_tests)
2323
2424run_tests(
2525 qlimitproxymodeltest
26− qsortfilterproxymodeltest
26+ unitysortfilterproxymodeltest
2727 timeformattertest
2828 )
2929
tests/plugins/Utils/qsortfilterproxymodeltest.cpp → tests/plugins/Utils/unitysortfilterproxymodeltest.cpprenamed+14−14
@@ -18,7 +18,7 @@
1818 */
1919
2020// local
21−#include "qsortfilterproxymodelqml.h"
21+#include "unitysortfilterproxymodelqml.h"
2222#include "modeltest.h"
2323
2424// Qt
@@ -91,7 +91,7 @@ private:
9191 QHash<int, QByteArray> m_roles;
9292};
9393
94−class QSortFilterProxyModelTest : public QObject
94+class UnitySortFilterProxyModelTest : public QObject
9595{
9696 Q_OBJECT
9797
@@ -103,7 +103,7 @@ private Q_SLOTS:
103103
104104 void testRoleNamesSetAfter()
105105 {
106− QSortFilterProxyModelQML proxy;
106+ UnitySortFilterProxyModelQML proxy;
107107 MockListModel model;
108108 QHash<int, QByteArray> roles;
109109
@@ -117,7 +117,7 @@ private Q_SLOTS:
117117
118118 void testRoleNamesSetBefore()
119119 {
120− QSortFilterProxyModelQML proxy;
120+ UnitySortFilterProxyModelQML proxy;
121121 MockListModel model;
122122 QHash<int, QByteArray> roles;
123123
@@ -131,7 +131,7 @@ private Q_SLOTS:
131131
132132 void testCountSetAfter()
133133 {
134− QSortFilterProxyModelQML proxy;
134+ UnitySortFilterProxyModelQML proxy;
135135 MockListModel model;
136136 model.insertRows(0, 5);
137137
@@ -144,7 +144,7 @@ private Q_SLOTS:
144144
145145 void testCountInsert()
146146 {
147− QSortFilterProxyModelQML proxy;
147+ UnitySortFilterProxyModelQML proxy;
148148 MockListModel model;
149149
150150 proxy.setModel(&model);
@@ -158,7 +158,7 @@ private Q_SLOTS:
158158
159159 void testCountRemove()
160160 {
161− QSortFilterProxyModelQML proxy;
161+ UnitySortFilterProxyModelQML proxy;
162162 MockListModel model;
163163 model.insertRows(0, 5);
164164
@@ -173,7 +173,7 @@ private Q_SLOTS:
173173 }
174174
175175 void testInvertMatch() {
176− QSortFilterProxyModelQML proxy;
176+ UnitySortFilterProxyModelQML proxy;
177177 MockListModel model;
178178
179179 proxy.setModel(&model);
@@ -215,7 +215,7 @@ private Q_SLOTS:
215215 }
216216
217217 void testNestedProxyRoleNames() {
218− QSortFilterProxyModelQML proxy1, proxy2;
218+ UnitySortFilterProxyModelQML proxy1, proxy2;
219219 MockListModel model;
220220 QHash<int, QByteArray> roles;
221221 roles[0] = "role0";
@@ -229,7 +229,7 @@ private Q_SLOTS:
229229 }
230230
231231 void testModelTest() {
232− QSortFilterProxyModelQML proxy;
232+ UnitySortFilterProxyModelQML proxy;
233233 MockListModel model;
234234
235235 proxy.setModel(&model);
@@ -246,7 +246,7 @@ private Q_SLOTS:
246246 }
247247
248248 void testModelChanged() {
249− QSortFilterProxyModelQML proxy;
249+ UnitySortFilterProxyModelQML proxy;
250250 MockListModel model, model2;
251251
252252 QSignalSpy spyOnModelChanged(&proxy, SIGNAL(modelChanged()));
@@ -265,7 +265,7 @@ private Q_SLOTS:
265265 }
266266
267267 void testData() {
268− QSortFilterProxyModelQML proxy;
268+ UnitySortFilterProxyModelQML proxy;
269269 MockListModel model, model2;
270270
271271 QStringList rows;
@@ -285,6 +285,6 @@ private Q_SLOTS:
285285 }
286286};
287287
288−QTEST_GUILESS_MAIN(QSortFilterProxyModelTest)
288+QTEST_GUILESS_MAIN(UnitySortFilterProxyModelTest)
289289
290−#include "qsortfilterproxymodeltest.moc"
290+#include "unitysortfilterproxymodeltest.moc"
tests/qmltests/Components/tst_ResponsiveVerticalJournal.qml+1−1
@@ -79,7 +79,7 @@ Item {
7979 ListElement { name: "U" }
8080 }
8181
82− SortFilterProxyModel {
82+ UnitySortFilterProxyModel {
8383 id: wrappedFakeModel
8484 model: fakeModel
8585 }
tests/qmltests/tst_Shell.qml+1−1
@@ -222,7 +222,7 @@ Item {
222222
223223 notifications.model = mockNotificationsModel;
224224
225− // FIXME: Hack: SortFilterProxyModelQML doesn't work with QML ListModels which we use
225+ // FIXME: Hack: UnitySortFilterProxyModelQML doesn't work with QML ListModels which we use
226226 // for mocking here (RoleType can't be found in the QML model). As we only need to show
227227 // one SnapDecision lets just disable the filtering and make appear any notification as a
228228 // SnapDecision.