Optionally appending current playlist to selected playlist if it exists
[someplayer] / src / playerform.h
1 /*
2  * SomePlayer - An alternate music player for Maemo 5
3  * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (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 Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19
20 #ifndef PLAYERFORM_H
21 #define PLAYERFORM_H
22
23 #include <QWidget>
24 #include "someplayer.h"
25 #include "playlist.h"
26 #include <QStandardItemModel>
27 #include "player/player.h"
28 #include <QSlider>
29 #include <QMenu>
30 #include <QTime>
31 #include "trackrenderer.h"
32 #include "tagresolver.h"
33
34 namespace Ui {
35     class PlayerForm;
36 }
37
38 using SomePlayer::DataObjects::Library;
39 using SomePlayer::DataObjects::Playlist;
40 using SomePlayer::DataObjects::Track;
41 using SomePlayer::Playback::Player;
42 using SomePlayer::Playback::PlayerState;
43 using SomePlayer::DataObjects::TagResolver;
44
45 class PlayerForm : public QWidget
46 {
47     Q_OBJECT
48
49 public:
50         explicit PlayerForm(Library *lib, QWidget *parent = 0);
51     ~PlayerForm();
52 signals:
53         void library();
54         void showSearchPanel();
55         void hideSearchPanel();
56
57 public slots:
58         void reload();
59         void search(QString &);
60         void nextItem();
61         void prevItem();
62         void cancelSearch();
63         void addFiles(QList<QString> files);
64         void stop();
65
66 private slots:
67         void _library();
68         void _toggle_view();
69         void _process_click(QModelIndex);
70         void _track_changed(Track);
71         void _tick(int, int);
72         void _slider_released();
73         void _custom_context_venu_requested ( const QPoint & pos );
74         void _delete_track();
75         void _enqueue_track();
76         void _add_to_favorites();
77         void _add_to_playlists();
78         void _edit_tags();
79         void _state_changed(PlayerState);
80         void _toggle_repeat();
81         void _toggle_random();
82         void _toggle_volume();
83         void _track_decoded(Track);
84         void _volume_changed();
85
86 private:
87     Ui::PlayerForm *ui;
88         Library *_lib;
89         Playlist _current_playlist;
90         QTime *_time;
91         QStandardItemModel *_model;
92         Player *_player;
93         QSlider *_seek_slider;
94         QMenu *_context_menu;
95         QString _search_pattern;
96
97         TrackRenderer *_track_renderer;
98         TagResolver *_tag_resolver;
99         void _display_track(Track);
100         int _search_current_id;
101 };
102
103 #endif // PLAYERFORM_H