![]() |
Mixxx
|
00001 // wlibrary.h 00002 // Created 8/28/2009 by RJ Ryan (rryan@mit.edu) 00003 00004 #ifndef WLIBRARY_H 00005 #define WLIBRARY_H 00006 00007 #include <QDomNode> 00008 #include <QMap> 00009 #include <QMutex> 00010 #include <QStackedWidget> 00011 #include <QString> 00012 00013 #include "library/libraryview.h" 00014 00015 class MixxxKeyboard; 00016 00017 class WLibrary : public QStackedWidget { 00018 Q_OBJECT 00019 public: 00020 WLibrary(QWidget* parent); 00021 virtual ~WLibrary(); 00022 00023 // registerView is used to add a view to the LibraryWidget which the widget 00024 // can disply on request via showView(). To switch to a given view, call 00025 // showView with the name provided here. WLibraryWidget takes ownership of 00026 // the view and is in charge of deleting it. Returns whether or not the 00027 // registration was successful. Registered widget must implement the 00028 // LibraryView interface. 00029 bool registerView(QString name, QWidget* view); 00030 00031 // Apply skin-specific customizations to the library views. Will not affect 00032 // any views registered after calling setup(), so the Library must be bound 00033 // to this widget before calling setup(). 00034 void setup(QDomNode node); 00035 00036 LibraryView* getActiveView() const; 00037 00038 public slots: 00039 // Show the view registered with the given name. Does nothing if the current 00040 // view is the specified view, or if the name does not specify any 00041 // registered view. 00042 void switchToView(const QString& name); 00043 00044 void search(const QString&); 00045 void searchStarting(); 00046 void searchCleared(); 00047 signals: 00048 void searchActivated(const QString&); 00049 private: 00050 QMutex m_mutex; 00051 QMap<QString, QWidget*> m_viewMap; 00052 }; 00053 00054 #endif /* WLIBRARY_H */