← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk13-textview into lp:ubuntu-docviewer-app

 

Stefano Verzegnassi has proposed merging lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk13-textview into lp:ubuntu-docviewer-app.

Commit message:
[TextView] Switch to UITK 1.3 PageHeader component

Requested reviews:
  Ubuntu Document Viewer Developers (ubuntu-docviewer-dev)

For more details, see:
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-docviewer-app/uitk13-textview/+merge/289482

[TextView] Switch to UITK 1.3 PageHeader component
-- 
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-docviewer-app/uitk13-textview into lp:ubuntu-docviewer-app.
=== modified file 'src/app/qml/textView/TextView.qml'
--- src/app/qml/textView/TextView.qml	2015-12-26 18:27:13 +0000
+++ src/app/qml/textView/TextView.qml	2016-03-18 11:23:04 +0000
@@ -23,10 +23,11 @@
 
 Page {
     id: textPage
-    title: DocumentViewer.getFileBaseNameFromPath(file.path)
 
-    // Reset night mode shader settings when closing the page
-    // Component.onDestruction: mainView.nightModeEnabled = false
+    header: TextViewDefaultHeader {
+        title: DocumentViewer.getFileBaseNameFromPath(file.path)
+        activityRunning: textAreaMain.isLoading
+    }
 
     TextArea {
         id: textAreaMain
@@ -34,7 +35,12 @@
 
         property bool isLoading: true
 
-        anchors.fill: parent
+        anchors {
+            top: textPage.header.bottom
+            left: parent.left
+            right: parent.right
+            bottom: parent.bottom
+        }
 
         // FIXME: If set to true, some of the keyboard hooks are disabled
         // And it's not possible to move the cursor with arrow keys.
@@ -61,14 +67,4 @@
             background: Rectangle { color: "white" }
         }
     }
-
-    // *** HEADER ***
-    state: "default"
-    states: [
-        TextViewDefaultHeader {
-            name: "default"
-            targetPage: textPage
-            activityRunning: textAreaMain.isLoading
-        }
-    ]
 }

=== modified file 'src/app/qml/textView/TextViewDefaultHeader.qml'
--- src/app/qml/textView/TextViewDefaultHeader.qml	2015-11-13 21:19:46 +0000
+++ src/app/qml/textView/TextViewDefaultHeader.qml	2016-03-18 11:23:04 +0000
@@ -20,44 +20,30 @@
 import Ubuntu.Components.Popups 1.3
 import DocumentViewer 1.0
 
-PageHeadState {
+PageHeader {
     id: rootItem
 
-    property Page targetPage
     property alias activityRunning: activity.running
 
-    head: targetPage.head
-
-    contents: RowLayout {
-        anchors.fill: parent
-        spacing: units.gu(1)
-
-        ActivityIndicator { id: activity; visible: running }
-
-        Column {
-            id: layout
-            Layout.fillWidth: true
-
-            Label {
-                width: parent.width
-                //horizontalAlignment: Text.AlignHCenter
-                elide: Text.ElideMiddle
-
-                font.weight: Font.DemiBold
-                text: targetPage.title
-            }
-            Label {
-                width: parent.width
-                //horizontalAlignment: Text.AlignHCenter
-                elide: Text.ElideMiddle
-
-                textSize: Label.Small
-                text: file.mimetype.description
-            }
-        }
+    contents: ListItemLayout {
+        anchors.centerIn: parent
+
+        ActivityIndicator {
+            id: activity
+            SlotsLayout.position: SlotsLayout.Leading
+            visible: running
+        }
+
+        title {
+            font.weight: Font.DemiBold
+            elide: Text.ElideMiddle
+            text: rootItem.title
+        }
+
+        subtitle.text: file.mimetype.description
     }
 
-    actions: [
+    trailingActionBar.actions: [
         Action {
             iconName: "night-mode"
             text: mainView.nightModeEnabled ? i18n.tr("Disable night mode") : i18n.tr("Enable night mode")


Follow ups