]> git.sesse.net Git - vlc/commitdiff
Qt: create new classes for IconView
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 24 Jan 2010 23:54:28 +0000 (00:54 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 25 Jan 2010 00:15:27 +0000 (01:15 +0100)
modules/gui/qt4/Modules.am
modules/gui/qt4/components/playlist/icon_view.cpp [new file with mode: 0644]
modules/gui/qt4/components/playlist/icon_view.hpp [new file with mode: 0644]

index d86c20a386f8c05c6a6fc3a242ec3363bfcefb74..5831febebe8565a4637792f6405991354d2d04f8 100644 (file)
@@ -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 (file)
index 0000000..48d6db7
--- /dev/null
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * 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 );
+}
+
diff --git a/modules/gui/qt4/components/playlist/icon_view.hpp b/modules/gui/qt4/components/playlist/icon_view.hpp
new file mode 100644 (file)
index 0000000..1d73384
--- /dev/null
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * 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
+