[muon/frameworks] discover: Port Muon Discover away from PlasmaComponents

Aleix Pol aleixpol at kde.org
Mon Sep 22 17:09:49 UTC 2014


Git commit 5a331be3e90abb3e2fa942deb11347d33986c187 by Aleix Pol.
Committed on 22/09/2014 at 16:57.
Pushed by apol into branch 'frameworks'.

Port Muon Discover away from PlasmaComponents

Depending on org.kde.plasma.* components is problematic at the moment as
plasma-framework is not coinstallable (or kactivities for that matter) and
it has stopped a couple of people who were trying to contribute to the
project.
Furthermore, it was not a good idea to depend on it anyway. It wouldn't
integrate with the application look and feel settings and we had to juggle
to make it look acceptable.
Counter-side is that most of our components are provided in plasma
framework, so development will be needed to get all needed components in
shape either in Qt or KDeclarative.

REVIEW: 120265
CCMAIL: plasma-devel at kde.org

M  +0    -2    discover/MuonDiscoverMainWindow.cpp
M  +6    -8    discover/qml/ApplicationDescription.qml
M  +2    -4    discover/qml/ApplicationOverview.qml
M  +0    -1    discover/qml/ApplicationPage.qml
M  +0    -1    discover/qml/ApplicationsGridDelegate.qml
M  +5    -5    discover/qml/ApplicationsList.qml
M  +3    -3    discover/qml/ApplicationsTop.qml
M  +2    -3    discover/qml/CategoryHeader.qml
M  +3    -3    discover/qml/CategoryPage.qml
M  +2    -3    discover/qml/DefaultBanner.qml
M  +8    -9    discover/qml/FeaturedBanner.qml
M  +0    -34   discover/qml/GridItem.qml
M  +1    -2    discover/qml/Main.qml
M  +3    -3    discover/qml/MuonToolButton.qml
M  +4    -4    discover/qml/ProgressView.qml
M  +0    -1    discover/qml/Rating.qml
M  +0    -1    discover/qml/ReviewsPage.qml
M  +0    -1    discover/qml/UpdatesPage.qml

http://commits.kde.org/muon/5a331be3e90abb3e2fa942deb11347d33986c187

diff --git a/discover/MuonDiscoverMainWindow.cpp b/discover/MuonDiscoverMainWindow.cpp
index 96bdfa0..6c7e93c 100644
--- a/discover/MuonDiscoverMainWindow.cpp
+++ b/discover/MuonDiscoverMainWindow.cpp
@@ -71,8 +71,6 @@ MuonDiscoverMainWindow::MuonDiscoverMainWindow()
 //     m_view->setBackgroundRole(QPalette::AlternateBase);
 //     qreal bgGrayness = m_view->backgroundBrush().color().blackF();
 
-//     Plasma::Theme::defaultTheme()->setUseGlobalSettings(false); //don't change every plasma theme!
-//     Plasma::Theme::defaultTheme()->setThemeName(bgGrayness>0.5 ? "muon-contenttheme" : "oxygen");
     m_view = new QQuickWidget(this);
     m_view->setResizeMode(QQuickWidget::SizeRootObjectToView);
     QQmlEngine* engine = m_view->engine();
diff --git a/discover/qml/ApplicationDescription.qml b/discover/qml/ApplicationDescription.qml
index f2ea22c..c54cae8 100644
--- a/discover/qml/ApplicationDescription.qml
+++ b/discover/qml/ApplicationDescription.qml
@@ -19,8 +19,6 @@
 
 import QtQuick 2.1
 import QtQuick.Controls 1.1
-import org.kde.plasma.core 2.0
-import org.kde.plasma.extras 2.0
 import org.kde.muon 1.0
 import org.kde.muon.discover 1.0 as Discover
 import "navigation.js" as Navigation
@@ -35,7 +33,7 @@ Column {
             margins: 10
         }
         height: icon.height
-        IconItem {
+        Image {
             id: icon
             anchors {
                 top: header.top
@@ -44,7 +42,7 @@ Column {
             height: 64
             width: height
 
-            source: application.icon
+            source: "image://icon/"+application.icon
             clip: true
         }
 
@@ -58,7 +56,7 @@ Column {
                 leftMargin: 5
             }
 
-            Heading {
+            Label {
                 id: heading
                 text: application.name
                 width: parent.width
@@ -81,7 +79,7 @@ Column {
         }
     }
     Item {width: 10; height: 20}
-    Heading { text: i18n("Description") }
+    Label { text: i18n("Description") }
     Label {
         id: info
         anchors {
@@ -95,7 +93,7 @@ Column {
     }
     Item {width: 10; height: 20}
 
-    Heading {
+    Label {
         text: i18n("Addons")
         visible: addonsView.visible
     }
@@ -107,7 +105,7 @@ Column {
     }
 
     Item {width: 10; height: 20}
-    Heading {
+    Label {
         text: i18n("Comments")
         visible: reviewsView.visible
     }
diff --git a/discover/qml/ApplicationOverview.qml b/discover/qml/ApplicationOverview.qml
index e3dd9fe..7493a17 100644
--- a/discover/qml/ApplicationOverview.qml
+++ b/discover/qml/ApplicationOverview.qml
@@ -20,9 +20,6 @@
 import QtQuick 2.1
 import QtQuick.Controls 1.1
 import QtQuick.Controls 1.1
-import org.kde.plasma.core 2.0
-import org.kde.plasma.extras 2.0
-import org.kde.kquickcontrols 2.0
 import org.kde.muon.discover 1.0 as Discover
 import org.kde.muon 1.0
 
@@ -80,7 +77,8 @@ Item {
                     anchors.fill: parent
                     onClicked: Qt.openUrlExternally(application.homepage);
                 }
-                color: theme.linkColor
+                SystemPalette { id: palette }
+                color: palette.highlight
                 font.underline: true
                 width: parent.width/2
                 elide: Text.ElideRight
diff --git a/discover/qml/ApplicationPage.qml b/discover/qml/ApplicationPage.qml
index 5f0c01d..83698ad 100644
--- a/discover/qml/ApplicationPage.qml
+++ b/discover/qml/ApplicationPage.qml
@@ -18,7 +18,6 @@
  */
 
 import QtQuick 2.1
-import org.kde.plasma.core 2.0
 import org.kde.muon 1.0
 
 Item
diff --git a/discover/qml/ApplicationsGridDelegate.qml b/discover/qml/ApplicationsGridDelegate.qml
index dc134c3..3472806 100644
--- a/discover/qml/ApplicationsGridDelegate.qml
+++ b/discover/qml/ApplicationsGridDelegate.qml
@@ -19,7 +19,6 @@
 
 import QtQuick 2.1
 import QtQuick.Controls 1.1
-import org.kde.plasma.core 2.0
 import "navigation.js" as Navigation
 
 GridItem {
diff --git a/discover/qml/ApplicationsList.qml b/discover/qml/ApplicationsList.qml
index 10cd876..1a1f9ad 100644
--- a/discover/qml/ApplicationsList.qml
+++ b/discover/qml/ApplicationsList.qml
@@ -19,7 +19,7 @@
 
 import QtQuick 2.1
 import QtQuick.Controls 1.1
-import org.kde.plasma.core 2.0
+import org.kde.kquickcontrolsaddons 2.0
 import "navigation.js" as Navigation
 
 ScrollView {
@@ -52,20 +52,20 @@ ScrollView {
                         Navigation.openApplication(application)
                     }
                     hoverEnabled: true
-                    IconItem {
+                    QIconItem {
                         id: icon
-                        source: model.icon
+                        icon: model.icon
                         width: contHeight
                         height: contHeight
                         anchors.verticalCenter: parent.verticalCenter
                         anchors.left: parent.left
                     }
                     
-                    IconItem {
+                    Image {
                         anchors.right: icon.right
                         anchors.bottom: icon.bottom
                         visible: isInstalled && view.model.stateFilter!=2
-                        source: "dialog-ok"
+                        source: "image://icon/dialog-ok"
                         height: 16
                         width: 16
                     }
diff --git a/discover/qml/ApplicationsTop.qml b/discover/qml/ApplicationsTop.qml
index 695ce0e..ffee800 100644
--- a/discover/qml/ApplicationsTop.qml
+++ b/discover/qml/ApplicationsTop.qml
@@ -19,9 +19,9 @@
 
 import QtQuick 2.1
 import QtQuick.Controls 1.1
-import org.kde.plasma.core 2.0
 import org.kde.muon 1.0
 import org.kde.muon.discover 1.0
+import org.kde.kquickcontrolsaddons 2.0
 import "navigation.js" as Navigation
 
 Column {
@@ -53,12 +53,12 @@ Column {
                     height: (topView.height-nameLabel.paintedHeight*1.3-topView.spacing*5)/5
 
 
-                    IconItem {
+                    QIconItem {
                         id: iconItem
                         anchors { left: parent.left; verticalCenter: parent.verticalCenter }
                         height: parent.height*0.5
                         width: height
-                        source: model.icon
+                        icon: model.icon
                     }
                     Label {
                         id: nameLabel
diff --git a/discover/qml/CategoryHeader.qml b/discover/qml/CategoryHeader.qml
index 68e5dcc..3bef9af 100644
--- a/discover/qml/CategoryHeader.qml
+++ b/discover/qml/CategoryHeader.qml
@@ -19,15 +19,14 @@
 
 import QtQuick 2.1
 import QtQuick.Controls 1.1
-import org.kde.plasma.core 2.0
 
 Item {
     property QtObject category: null
     property real proposedMargin: 0
     
-    IconItem {
+    Image {
         id: iconItem
-        source: category.icon
+        source: "image://icon/"+category.icon
         anchors {
             top: parent.top
             bottom: parent.bottom
diff --git a/discover/qml/CategoryPage.qml b/discover/qml/CategoryPage.qml
index 6ec35c7..edc482c 100644
--- a/discover/qml/CategoryPage.qml
+++ b/discover/qml/CategoryPage.qml
@@ -19,8 +19,8 @@
 
 import QtQuick 2.1
 import QtQuick.Controls 1.1
-import org.kde.plasma.core 2.0
 import org.kde.muon 1.0
+import org.kde.kquickcontrolsaddons 2.0
 import "navigation.js" as Navigation
 
 Item {
@@ -53,8 +53,8 @@ Item {
                 anchors.centerIn: parent
                 width: parent.width
                 spacing: 10
-                IconItem {
-                    source: decoration
+                QIconItem {
+                    icon: decoration
                     width: 40; height: 40
                     anchors.horizontalCenter: parent.horizontalCenter
                 }
diff --git a/discover/qml/DefaultBanner.qml b/discover/qml/DefaultBanner.qml
index 6978533..b06ef79 100644
--- a/discover/qml/DefaultBanner.qml
+++ b/discover/qml/DefaultBanner.qml
@@ -1,12 +1,11 @@
 import QtQuick 2.1
 import QtQuick.Controls 1.1
-import org.kde.plasma.core 2.0
 
 Item
 {
-    IconItem {
+    Image {
         id: icon
-        source: "kde"
+        source: "image:/icon/kde"
         y: 30
         width: 200
         height: 200
diff --git a/discover/qml/FeaturedBanner.qml b/discover/qml/FeaturedBanner.qml
index 4381f21..a8b3e99 100644
--- a/discover/qml/FeaturedBanner.qml
+++ b/discover/qml/FeaturedBanner.qml
@@ -1,6 +1,5 @@
 import QtQuick 2.1
-import org.kde.plasma.core 2.0
-import org.kde.plasma.components 2.0 as Components
+import QtQuick.Controls 1.1
 import "navigation.js" as Navigation
 
 Information {
@@ -54,9 +53,9 @@ Information {
             opacity: 0.7
         }
         
-        Components.ToolButton {
+        ToolButton {
             id: prevButton
-            iconSource: "go-previous"
+            iconName: "go-previous"
             height: parent.height*0.9
             width: height
             onClicked: info.previous()
@@ -67,7 +66,7 @@ Information {
             }
         }
         
-        IconItem {
+        Image {
             id: iconItem
             anchors {
                 left: prevButton.right
@@ -76,10 +75,10 @@ Information {
                 margins: 3
             }
             width: height
-            source: titleBar.modelData ? titleBar.modelData.icon : "kde"
+            source: titleBar.modelData ? titleBar.modelData.icon : "image://icon/kde"
         }
         
-        Components.Label {
+        Label {
             anchors {
                 left: iconItem.right
                 verticalCenter: parent.verticalCenter
@@ -88,8 +87,8 @@ Information {
             color: "white"
             text: titleBar.modelData ? i18n("<b>%1</b><br/>%2", titleBar.modelData.text, titleBar.modelData.comment) : ""
         }
-        Components.ToolButton {
-            iconSource: "go-next"
+        ToolButton {
+            iconName: "go-next"
             height: parent.height*0.9
             width: height
             onClicked: info.next()
diff --git a/discover/qml/GridItem.qml b/discover/qml/GridItem.qml
index da2931c..88988f2 100644
--- a/discover/qml/GridItem.qml
+++ b/discover/qml/GridItem.qml
@@ -21,11 +21,9 @@
 ///This is a fork of ListItem so that it can be used for GridView
 
 import QtQuick 2.1
-import org.kde.plasma.core 2.0 as PlasmaCore
 
 MouseArea {
     id: listItem
-    default property alias content: paddingItem.data
 
     //this defines if the item will emit clicked and look pressed on mouse down
     property alias enabled: listItem.enabled
@@ -38,36 +36,4 @@ MouseArea {
 
     property bool changeBackgroundOnPress: !listItem.checked
     hoverEnabled: true
-
-    PlasmaCore.FrameSvgItem {
-        id : background
-        imagePath: "widgets/listitem"
-        prefix: (listItem.checked || listItem.pressed) ? "pressed" : "normal"
-
-        anchors.fill: parent
-        opacity: listItem.containsMouse && !listItem.pressed ? 0.5 : 1
-        Behavior on opacity { NumberAnimation { duration: 200 } }
-    }
-    PlasmaCore.SvgItem {
-        svg: PlasmaCore.Svg {imagePath: "widgets/listitem"}
-        elementId: "separator"
-        anchors {
-            left: parent.left
-            right: parent.right
-            top: parent.top
-        }
-        height: naturalSize.height
-        visible: listItem.sectionDelegate || (typeof(index) != "undefined" && index > 0 && !listItem.checked && !listItem.pressed)
-    }
-
-    Item {
-        id: paddingItem
-        anchors {
-            fill: background
-            leftMargin: background.margins.left
-            topMargin: background.margins.top
-            rightMargin: background.margins.right
-            bottomMargin: background.margins.bottom
-        }
-    }
 }
diff --git a/discover/qml/Main.qml b/discover/qml/Main.qml
index 3690d36..4f18506 100644
--- a/discover/qml/Main.qml
+++ b/discover/qml/Main.qml
@@ -20,7 +20,6 @@
 
 import QtQuick 2.1
 import QtQuick.Controls 1.1
-import org.kde.plasma.components 2.0 as PlasmaComponents
 import org.kde.muon.discover 1.0
 import "navigation.js" as Navigation
 
@@ -163,7 +162,7 @@ Item
         Behavior on height { NumberAnimation { duration: 250 } }
     }
 
-    PlasmaComponents.ToolBar {
+    ToolBar {
         id: pageToolBar
         anchors {
             top: parent.top
diff --git a/discover/qml/MuonToolButton.qml b/discover/qml/MuonToolButton.qml
index 6810324..f3a6a6b 100644
--- a/discover/qml/MuonToolButton.qml
+++ b/discover/qml/MuonToolButton.qml
@@ -1,17 +1,16 @@
 import QtQuick 2.1
 import QtQuick.Controls 1.1
-import org.kde.plasma.core 2.0
 
 ToolButton
 {
     id: button
-    property alias icon: iconItem.source
+    property string icon: ""
     property alias text: labelItem.text
     property alias overlayText: overlayTextItem.text
     width: height+(labelItem.text=="" ? 0 : labelItem.width)
     anchors.margins: 5
     
-    IconItem {
+    Image {
         id: iconItem
         anchors {
             top: parent.top
@@ -21,6 +20,7 @@ ToolButton
         }
         width: height
         smooth: true
+        source: "image://icon/"+button.icon
     }
     
     Label {
diff --git a/discover/qml/ProgressView.qml b/discover/qml/ProgressView.qml
index 7d4509f..037e7c9 100644
--- a/discover/qml/ProgressView.qml
+++ b/discover/qml/ProgressView.qml
@@ -1,7 +1,6 @@
 import QtQuick 2.1
 import QtQuick.Controls 1.1
 import QtQuick.Layouts 1.1
-import org.kde.plasma.core 2.0
 import org.kde.muon 1.0
 import "navigation.js" as Navigation
 
@@ -70,9 +69,9 @@ ToolBar {
                 id: launcherRow
                 anchors.fill: parent
                 spacing: 2
-                IconItem {
+                Image {
                     anchors.verticalCenter: parent.verticalCenter
-                    source: model.app.icon
+                    source: "image://icon/"+model.app.icon
                     Layout.preferredHeight: parent.height*0.5
                     width: height
                 }
@@ -107,7 +106,8 @@ ToolBar {
                     rightMargin: 3
                 }
                 width: (parent.width - anchors.leftMargin - anchors.rightMargin)*(listener.progress/100)
-                color: theme.textColor
+                SystemPalette { id: theme }
+                color: theme.buttonText
                 height: 1
                 opacity: 0.5
                 visible: listener.isActive
diff --git a/discover/qml/Rating.qml b/discover/qml/Rating.qml
index ed5a8e2..2238b9f 100644
--- a/discover/qml/Rating.qml
+++ b/discover/qml/Rating.qml
@@ -18,7 +18,6 @@
  */
 
 import QtQuick 2.1
-import org.kde.plasma.core 2.0
 
 Item {
     id: view
diff --git a/discover/qml/ReviewsPage.qml b/discover/qml/ReviewsPage.qml
index 5077c68..a1ee106 100644
--- a/discover/qml/ReviewsPage.qml
+++ b/discover/qml/ReviewsPage.qml
@@ -20,7 +20,6 @@
 
 import QtQuick 2.1
 import QtQuick.Controls 1.1
-import org.kde.plasma.extras 2.0
 import org.kde.muon 1.0
 
 Item
diff --git a/discover/qml/UpdatesPage.qml b/discover/qml/UpdatesPage.qml
index 2dfc5fb..c3eefb7 100644
--- a/discover/qml/UpdatesPage.qml
+++ b/discover/qml/UpdatesPage.qml
@@ -1,6 +1,5 @@
 import QtQuick 2.1
 import QtQuick.Controls 1.1
-import org.kde.plasma.core 2.0 as PlasmaCore
 import org.kde.muon 1.0
 
 Item



More information about the Plasma-devel mailing list