~ubuntu-branches/ubuntu/saucy/clementine/saucy

« back to all changes in this revision

Viewing changes to src/playlist/playlistview.h

  • Committer: Package Import Robot
  • Author(s): Thomas PIERSON
  • Date: 2012-01-01 20:43:39 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120101204339-lsb6nndwhfy05sde
Tags: 1.0.1+dfsg-1
New upstream release. (Closes: #653926, #651611, #657391)

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
// the caller set in the QStyleOption.  That breaks our currently playing track
41
41
// animation, which relies on the background painted by Qt to be transparent.
42
42
// This proxy style uses QCleanlooksStyle to paint the affected elements.
 
43
// This class is used by the global search view as well.
43
44
class PlaylistProxyStyle : public QProxyStyle {
44
45
public:
45
46
  PlaylistProxyStyle(QStyle* base);
55
56
 
56
57
class PlaylistView : public QTreeView {
57
58
  Q_OBJECT
58
 
 
 
59
  Q_PROPERTY(bool background_enabled 
 
60
             READ background_enabled 
 
61
             WRITE set_background_enabled 
 
62
             NOTIFY BackgroundPropertyChanged)
59
63
 public:
60
64
  PlaylistView(QWidget* parent = 0);
61
65
 
62
66
  static const int kStateVersion;
63
67
 
 
68
  static ColumnAlignmentMap DefaultColumnAlignment();
 
69
 
64
70
  void SetItemDelegates(LibraryBackend* backend);
65
71
  void SetPlaylist(Playlist* playlist);
66
72
  void RemoveSelected();
68
74
  void SetReadOnlySettings(bool read_only) { read_only_settings_ = read_only; }
69
75
 
70
76
  Playlist* playlist() const { return playlist_; }
 
77
  bool      background_enabled() const { return background_enabled_; }
 
78
  Qt::Alignment column_alignment(int section) const;
71
79
 
72
80
  // QTreeView
73
81
  void drawTree(QPainter* painter, const QRegion& region) const;
74
82
  void drawRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
75
83
  void keyPressEvent(QKeyEvent* event);
76
 
  void setModel(QAbstractItemModel *model);
 
84
  void setModel(QAbstractItemModel* model);
77
85
 
78
86
 public slots:
79
87
  void ReloadSettings();
83
91
  void JumpToLastPlayedTrack();
84
92
  void closeEditor(QWidget* editor, QAbstractItemDelegate::EndEditHint hint);
85
93
  void DynamicModeChanged(bool dynamic);
 
94
  void SetColumnAlignment(int section, Qt::Alignment alignment);
86
95
 
87
96
 signals:
88
97
  void PlayItem(const QModelIndex& index);
90
99
  void RightClicked(const QPoint& global_pos, const QModelIndex& index);
91
100
  void SeekTrack(int gap);
92
101
  void FocusOnFilterSignal(QKeyEvent *event);
 
102
  void BackgroundPropertyChanged();
 
103
  void ColumnAlignmentChanged(const ColumnAlignmentMap& alignment);
93
104
 
94
105
 protected:
 
106
  // QWidget
95
107
  void contextMenuEvent(QContextMenuEvent* e);
96
108
  void hideEvent(QHideEvent* event);
97
109
  void showEvent(QShowEvent* event);
99
111
  void mouseMoveEvent(QMouseEvent* event);
100
112
  void mousePressEvent(QMouseEvent* event);
101
113
  void leaveEvent(QEvent*);
102
 
  void scrollContentsBy(int dx, int dy);
103
114
  void paintEvent(QPaintEvent *event);
104
115
  void dragMoveEvent(QDragMoveEvent *event);
105
116
  void dragEnterEvent(QDragEnterEvent *event);
108
119
  void resizeEvent(QResizeEvent* event);
109
120
  bool eventFilter(QObject* object, QEvent* event);
110
121
 
 
122
  // QAbstractScrollArea
 
123
  void scrollContentsBy(int dx, int dy);
 
124
 
 
125
  // QAbstractItemView
 
126
  void rowsInserted(const QModelIndex& parent, int start, int end);
 
127
 
111
128
 private slots:
112
129
  void LoadGeometry();
113
130
  void SaveGeometry();
129
146
  void UpdateCachedCurrentRowPixmap(QStyleOptionViewItemV4 option,
130
147
                                    const QModelIndex& index);
131
148
 
 
149
  inline void set_background_enabled(bool bg) { background_enabled_ = bg; emit BackgroundPropertyChanged(); }
 
150
 
132
151
 private:
133
152
  static const int kGlowIntensitySteps;
134
153
  static const int kAutoscrollGraceTimeout;
140
159
  QModelIndex PrevEditableIndex(const QModelIndex& current);
141
160
 
142
161
  void RepositionDynamicControls();
143
 
 
 
162
  
144
163
  PlaylistProxyStyle* style_;
145
164
  Playlist* playlist_;
146
165
  PlaylistHeader* header_;
147
166
  bool setting_initial_header_layout_;
 
167
  bool upgrading_from_qheaderview_;
148
168
  bool read_only_settings_;
149
169
 
 
170
  bool background_enabled_;
 
171
 
150
172
  bool glow_enabled_;
151
173
  bool currently_glowing_;
152
174
  QBasicTimer glow_timer_;
177
199
  bool drag_over_;
178
200
 
179
201
  DynamicPlaylistControls* dynamic_controls_;
 
202
 
 
203
  ColumnAlignmentMap column_alignment_;
180
204
};
181
205
 
182
206
#endif // PLAYLISTVIEW_H