Sayonara Player
GUI_Playlist.h
1 /* GUI_Playlist.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 /*
23  * GUI_Playlist.h
24  *
25  * Created on: Apr 6, 2011
26  * Author: Lucio Carreras
27  */
28 
29 #ifndef GUI_PLAYLIST_H_
30 #define GUI_PLAYLIST_H_
31 
32 #include "GUI/Playlist/ui_GUI_Playlist.h"
33 
34 #include "Helper/Message/GlobalMessage.h"
35 #include "Helper/Library/LibraryNamespaces.h"
36 #include "Helper/SetFwd.h"
37 
38 #include "Components/PlayManager/PlayState.h"
39 #include "Components/Playlist/PlaylistDBInterface.h"
40 
41 #include <QTextEdit>
42 
43 class PlayManager;
44 class PlaylistView;
45 class PlaylistHandler;
46 
47 namespace Ui { class Playlist_Window; }
48 
49 class GUI_Playlist :
50  public SayonaraWidget
51 {
52  Q_OBJECT
53 
54 public:
55  explicit GUI_Playlist(QWidget *parent=nullptr);
56  ~GUI_Playlist();
57 
58 private:
59  PlayManager* _play_manager=nullptr;
60  PlaylistHandler* _playlist=nullptr;
61  Playlist::Type _playlist_type;
62  Ui::Playlist_Window* ui=nullptr;
63 
64 private:
65  PlaylistView* get_view_by_idx(int idx);
66  PlaylistView* get_current_view();
67 
68  void init_shortcuts();
69  void set_total_time_label();
70 
72  void resizeEvent(QResizeEvent *e) override;
73  void language_changed() override;
74  void skin_changed() override;
75 
76  void dragEnterEvent(QDragEnterEvent* event) override;
77  void dragLeaveEvent(QDragLeaveEvent* event) override;
78  void dropEvent(QDropEvent* event) override;
79  void dragMoveEvent(QDragMoveEvent* event) override;
80  void changeEvent(QEvent* e) override;
81 
82  GlobalMessage::Answer show_save_message_box(PlaylistDBInterface::SaveAsAnswer answer);
83 
84 private slots:
85 
86  void load_old_playlists();
87 
88  // triggered from playlist
89  void playlist_track_changed(int row, int pl_idx); // GUI_Playlist.cpp
90  void playlist_fill(PlaylistPtr pl); // GUI_Playlist.cpp
91  void playlist_added(PlaylistPtr pl); // GUI_PlaylistTabs.cpp
92  void playlist_name_changed(int pl_idx);// GUI_PlaylistTabs.cpp
93  void playlist_changed(int pl_idx);
94  void playlist_idx_changed(int pld_idx);
95 
96  // triggered by GUI
97  void tab_close_playlist_clicked(int pl_idx); // GUI_PlaylistTabs.cpp
98  void tab_save_playlist_clicked(int pl_idx); // GUI_PlaylistTabs.cpp
99  void tab_save_playlist_as_clicked(int pl_idx, const QString& str); // GUI_PlaylistTabs.cpp
100  void tab_rename_clicked(int pl_idx, const QString& str);
101  void tab_delete_playlist_clicked(int pl_idx); // GUI_PlaylistTabs.cpp
102  void tab_metadata_dropped(int pl_idx, const MetaDataList& v_md);
103  void open_file_clicked(int pl_idx);
104  void open_dir_clicked(int pl_idx);
105  void delete_tracks_clicked(const SP::Set<int>& rows);
106 
107  void check_tab_icon();
108  void check_playlist_menu(PlaylistConstPtr pl);
109  void check_playlist_name(PlaylistConstPtr pl);
110 
111  void double_clicked(int row);
112 
113  void add_playlist_button_pressed();
114 
115  void clear_button_pressed(int pl_idx);
116 
117  void select_tab_left();
118  void select_tab_right();
119 
120 
121  // called by playmanager
122  void playstate_changed(PlayState state);
123  void playlist_finished();
124  void playlist_time_changed();
125 
126 
127  void _sl_show_numbers_changed();
128  void _sl_show_clear_button_changed();
129  void _sl_library_path_changed();
130 };
131 
132 #endif /* GUI_PLAYLIST_H_ */
Definition: ui_GUI_Playlist.h:134
Definition: ui_GUI_SomaFM.h:216
Definition: MetaDataList.h:39
Definition: PlaylistView.h:48
Widget with Settings connection. Also contains triggers for language_changed() and skin_changed() wi...
Definition: SayonaraWidget.h:36
Definition: GUI_Playlist.h:49
Global handler for current playback state (Singleton)
Definition: PlayManager.h:37
std::shared_ptr< AbstractPlaylist > PlaylistPtr
PlaylistPtr Playlist Pointer (only used internally)
Definition: PlaylistFwd.h:27
std::shared_ptr< const AbstractPlaylist > PlaylistConstPtr
PlaylistConstPtr read only Playlist Pointer.
Definition: PlaylistFwd.h:41
Global handler for playlists.
Definition: PlaylistHandler.h:57
A set structure. Inherited from std::set with some useful methods. For integer and String this set is...
Definition: AbstractPlaylist.h:37
PlayState
The PlayState enum.
Definition: PlayState.h:30