viewmode.h 3.43 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/***************************************************************************
                          viewmode.h
                             -------------------
    begin                : Sat Jun 7 2003
    copyright            : (C) 2003 by Scott Wheeler, 
    email                : wheeler@kde.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 VIEWMODE_H
#define VIEWMODE_H

#include <klocale.h>

23
#include <qobject.h>
24
#include <qstring.h>
25
#include <qdict.h>
26

27 28
#include "playlistbox.h"

29 30 31
class QPainter;
class QColorGroup;

32 33 34
class SearchPlaylist;

class ViewMode : public QObject
35
{
36 37
    Q_OBJECT

38 39 40 41 42 43 44
public:
    ViewMode(PlaylistBox *b);
    virtual ~ViewMode();

    virtual QString name() const      { return i18n("Default"); }
    virtual void setShown(bool shown);

45
    virtual void paintCell(PlaylistBox::Item *item,
46 47 48
                           QPainter *painter, 
                           const QColorGroup &colorGroup,
                           int column, int width, int align);
49 50 51 52

    virtual PlaylistBox::Item *createSearchItem(PlaylistBox *box,
                                                SearchPlaylist *playlist,
                                                const QString &searchCategory);
53 54 55 56 57 58
    
protected:
    PlaylistBox *playlistBox() const { return m_playlistBox; }
    bool visible() const             { return m_visible; }
    void updateIcons(int size);

59 60 61 62 63
signals:
    void signalCreateSearchList(const PlaylistSearch &search,
                                const QString &searchCategory,
                                const QString &name);
    
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
private:
    PlaylistBox *m_playlistBox;
    bool m_visible;
};

////////////////////////////////////////////////////////////////////////////////

class CompactViewMode : public ViewMode
{
public:
    CompactViewMode(PlaylistBox *b);
    virtual ~CompactViewMode();
    
    virtual QString name() const { return i18n("Compact"); }
    virtual void setShown(bool shown);

80
    virtual void paintCell(PlaylistBox::Item *item,
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
                           QPainter *painter,
                           const QColorGroup &colorGroup,
                           int column, int width, int align);
};

////////////////////////////////////////////////////////////////////////////////

class TreeViewMode : public CompactViewMode
{
public:
    TreeViewMode(PlaylistBox *l);
    virtual ~TreeViewMode();

    virtual QString name() const { return i18n("Tree"); }
    virtual void setShown(bool shown);
96

97 98 99 100
    virtual PlaylistBox::Item *createSearchItem(PlaylistBox *box,
                                                SearchPlaylist *playlist,
                                                const QString &searchCategory);

101
private:
102
    void setupCategory(const QString &searchCategory, const QStringList &members, int column);
103

104
    QDict<PlaylistBox::Item> m_searchCategories;    
105 106 107
};

#endif