summaryrefslogtreecommitdiffstats
path: root/amarok/src/playlistwindow.h
blob: 13656fd4f22c0ef09e5c0a2abe53e36c67c33988 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/***************************************************************************
  begin                : Fre Nov 15 2002
  copyright            : (C) Mark Kretschmann <markey@web.de>
                       : (C) Max Howell <max.howell@methylblue.com>
***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef AMAROK_PLAYLISTWINDOW_H
#define AMAROK_PLAYLISTWINDOW_H

#include "browserbar.h"

#include <tqhbox.h>          //baseclass for DynamicBox
#include <tqwidget.h>        //baseclass
#include <kxmlguiclient.h>  //baseclass (for XMLGUI)

class ClickLineEdit;
class CollectionBrowser;
class ContextBrowser;
class MediaBrowser;
class TQMenuBar;
class TDEPopupMenu;
class TDEToolBar;
class TQLabel;
class TQTimer;

/**
  * @class PlaylistWindow
  * @short The PlaylistWindow widget class.
  *
  * This is the main window widget (the Playlist not Player).
  */
class PlaylistWindow : public TQWidget, public KXMLGUIClient
{
        Q_OBJECT
  

    public:
        PlaylistWindow();
       ~PlaylistWindow();

        void init();
        void applySettings();

        void createGUI(); //should be private but App::slowConfigToolbars requires it
        void recreateGUI();

        //allows us to switch browsers from within other browsers etc
        void showBrowser( const TQString& name ) { m_browsers->showBrowser( name ); }
        void addBrowser( const TQString &name, TQWidget *widget, const TQString &text, const TQString &icon );

        //takes into account minimized, multiple desktops, etc.
        bool isReallyShown() const;

        virtual bool eventFilter( TQObject*, TQEvent* );

        //instance is declared in KXMLGUI
        static PlaylistWindow *self() { return s_instance; }

        void activate();

    public slots:
        void showHide();
        void mbAvailabilityChanged( bool isAvailable );

    private slots:
        void savePlaylist() const;
        void slotBurnPlaylist() const;
        void slotPlayMedia();
        void slotAddLocation( bool directPlay = false );
        void slotAddStream();
        void playLastfmPersonal();
        void addLastfmPersonal();
        void playLastfmNeighbor();
        void addLastfmNeighbor();
        void playLastfmCustom();
        void addLastfmCustom();
        void playLastfmGlobaltag( int );
        void addLastfmGlobaltag( int );
        void playAudioCD();
        void showQueueManager();
        void showScriptSelector();
        void showStatistics();
        void slotMenuActivated( int );
        void actionsMenuAboutToShow();
        void toolsMenuAboutToShow();
        void slotToggleMenu();
        void slotToggleFocus();
        void slotEditFilter();
        void slotSetFilter( const TQString &filter );

    protected:
        virtual void closeEvent( TQCloseEvent* );
        virtual void showEvent( TQShowEvent* );
        virtual TQSize sizeHint() const;

    private:
        enum MenuId { ID_SHOW_TOOLBAR = 2000, ID_SHOW_PLAYERWINDOW };

        TQMenuBar      *m_menubar;
        TDEPopupMenu    *m_toolsMenu;
        TDEPopupMenu    *m_settingsMenu;
        BrowserBar    *m_browsers;
        TDEPopupMenu    *m_searchMenu;
        ClickLineEdit *m_lineEdit;
        TDEToolBar      *m_toolbar;
        TQTimer        *m_timer;  //search filter timer
        TQStringList    m_lastfmTags;
        MediaBrowser  *m_currMediaBrowser;

        int m_lastBrowser;
        int m_searchField;

        static PlaylistWindow *s_instance;
};

class DynamicTitle : public TQWidget
{
    Q_OBJECT
  
    public:
        DynamicTitle( TQWidget* parent );
        void setTitle( const TQString& newTitle );

    protected:
        virtual void paintEvent( TQPaintEvent* e );

    private:
        static const int s_curveWidth = 5;
        static const int s_imageSize = 16;
        TQString m_title;
        TQFont m_font;
};

class DynamicBar : public TQHBox
{
    Q_OBJECT
  
    public:
        DynamicBar( TQWidget* parent );
        void init();

    public slots:
        void slotNewDynamicMode( const DynamicMode* mode );
        void changeTitle( const TQString& title );

    private:
        DynamicTitle* m_titleWidget;
};


#endif //AMAROK_PLAYLISTWINDOW_H