Clementine-audio-player-Mac.../src/library/libraryview.h

88 lines
2.2 KiB
C
Raw Normal View History

/* This file is part of Clementine.
Clementine 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 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
2009-12-24 20:16:07 +01:00
#ifndef LIBRARYVIEW_H
#define LIBRARYVIEW_H
#include "widgets/autoexpandingtreeview.h"
2009-12-24 20:16:07 +01:00
#include <QStyledItemDelegate>
class LibraryModel;
2009-12-24 20:16:07 +01:00
class LibraryItemDelegate : public QStyledItemDelegate {
public:
LibraryItemDelegate(QObject* parent);
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
};
class LibraryView : public AutoExpandingTreeView {
2009-12-24 20:16:07 +01:00
Q_OBJECT
public:
LibraryView(QWidget* parent = 0);
static const char* kSettingsGroup;
void SetLibrary(LibraryModel* library);
2009-12-24 20:16:07 +01:00
// QTreeView
void keyboardSearch(const QString &search);
void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible);
2009-12-24 20:16:07 +01:00
public slots:
void TotalSongCountUpdated(int count);
void ReloadSettings();
2009-12-24 20:16:07 +01:00
signals:
void ShowConfigDialog();
void Load(const QModelIndexList& indexes);
void AddToPlaylist(const QModelIndexList& indexes);
2009-12-24 20:16:07 +01:00
protected:
// QWidget
void paintEvent(QPaintEvent* event);
void mouseReleaseEvent(QMouseEvent* e);
void contextMenuEvent(QContextMenuEvent* e);
2009-12-24 20:16:07 +01:00
private slots:
void Load();
void AddToPlaylist();
void ShowInVarious();
void NoShowInVarious();
2009-12-24 20:16:07 +01:00
private:
void RecheckIsEmpty();
void ShowInVarious(bool on);
2009-12-24 20:16:07 +01:00
private:
LibraryModel* library_;
2009-12-24 20:16:07 +01:00
int total_song_count_;
QPixmap nomusic_;
QMenu* context_menu_;
QModelIndex context_menu_index_;
QAction* load_;
QAction* add_to_playlist_;
QAction* show_in_various_;
QAction* no_show_in_various_;
bool is_in_keyboard_search_;
2009-12-24 20:16:07 +01:00
};
#endif // LIBRARYVIEW_H