1 /***************************************************************************
2 * Copyright (c) 2007 Nikolaj Hald Nielsen <nhnFreespirit@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef AMAROKSERVICEBASE_H
21 #define AMAROKSERVICEBASE_H
25 //#include "servicemodelitembase.h"
26 //#include "servicemodelbase.h"
28 #include "infoparserbase.h"
30 #include "amarok_export.h"
31 #include "../collectionbrowser/SingleCollectionTreeItemModel.h"
32 #include "../collectionbrowser/CollectionTreeItem.h"
33 #include "../collectionbrowser/CollectionTreeView.h"
34 #include "plugin/plugin.h"
36 #include <khtml_part.h>
37 //#include <klistwidget.h>
40 #include <QPushButton>
41 #include <QSortFilterProxyModel>
43 //#include <QTreeView>
45 #include <KPluginInfo>
49 class AMAROK_EXPORT ServiceFactory
: public QObject
, public Amarok::Plugin
54 virtual ~ServiceFactory();
56 virtual void init() = 0;
57 virtual QString
name() = 0;
58 virtual KConfigGroup
config() = 0;
59 virtual KPluginInfo
info() = 0;
62 void newService( class ServiceBase
*newService
);
67 A very basic composite widget used as a base for building service browsers.
69 @author Nikolaj Hald Nielsen <nhnFreespirit@gmail.com>
71 class AMAROK_EXPORT ServiceBase
: public KVBox
81 ServiceBase( const QString
&name
);
91 void setShortDescription( const QString
&shortDescription
);
92 QString
getShortDescription();
93 void setLongDescription( const QString
&longDescription
);
94 QString
getLongDescription();
95 void setIcon( const QIcon
&icon
);
97 void setModel( SingleCollectionTreeItemModel
* model
);
98 SingleCollectionTreeItemModel
* getModel();
101 virtual void polish() = 0;
102 virtual bool updateContextView() { return false; }
106 //void treeViewSelectionChanged( const QItemSelection & selected );
107 void infoChanged ( const QString
&infoHtml
);
113 void selectionChanged ( CollectionTreeItem
* );
119 * Toggles the info area on and off
120 * @param show If true the info box is shown, if false it is hidden
122 void showInfo(bool show
);
124 void homeButtonClicked();
126 void itemActivated ( const QModelIndex
& index
);
128 void itemSelected( CollectionTreeItem
* item
);
133 virtual void generateWidgetInfo() const;
135 static ServiceBase
*s_instance
;
137 QSplitter
*m_mainSplitter
;
138 CollectionTreeView
*m_contentView
;
139 KHTMLPart
*m_infoBox
;
141 QPushButton
*m_homeButton
;
144 KVBox
*m_bottomPanel
;
149 QString m_shortDescription
;
150 QString m_longDescription
;
153 KUrl::List m_urlsToInsert
;
155 InfoParserBase
* m_infoParser
;
157 //void addToPlaylist( CollectionTreeItem * item );
161 private: // need to move stuff here
162 SingleCollectionTreeItemModel
* m_model
;
163 QSortFilterProxyModel
* m_filterModel
;