make PlaylistModel observe albums for changes to the cover image (needed for services...
[amarok.git] / src / MainWindow.h
blob08ef71b98943520a768e8c9e4512a45e8c140d3d
1 /***************************************************************************
2 begin : Fre Nov 15 2002
3 copyright : (C) Mark Kretschmann <markey@web.de>
4 : (C) Max Howell <max.howell@methylblue.com>
5 ***************************************************************************/
7 /***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
16 #ifndef AMAROK_PLAYLISTWINDOW_H
17 #define AMAROK_PLAYLISTWINDOW_H
19 #include "amarok_export.h"
20 #include "dynamicmode.h"
22 #include <QtGui/QWidget> //baseclass
24 #include <khbox.h> //baseclass for DynamicBox
25 #include <kxmlguiwindow.h>
26 #include <kxmlguiclient.h> //baseclass (for XMLGUI)
28 class KMenu;
29 class MediaBrowser;
30 class QMenuBar;
31 class QTimer;
32 class SearchWidget;
33 class SideBar;
34 class QSplitter;
36 /**
37 * @class MainWindow
38 * @short The MainWindow widget class.
40 * This is the main window widget (the Playlist not Player).
42 class AMAROK_EXPORT MainWindow : public KXmlGuiWindow
44 Q_OBJECT
46 public:
47 MainWindow();
48 ~MainWindow();
50 void init();
51 void applySettings();
53 void createGUI(); //should be private but App::slowConfigToolbars requires it
54 void recreateGUI();
56 //allows us to switch browsers from within other browsers etc
57 void showBrowser( const QString& name );
58 void addBrowser( const QString &name, QWidget *widget, const QString &text, const QString &icon );
60 //takes into account minimized, multiple desktops, etc.
61 bool isReallyShown() const;
63 virtual bool eventFilter( QObject*, QEvent* );
65 //instance is declared in KXMLGUI
66 static MainWindow *self() { return s_instance; }
68 void activate();
70 SideBar *sideBar() const { return m_browsers; }
72 public slots:
73 void showHide();
74 void mbAvailabilityChanged( bool isAvailable );
76 private slots:
77 void slotShrinkBrowsers( int index ) const;
78 void savePlaylist() const;
79 void slotBurnPlaylist() const;
80 void slotShowCoverManager() const;
81 void slotPlayMedia();
82 void slotAddLocation( bool directPlay = false );
83 void slotAddStream();
84 void playLastfmPersonal();
85 void addLastfmPersonal();
86 void playLastfmNeighbor();
87 void addLastfmNeighbor();
88 void playLastfmCustom();
89 void addLastfmCustom();
90 void playLastfmGlobaltag();
91 void addLastfmGlobaltag();
92 void playAudioCD();
93 void showQueueManager();
94 void showScriptSelector();
95 void showStatistics();
96 void toolsMenuAboutToShow();
97 void slotToggleFocus();
98 void slotToggleToolbar();
99 // void slotEditFilter();
100 void slotSetFilter( const QString &filter );
102 protected:
103 virtual void closeEvent( QCloseEvent* );
104 virtual void showEvent( QShowEvent* );
105 virtual QSize sizeHint() const;
107 private:
108 enum MenuId { ID_SHOW_TOOLBAR = 2000, ID_SHOW_PLAYERWINDOW };
110 QMenuBar *m_menubar;
111 KMenu *m_toolsMenu;
112 KMenu *m_settingsMenu;
113 SideBar *m_browsers;
114 QStringList m_browserNames;
115 KMenu *m_searchMenu;
117 SearchWidget *m_searchWidget;
118 QWidget *m_controlBar;
119 QTimer *m_timer; //search filter timer
120 QStringList m_lastfmTags;
121 MediaBrowser *m_currMediaBrowser;
122 QSplitter *m_splitter;
124 void createActions();
125 void createMenus();
126 int m_lastBrowser;
127 int m_searchField;
128 static MainWindow *s_instance;
131 class DynamicTitle : public QWidget
133 Q_OBJECT
135 public:
136 DynamicTitle(QWidget* parent);
137 void setTitle(const QString& newTitle);
139 virtual void paintEvent(QPaintEvent* e);
141 private:
142 static const int s_curveWidth = 5;
143 static const int s_imageSize = 16;
144 QString m_title;
145 QFont m_font;
148 class DynamicBar : public KHBox
150 Q_OBJECT
152 public:
153 DynamicBar(QWidget* parent);
154 void init();
156 public slots:
157 void slotNewDynamicMode(const DynamicMode* mode);
158 void changeTitle(const QString& title);
160 private:
161 DynamicTitle* m_titleWidget;
165 #endif //AMAROK_PLAYLISTWINDOW_H