[vlc-devel] commit: Qt: create new classes for IconView (Jean-Baptiste Kempf )
git version control
git at videolan.org
Mon Jan 25 01:28:05 CET 2010
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Jan 25 00:54:28 2010 +0100| [c07eff528deb31d8b430d82f28b19eb33dbcd4d9] | committer: Jean-Baptiste Kempf
Qt: create new classes for IconView
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c07eff528deb31d8b430d82f28b19eb33dbcd4d9
---
modules/gui/qt4/Modules.am | 3 +
modules/gui/qt4/components/playlist/icon_view.cpp | 48 +++++++++++++++++++
modules/gui/qt4/components/playlist/icon_view.hpp | 53 +++++++++++++++++++++
3 files changed, 104 insertions(+), 0 deletions(-)
diff --git a/modules/gui/qt4/Modules.am b/modules/gui/qt4/Modules.am
index d86c20a..5831feb 100644
--- a/modules/gui/qt4/Modules.am
+++ b/modules/gui/qt4/Modules.am
@@ -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 \
diff --git a/modules/gui/qt4/components/playlist/icon_view.cpp b/modules/gui/qt4/components/playlist/icon_view.cpp
new file mode 100644
index 0000000..48d6db7
--- /dev/null
+++ b/modules/gui/qt4/components/playlist/icon_view.cpp
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * icon_view.cpp : Icon view for the Playlist
+ ****************************************************************************
+ * Copyright © 2010 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Jean-Baptiste Kempf <jb at 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 );
+}
+
diff --git a/modules/gui/qt4/components/playlist/icon_view.hpp b/modules/gui/qt4/components/playlist/icon_view.hpp
new file mode 100644
index 0000000..1d73384
--- /dev/null
+++ b/modules/gui/qt4/components/playlist/icon_view.hpp
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * icon_view.hpp : Icon view for the Playlist
+ ****************************************************************************
+ * Copyright © 2010 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Jean-Baptiste Kempf <jb at 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
+
More information about the vlc-devel
mailing list