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