~mr-unwell2006/mixxx/features_key_preferences

« back to all changes in this revision

Viewing changes to mixxx/src/library/mixxxlibraryfeature.cpp

  • Committer: Keith Salisbury
  • Date: 2012-06-24 07:28:29 UTC
  • mfrom: (3002.1.281 trunk)
  • Revision ID: keithsalisbury@gmail.com-20120624072829-y14q80b9dnac35c2
merged with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
#include "library/basetrackcache.h"
9
9
#include "library/librarytablemodel.h"
10
10
#include "library/missingtablemodel.h"
 
11
#include "library/hiddentablemodel.h"
11
12
#include "library/queryutil.h"
12
13
#include "library/trackcollection.h"
13
14
#include "treeitem.h"
14
15
 
15
 
#define CHILD_MISSING "Missing Songs"
16
 
 
17
16
MixxxLibraryFeature::MixxxLibraryFeature(QObject* parent,
18
17
                                         TrackCollection* pTrackCollection)
19
 
        : LibraryFeature(parent) {
 
18
        : LibraryFeature(parent),
 
19
          kMissingTitle(tr("Missing Tracks")),
 
20
          kHiddenTitle(tr("Hidden Tracks")){
20
21
    QStringList columns;
21
22
    columns << "library." + LIBRARYTABLE_ID
22
23
            << "library." + LIBRARYTABLE_PLAYED
34
35
            << "library." + LIBRARYTABLE_KEY
35
36
            << "library." + LIBRARYTABLE_DATETIMEADDED
36
37
            << "library." + LIBRARYTABLE_BPM
 
38
            << "library." + LIBRARYTABLE_BPM_LOCK
37
39
            << "library." + LIBRARYTABLE_BITRATE
38
40
            << "track_locations.location"
39
41
            << "track_locations.fs_deleted"
81
83
    // These rely on the 'default' track source being present.
82
84
    m_pLibraryTableModel = new LibraryTableModel(this, pTrackCollection);
83
85
    m_pMissingTableModel = new MissingTableModel(this, pTrackCollection);
84
 
 
85
 
    TreeItem *rootItem = new TreeItem();
86
 
    TreeItem *childItem = new TreeItem(CHILD_MISSING, CHILD_MISSING,
87
 
                                       this, rootItem);
88
 
    rootItem->appendChild(childItem);
89
 
    m_childModel.setRootItem(rootItem);
 
86
    m_pHiddenTableModel = new HiddenTableModel(this, pTrackCollection);
 
87
 
 
88
    TreeItem* pRootItem = new TreeItem();
 
89
    TreeItem* pmissingChildItem = new TreeItem(kMissingTitle, kMissingTitle,
 
90
                                       this, pRootItem);
 
91
    TreeItem* phiddenChildItem = new TreeItem(kHiddenTitle, kHiddenTitle,
 
92
                                       this, pRootItem);
 
93
    pRootItem->appendChild(pmissingChildItem);
 
94
    pRootItem->appendChild(phiddenChildItem);
 
95
 
 
96
    m_childModel.setRootItem(pRootItem);
90
97
}
91
98
 
92
99
MixxxLibraryFeature::~MixxxLibraryFeature() {
93
100
    delete m_pLibraryTableModel;
94
101
    delete m_pMissingTableModel;
 
102
    delete m_pHiddenTableModel;
95
103
}
96
104
 
97
105
QVariant MixxxLibraryFeature::title() {
117
125
    if (m_pMissingTableModel) {
118
126
        m_pMissingTableModel->select();
119
127
    }
 
128
    if (m_pHiddenTableModel) {
 
129
        m_pHiddenTableModel->select();
 
130
    }
120
131
}
121
132
 
122
133
void MixxxLibraryFeature::activate() {
130
141
    /*if (itemName == m_childModel.stringList().at(0))
131
142
        emit(showTrackModel(m_pMissingTableModel));
132
143
     */
133
 
    if (itemName == CHILD_MISSING)
 
144
    if (itemName == kMissingTitle) {
134
145
        emit(showTrackModel(m_pMissingTableModel));
 
146
    }
 
147
    if (itemName == kHiddenTitle) {
 
148
        emit(showTrackModel(m_pHiddenTableModel));
 
149
    }
135
150
}
136
151
 
137
152
void MixxxLibraryFeature::onRightClick(const QPoint& globalPos) {
 
153
    Q_UNUSED(globalPos);
138
154
}
139
155
 
140
156
void MixxxLibraryFeature::onRightClickChild(const QPoint& globalPos,
141
157
                                            QModelIndex index) {
 
158
    Q_UNUSED(globalPos);
 
159
    Q_UNUSED(index);
142
160
}
143
161
 
144
162
bool MixxxLibraryFeature::dropAccept(QUrl url) {
 
163
    Q_UNUSED(url);
145
164
    return false;
146
165
}
147
166
 
148
167
bool MixxxLibraryFeature::dropAcceptChild(const QModelIndex& index, QUrl url) {
 
168
    Q_UNUSED(url);
 
169
    Q_UNUSED(index);
149
170
    return false;
150
171
}
151
172
 
152
173
bool MixxxLibraryFeature::dragMoveAccept(QUrl url) {
 
174
    Q_UNUSED(url);
153
175
    return false;
154
176
}
155
177
 
156
178
bool MixxxLibraryFeature::dragMoveAcceptChild(const QModelIndex& index,
157
179
                                              QUrl url) {
 
180
    Q_UNUSED(url);
 
181
    Q_UNUSED(index);
158
182
    return false;
159
 
}void MixxxLibraryFeature::onLazyChildExpandation(const QModelIndex &index){
 
183
}
 
184
 
 
185
void MixxxLibraryFeature::onLazyChildExpandation(const QModelIndex &index){
 
186
    Q_UNUSED(index);
160
187
//Nothing to do because the childmodel is not of lazy nature.
161
188
}