on xenial help sign in
rolenames come from interface
2d05265Albert Astals
tests/mocks/Unity/fake_categories.cpp−22
@@ -25,22 +25,6 @@ Categories::Categories(int category_count, QObject* parent)
25 : m_category_count(category_count)
25 : m_category_count(category_count)
26{
26{
27 setParent(parent);
27 setParent(parent);
28−
29− m_roles[Categories::RoleCategoryId] = "categoryId";
30− m_roles[Categories::RoleName] = "name";
31− m_roles[Categories::RoleIcon] = "icon";
32− m_roles[Categories::RoleRawRendererTemplate] = "rawRendererTemplate";
33− m_roles[Categories::RoleRenderer] = "renderer";
34− m_roles[Categories::RoleComponents] = "components";
35− m_roles[Categories::RoleProgressSource] = "progressSource";
36− m_roles[Categories::RoleResults] = "results";
37− m_roles[Categories::RoleCount] = "count";
38−}
39−
40−QHash<int, QByteArray>
41−Categories::roleNames() const
42−{
43− return m_roles;
44}
28}
45
29
46int Categories::rowCount(const QModelIndex& /*parent*/) const
30int Categories::rowCount(const QModelIndex& /*parent*/) const
@@ -127,9 +111,6 @@ Categories::data(const QModelIndex& index, int role) const
127 map["title"] = "HOLA";
111 map["title"] = "HOLA";
128 return map;
112 return map;
129 }
113 }
130− case RoleProgressSource:
131− qFatal("Using un-implemented RoleProgressSource Categories role");
132− return QVariant();
133 case RoleResults:
114 case RoleResults:
134 return QVariant();
115 return QVariant();
135 case RoleCount:
116 case RoleCount:
@@ -165,9 +146,6 @@ Categories::data(const QModelIndex& index, int role) const
165 map["title"] = "HOLA";
146 map["title"] = "HOLA";
166 return map;
147 return map;
167 }
148 }
168− case RoleProgressSource:
169− qFatal("Using un-implemented RoleProgressSource Categories role");
170− return QVariant();
171 case RoleResults:
149 case RoleResults:
172 return QVariant::fromValue(resultsModel);
150 return QVariant::fromValue(resultsModel);
173 case RoleCount:
151 case RoleCount:
tests/mocks/Unity/fake_categories.h−2
@@ -32,7 +32,6 @@ public:
32 Categories(int category_count, QObject* parent = 0);
32 Categories(int category_count, QObject* parent = 0);
33
33
34 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
34 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
35− QHash<int, QByteArray> roleNames() const override;
36 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
35 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
37
36
38 Q_INVOKABLE void addSpecialCategory(QString const& categoryId, QString const& name, QString const& icon, QString const& rawTemplate, QObject* countObject) override;
37 Q_INVOKABLE void addSpecialCategory(QString const& categoryId, QString const& name, QString const& icon, QString const& rawTemplate, QObject* countObject) override;
@@ -43,7 +42,6 @@ private Q_SLOTS:
43
42
44private:
43private:
45 mutable QHash<int, ResultsModel*> m_resultsModels;
44 mutable QHash<int, ResultsModel*> m_resultsModels;
46− QHash<int, QByteArray> m_roles;
47 int m_category_count;
45 int m_category_count;
48
46
49 struct CategoryData {
47 struct CategoryData {
tests/mocks/Unity/fake_previewmodel.cpp−9
@@ -36,15 +36,6 @@ PreviewModel::PreviewModel(QObject* parent)
36 m_previewWidgetModels.append(columnModel);
36 m_previewWidgetModels.append(columnModel);
37}
37}
38
38
39−QHash<int, QByteArray> PreviewModel::roleNames() const
40−{
41− QHash<int, QByteArray> roles;
42−
43− roles[Roles::RoleColumnModel] = "columnModel";
44−
45− return roles;
46−}
47−
48void PreviewModel::setWidgetColumnCount(int count)
39void PreviewModel::setWidgetColumnCount(int count)
49{
40{
50 if (count != 1) {
41 if (count != 1) {
tests/mocks/Unity/fake_previewmodel.h−2
@@ -33,7 +33,6 @@ public:
33 explicit PreviewModel(QObject* parent = 0);
33 explicit PreviewModel(QObject* parent = 0);
34
34
35 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
35 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
36− QHash<int, QByteArray> roleNames() const override;
37 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
36 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
38
37
39 void setWidgetColumnCount(int count) override;
38 void setWidgetColumnCount(int count) override;
@@ -43,7 +42,6 @@ public:
43 void setProcessingAction(bool processing);
42 void setProcessingAction(bool processing);
44
43
45private:
44private:
46− QHash<int, QByteArray> m_roles;
47 QList<PreviewWidgetModel*> m_previewWidgetModels;
45 QList<PreviewWidgetModel*> m_previewWidgetModels;
48};
46};
49
47
tests/mocks/Unity/fake_previewstack.cpp−9
@@ -32,15 +32,6 @@ PreviewStack::~PreviewStack()
32{
32{
33}
33}
34
34
35−QHash<int, QByteArray> PreviewStack::roleNames() const
36−{
37− QHash<int, QByteArray> roles;
38−
39− roles[Roles::RolePreviewModel] = "previewModel";
40−
41− return roles;
42−}
43−
44void PreviewStack::setWidgetColumnCount(int columnCount)
35void PreviewStack::setWidgetColumnCount(int columnCount)
45{
36{
46 if (columnCount != 1) {
37 if (columnCount != 1) {
tests/mocks/Unity/fake_previewstack.h−1
@@ -34,7 +34,6 @@ public:
34 virtual ~PreviewStack();
34 virtual ~PreviewStack();
35
35
36 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
36 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
37− QHash<int, QByteArray> roleNames() const override;
38 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
37 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
39
38
40 Q_INVOKABLE unity::shell::scopes::PreviewModelInterface* get(int index) const override;
39 Q_INVOKABLE unity::shell::scopes::PreviewModelInterface* get(int index) const override;
tests/mocks/Unity/fake_previewwidgetmodel.cpp−9
@@ -39,10 +39,6 @@ PreviewWidgetModel::PreviewWidgetModel(QObject* parent)
39{
39{
40 setParent(parent);
40 setParent(parent);
41
41
42− m_roles[Roles::RoleWidgetId] = "widgetId";
43− m_roles[Roles::RoleType] = "type";
44− m_roles[Roles::RoleProperties] = "properties";
45−
46 populateWidgets();
42 populateWidgets();
47}
43}
48
44
@@ -62,11 +58,6 @@ void PreviewWidgetModel::populateWidgets()
62
58
63}
59}
64
60
65−QHash<int, QByteArray> PreviewWidgetModel::roleNames() const
66−{
67− return m_roles;
68−}
69−
70int PreviewWidgetModel::rowCount(const QModelIndex&) const
61int PreviewWidgetModel::rowCount(const QModelIndex&) const
71{
62{
72 return m_previewWidgets.size();
63 return m_previewWidgets.size();
tests/mocks/Unity/fake_previewwidgetmodel.h−2
@@ -33,11 +33,9 @@ public:
33 explicit PreviewWidgetModel(QObject* parent = 0);
33 explicit PreviewWidgetModel(QObject* parent = 0);
34
34
35 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
35 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
36− QHash<int, QByteArray> roleNames() const override;
37 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
36 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
38
37
39private:
38private:
40− QHash<int, QByteArray> m_roles;
41 QList<QSharedPointer<PreviewData>> m_previewWidgets;
39 QList<QSharedPointer<PreviewData>> m_previewWidgets;
42
40
43 void populateWidgets();
41 void populateWidgets();
tests/mocks/Unity/fake_resultsmodel.cpp−17
@@ -27,17 +27,6 @@ ResultsModel::ResultsModel(int result_count, int categoryId, QObject* parent)
27 , m_categoryId(categoryId)
27 , m_categoryId(categoryId)
28{
28{
29 setParent(parent);
29 setParent(parent);
30−
31− m_roles[ResultsModel::RoleUri] = "uri";
32− m_roles[ResultsModel::RoleCategoryId] = "categoryId";
33− m_roles[ResultsModel::RoleDndUri] = "dndUri";
34− m_roles[ResultsModel::RoleResult] = "result";
35− m_roles[ResultsModel::RoleTitle] = "title";
36− m_roles[ResultsModel::RoleArt] = "art";
37− m_roles[ResultsModel::RoleSubtitle] = "subtitle";
38− m_roles[ResultsModel::RoleMascot] = "mascot";
39− m_roles[ResultsModel::RoleEmblem] = "emblem";
40− m_roles[ResultsModel::RoleSummary] = "summary";
41}
30}
42
31
43QString ResultsModel::categoryId() const
32QString ResultsModel::categoryId() const
@@ -50,12 +39,6 @@ void ResultsModel::setCategoryId(QString const& /*id*/)
50 qFatal("Calling un-implemented ResultsModel::setCategoryId");
39 qFatal("Calling un-implemented ResultsModel::setCategoryId");
51}
40}
52
41
53−QHash<int, QByteArray>
54−ResultsModel::roleNames() const
55−{
56− return m_roles;
57−}
58−
59int ResultsModel::rowCount(const QModelIndex& parent) const
42int ResultsModel::rowCount(const QModelIndex& parent) const
60{
43{
61 Q_UNUSED(parent);
44 Q_UNUSED(parent);
tests/mocks/Unity/fake_resultsmodel.h−2
@@ -31,7 +31,6 @@ public:
31 explicit ResultsModel(int result_count, int categoryId, QObject* parent = 0);
31 explicit ResultsModel(int result_count, int categoryId, QObject* parent = 0);
32
32
33 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
33 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
34− QHash<int, QByteArray> roleNames() const override;
35 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
34 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
36
35
37 Q_INVOKABLE QVariant get(int row) const override;
36 Q_INVOKABLE QVariant get(int row) const override;
@@ -44,7 +43,6 @@ public:
44 void setCategoryId(QString const& id) override;
43 void setCategoryId(QString const& id) override;
45
44
46private:
45private:
47− QHash<int, QByteArray> m_roles;
48 int m_result_count;
46 int m_result_count;
49 int m_categoryId;
47 int m_categoryId;
50};
48};
tests/mocks/Unity/fake_scopes.cpp−10
@@ -29,11 +29,6 @@ Scopes::Scopes(QObject *parent) : m_loaded(false)
29{
29{
30 setParent(parent);
30 setParent(parent);
31
31
32− m_roles[Scopes::RoleScope] = "scope";
33− m_roles[Scopes::RoleId] = "id";
34− m_roles[Scopes::RoleVisible] = "visible";
35− m_roles[Scopes::RoleTitle] = "title";
36−
37 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
32 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
38 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
33 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
39 QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
34 QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
@@ -83,11 +78,6 @@ void Scopes::load()
83 timer.start();
78 timer.start();
84}
79}
85
80
86−QHash<int, QByteArray> Scopes::roleNames() const
87−{
88− return m_roles;
89−}
90−
91int Scopes::rowCount(const QModelIndex&) const
81int Scopes::rowCount(const QModelIndex&) const
92{
82{
93 return m_scopes.count();
83 return m_scopes.count();
tests/mocks/Unity/fake_scopes.h−2
@@ -47,7 +47,6 @@ public:
47 Q_INVOKABLE void load();
47 Q_INVOKABLE void load();
48
48
49 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
49 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
50− QHash<int, QByteArray> roleNames() const;
51 QModelIndex parent ( const QModelIndex & index ) const;
50 QModelIndex parent ( const QModelIndex & index ) const;
52
51
53 bool loaded() const override;
52 bool loaded() const override;
@@ -62,7 +61,6 @@ private Q_SLOTS:
62
61
63private:
62private:
64 QList<Scope*> m_scopes;
63 QList<Scope*> m_scopes;
65− QHash<int, QByteArray> m_roles;
66 bool m_loaded;
64 bool m_loaded;
67 QTimer timer;
65 QTimer timer;
68};
66};