Added countdown label
[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 <QPushButton>
32 #include "trackrenderer.h"
33 #include "tagresolver.h"
34 #include "dbusadaptor.h"
35 #include "toolswidget.h"
36
37 namespace Ui {
38     class PlayerForm;
39 }
40
41 using SomePlayer::DataObjects::Library;
42 using SomePlayer::DataObjects::Playlist;
43 using SomePlayer::DataObjects::Track;
44 using SomePlayer::Playback::Player;
45 using SomePlayer::Playback::PlayerState;
46 using SomePlayer::DataObjects::TagResolver;
47
48 class PlayerForm : public QWidget
49 {
50     Q_OBJECT
51
52 public:
53         explicit PlayerForm(Library *lib, QWidget *parent = 0);
54         ~PlayerForm();
55         bool isEqualizerEnabled() { return _player->equalizerEnabled(); }
56         bool isEqualizerAvailable() { return _player->equalizerAvailable(); }
57
58 signals:
59         void library();
60         void fullscreen(bool);
61         void clearPlaylist();
62         void refreshLibrary();
63         void dirView();
64
65 public slots:
66         void reload(bool);
67         void search(QString);
68         void nextItem();
69         void prevItem();
70         void cancelSearch();
71         void addFiles(QList<QString> files);
72         void stop();
73         void setEqualizerValue(int band, double value) { _player->setEqualizerValue(band, value); }
74         void equalizerValue(int band, double *value) { _player->equalizerValue(band, value); }
75         void enableEqualizer() { _player->enableEqualizer(); }
76         void disableEqualizer() { _player->disableEqualizer(); }
77         void portraitMode();
78         void landscapeMode();
79         void updateIcons();
80         void checkGradient();
81         void play(Track);
82         void showCountdown(QString);
83         void hideCountdown();
84
85 private slots:
86         void _library();
87         void _dirview();
88         void _toggle_view();
89         void _process_click(QModelIndex);
90         void _track_changed(Track);
91         void _tick(int, int);
92         void _slider_released();
93         void _custom_context_menu_requested ( const QPoint & pos );
94         void _delete_track();
95         void _enqueue_track();
96         void _add_to_favorites();
97         void _add_to_playlists();
98         void _edit_tags();
99         void _state_changed(PlayerState);
100         void _toggle_repeat();
101         void _toggle_random();
102         void _track_decoded(Track);
103         void _tools_widget_toggle();
104
105 private:
106     Ui::PlayerForm *ui;
107         Library *_lib;
108         Playlist _current_playlist;
109         QTime *_time;
110         QStandardItemModel *_model;
111         Player *_player;
112         QSlider *_seek_slider;
113         QMenu *_context_menu;
114         QString _search_pattern;
115         ToolsWidget *_tools_widget;
116         QPushButton *_fscreen_button;
117         bool landscape;
118         QString _icons_theme;
119         QString _top_gradient;
120         QString _bottom_gradient;
121
122         TrackRenderer *_track_renderer;
123         TagResolver *_tag_resolver;
124         void _display_track(Track);
125         int _search_current_id;
126
127         DBusAdaptop *_dbusadaptor;
128 };
129
130 #endif // PLAYERFORM_H