![]() |
Mixxx
|
00001 /*************************************************************************** 00002 promotrackswebview.h 00003 ------------------- 00004 begin : Jan 2010 00005 copyright : (C) 2010 Albert Santoni 00006 email : alberts@mixxx.org 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef __BUNDLEDSONGSWEBVIEW_H_ 00019 #define __BUNDLEDSONGSWEBVIEW_H_ 00020 00021 #include <QWebView> 00022 #include <QUrl> 00023 #include "configobject.h" 00024 #include "trackinfoobject.h" 00025 #include "library/libraryview.h" 00026 class TrackCollection; 00027 00028 #define MIXXX_PROMO_HTML_LOCATION "promo/promotracks.html" 00029 00030 class BundledSongsWebView : public QWebView, public LibraryView 00031 { 00032 Q_OBJECT 00033 Q_PROPERTY(bool m_statTracking READ statTracking WRITE setStatTracking) 00034 Q_PROPERTY(bool m_bFirstRun READ firstRun WRITE setFirstRun) 00035 00036 public: 00037 BundledSongsWebView(QWidget* parent, TrackCollection* trackCollection, 00038 QString promoBundlePath, 00039 QString localURL, bool firstRun, 00040 ConfigObject<ConfigValue>* config); 00041 virtual ~BundledSongsWebView(); 00042 00043 virtual void setup(QDomNode node); 00044 virtual void onSearchStarting() {}; 00045 virtual void onSearchCleared() {}; 00046 virtual void onSearch(const QString&) {}; 00047 virtual void onShow(); 00048 virtual void keyPressEvent(QKeyEvent* event); 00049 virtual void loadSelectedTrack(); 00050 virtual void loadSelectedTrackToGroup(QString group); 00051 virtual void moveSelection(int delta); 00052 bool firstRun() const; 00053 00054 public slots: 00055 void handleClickedLink(const QUrl& url); 00056 void attachObjects(); 00057 void setStatTracking(bool statTracking); 00058 bool statTracking() const; //has to be a slot to get it into javascript land 00059 void setFirstRun(bool firstRun); 00060 void loadFinished(bool ok); 00061 00062 signals: 00063 void loadTrack(TrackPointer pTrack); 00064 void loadTrackToPlayer(TrackPointer pTrack, QString group); 00065 00066 protected: 00067 //virtual QString userAgentForUrl (const QUrl & url) const; 00068 00069 private: 00070 QString m_sPromoBundlePath; 00072 QString m_sLocalURL; 00073 bool m_statTracking; 00074 bool m_bFirstRun; 00075 ConfigObject<ConfigValue>* m_pConfig; 00076 TrackCollection* m_pTrackCollection; 00077 }; 00078 00079 00080 #endif //__BUNDLEDSONGSWEBVIEW_H_