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

List:       kde-commits
Subject:    [kdeplasma-addons] applets/konsoleprofiles/package/contents/ui: redo entirely the layouts of konsole
From:       Shaun Reich <shaun.reich () kdemail ! net>
Date:       2012-02-07 4:17:36
Message-ID: 20120207041736.53E71A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit a0f270492c02df2b8d3ecf1792b5916c1c0d18a3 by Shaun Reich.
Committed on 07/02/2012 at 05:06.
Pushed by sreich into branch 'master'.

redo entirely the layouts of konsoleprofiles

fixes: highlighter off-the-grid bugs

breaks: title is missing now, need to readd it

M  +111  -112  applets/konsoleprofiles/package/contents/ui/konsoleprofiles.qml

http://commits.kde.org/kdeplasma-addons/a0f270492c02df2b8d3ecf1792b5916c1c0d18a3

diff --git a/applets/konsoleprofiles/package/contents/ui/konsoleprofiles.qml \
b/applets/konsoleprofiles/package/contents/ui/konsoleprofiles.qml index \
                2b9976c..fcc37e5 100644
--- a/applets/konsoleprofiles/package/contents/ui/konsoleprofiles.qml
+++ b/applets/konsoleprofiles/package/contents/ui/konsoleprofiles.qml
@@ -34,148 +34,147 @@ Item {
         Component.onCompleted: connectedSources = sources
     }
 
+    PlasmaCore.DataModel {
+        id: profilesModel
+        dataSource: profilesSource
+    }
+
     Component.onCompleted: {
         plasmoid.popupIcon = "utilities-terminal";
         plasmoid.aspectRatioMode = IgnoreAspectRatio;
     }
 
-    PlasmaComponents.Label {
-        id: header
-        text: i18n("Konsole Profiles")
-        anchors { top: parent.top; left: parent.left; right: parent.right }
-        horizontalAlignment: Text.AlignHCenter
-    }
 
    PlasmaCore.Svg {
        id: lineSvg
        imagePath: "widgets/line"
     }
 
-    PlasmaCore.SvgItem {
-        id: separator
-
-        anchors { top: header.bottom; left: parent.left; right: parent.right }
-        anchors { topMargin: 3 }
-
-        svg: lineSvg
-        elementId: "horizontal-line"
-        height: lineSvg.elementSize("horizontal-line").height
-    }
 
-    ListView {
-        id: profileView
-        anchors {
-            top : scrollBar.top
-            topMargin: 10
-            bottom: konsoleProfiles.bottom
-            left: parent.left
-            leftMargin: 10
-            right: scrollBar.left
-            rightMargin: 10
-        }
+    Column {
+        width: parent.width
+        height: parent.height
 
-        model: PlasmaCore.DataModel {
-            dataSource: profilesSource
-        }
+  //      Row {
+   //         id: searchRow
 
-        delegate: profileViewDelegate
-
-        //NOTE: if this is fixed, fix kate, konq and kdevelop session applets
-        //if applicable.
-        // FIXME: after a few experiments..is broken
-        // the highlight item's sizing is always cut off.
-        // yet I have no problems with my own svg, but without anchors or
-        // anything on the component, it bugs out on sizing...
-
-       highlight: PlasmaComponents.Highlight {
-//            anchors { left: profileView.left; right: profileView.right }
- //           width: view.width
-  //          height: view.height
-            //TODO: animation. Ideally the Highlight component itself needs to do \
                it.
-            //the question is...how much should that api handle, and how much do I \
                need to..
-//            Behavior on opacity { NumberAnimation { duration: 250 } }
-            hover: true;
-        }
+    //        width: parent.width
 
-        //highlight: profileViewHighlighter
-// old, working good way. I think the plasma component is busted, or my use of it \
                is.
-//    Component {
-//        id: profileViewHighlighter
-//
-//        PlasmaCore.FrameSvgItem {
-//            imagePath: "widgets/viewitem"
-//            prefix: "hover"
-//            opacity: 0
 //        }
-//    }
 
-        highlightMoveDuration: 250
-        highlightMoveSpeed: 1
 
-        clip: true
+            PlasmaCore.SvgItem {
+                id: separator
 
-        Component.onCompleted: currentIndex = -1
-    }
+                anchors { left: parent.left; right: parent.right } //top: \
header.bottom;  } +//                anchors { topMargin: 3 }
 
-    PlasmaComponents.ScrollBar {
-        id: scrollBar
+                svg: lineSvg
+                elementId: "horizontal-line"
+                height: lineSvg.elementSize("horizontal-line").height
+            }
 
-        anchors {
-            top: separator.bottom
-            right: parent.right
-            bottom: parent.bottom
+        //Row {
+        //    id: searchRow
+        //
+        //    width: parent.width
+        //
+        //    PlasmaComponents.TextField {
+        //        id: searchBox
+        //
+        //        clearButtonShown: true
+        //        placeholderText: i18n("Type a word...")
+        //        width: parent.width // - icon.width - parent.spacing
+        //
+        //        onTextChanged: {
+        //            timer.running = true
+        //            mainWindow.listdictionaries = false
+        //        }
+        //    }
+        //}
+
+        //we use this to compute a fixed height for the items, and also to implement
+        //the said constant below (itemHeight)
+        Text {
+            id: textMetric
+            visible: false
+            // i think this should indeed technically be translated, even though we \
won't ever use it, just +            // its height/width
+            text: i18n("Arbitrary String Which Says The Dictionary Type")
         }
 
-        orientation: Qt.Vertical
-        flickableItem: profileView
-        // TODO: set to something "constant", like 2 list item heights, or \
                something.
-        // that way we don't get these pixel steppings
-        stepSize: 40
-        scrollButtonInterval: 50
-    }
-
-    //we use this to compute a fixed height for the items, and also to implement
-    //the said constant below (itemHeight)
-    Text {
-        id: heightMetric
-        visible: false
-        text: "Arbitrary String"
-    }
-
-    property int itemHeight: heightMetric.height * 2
-    Component {
-        id: profileViewDelegate
+        Flickable {
+            id: flickable
+
+            width: parent.width
+            height: parent.height
+            //FIXME:            contentHeight: mainWindow.listdictionaries ? 0 : \
textBrowser.paintedHeight +            clip: true
+
+            ListView {
+                id: view
+
+                anchors.fill: parent
+                anchors.topMargin: 20
+
+                model: profilesModel
+                spacing: 15
+
+                delegate: Item {
+                    id: listdelegate
+                    height: textMetric.paintedHeight
+                    anchors { left: parent.left; leftMargin: 10; right: \
parent.right; rightMargin: 10 } +
+                    Text {
+                        id: text
+                        anchors.fill: parent
+                        //anchors { left: parent.left; right: parent.right; \
verticalCenter: parent.verticalCenter } +                       text: "TEST" \
//model.name + " - " + model.description +                    }
+
+                    MouseArea {
+                        height: parent.height + 15
+                        anchors { left: parent.left; right: parent.right;}
+                        hoverEnabled: true
+
+                        onClicked: {
+                            console.log("CLICKED: " + model.name)
+                        }
+
+                        onEntered: {
+                            view.currentIndex = index
+                            view.highlightItem.opacity = 1
+                        }
+
+                        onExited: {
+                            view.highlightItem.opacity = 0
+                        }
+                    }
+                }
 
-        Item {
-            height: itemHeight
-            anchors { left: parent.left; leftMargin: 10; right: parent.right; \
rightMargin: 10 } +                highlight: PlasmaComponents.Highlight {
+                    anchors { left: parent.left; right: parent.right; leftMargin: \
10; rightMargin: 10 } +                    height: textMetric.paintedHeight
+                    hover: true;
+                }
 
-            Text {
-                id: text
-                anchors { left: parent.left; right: parent.right; verticalCenter: \
                parent.verticalCenter }
-                text: model.prettyName
+                highlightMoveDuration: 250
+                highlightMoveSpeed: 1
             }
+        }
 
-            MouseArea {
-                height: itemHeight
-                anchors { left: parent.left; right: parent.right }
-                hoverEnabled: true
+        PlasmaComponents.ScrollBar {
+            id: scrollBar
 
-                onClicked: {
-                    var service = \
                profilesSource.serviceForSource(model["DataEngineSource"])
-                    var operation = service.operationDescription("open")
-                    var job = service.startOperationCall(operation)
-                }
+            anchors { bottom: parent.bottom }
 
-                onEntered: {
-                    profileView.currentIndex = index
-                    profileView.highlightItem.opacity = 1
-                }
+            orientation: Qt.Vertical
+            stepSize: 40 // textBrowser.lineCount / 4
+            scrollButtonInterval: 40 //textBrowser.lineCount / 4
 
-                onExited: {
-                    profileView.highlightItem.opacity = 0
-                }
-            }
+            flickableItem: flickable
         }
     }
+
+//    property int itemHeight: heightMetric.height * 2
 }


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

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