Qmmp
jumptotrackdialog_p.h
1 /***************************************************************************
2  * Copyright (C) 2007-2022 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef JUMPTOTRACKDIALOG_P_H
22 #define JUMPTOTRACKDIALOG_P_H
23 
24 #include <QDialog>
25 #include <QList>
26 #include <QSet>
27 #include "metadataformatter.h"
28 #include "ui_jumptotrackdialog.h"
29 
30 class TrackListModel;
31 class QSortFilterProxyModel;
32 class QEvent;
33 class PlayListManager;
34 class PlayListModel;
35 
40 class JumpToTrackDialog : public QDialog, private Ui::JumpToTrackDialog
41 {
42  Q_OBJECT
43 
44 public:
45  enum { QueueRole = Qt::UserRole + 1 };
46 
47  explicit JumpToTrackDialog(PlayListModel *model, QWidget* parent = nullptr);
48  ~JumpToTrackDialog();
49 
50 private slots:
51  void on_queuePushButton_clicked();
52  void on_jumpToPushButton_clicked();
53  void jumpTo(const QModelIndex&);
54  void queueUnqueue(const QModelIndex&,const QModelIndex&);
55 
56 private:
57  bool eventFilter(QObject *o, QEvent *e) override;
58  TrackListModel* m_listModel;
59  QSortFilterProxyModel* m_proxyModel;
60  PlayListManager *m_pl_manager;
61  PlayListModel *m_model;
62  QList<int> m_indexes;
63  QHash<int, QString> m_queueText;
64 };
65 
70 class TrackListModel : public QAbstractListModel
71 {
72  Q_OBJECT
73 public:
74  explicit TrackListModel(PlayListModel *model, QObject *parent);
75 
76  QVariant data(const QModelIndex &index, int role) const override;
77  int rowCount(const QModelIndex &parent) const override;
78 
79 private slots:
80  void onListChanged(int flags);
81 
82 private:
83  PlayListModel *m_model;
84  QSet<PlayListTrack *> m_queue;
85 
86 };
87 
88 
89 #endif //JUMPTOTRACKDIALOG_P_H
The PlayListManager class is used to handle multiple playlists.
Definition: playlistmanager.h:37
The PlayListModel class provides a data model for the playlist.
Definition: playlistmodel.h:97