2 * SomePlayer - An alternate music player for Maemo 5
3 * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
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.
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.
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.
24 #include "someplayer.h"
26 #include <QStandardItemModel>
27 #include <QStandardItem>
28 #include <QModelIndex>
29 #include <QItemSelectionModel>
30 #include <QItemSelection>
31 #include <QPushButton>
33 #include "toolswidget.h"
39 using SomePlayer::DataObjects::Library;
40 using SomePlayer::DataObjects::Track;
41 using SomePlayer::DataObjects::Playlist;
43 enum LibraryFormListState {STATE_NONE, STATE_ARTIST, STATE_ALBUM, STATE_TRACK, STATE_PLAYLIST, STATE_PLAYLIST_TRACK, STATE_DYNAMIC, STATE_SEARCH};
45 class LibraryForm : public QWidget
50 explicit LibraryForm(Library *lib, QWidget *parent = 0);
54 void addAndPlay(Track);
67 void _dynamic_button();
68 void _playlists_button();
69 void _toggle_select_all_button();
71 void _delete_button();
74 void _process_list_click(QModelIndex);
75 void _process_dblclick(QModelIndex);
76 void _process_selection(QItemSelection, QItemSelection);
78 void _search_button(bool);
79 void _search_in_library(QString);
84 QStandardItemModel *_model;
85 LibraryFormListState _state;
86 bool _is_dynamic; // workaround
87 QString _current_artist;
88 QString _current_album;
89 Playlist _current_playlist;
90 QList<Track> _current_tracks;
91 QString _search_pattern;
92 int _search_current_id;
93 ToolsWidget *_tools_widget;
94 QPushButton *_search_in_library_button;
97 QString _top_gradient;
98 QString _bottom_gradient;
100 void _add_artist(Playlist *cur, QString artist);
101 void _add_album(Playlist *cur, QString artist, QString album);
102 void _add_track(Playlist *cur, Track track);
103 void _add_playlist(Playlist *cur, QString name);
104 void _delete_track(Track track);
107 #endif // LIBRARYFORM_H