Added application config. Moved application data from /tmp to ~/.someplayer
[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 "trackrenderer.h"
32
33 namespace Ui {
34     class PlayerForm;
35 }
36
37 using SomePlayer::DataObjects::Library;
38 using SomePlayer::DataObjects::Playlist;
39 using SomePlayer::DataObjects::Track;
40 using SomePlayer::Playback::Player;
41 using SomePlayer::Playback::PlayerState;
42
43 class PlayerForm : public QWidget
44 {
45     Q_OBJECT
46
47 public:
48         explicit PlayerForm(Library *lib, QWidget *parent = 0);
49     ~PlayerForm();
50 signals:
51         void library();
52         void showSearchPanel();
53         void hideSearchPanel();
54
55 public slots:
56         void reload();
57         void search(QString &);
58         void nextItem();
59         void prevItem();
60         void cancelSearch();
61
62 private slots:
63         void _library();
64         void _toggle_view();
65         void _process_click(QModelIndex);
66         void _track_changed(Track);
67         void _tick(int, int);
68         void _slider_released();
69         void _custom_context_venu_requested ( const QPoint & pos );
70         void _delete_track();
71         void _enqueue_track();
72         void _add_to_favorites();
73         void _state_changed(PlayerState);
74         void _toggle_repeat();
75         void _toggle_random();
76
77 private:
78     Ui::PlayerForm *ui;
79         Library *_lib;
80         Playlist _current_playlist;
81         QTime *_time;
82         QStandardItemModel *_model;
83         Player *_player;
84         QSlider *_seek_slider;
85         QMenu *_context_menu;
86         QString _search_pattern;
87
88         TrackRenderer *_track_renderer;
89         void _display_track(Track);
90         int _search_current_id;
91 };
92
93 #endif // PLAYERFORM_H