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