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