playlistsplitter.h 2.88 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/**
 * Copyright (C) 2002-2004 Scott Wheeler <wheeler@kde.org>
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 */
16 17 18 19

#ifndef PLAYLISTSPLITTER_H
#define PLAYLISTSPLITTER_H

20
#include <QSplitter>
21

22
class QStackedWidget;
23
class QTreeWidgetItem;
24

25
class Playlist;
26
class SearchWidget;
27 28
class PlaylistInterface;
class TagEditor;
29
class PlaylistBox;
30
class NowPlaying;
31 32
class PlayerManager;
class FileHandle;
33
class LyricsWidget;
34

35 36
/**
 * This is the main layout class of JuK.  It should contain a PlaylistBox and
37
 * a QStackedWidget of the Playlists.
38
 *
39
 * This class serves as a "mediator" (see "Design Patterns") between the JuK
40 41
 * class and the playlist classes.  Thus all access to the playlist classes from
 * non-Playlist related classes should be through the public API of this class.
42
 */
43

44
class PlaylistSplitter : public QSplitter
45 46
{
    Q_OBJECT
47

48
public:
49
    PlaylistSplitter(PlayerManager *player, QWidget *parent);
50
    virtual ~PlaylistSplitter();
51

52
    PlaylistInterface *playlist() const;
53

Michael Pyne's avatar
Michael Pyne committed
54 55 56 57 58 59 60
signals:
    /**
     * Emitted when GUI is created and the cache is loaded.  Is kind of a hack
     * until we move the time-intensive parts to a separate thread but then
     * again at least this works.
     */
    void guiReady();
61
    void currentPlaylistChanged(const PlaylistInterface &currentPlaylist);
Michael Pyne's avatar
Michael Pyne committed
62

63 64
public slots:
    virtual void setFocus();
65
    virtual void slotFocusCurrentPlaylist();
Michael Pyne's avatar
Michael Pyne committed
66
    void slotEnable();
67

68
private:
69

70 71
    /**
     * This returns a pointer to the first item in the playlist on the top
72
     * of the QStackedWidget of playlists.
73
     */
74
    Playlist *visiblePlaylist() const;
75

76
    void setupActions();
77 78
    void setupLayout();
    void readConfig();
79
    void saveConfig();
80

81
private slots:
Scott Wheeler's avatar
Scott Wheeler committed
82 83 84 85 86

    /**
     * Updates the visible search results based on the result of the search
     * associated with the currently visible playlist.
     */
87
    void slotShowSearchResults();
88
    void slotPlaylistSelectionChanged();
89
    void slotPlaylistChanged(int i);
90
    void slotCurrentPlaylistChanged(QTreeWidgetItem *item);
91

92
private:
93
    Playlist *m_newVisible;
94
    PlaylistBox *m_playlistBox;
95
    SearchWidget *m_searchWidget;
96
    QStackedWidget *m_playlistStack;
97
    TagEditor *m_editor;
98
    NowPlaying *m_nowPlaying;
99
    PlayerManager *m_player;
100
    LyricsWidget *m_lyricsWidget;
101
    QSplitter *m_editorSplitter;
102 103 104
};

#endif
105 106

// vim: set et sw=4 tw=0 sta: