on xenial help sign in
add subtitle support
commite07f589fd2cd0b1cb31fd9eac920619a4e8ecae9 authorAlbert Astals <albert.astals@canonical.com> dateMon 6 Oct 2014, 10:52 (12 years ago) parenta8760ae
3 files changed+24−7
qml/Dash/ScopesListCategory.qml+1 qml/Dash/ScopesListCategoryItem.qml+21−7 tests/mocks/Unity/fake_scopesoverview.cpp+2
qml/Dash/ScopesListCategory.qml+1
@@ -75,6 +75,7 @@ Item {
7575
7676 icon: model.art || ""
7777 text: model.title || ""
78+ subtext: model.subtitle || ""
7879 showStar: model.scopeId != "clickscope" && (root.isFavoritesFeed || root.isOtherFeed)
7980 isFavorite: root.isFavoritesFeed
8081
qml/Dash/ScopesListCategoryItem.qml+21−7
@@ -14,7 +14,8 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.0
17+import QtQuick 2.3
18+import QtQuick.Layouts 1.1
1819import Ubuntu.Components 1.1
1920
2021MouseArea {
@@ -22,6 +23,7 @@ MouseArea {
2223
2324 property alias icon: shapeImage.source
2425 property alias text: titleLabel.text
26+ property alias subtext: subtitleLabel.text
2527 property alias showStar: star.visible
2628
2729 property bool isFavorite: false
@@ -41,8 +43,8 @@ MouseArea {
4143 fillMode: Image.PreserveAspectCrop
4244 }
4345 }
44− Label {
45− id: titleLabel
46+
47+ ColumnLayout {
4648 anchors {
4749 left: shape.right
4850 leftMargin: units.gu(1)
@@ -50,10 +52,22 @@ MouseArea {
5052 rightMargin: units.gu(1)
5153 verticalCenter: parent.verticalCenter
5254 }
53− elide: Text.ElideRight
54− wrapMode: Text.Wrap
55− maximumLineCount: 1
56− verticalAlignment: Text.AlignHCenter
55+ Label {
56+ id: titleLabel
57+ elide: Text.ElideRight
58+ wrapMode: Text.Wrap
59+ maximumLineCount: 1
60+ verticalAlignment: Text.AlignHCenter
61+ }
62+ Label {
63+ id: subtitleLabel
64+ elide: Text.ElideRight
65+ fontSize: "xx-small"
66+ wrapMode: Text.Wrap
67+ maximumLineCount: 1
68+ verticalAlignment: Text.AlignHCenter
69+ visible: text != ""
70+ }
5771 }
5872 MouseArea {
5973 id: starArea
tests/mocks/Unity/fake_scopesoverview.cpp+2
@@ -304,6 +304,8 @@ QVariant ScopesOverviewResultsModel::data(const QModelIndex& index, int role) co
304304 return scope ? scope->id() : QString("Result.%1.%2").arg(categoryId()).arg(index.row());
305305 case RoleTitle:
306306 return scope ? scope->name() : QString("Title.%1.%2").arg(categoryId()).arg(index.row());
307+ case RoleSubtitle:
308+ return scope && scope->name() == "Videos" ? "tube, movies, cinema" : QString();
307309 case RoleArt:
308310 return qmlDirectory() + "graphics/applicationIcons/dash.png";
309311 case RoleMascot: