Version bump
[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/abstractplayer.h"
28 #include "player/playerfactory.h"
29 #include <QSlider>
30 #include <QMenu>
31 #include <QTime>
32 #include <QPushButton>
33 #include "trackrenderer.h"
34 #include "tagresolver.h"
35 #include "dbusadaptor.h"
36 #include "toolswidget.h"
37 #include "coverfinder.h"
38 #include "clickablelabel.h"
39 #include "playlistsortform.h"
40
41 namespace Ui {
42     class PlayerForm;
43 }
44
45 using SomePlayer::DataObjects::Library;
46 using SomePlayer::DataObjects::Playlist;
47 using SomePlayer::DataObjects::Track;
48 using SomePlayer::Playback::AbstractPlayer;
49 using SomePlayer::Playback::PlayerState;
50 using SomePlayer::DataObjects::TagResolver;
51
52 class PlayerForm : public QWidget
53 {
54     Q_OBJECT
55
56 public:
57         explicit PlayerForm(Library *lib, QWidget *parent = 0);
58         ~PlayerForm();
59         bool isEqualizerEnabled() { return _player->equalizerEnabled(); }
60         bool isEqualizerAvailable() { return _player->equalizerAvailable(); }
61         QString playerCaption();
62
63 signals:
64         void library();
65         void fullscreen(bool);
66         void clearPlaylist();
67         void refreshLibrary();
68         void dirView();
69         void trackChanged();
70
71 public slots:
72         void reload(bool);
73         void search(QString);
74         void nextItem();
75         void prevItem();
76         void cancelSearch();
77         void addFiles(QList<QString> files);
78         void stop();
79         void setEqualizerValue(int band, double value) { _player->setEqualizerValue(band, value); }
80         void equalizerValue(int band, double *value) { _player->equalizerValue(band, value); }
81         void enableEqualizer() { _player->enableEqualizer(); }
82         void disableEqualizer() { _player->disableEqualizer(); }
83         void portraitMode();
84         void landscapeMode();
85         void updateIcons();
86         void checkGradient();
87         void play(Track);
88         void next();
89         void prev();
90         void toggle();
91         void toggleRandom();
92         void toggleView();
93         void showCountdown(QString);
94         void hideCountdown();
95         void updateTranslations();
96         void updateTrackColor();
97         void toggleRepeat();
98         void toggleToolsWidget();
99
100 private slots:
101         void _library();
102         void _dirview();
103         void _process_click(QModelIndex);
104         void _track_changed(Track);
105         void _tick(int, int);
106         void _slider_released();
107         void _custom_context_menu_requested ( const QPoint & pos );
108         void _delete_track();
109         void _c_delete_track();
110         void _enqueue_track();
111         void _add_to_favorites();
112         void _c_add_to_favorites();
113         void _add_to_playlists();
114         void _c_add_to_playlists();
115         void _edit_tags();
116         void _c_edit_tags();
117         void _state_changed(PlayerState);
118         void _track_decoded(Track);
119         void _display_cover(QImage);
120         void _toggle_extra_buttons();
121         void _start_playlist();
122         void _sort_playlist();
123         void _playlist_sorted();
124
125 private:
126     Ui::PlayerForm *ui;
127         Library *_lib;
128         Playlist _current_playlist;
129         ClickableLabel *_cover;
130         QTime *_time;
131         QStandardItemModel *_model;
132         CoverFinder *_coverfinder;
133         AbstractPlayer *_player;
134         QSlider *_seek_slider;
135         QMenu *_context_menu;
136         QString _search_pattern;
137         ToolsWidget *_tools_widget;
138         QPushButton *_fscreen_button;
139         bool landscape;
140         QString _icons_theme;
141         QString _top_gradient;
142         QString _bottom_gradient;
143         bool _show_extra_buttons;
144
145         QAction *__clear_playlist;
146         QAction *__delete_action;
147         QAction *__add_to_favorites;
148         QAction *__enqueue_action;
149         QAction *__add_to_playlists;
150         QAction *__edit_tags;
151
152         TrackRenderer *_track_renderer;
153         TagResolver *_tag_resolver;
154         void _display_track(Track);
155         int _search_current_id;
156
157         DBusAdaptop *_dbusadaptor;
158
159         PlaylistSortForm *_pls_sort_form;
160 };
161
162 #endif // PLAYERFORM_H