[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasma-mediacenter] /: Redesign welcome screen as suggestions from PMC BoF at Akademy
From:       Sinny Kumari <ksinny () gmail ! com>
Date:       2012-07-28 15:15:56
Message-ID: 20120728151556.7D1E9A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 77cd7775030f96a68f57cd4007c59c60167cdcb6 by Sinny Kumari.
Committed on 28/07/2012 at 17:15.
Pushed by sinnykumari into branch 'master'.

Redesign welcome screen as suggestions from PMC BoF at Akademy

M  +1    -1    browsingbackends/localfiles/localmusic/localmusicbackend.cpp
M  +1    -1    browsingbackends/metadatabackends/metadatamusicbackend/metadatamusicbackend.cpp
 M  +11   -3    components/mediawelcome/BackendsListDelegate.qml
A  +44   -0    components/mediawelcome/CategoriesList.qml     [License: LGPL (v2+)]
C  +21   -15   components/mediawelcome/CategoriesListDelegate.qml [from: \
components/mediawelcome/BackendsListDelegate.qml - 076% similarity] C  +24   -23   \
components/mediawelcome/CategoriesModel.qml [from: \
browsingbackends/localfiles/localmusic/localmusicbackend.cpp - 069% similarity] C  \
+13   -22   components/mediawelcome/FilteredBackendsList.qml [from: \
components/mediawelcome/BackendsListDelegate.qml - 068% similarity] M  +19   -34   \
components/mediawelcome/MediaWelcome.qml M  +2    -0    \
libs/mediacenter/filteredbackendsmodel.cpp M  +1    -6    \
shells/newshell/package/contents/ui/mediacenter.qml

http://commits.kde.org/plasma-mediacenter/77cd7775030f96a68f57cd4007c59c60167cdcb6

diff --git a/browsingbackends/localfiles/localmusic/localmusicbackend.cpp \
b/browsingbackends/localfiles/localmusic/localmusicbackend.cpp index d06881c..79e5ff8 \
                100644
--- a/browsingbackends/localfiles/localmusic/localmusicbackend.cpp
+++ b/browsingbackends/localfiles/localmusic/localmusicbackend.cpp
@@ -38,5 +38,5 @@ void LocalMusicBackend::initModel()
 
 QString LocalMusicBackend::backendCategory() const
 {
-    return "music";
+    return "audio";
 }
diff --git a/browsingbackends/metadatabackends/metadatamusicbackend/metadatamusicbackend.cpp \
b/browsingbackends/metadatabackends/metadatamusicbackend/metadatamusicbackend.cpp \
                index f8bdf78..7dcf4ab 100644
--- a/browsingbackends/metadatabackends/metadatamusicbackend/metadatamusicbackend.cpp
+++ b/browsingbackends/metadatabackends/metadatamusicbackend/metadatamusicbackend.cpp
@@ -131,7 +131,7 @@ QObject* MetadataMusicBackend::musicModel() const
 
 QString MetadataMusicBackend::backendCategory() const
 {
-    return "music";
+    return "audio";
 }
 
 #include "metadatamusicbackend.moc"
diff --git a/components/mediawelcome/BackendsListDelegate.qml \
b/components/mediawelcome/BackendsListDelegate.qml index 950576d..186ff72 100644
--- a/components/mediawelcome/BackendsListDelegate.qml
+++ b/components/mediawelcome/BackendsListDelegate.qml
@@ -21,6 +21,9 @@ import QtQuick 1.1
 import org.kde.qtextracomponents 0.1 as QtExtraComponents
 
 Item {
+    id: rootItem
+    property int finalHeight: 0
+
     Row {
         anchors.fill: parent
         spacing: 20
@@ -29,7 +32,7 @@ Item {
             id: backendIcon
             icon: decoration
             height: parent.height
-            width: height
+            width: finalHeight
         }
 
         HomeScreenText {
@@ -46,5 +49,10 @@ Item {
         onClicked: { homeScreenRootItem.selectedBackend = modelObject; \
homeScreenRootItem.backendSelected() }  }
 
-    ListView.onIsCurrentItemChanged: if (PathView.isCurrentItem) \
                homeScreenRootItem.selectedBackend = modelObject
-}
\ No newline at end of file
+    ListView.onIsCurrentItemChanged: if (ListView.isCurrentItem) \
homeScreenRootItem.selectedBackend = modelObject +
+    Component.onCompleted: SequentialAnimation {
+        PropertyAction { target: rootItem; property: "height"; value: 0 }
+        NumberAnimation { target: rootItem; property: "height"; to: \
rootItem.finalHeight; easing.type: Easing.InOutQuad } +    }
+}
diff --git a/components/mediawelcome/CategoriesList.qml \
b/components/mediawelcome/CategoriesList.qml new file mode 100644
index 0000000..0cb0390
--- /dev/null
+++ b/components/mediawelcome/CategoriesList.qml
@@ -0,0 +1,44 @@
+/*
+ *   Copyright 2012 Sinny Kumari <ksinny@gmail.com>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License as
+ *   published by the Free Software Foundation; either version 2, 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 Library 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.
+ */
+
+import QtQuick 1.1
+
+ListView {
+    id: categoriesList
+    property int delegateWidth: parent.height
+    property string currentCategory: currentItem.currentCategory
+
+    spacing: 20
+    preferredHighlightBegin: width*0.45
+    preferredHighlightEnd: width*0.55
+    highlightRangeMode: GridView.StrictlyEnforceRange
+    orientation: ListView.Horizontal
+    model: CategoriesModel { }
+    delegate: CategoriesListDelegate {
+        height: categoriesList.height
+        width: categoriesList.delegateWidth
+    }
+
+    highlightFollowsCurrentItem: true
+    highlight: Rectangle {
+        radius: 10
+        color: "white"
+        opacity: 0.5
+    }
+}
\ No newline at end of file
diff --git a/components/mediawelcome/BackendsListDelegate.qml \
b/components/mediawelcome/CategoriesListDelegate.qml similarity index 76%
copy from components/mediawelcome/BackendsListDelegate.qml
copy to components/mediawelcome/CategoriesListDelegate.qml
index 950576d..5d40af5 100644
--- a/components/mediawelcome/BackendsListDelegate.qml
+++ b/components/mediawelcome/CategoriesListDelegate.qml
@@ -21,30 +21,36 @@ import QtQuick 1.1
 import org.kde.qtextracomponents 0.1 as QtExtraComponents
 
 Item {
-    Row {
-        anchors.fill: parent
-        spacing: 20
+    id: root
+    property alias currentCategory: workaround.text
+    opacity: ListView.isCurrentItem ? 1 : 0.4
+
+    Text {
+        id: workaround
+        visible: false
+        text: category
+    }
+
+    Column {
+        anchors { fill: parent; margins: 20 }
+        spacing: 10
 
         QtExtraComponents.QIconItem {
             id: backendIcon
             icon: decoration
-            height: parent.height
-            width: height
+            height: width
+            width: parent.width
         }
-
-        HomeScreenText {
-            height: parent.height
-
-            text: display
-            font.pointSize: 20
-        }
-
     }
 
     MouseArea {
         anchors.fill: parent
-        onClicked: { homeScreenRootItem.selectedBackend = modelObject; \
homeScreenRootItem.backendSelected() } +        onClicked: { \
root.ListView.view.currentIndex = index; root.ListView.view.focus = true }  }
 
-    ListView.onIsCurrentItemChanged: if (PathView.isCurrentItem) \
homeScreenRootItem.selectedBackend = modelObject +    Behavior on opacity {
+        NumberAnimation {
+            duration: 500
+        }
+    }
 }
\ No newline at end of file
diff --git a/browsingbackends/localfiles/localmusic/localmusicbackend.cpp \
b/components/mediawelcome/CategoriesModel.qml similarity index 69%
copy from browsingbackends/localfiles/localmusic/localmusicbackend.cpp
copy to components/mediawelcome/CategoriesModel.qml
index d06881c..8e1ce6a 100644
--- a/browsingbackends/localfiles/localmusic/localmusicbackend.cpp
+++ b/components/mediawelcome/CategoriesModel.qml
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright 2009 by Alessandro Diaferia <alediaferia@gmail.com>         *
+ *   Copyright 2012 by Sinny Kumari <ksinny@gmail.com>                     *
  *                                                                         *
  *   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  *
@@ -17,26 +17,27 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
  ***************************************************************************/
 
-#include "localmusicbackend.h"
-#include "localmusicmodel.h"
+import QtQuick 1.1
 
-MEDIACENTER_EXPORT_BROWSINGBACKEND(LocalMusicBackend)
-
-LocalMusicBackend::LocalMusicBackend (QObject* parent, const QVariantList& args)
-    : LocalFilesAbstractBackend (parent, args)
-{
-
-}
-
-LocalMusicBackend::~LocalMusicBackend()
-{}
-
-void LocalMusicBackend::initModel()
-{
-    setModel(new LocalMusicModel(this));
-}
-
-QString LocalMusicBackend::backendCategory() const
-{
-    return "music";
-}
+ListModel {
+    ListElement {
+        display: "Music"
+        decoration: "tools-rip-audio-cd"
+        category: "audio"
+    }
+    ListElement {
+        display: "Pictures"
+        decoration: "image-x-generic"
+        category: "image"
+    }
+    ListElement {
+        display: "Videos"
+        decoration: "tools-rip-video-cd"
+        category: "video"
+    }
+    ListElement {
+        display: "Others"
+        decoration: "plasma"
+        category: "other"
+    }
+}
\ No newline at end of file
diff --git a/components/mediawelcome/BackendsListDelegate.qml \
b/components/mediawelcome/FilteredBackendsList.qml similarity index 68%
copy from components/mediawelcome/BackendsListDelegate.qml
copy to components/mediawelcome/FilteredBackendsList.qml
index 950576d..80889c9 100644
--- a/components/mediawelcome/BackendsListDelegate.qml
+++ b/components/mediawelcome/FilteredBackendsList.qml
@@ -18,33 +18,24 @@
  ***************************************************************************/
 
 import QtQuick 1.1
-import org.kde.qtextracomponents 0.1 as QtExtraComponents
+import org.kde.plasma.mediacentercomponents 0.1 as MediaCenterComponents
 
 Item {
-    Row {
-        anchors.fill: parent
-        spacing: 20
-
-        QtExtraComponents.QIconItem {
-            id: backendIcon
-            icon: decoration
-            height: parent.height
-            width: height
-        }
-
-        HomeScreenText {
-            height: parent.height
+    property alias backendsModel: filteredModel.sourceBackendsModel
+    property alias categoryFilter: filteredModel.backendCategory
 
-            text: display
-            font.pointSize: 20
-        }
+    MediaCenterComponents.FilteredBackendsModel {
+        id: filteredModel
 
+        onBackendCategoryChanged: console.log(backendCategory)
     }
 
-    MouseArea {
-        anchors.fill: parent
-        onClicked: { homeScreenRootItem.selectedBackend = modelObject; \
                homeScreenRootItem.backendSelected() }
-    }
+    ListView {
+        id: listView
+        anchors { fill: parent; margins: 20 }
+        spacing: 20
 
-    ListView.onIsCurrentItemChanged: if (PathView.isCurrentItem) \
homeScreenRootItem.selectedBackend = modelObject +        model: filteredModel
+        delegate: BackendsListDelegate { width: listView.width; finalHeight: 64 }
+    }
 }
\ No newline at end of file
diff --git a/components/mediawelcome/MediaWelcome.qml \
b/components/mediawelcome/MediaWelcome.qml index 65d6105..aca9dad 100644
--- a/components/mediawelcome/MediaWelcome.qml
+++ b/components/mediawelcome/MediaWelcome.qml
@@ -23,7 +23,7 @@ import org.kde.plasma.mediacentercomponents 0.1 as \
MediaCenterComponents  
 Item {
     id: homeScreenRootItem
-    property alias model: homeScreenBackendsList.model
+    property QtObject model
     property variant selectedBackend
     property QtObject metaData
 
@@ -41,42 +41,27 @@ Item {
             height: 0.2 * parent.height
         }
 
-        Row {
-            id: homeScreenBody
+        Item {
+            id: homeScreenBodyLeft
             width: parent.width
-            height: 0.7 * parent.height
-            spacing: 20
+            height: 0.3 * parent.height
+            clip: true
 
-            Item {
-                id: homeScreenBodyLeft
-                width: parent.width/2
-                height: parent.height
-                clip: true
-
-                ListView {
-                    id: homeScreenBackendsList
-                    anchors { fill: parent; margins: 20 }
-                    spacing: 20
-
-                    delegate: BackendsListDelegate { width: parent.width; height: 64 \
                }
-                }
+            CategoriesList {
+                id: categoriesList
+                anchors { top: parent.top; horizontalCenter: parent.horizontalCenter \
} +                height: delegateWidth; width: parent.width
             }
+        }
 
-            Item {
-                id: homeScreenBodyRight
-                width: parent.width/2
-                height: parent.height
-                clip: true
-
-                ListView {
-                    id: recentlyPlayedList
-                    anchors { fill: parent; margins: 20 }
-                    spacing: 20
-                    model: RecentlyPlayed { }
-
-                    header: HomeScreenText { width: parent.width; height: 64; \
                horizontalAlignment: Text.AlignHCenter; text: "Recently Played"; \
                font.pointSize: 24 }
-                    delegate: RecentlyPlayedListDelegate { width: parent.width; \
                height: 64 }
-                }
+        Item {
+            width: parent.width
+            height: 0.4 * parent.height
+            FilteredBackendsList {
+                height: parent.height; width: 200
+                anchors.centerIn: parent
+                backendsModel: homeScreenRootItem.model
+                categoryFilter: categoriesList.currentCategory
             }
         }
 
@@ -84,7 +69,7 @@ Item {
             id: homeScreenFooter
             width: parent.width
             height: 0.1 * parent.height
-            text: homeScreenRootItem.metaData.title
+            //text: homeScreenRootItem.metaData.title
         }
     }
 }
diff --git a/libs/mediacenter/filteredbackendsmodel.cpp \
b/libs/mediacenter/filteredbackendsmodel.cpp index 4426bf7..88b74af 100644
--- a/libs/mediacenter/filteredbackendsmodel.cpp
+++ b/libs/mediacenter/filteredbackendsmodel.cpp
@@ -37,7 +37,9 @@ bool FilteredBackendsModel::filterAcceptsRow(int source_row, const \
QModelIndex&  
 void FilteredBackendsModel::setBackendCategory(const QString& category)
 {
+    beginResetModel();
     m_category = category;
+    endResetModel();
     emit backendCategoryChanged();
 }
 
diff --git a/shells/newshell/package/contents/ui/mediacenter.qml \
b/shells/newshell/package/contents/ui/mediacenter.qml index 1091cc4..bb0ebbb 100644
--- a/shells/newshell/package/contents/ui/mediacenter.qml
+++ b/shells/newshell/package/contents/ui/mediacenter.qml
@@ -30,11 +30,6 @@ Rectangle {
         GradientStop { position: 1.0; color: "#000000" }
     }
 
-    MediaCenterComponents.FilteredBackendsModel {
-        id: filteredBackendsModel
-        sourceBackendsModel: backendsModel
-    }
-
     MediaCenterComponents.RuntimeData {
         id: runtimeData
 
@@ -189,7 +184,7 @@ Rectangle {
         anchors.fill: parent
         focus: visible
 
-        model: filteredBackendsModel
+        model: backendsModel
         metaData: mediaPlayer.metaData
         onBackendSelected: { runtimeData.currentBrowsingBackend = selectedBackend; \
visible = false }  onVisibleChanged: {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic