~daschuer/mixxx/features_setlog

« back to all changes in this revision

Viewing changes to mixxx/src/library/trackmodel.h

  • Committer: daschuer at gmx
  • Date: 2011-10-04 20:29:10 UTC
  • mfrom: (2840.1.15 mixxx-trunk)
  • Revision ID: daschuer@gmx.de-20111004202910-8pktjwu7f51xl515
merged with lp:mixxx

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
/** Pure virtual (abstract) class that provides an interface for data models which
13
13
    display track lists. */
14
14
class TrackModel {
15
 
 
16
 
public:
17
 
 
 
15
  public:
18
16
    TrackModel(QSqlDatabase db,
19
17
               QString settingsNamespace)
20
18
            : m_db(db),
21
19
              m_settingsNamespace(settingsNamespace) {
22
 
 
23
20
    }
 
21
    virtual ~TrackModel() {}
24
22
 
25
 
    enum Capabilities
26
 
    {
 
23
    enum Capabilities {
27
24
        TRACKMODELCAPS_NONE           = 0x0000,
28
25
        TRACKMODELCAPS_REORDER        = 0x0001,
29
26
        TRACKMODELCAPS_RECEIVEDROPS   = 0x0002,
32
29
        TRACKMODELCAPS_ADDTOAUTODJ    = 0x0010,
33
30
        TRACKMODELCAPS_LOCKED         = 0x0020,
34
31
        TRACKMODELCAPS_RELOADMETADATA = 0x0040,
35
 
                                    //0x0004
36
32
    };
37
33
 
38
34
    typedef int CapabilitiesFlags; /** Enables us to do ORing */
53
49
 
54
50
    bool isTrackModel() { return true;}
55
51
    virtual void search(const QString& searchText) = 0;
56
 
    virtual const QString currentSearch() = 0;
 
52
    virtual const QString currentSearch() const = 0;
57
53
    virtual bool isColumnInternal(int column) = 0;
58
 
    /** if no header state exists, we may hide some columns so that the user can reactivate them **/
 
54
    // if no header state exists, we may hide some columns so that the user can
 
55
    // reactivate them
59
56
    virtual bool isColumnHiddenByDefault(int column) = 0;
60
57
    virtual const QList<int>& showableColumns() const { return m_emptyColumns; }
61
58
    virtual const QList<int>& searchColumns() const { return m_emptyColumns; }
62
 
    virtual void removeTrack(const QModelIndex& index) = 0;
63
 
    virtual void removeTracks(const QModelIndexList& indices) = 0;
64
 
    virtual bool addTrack(const QModelIndex& index, QString location) = 0;
 
59
    virtual void removeTrack(const QModelIndex& index) {
 
60
        Q_UNUSED(index);
 
61
    }
 
62
    virtual void removeTracks(const QModelIndexList& indices) {
 
63
        Q_UNUSED(indices);
 
64
    }
 
65
    virtual bool addTrack(const QModelIndex& index, QString location) {
 
66
        Q_UNUSED(index);
 
67
        Q_UNUSED(location);
 
68
        return false;
 
69
    }
65
70
    virtual void moveTrack(const QModelIndex& sourceIndex,
66
 
                           const QModelIndex& destIndex) = 0;
67
 
    virtual QItemDelegate* delegateForColumn(const int i) = 0;
68
 
    virtual ~TrackModel() {}
69
 
    virtual TrackModel::CapabilitiesFlags getCapabilities() const { return TRACKMODELCAPS_NONE; }
70
 
 
 
71
                           const QModelIndex& destIndex) {
 
72
        Q_UNUSED(sourceIndex);
 
73
        Q_UNUSED(destIndex);
 
74
    }
 
75
    virtual QItemDelegate* delegateForColumn(const int i) {
 
76
        Q_UNUSED(i);
 
77
        return NULL;
 
78
    }
 
79
    virtual TrackModel::CapabilitiesFlags getCapabilities() const {
 
80
        return TRACKMODELCAPS_NONE;
 
81
    }
71
82
    virtual QString getModelSetting(QString name) {
72
83
        SettingsDAO settings(m_db);
73
84
        QString key = m_settingsNamespace + "." + name;