Commit c07eff52 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: create new classes for IconView

parent 251ae55f
......@@ -52,6 +52,7 @@ nodist_SOURCES_qt4 = \
components/interface_widgets.moc.cpp \
components/controller.moc.cpp \
components/controller_widget.moc.cpp \
components/playlist/icon_view.moc.cpp \
components/playlist/playlist_model.moc.cpp \
components/playlist/playlist.moc.cpp \
components/playlist/standardpanel.moc.cpp \
......@@ -244,6 +245,7 @@ SOURCES_qt4 = qt4.cpp \
components/interface_widgets.cpp \
components/controller.cpp \
components/controller_widget.cpp \
components/playlist/icon_view.cpp \
components/playlist/playlist_model.cpp \
components/playlist/playlist_item.cpp \
components/playlist/standardpanel.cpp \
......@@ -294,6 +296,7 @@ noinst_HEADERS = \
components/interface_widgets.hpp \
components/controller.hpp \
components/controller_widget.hpp \
components/playlist/icon_view.hpp \
components/playlist/playlist_model.hpp \
components/playlist/playlist_item.hpp \
components/playlist/standardpanel.hpp \
......
/*****************************************************************************
* icon_view.cpp : Icon view for the Playlist
****************************************************************************
* Copyright © 2010 the VideoLAN team
* $Id$
*
* Authors: Jean-Baptiste Kempf <jb@videolan.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.
*
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "components/playlist/icon_view.hpp"
#include "components/playlist/playlist_model.hpp"
#include <QPainter>
void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
}
QSize PlListViewItemDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
return QSize(100, 100);
}
PlIconView::PlIconView( PLModel *model, QWidget *parent ) : QListView( parent )
{
setModel( model );
setViewMode( QListView::IconMode );
setMovement( QListView::Snap );
PlListViewItemDelegate *pl = new PlListViewItemDelegate();
setItemDelegate( pl );
}
/*****************************************************************************
* icon_view.hpp : Icon view for the Playlist
****************************************************************************
* Copyright © 2010 the VideoLAN team
* $Id$
*
* Authors: Jean-Baptiste Kempf <jb@videolan.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.
*
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _ICON_VIEW_H_
#define _ICON_VIEW_H_
#include <QStyledItemDelegate>
#include <QListView>
class QPainter;
class PLModel;
class PlListViewItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
PlListViewItemDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent) {}
void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const;
};
class PlIconView : public QListView
{
Q_OBJECT
public:
PlIconView( PLModel *model, QWidget *parent = 0 );
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment