~ubuntu-branches/ubuntu/trusty/unity8/trusty-proposed

« back to all changes in this revision

Viewing changes to plugins/DashViews/verticaljournal.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Michal Hruby, Michał Sawicz, Albert Astals, Michał Karnicki, Allan LeSage, Andrea Cimitan, Leo Arias, Nick Dedekind, Mirco Müller, Michael Zanetti, Michael Terry, Daniel d'Andrada, Bill Filler
  • Date: 2014-01-28 15:58:45 UTC
  • mfrom: (1.1.61)
  • Revision ID: package-import@ubuntu.com-20140128155845-rgg0gscvllv5qd3q
Tags: 7.84+14.04.20140128-0ubuntu1
[ Michal Hruby ]
* Added unity-scope-tool, which will help when developing scopes.

[ Michał Sawicz ]
* Added unity-scope-tool, which will help when developing scopes.
* Use full DashContent, not just GenericScopeView in ScopeTool.qml.
* Bring Card and CardHeader over from new-scopes.
* Work around bug #1268578. (LP: #1268578)
* Drop unnecessary version dependencies.
* Return null instead of undefined from findChild and
  findInvisibleChild.
* Fix CardHeader and Card heights (empty Label does have non-zero
  height apparently). Also improve test robustness and reduce future
  diffs.

[ Albert Astals ]
* Do not assert if the item we are removing was not created yet
  (because e.g. it's not in the viewport).
* Position correctly the pointer of the search history box .
* Make test_filter_expand_expand less unstable in CI VMs Make sure
  header0 is the header0 we want to click On the CI VM stuff is a bit
  slower than on real hw and we were clicking in the wrong place.
* Add TabBar to the Dash header navigation Changes this comes with: *
  DashBar at the bottom is gone * PageHeader doesn't have a Label
  anymore, it has the childItem property where you add which thing it
  has to contain * New: PageHeaderLabel mimics the old behaviour of
  PageHeader * The header of the LVWPH of GenericScopeView is now fake
  and only used for positioning. There is a single global floating
  header in DashContent (which is a PageHeader with a TabBar as
  childItem) * The GenericScopeView previewLoader and OpenEffect have
  been also moved to the DashContent so that the openEffect includes
  the floating header in the "animation" .
* Introduce the HorizontalJournal.
* If there are no items m_firstVisibleIndex has to be -1 .
* Add some more documentation about tests to the CODING file.
* Fixes to the journal cmake tests code * Output to the correct
  filename for the test * Don't output stuff from the tryXYZ targets.
* Adapt to findChild return value changes .
* Organic Grid for the Dash View.
* Misc journal fixes Don't init *modelIndex to INT_MAX Makes no sense
  since we're not doing any qMin and the calling function also accepts
  any index >= 0 as valid so in some cases it may end up wanting to
  create an index that doesn't exist Don't refill if height() < 0,
  that gives bad ranges for from/to and the code gets confused .

[ Michał Karnicki ]
* Fix grid view column count.
* Add test for minimum number of items in a carousel.

[ Allan LeSage ]
* Add stubs for indicators autopilot tests.

[ Andrea Cimitan ]
* Avoid input falling through notifications onto surfaces below, thus
  fixing LP: #1257312. (LP: #1257312)

[ Leo Arias ]
* Close the Touch devices after the tests. (LP: #1267600)
* Added methods to scroll to other scopes on autopilot tests.
* Added autopilot helpers for the app scope and the app preview.
  Install the fake scopes in order to use them on the tests. (LP:
  #1269114)
* On autopilot helpers, wait for the scope category to appear.

[ Nick Dedekind ]
* Visual updates for indicator panel highlight and opening opacity.
* Added inidcator tests for page & item factories.
* Fixes visible indicator misalignment in indicator items/menus
  (lp#1264678). (LP: #1264678)

[ Mirco Müller ]
* Fixed the failure of notification autopilot-test
  test_sd_incoming_call.

[ Michael Zanetti ]
* clean up fullscreen notifications code.
* import qml files into cmake, drop qmlproject.
* also add qml files in tests directory.
* Added autopilot helpers for the app scope and the app preview.
  Install the fake scopes in order to use them on the tests. (LP:
  #1269114)

[ Michael Terry ]
* Fix failure to build when using the ./build script with ninja-build
  installed. (LP: #1268525)
* Point DBus-activated processes at unity8's MIR_SOCKET rather than
  the system socket.

[ Daniel d'Andrada ]
* DragHandle: Never restart hinting animation while still pressed (LP:
  #1269022)

[ Bill Filler ]
* fix for lp:1259294, turn off auto capitalization for wifi password
  field. (LP: #1259294)
* disable predictive text in Dash search field as it interferes with
  built-in search (LP: #1273643)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#ifndef VERTICALJOURNAL_H
18
18
#define VERTICALJOURNAL_H
19
19
 
20
 
#include <QQuickItem>
21
 
 
22
 
class QAbstractItemModel;
23
 
class QQmlComponent;
24
 
#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
25
 
class QQuickChangeSet;
26
 
class QQuickVisualDataModel;
27
 
#else
28
 
class QQmlChangeSet;
29
 
class QQmlDelegateModel;
30
 
#endif
 
20
#include "abstractdashview.h"
31
21
 
32
22
 /** A vertical journal is a view that creates delegates
33
23
   * based on a model and layouts them in columns following
60
50
   * +-----+
61
51
   *
62
52
   */
63
 
 class VerticalJournal : public QQuickItem
 
53
 
 
54
class VerticalJournal : public AbstractDashView
64
55
{
65
56
    Q_OBJECT
66
57
 
67
 
    Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelChanged)
68
 
    Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
69
58
    Q_PROPERTY(qreal columnWidth READ columnWidth WRITE setColumnWidth NOTIFY columnWidthChanged)
70
 
    Q_PROPERTY(qreal columnSpacing READ columnSpacing WRITE setColumnSpacing NOTIFY columnSpacingChanged)
71
 
    Q_PROPERTY(qreal rowSpacing READ rowSpacing WRITE setRowSpacing NOTIFY rowSpacingChanged)
72
 
    Q_PROPERTY(qreal delegateCreationBegin READ delegateCreationBegin
73
 
                                           WRITE setDelegateCreationBegin
74
 
                                           NOTIFY delegateCreationBeginChanged
75
 
                                           RESET resetDelegateCreationBegin)
76
 
    Q_PROPERTY(qreal delegateCreationEnd READ delegateCreationEnd
77
 
                                         WRITE setDelegateCreationEnd
78
 
                                         NOTIFY delegateCreationEndChanged
79
 
                                         RESET resetDelegateCreationEnd)
80
59
 
81
60
friend class VerticalJournalTest;
82
61
 
83
62
public:
84
63
    VerticalJournal();
85
64
 
86
 
    QAbstractItemModel *model() const;
87
 
    void setModel(QAbstractItemModel *model);
88
 
 
89
 
    QQmlComponent *delegate() const;
90
 
    void setDelegate(QQmlComponent *delegate);
91
 
 
92
65
    qreal columnWidth() const;
93
66
    void setColumnWidth(qreal columnWidth);
94
67
 
95
 
    qreal columnSpacing() const;
96
 
    void setColumnSpacing(qreal columnSpacing);
97
 
 
98
 
    qreal rowSpacing() const;
99
 
    void setRowSpacing(qreal rowSpacing);
100
 
 
101
 
    qreal delegateCreationBegin() const;
102
 
    void setDelegateCreationBegin(qreal);
103
 
    void resetDelegateCreationBegin();
104
 
 
105
 
    qreal delegateCreationEnd() const;
106
 
    void setDelegateCreationEnd(qreal);
107
 
    void resetDelegateCreationEnd();
108
 
 
109
68
Q_SIGNALS:
110
 
    void modelChanged();
111
 
    void delegateChanged();
112
69
    void columnWidthChanged();
113
 
    void columnSpacingChanged();
114
 
    void rowSpacingChanged();
115
 
    void delegateCreationBeginChanged();
116
 
    void delegateCreationEndChanged();
117
 
 
118
 
protected:
119
 
    void updatePolish();
120
 
    void componentComplete();
121
 
 
122
 
private Q_SLOTS:
123
 
#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
124
 
    void itemCreated(int modelIndex, QQuickItem *item);
125
 
    void onModelUpdated(const QQuickChangeSet &changeSet, bool reset);
126
 
#else
127
 
    void itemCreated(int modelIndex, QObject *object);
128
 
    void onModelUpdated(const QQmlChangeSet &changeSet, bool reset);
129
 
#endif
130
 
    void relayout();
131
 
    void onHeightChanged();
132
70
 
133
71
private:
134
72
    class ViewItem
144
82
            int m_modelIndex;
145
83
    };
146
84
 
147
 
    void createDelegateModel();
148
 
    void refill();
149
 
    void findBottomModelIndexToAdd(int *modelIndex, qreal *yPos);
150
 
    void findTopModelIndexToAdd(int *modelIndex, qreal *yPos);
151
 
    bool addVisibleItems(qreal fillFrom, qreal fillTo, bool asynchronous);
152
 
    bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo);
153
 
    QQuickItem *createItem(int modelIndex, bool asynchronous);
154
 
    void positionItem(int modelIndex, QQuickItem *item);
155
 
    void cleanupExistingItems();
156
 
    void releaseItem(const ViewItem &item);
157
 
    void calculateImplicitHeight();
158
 
 
 
85
    void findBottomModelIndexToAdd(int *modelIndex, qreal *yPos) override;
 
86
    void findTopModelIndexToAdd(int *modelIndex, qreal *yPos) override;
 
87
    bool removeNonVisibleItems(qreal bufferFromY, qreal bufferToY) override;
 
88
    void addItemToView(int modelIndex, QQuickItem *item) override;
 
89
    void cleanupExistingItems() override;
 
90
    void calculateImplicitHeight() override;
 
91
    void doRelayout() override;
 
92
    void updateItemCulling(qreal visibleFromY, qreal visibleToY) override;
159
93
#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
160
 
    QQuickVisualDataModel *m_delegateModel;
 
94
    void processModelRemoves(const QVector<QQuickChangeSet::Remove> &removes) override;
161
95
#else
162
 
    QQmlDelegateModel *m_delegateModel;
 
96
    void processModelRemoves(const QVector<QQmlChangeSet::Remove> &removes) override;
163
97
#endif
164
98
 
165
 
    // Index we are waiting because we requested it asynchronously
166
 
    int m_asyncRequestedIndex;
167
 
 
168
99
    QVector<QList<ViewItem>> m_columnVisibleItems;
169
100
    QHash<int, int> m_indexColumnMap;
170
101
    int m_columnWidth;
171
 
    int m_columnSpacing;
172
 
    int m_rowSpacing;
173
 
    qreal m_delegateCreationBegin;
174
 
    qreal m_delegateCreationEnd;
175
 
    bool m_delegateCreationBeginValid;
176
 
    bool m_delegateCreationEndValid;
177
 
    bool m_needsRelayout;
178
 
    bool m_delegateValidated;
179
 
    bool m_implicitHeightDirty;
180
102
};
181
103
 
182
104
#endif