Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/library/sidebarmodel.h

Go to the documentation of this file.
00001 // sidebarmodel.h
00002 // Created 8/21/09 by RJ Ryan (rryan@mit.edu)
00003 
00004 #ifndef SIDEBARMODEL_H
00005 #define SIDEBARMODEL_H
00006 
00007 #include <QAbstractItemModel>
00008 #include <QList>
00009 #include <QModelIndex>
00010 #include <QVariant>
00011 
00012 class LibraryFeature;
00013 
00014 class SidebarModel : public QAbstractItemModel {
00015     Q_OBJECT
00016   public:
00017     explicit SidebarModel(QObject* parent = 0);
00018     virtual ~SidebarModel();
00019 
00020     void addLibraryFeature(LibraryFeature* feature);
00021     QModelIndex getDefaultSelection();
00022     void setDefaultSelection(unsigned int index);
00023     void activateDefaultSelection();
00024 
00025     // Required for QAbstractItemModel
00026     QModelIndex index(int row, int column,
00027                       const QModelIndex& parent = QModelIndex()) const;
00028     QModelIndex parent(const QModelIndex& index) const;
00029     int rowCount(const QModelIndex& parent = QModelIndex()) const;
00030     int columnCount(const QModelIndex& parent = QModelIndex()) const;
00031     QVariant data(const QModelIndex& index,
00032                   int role = Qt::DisplayRole ) const;
00033     bool dropAccept(const QModelIndex& index, QUrl url);
00034     bool dragMoveAccept(const QModelIndex& index, QUrl url);
00035     virtual bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const;
00036 
00037   public slots:
00038     void clicked(const QModelIndex& index);
00039     void doubleClicked(const QModelIndex& index);
00040     void rightClicked(const QPoint& globalPos, const QModelIndex& index);
00041     void refreshData();
00042     void selectFeature(LibraryFeature* pFeature);
00043 
00044     // Slots for every single QAbstractItemModel signal
00045     // void slotColumnsAboutToBeInserted(const QModelIndex& parent, int start, int end);
00046     // void slotColumnsAboutToBeRemoved(const QModelIndex & parent, int start, int end);
00047     // void slotColumnsInserted(const QModelIndex & parent, int start, int end);
00048     // void slotColumnsRemoved(const QModelIndex & parent, int start, int end);
00049     void slotDataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
00050     //void slotHeaderDataChanged(Qt::Orientation orientation, int first, int last);
00051     // void slotLayoutAboutToBeChanged();
00052     // void slotLayoutChanged();
00053     // void slotModelAboutToBeReset();
00054     // void slotModelReset();
00055     void slotRowsAboutToBeInserted(const QModelIndex& parent, int start, int end);
00056     void slotRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end);
00057     void slotRowsInserted(const QModelIndex& parent, int start, int end);
00058     void slotRowsRemoved(const QModelIndex& parent, int start, int end);
00059     void slotModelReset();
00060     void slotFeatureIsLoading(LibraryFeature*);
00061     void slotFeatureLoadingFinished(LibraryFeature*);
00062 
00063   signals:
00064     void selectIndex(const QModelIndex& index);
00065 
00066   private:
00067     QModelIndex translateSourceIndex(const QModelIndex& parent);
00068     void featureRenamed(LibraryFeature*);
00069     QList<LibraryFeature*> m_sFeatures;
00070     unsigned int m_iDefaultSelectedIndex; 
00071 };
00072 
00073 #endif /* SIDEBARMODEL_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines