File indexing completed on 2023-05-30 11:30:51
0001 /** 0002 * Copyright (C) 2002-2004 Scott Wheeler <wheeler@kde.org> 0003 * 0004 * This program is free software; you can redistribute it and/or modify it under 0005 * the terms of the GNU General Public License as published by the Free Software 0006 * Foundation; either version 2 of the License, or (at your option) any later 0007 * version. 0008 * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. 0012 * 0013 * You should have received a copy of the GNU General Public License along with 0014 * this program. If not, see <http://www.gnu.org/licenses/>. 0015 */ 0016 0017 #ifndef PLAYLISTSPLITTER_H 0018 #define PLAYLISTSPLITTER_H 0019 0020 #include <QSplitter> 0021 0022 class QStackedWidget; 0023 class QTreeWidgetItem; 0024 0025 class Playlist; 0026 class SearchWidget; 0027 class PlaylistInterface; 0028 class TagEditor; 0029 class PlaylistBox; 0030 class NowPlaying; 0031 class PlayerManager; 0032 class FileHandle; 0033 class LyricsWidget; 0034 0035 /** 0036 * This is the main layout class of JuK. It should contain a PlaylistBox and 0037 * a QStackedWidget of the Playlists. 0038 * 0039 * This class serves as a "mediator" (see "Design Patterns") between the JuK 0040 * class and the playlist classes. Thus all access to the playlist classes from 0041 * non-Playlist related classes should be through the public API of this class. 0042 */ 0043 0044 class PlaylistSplitter : public QSplitter 0045 { 0046 Q_OBJECT 0047 0048 public: 0049 PlaylistSplitter(PlayerManager *player, QWidget *parent); 0050 virtual ~PlaylistSplitter(); 0051 0052 PlaylistInterface *playlist() const; 0053 0054 signals: 0055 /** 0056 * Emitted when GUI is created and the cache is loaded. Is kind of a hack 0057 * until we move the time-intensive parts to a separate thread but then 0058 * again at least this works. 0059 */ 0060 void guiReady(); 0061 void currentPlaylistChanged(const PlaylistInterface ¤tPlaylist); 0062 0063 public slots: 0064 virtual void setFocus(); 0065 virtual void slotFocusCurrentPlaylist(); 0066 void slotEnable(); 0067 0068 private: 0069 0070 /** 0071 * This returns a pointer to the first item in the playlist on the top 0072 * of the QStackedWidget of playlists. 0073 */ 0074 Playlist *visiblePlaylist() const; 0075 0076 void setupActions(); 0077 void setupLayout(); 0078 void readConfig(); 0079 void saveConfig(); 0080 0081 private slots: 0082 0083 /** 0084 * Updates the visible search results based on the result of the search 0085 * associated with the currently visible playlist. 0086 */ 0087 void slotShowSearchResults(); 0088 void slotPlaylistSelectionChanged(); 0089 void slotPlaylistChanged(int i); 0090 void slotCurrentPlaylistChanged(QTreeWidgetItem *item); 0091 0092 private: 0093 0094 // These classes appear in the main user interface in the following arrangement/layout: 0095 // (note the left/right splitter is the reason this class is named as it is and why it 0096 // is a subclass of QSplitter). 0097 // 0098 // +-----------+--------------------------------------------------------------+---------+ 0099 // | Playlist | NowPlaying* | Lyrics | 0100 // | Box* +--------------------------------------------------------------+ Widget* | 0101 // | | SearchWidget* | | 0102 // | +--------------------------------------------------------------+ | 0103 // | ^ Playlist* (multiple; stacked under QStackedWidget*) | | 0104 // | | -------------- --------- -------- --------- ----------- | | 0105 // | * PlaylistItem*s | | 0106 // | splitter t -------------- --------- -------- --------- ----------- | | 0107 // | handle h | | 0108 // | ------> i -------------- --------- -------- --------- ----------- | | 0109 // | s | | 0110 // | | -------------- --------- -------- --------- ----------- | | 0111 // | , ... | | 0112 // | | ... | | 0113 // | +-------------[ splitter handle m_editorSplitter ]-------------+ | 0114 // | | TagEditor* | | 0115 // | | | | 0116 // | | | | 0117 // +-----------+--------------------------------------------------------------+---------+ 0118 0119 PlaylistBox *m_playlistBox = nullptr; 0120 QSplitter *m_editorSplitter = nullptr; 0121 NowPlaying *m_nowPlaying = nullptr; 0122 SearchWidget *m_searchWidget = nullptr; 0123 QStackedWidget *m_playlistStack = nullptr; 0124 TagEditor *m_editor = nullptr; 0125 LyricsWidget *m_lyricsWidget = nullptr; 0126 Playlist *m_newVisible = nullptr; 0127 PlayerManager *m_player = nullptr; 0128 }; 0129 0130 #endif 0131 0132 // vim: set et sw=4 tw=0 sta: