Merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-merged-trunk-revno-181 into lp:ubuntu-docviewer-app

Proposed by Stefano Verzegnassi
Status: Merged
Approved by: Stefano Verzegnassi
Approved revision: 170
Merged at revision: 171
Proposed branch: lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-merged-trunk-revno-181
Merge into: lp:ubuntu-docviewer-app
Diff against target: 1007 lines (+540/-286)
13 files modified
AUTHORS (+26/-0)
src/app/qml/common/ToastWithAction.qml (+2/-2)
src/app/qml/documentPage/DeleteFileDialog.qml (+12/-2)
src/app/qml/documentPage/DocumentDelegateActions.qml (+41/-0)
src/app/qml/documentPage/DocumentGridDelegate.qml (+65/-169)
src/app/qml/documentPage/DocumentListDelegate.qml (+12/-19)
src/app/qml/documentPage/SortSettingsDialog.qml (+1/-1)
src/app/qml/documentPage/TileBase.qml (+369/-0)
src/plugin/file-qml-plugin/documentmodel.cpp (+0/-6)
src/plugin/poppler-qml-plugin/CMakeLists.txt (+1/-2)
src/plugin/poppler-qml-plugin/pdfdocument.cpp (+11/-8)
src/plugin/poppler-qml-plugin/pdfthread.cpp (+0/-35)
src/plugin/poppler-qml-plugin/pdfthread.h (+0/-42)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-merged-trunk-revno-181
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Roman Shchekin Approve
Review via email: mp+266904@code.launchpad.net

Commit message

Merged trunk (rev. 181) into "reboot" branch

Description of the change

Merged trunk (rev. 181) into "reboot" branch

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Roman Shchekin (mrqtros) wrote :

That's ok!

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'AUTHORS'
--- AUTHORS 1970-01-01 00:00:00 +0000
+++ AUTHORS 2015-08-04 16:03:21 +0000
@@ -0,0 +1,26 @@
1DocViewer was started in 2013 and has received many contributions from the following people.
2
3In addition, numerous translations, bug reports and other non-code contributions have been made which are equally valued.
4
5Adolfo Jayme Barrientos <fitojb@ubuntu.com>
6Akiva Abraham <akiva@linux.com>
7Alan Pope <alan.pope@canonical.com>
8Andrew Hayzen <ahayzen@gmail.com>
9Arto Jalkanen <ajalkane@gmail.com>
10Bartosz Kosiorek <gang65@poczta.onet.pl>
11Carla Sella <carla.sella@gmail.com>
12Daniel Holbach <daniel.holbach@canonical.com>
13David Planella <david.planella@ubuntu.com>
14Didier Roche <didrocks@ubuntu.com>
15Fabio Colella <fcole90@gmail.com>
16Francis Ginther <francis.ginther@canonical.com>
17Granger Anthony <grangeranthony@gmail.com>
18Michael Hall <mhall119@ubuntu.com>
19Nicholas Skaggs <nicholas.skaggs@canonical.com>
20Olivier Tilloy <olivier.tilloy@canonical.com>
21Omer Akram <om26er@ubuntu.com>
22Richard Somlói <level@somloirichard.hu>
23Roman Shchekin <mrqtros@gmail.com>
24Sergio Schvezov <sergio.schvezov@canonical.com>
25Stefano Verzegnassi <stefano92.100@gmail.com>
26xeranas <anorkus@fastmail.fm>
027
=== modified file 'src/app/qml/common/ToastWithAction.qml'
--- src/app/qml/common/ToastWithAction.qml 2015-04-07 22:52:48 +0000
+++ src/app/qml/common/ToastWithAction.qml 2015-08-04 16:03:21 +0000
@@ -60,8 +60,8 @@
60 }60 }
6161
62 AbstractButton {62 AbstractButton {
63 width: actionLabel.paintedWidth63 Layout.preferredWidth: actionLabel.paintedWidth
64 height: parent.height64 Layout.fillHeight: true
6565
66 onClicked: {66 onClicked: {
67 action.triggered("[Toast] Action %1 clicked!".arg(action.text))67 action.triggered("[Toast] Action %1 clicked!".arg(action.text))
6868
=== modified file 'src/app/qml/documentPage/DeleteFileDialog.qml'
--- src/app/qml/documentPage/DeleteFileDialog.qml 2015-04-29 15:23:32 +0000
+++ src/app/qml/documentPage/DeleteFileDialog.qml 2015-08-04 16:03:21 +0000
@@ -25,6 +25,14 @@
25 property string path25 property string path
26 property int __deleteCount: documentPage.view.item.selectedItems.count26 property int __deleteCount: documentPage.view.item.selectedItems.count
2727
28 // WORKAROUND: This property is used only when user wants to remove a single
29 // file from a delegate action, and the value of the property is read during
30 // the Component.onDestruction event.
31 // We do this because we need to avoid that the entry in the model is removed
32 // before this dialog is closed.
33 // See src/app/qml/documentPage/DocumentDelegateActions.qml
34 property bool confirmed: false
35
28 title: path ? i18n.tr("Delete file") :36 title: path ? i18n.tr("Delete file") :
29 i18n.tr("Delete %1 file", "Delete %1 files", __deleteCount).arg(__deleteCount)37 i18n.tr("Delete %1 file", "Delete %1 files", __deleteCount).arg(__deleteCount)
30 text: path ? i18n.tr("Are you sure you want to permanently delete this file?") :38 text: path ? i18n.tr("Are you sure you want to permanently delete this file?") :
@@ -43,17 +51,19 @@
4351
44 onClicked: {52 onClicked: {
45 if (deleteFileDialog.path) {53 if (deleteFileDialog.path) {
46 docModel.rm(path)54 deleteFileDialog.confirmed = true;
47 } else {55 } else {
56 // This is called from selection mode
48 var items = documentPage.view.item.selectedItems;57 var items = documentPage.view.item.selectedItems;
4958
50 for (var i=0; i < items.count; i++) {59 for (var i=0; i < items.count; i++) {
51 console.log("Removing:", items.get(i).model.path);60 console.log("Removing:", items.get(i).model.path);
52 docModel.rm(items.get(i).model.path);61 docModel.rm(items.get(i).model.path);
53 }62 }
63
64 viewLoader.item.endSelection();
54 }65 }
5566
56 viewLoader.item.endSelection();
57 PopupUtils.close(deleteFileDialog)67 PopupUtils.close(deleteFileDialog)
58 }68 }
59 }69 }
6070
=== added file 'src/app/qml/documentPage/DocumentDelegateActions.qml'
--- src/app/qml/documentPage/DocumentDelegateActions.qml 1970-01-01 00:00:00 +0000
+++ src/app/qml/documentPage/DocumentDelegateActions.qml 2015-08-04 16:03:21 +0000
@@ -0,0 +1,41 @@
1/*
2 Copyright (C) 2015 Canonical Ltd.
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License 3 as published by
6 the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see http://www.gnu.org/licenses/.
15*/
16
17import QtQuick 2.0
18import Ubuntu.Components 1.1
19import Ubuntu.Components.Popups 1.0
20
21QtObject {
22 property list<Action> leadingActions: [
23 Action {
24 iconName: "delete"
25 text: i18n.tr("Delete")
26 onTriggered: {
27 var dialog = PopupUtils.open(Qt.resolvedUrl("DeleteFileDialog.qml"),
28 documentPage, { path: model.path })
29
30 dialog.Component.destruction.connect(function() {
31 if (dialog.confirmed) {
32 console.log("Removing:", model.path);
33 docModel.rm(model.path);
34 }
35 });
36 }
37 }
38 ]
39
40 property list<Action> trailingActions
41}
042
=== modified file 'src/app/qml/documentPage/DocumentGridDelegate.qml'
--- src/app/qml/documentPage/DocumentGridDelegate.qml 2015-07-14 01:35:59 +0000
+++ src/app/qml/documentPage/DocumentGridDelegate.qml 2015-08-04 16:03:21 +0000
@@ -16,14 +16,11 @@
1616
17import QtQuick 2.017import QtQuick 2.0
18import Ubuntu.Components 1.118import Ubuntu.Components 1.1
19import QtQuick.Layouts 1.1
2019
21import "../common/utils.js" as Utils20import "../common/utils.js" as Utils
2221
23AbstractButton {22TileBase {
24 id: root23 id: root
25 property bool selected: false
26 property bool selectionMode: false
2724
28 function formattedDateTime() {25 function formattedDateTime() {
29 var date = new Date(model.date)26 var date = new Date(model.date)
@@ -49,169 +46,68 @@
49 return Qt.formatDateTime(date, i18n.tr("dd-MM-yyyy hh:mm"))46 return Qt.formatDateTime(date, i18n.tr("dd-MM-yyyy hh:mm"))
50 }47 }
5148
52 Rectangle {49 title: model.name
53 anchors { fill: parent; margins: units.gu(0.5) }50 text: formattedDateTime()
5451 subText: Utils.printSize(i18n, model.size)
55 color: Qt.lighter(UbuntuColors.lightGrey)52
56 clip: true53 leadingActions: documentDelegateActions.leadingActions
5754 trailingActions: documentDelegateActions.trailingActions
58 Loader {55
59 id: selectionIcon56 Icon {
6057 id: extStorageIcon
61 anchors {58
62 right: parent.right59 width: units.gu(4)
63 top: parent.top60 height: units.gu(4)
64 }61 anchors {
6562 left: parent.left
66 z: 1063 top: parent.top
6764 margins: units.gu(0.5)
68 width: (status === Loader.Ready) ? item.implicitWidth : 065 }
69 visible: (status === Loader.Ready) && (item.width === item.implicitWidth)66
70 Behavior on opacity {67 visible: model.isFromExternalStorage
71 NumberAnimation {68 source: Qt.resolvedUrl("../../graphics/sd-card-symbolic.png")
72 duration: UbuntuAnimation.SnapDuration69 }
73 }70
74 }71 // Document mimetype icon
75 }72 Icon {
7673 anchors.centerIn: parent
77 Icon {74 width: units.gu(8); height: width
78 id: extStorageIcon75
7976 // At the moment the suru icon theme doesn't have much icons.
80 width: units.gu(4)77 // Just some note for the future:
81 height: units.gu(4)78 // TODO: Add icons for Office/ODF documents
82 anchors {79 // TODO: Whenever there will be icons for source code files, add them.
83 left: parent.left80 name: {
84 top: parent.top81 if (model.mimetype.substring(0, 5) === "text/")
85 margins: units.gu(0.5)82 return "text-x-generic-symbolic"
86 }83
8784 if (model.mimetype.substring(0, 5) === "image")
88 visible: model.isFromExternalStorage85 return "image-x-generic-symbolic"
89 source: Qt.resolvedUrl("../../graphics/sd-card-symbolic.png")86
90 }87 if (model.mimetype === "application/pdf")
9188 return "application-pdf-symbolic"
92 // Document mimetype icon89
93 Icon {90 return "package-x-generic-symbolic"
94 anchors.centerIn: parent91 }
95 anchors.verticalCenterOffset: - infoColumn.height * 0.392 }
9693
97 width: units.gu(8); height: width94 // Cover
9895 /* Image {
99 // At the moment the suru icon theme doesn't have much icons.96 anchors.fill: parent
100 // Just some note for the future:97
101 // TODO: Add icons for Office/ODF documents98 source: {
102 // TODO: Whenever there will be icons for source code files, add them.99 if (model.cover !== "" && typeof model.cover !== "undefined")
103 name: {100 return model.cover
104 if (model.mimetype.substring(0, 5) === "text/")101
105 return "text-x-generic-symbolic"102 if (model.mimetype.toString().indexOf("image") !== -1)
106103 return model.path
107 if (model.mimetype.substring(0, 5) === "image")104
108 return "image-x-generic-symbolic"105 return ""
109106 }
110 if (model.mimetype === "application/pdf")107
111 return "application-pdf-symbolic"108 sourceSize.width: width
112109 fillMode: Image.PreserveAspectCrop
113 if (model.mimetype === "application/vnd.oasis.opendocument.text"110 }*/
114 || model.mimetype === "application/msword"111
115 || model.mimetype === "application/vnd.openxmlformats-officedocument.wordprocessingml.document")112 DocumentDelegateActions { id: documentDelegateActions }
116 return "x-office-document-symbolic"
117
118 if (model.mimetype === "application/vnd.oasis.opendocument.spreadsheet"
119 || model.mimetype === "application/vnd.ms-excel"
120 || model.mimetype === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
121 return "x-office-spreadsheet-symbolic"
122
123 if (model.mimetype === "application/vnd.oasis.opendocument.presentation"
124 || model.mimetype === "application/vnd.ms-powerpoint"
125 || model.mimetype === "application/vnd.openxmlformats-officedocument.presentationml.presentation")
126 return "x-office-presentation-symbolic"
127
128 return "package-x-generic-symbolic"
129 }
130 }
131
132 // Cover
133 /* Image {
134 anchors.fill: parent
135
136 source: {
137 if (model.cover !== "" && typeof model.cover !== "undefined")
138 return model.cover
139
140 if (model.mimetype.toString().indexOf("image") !== -1)
141 return model.path
142
143 return ""
144 }
145
146 sourceSize.width: width
147 fillMode: Image.PreserveAspectCrop
148 }*/
149
150 // Document info overlay
151 Rectangle {
152 id: overlay
153
154 anchors {
155 left: parent.left
156 right: parent.right
157 bottom: parent.bottom
158 }
159
160 height: infoColumn.height + units.gu(1)
161
162 color: UbuntuColors.darkGrey
163 opacity: 0.75
164 layer.enabled: true
165
166 // Document info
167 Column {
168 id: infoColumn
169 anchors {
170 left: parent.left;
171 right: parent.right
172 verticalCenter: parent.verticalCenter
173 margins: units.gu(0.5)
174 }
175
176 Label {
177 text: model.name
178 color: "white"
179
180 elide: Text.ElideRight
181 font.weight: Font.DemiBold
182 fontSize: "small"
183
184 anchors { left: parent.left; right: parent.right }
185 }
186
187 Label {
188 text: formattedDateTime()
189 color: "white"
190 fontSize: "small"
191
192 anchors { left: parent.left; right: parent.right }
193 }
194
195 Label {
196 text: Utils.printSize(i18n, model.size)
197 color: "white"
198 fontSize: "small"
199
200 anchors { left: parent.left; right: parent.right }
201 }
202 } // Document info end
203 }
204
205 states: [
206 State {
207 name: "select"
208 when: selectionMode || selected
209 PropertyChanges {
210 target: selectionIcon
211 source: Qt.resolvedUrl("../upstreamComponents/ListItemWithActionsCheckBox.qml")
212 anchors.margins: units.gu(1)
213 }
214 }
215 ]
216 }
217}113}
218114
=== modified file 'src/app/qml/documentPage/DocumentListDelegate.qml'
--- src/app/qml/documentPage/DocumentListDelegate.qml 2015-07-14 01:35:59 +0000
+++ src/app/qml/documentPage/DocumentListDelegate.qml 2015-08-04 16:03:21 +0000
@@ -23,6 +23,8 @@
23import "../upstreamComponents"23import "../upstreamComponents"
2424
25ListItemWithActions {25ListItemWithActions {
26 property QtObject documentDelegateActions: DocumentDelegateActions { }
27
26 function formattedDateTime() {28 function formattedDateTime() {
27 var date = new Date(model.date)29 var date = new Date(model.date)
28 var diff = model.dateDiff30 var diff = model.dateDiff
@@ -30,16 +32,14 @@
30 if (sortSettings.sortMode !== 0) { // The sort rule is not "by date"32 if (sortSettings.sortMode !== 0) { // The sort rule is not "by date"
31 switch(diff) {33 switch(diff) {
32 case 0: // DocumentsModel.Today34 case 0: // DocumentsModel.Today
33 // TRANSLATORS: this is a datetime formatting string, and the35 // TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
34 // singlequote is an escape character.36 // http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
35 // See http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.37 return i18n.tr("Today, %1").arg(Qt.formatTime(date, Qt.locale().timeFormat(Locale.ShortFormat)))
36 return Qt.formatDateTime(date, i18n.tr("'Today', hh:mm"))
3738
38 case 1: // DocumentsModel.Yesterday39 case 1: // DocumentsModel.Yesterday
39 // TRANSLATORS: this is a datetime formatting string, and the40 // TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
40 // singlequote is an escape character.41 // http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
41 // See http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.42 return i18n.tr("Yesterday, %1").arg(Qt.formatTime(date, Qt.locale().timeFormat(Locale.ShortFormat)))
42 return Qt.formatDateTime(date, i18n.tr("'Yesterday', hh:mm"))
4343
44 default: // DocumentsModel.LastWeek || DocumentsModel.LastMonth || DocumentsModel.Earlier44 default: // DocumentsModel.LastWeek || DocumentsModel.LastMonth || DocumentsModel.Earlier
45 // TRANSLATORS: this is a datetime formatting string,45 // TRANSLATORS: this is a datetime formatting string,
@@ -70,23 +70,16 @@
7070
71 locked: documentPage.state == "pickMode"71 locked: documentPage.state == "pickMode"
7272
73 // TODO: NEEDS-DESIGN: Enable left action. Still need to find an equivalent for GridDelegate.73 leftSideAction: documentDelegateActions.leadingActions[0]
74 /* leftSideAction: Action {74 rightSideActions: documentDelegateActions.trailingActions
75 iconName: "delete"
76 text: i18n.tr("Delete")
77 onTriggered: {
78 PopupUtils.open(Qt.resolvedUrl("DeleteFileDialog.qml"),
79 documentPage, { path: model.filePath })
80 }
81 }*/
8275
83 contents: RowLayout {76 contents: RowLayout {
84 anchors.fill: parent77 anchors.fill: parent
85 spacing: units.gu(2)78 spacing: units.gu(2)
8679
87 Icon {80 Icon {
88 width: height81 Layout.preferredWidth: height
89 height: units.gu(5)82 Layout.preferredHeight: units.gu(5)
9083
91 // At the moment the suru icon theme doesn't have much icons.84 // At the moment the suru icon theme doesn't have much icons.
92 name: {85 name: {
9386
=== modified file 'src/app/qml/documentPage/SortSettingsDialog.qml'
--- src/app/qml/documentPage/SortSettingsDialog.qml 2015-06-10 17:17:47 +0000
+++ src/app/qml/documentPage/SortSettingsDialog.qml 2015-08-04 16:03:21 +0000
@@ -18,7 +18,7 @@
18import QtQuick 2.018import QtQuick 2.0
19import Ubuntu.Components 1.119import Ubuntu.Components 1.1
20import Ubuntu.Components.Popups 1.020import Ubuntu.Components.Popups 1.0
21import QtQuick.Layouts 1.021import QtQuick.Layouts 1.1
2222
23Dialog {23Dialog {
24 id: sortSettingsDialog24 id: sortSettingsDialog
2525
=== added file 'src/app/qml/documentPage/TileBase.qml'
--- src/app/qml/documentPage/TileBase.qml 1970-01-01 00:00:00 +0000
+++ src/app/qml/documentPage/TileBase.qml 2015-08-04 16:03:21 +0000
@@ -0,0 +1,369 @@
1/*
2 Copyright (C) 2014, 2015 Canonical Ltd.
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License 3 as published by
6 the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see http://www.gnu.org/licenses/.
15*/
16
17import QtQuick 2.0
18import Ubuntu.Components 1.1
19import Ubuntu.Components.Popups 1.0
20import Ubuntu.Components.ListItems 1.0 as ListItem
21
22AbstractButton {
23 id: root
24
25 property bool selected: false
26 property bool selectionMode: false
27
28 default property alias content: tileContent.data
29
30 property alias title: titleLabel.text
31 property alias text: textLabel.text
32 property alias subText: subTextLabel.text
33
34 // We don't really have swipe gesture here, but we anyway use the same
35 // properties' name used for UITK1.2 ListItem just for consistency.
36 property list<Action> trailingActions // Right to Left gesture in ListItem
37 property list<Action> leadingActions // Left to Right gesture in ListItem
38
39 Rectangle {
40 id: rect
41
42 anchors { fill: parent; margins: units.gu(0.5) }
43
44 color: Qt.lighter(UbuntuColors.lightGrey)
45 clip: true
46
47 Item {
48 id: tileContent
49
50 height: parent.height - captionsLayout.height * 0.3 - units.gu(2)
51 anchors {
52 left: parent.left
53 right: parent.right
54 verticalCenter: parent.verticalCenter
55 verticalCenterOffset: - captionsLayout.height * 0.3
56 }
57 }
58
59 Loader {
60 id: overflowButton
61
62 anchors {
63 right: parent.right
64 top: parent.top
65 }
66
67 z: 10
68
69 sourceComponent: actionsOverflowButton
70
71 onStatusChanged: {
72 if (status === Loader.Ready) {
73 item.iconName = "contextual-menu"
74 item.color = UbuntuColors.darkGrey
75 item.width = overflowButton.width
76 item.height = overflowButton.height
77
78 item.triggered.connect(function() {
79 var overflowPanel = PopupUtils.open(actionsOverflowPopoverComponent, item)
80 item.overflowPanelVisible = overflowPanel.visible;
81
82 overflowPanel.visibleChanged.connect(function() {
83 item.overflowPanelVisible = overflowPanel.visible
84 });
85 });
86 }
87 }
88
89 width: units.gu(5)
90 height: units.gu(5)
91 visible: rect.state !== "select" && (trailingActions.length > 0 || leadingActions.length > 0)
92
93 Behavior on opacity {
94 NumberAnimation {
95 duration: UbuntuAnimation.SnapDuration
96 }
97 }
98 }
99
100 Loader {
101 id: selectionIcon
102
103 anchors {
104 right: parent.right
105 top: parent.top
106 }
107
108 z: 10
109
110 width: (status === Loader.Ready) ? item.implicitWidth : 0
111 visible: (status === Loader.Ready) && (item.width === item.implicitWidth)
112 Behavior on opacity {
113 NumberAnimation {
114 duration: UbuntuAnimation.SnapDuration
115 }
116 }
117 }
118
119 // Tile captions
120 Rectangle {
121 id: captionsRect
122
123 anchors {
124 left: parent.left
125 right: parent.right
126 bottom: parent.bottom
127 }
128
129 height: captionsLayout.height + units.gu(1)
130
131 color: UbuntuColors.darkGrey
132 opacity: 0.75
133 layer.enabled: true
134
135 Column {
136 id: captionsLayout
137 anchors {
138 left: parent.left;
139 right: parent.right
140 verticalCenter: parent.verticalCenter
141 margins: units.gu(0.5)
142 }
143
144 Label {
145 id: titleLabel
146 color: "white"
147
148 elide: Text.ElideRight
149 font.weight: Font.DemiBold
150 fontSize: "small"
151
152 anchors { left: parent.left; right: parent.right }
153 }
154
155 Label {
156 id: textLabel
157 color: "white"
158 fontSize: "small"
159
160 anchors { left: parent.left; right: parent.right }
161 }
162
163 Label {
164 id: subTextLabel
165 color: "white"
166 fontSize: "small"
167
168 anchors { left: parent.left; right: parent.right }
169 }
170 }
171 }
172
173 states: [
174 State {
175 name: "select"
176 when: selectionMode || selected
177 PropertyChanges {
178 target: selectionIcon
179 sourceComponent: selectionCheckBox
180 anchors.margins: units.gu(1)
181 }
182 }
183 ]
184 }
185
186 // *** COMPONENTS
187 Component {
188 id: selectionCheckBox
189
190 CheckBox {
191 checked: root.selected
192 width: implicitWidth
193 // disable item mouse area to avoid conflicts with parent mouse area
194 __mouseArea.enabled: false
195 }
196 }
197
198 Component {
199 id: actionsOverflowButton
200
201 AbstractButton {
202 id: button
203
204 property alias color: icon.color
205 property bool overflowPanelVisible: false
206
207 width: visible ? units.gu(5) : 0
208 height: parent ? parent.height : undefined
209 Rectangle {
210 visible: button.pressed || button.overflowPanelVisible
211 anchors.fill: parent
212 color: Theme.palette.selected.background
213 }
214
215 Icon {
216 id: icon
217 anchors.centerIn: parent
218
219 // prevent trying to render the icon with an invalid source
220 // when the button is invisible by setting width and height to 0
221 width: visible ? units.gu(2.5) : 0
222 height: visible ? units.gu(2.5) : 0
223 source: button.iconSource
224 color: Qt.rgba(0, 0, 0, 0)
225 opacity: button.enabled ? 1.0 : 0.3
226 }
227
228 Component {
229 id: labelComponent
230 Label {
231 id: label
232 objectName: button.objectName + "_label"
233 color: button.color
234 opacity: button.enabled ? 1.0 : 0.3
235 text: button.text
236 fontSize: "xx-small"
237 }
238 }
239 Loader {
240 anchors {
241 top: icon.bottom
242 topMargin: units.gu(0.5)
243 horizontalCenter: parent.horizontalCenter
244 }
245 sourceComponent: button.state === "IconAndLabel" ? labelComponent : null
246 }
247 }
248 }
249
250 Component {
251 id: actionsOverflowPopoverComponent
252
253 Popover {
254 id: actionsOverflowPopover
255 property bool square: true
256 callerMargin: -units.gu(1) + units.dp(4)
257 contentWidth: units.gu(20)
258 contentHeight: popoverActionsLayout.height
259
260 Connections {
261 target: root
262 onLeadingActionsChanged: {
263 actionsOverflowPopover.hide();
264 }
265 onTrailingActionsChanged: {
266 actionsOverflowPopover.hide();
267 }
268 }
269
270 Column {
271 id: popoverActionsLayout
272 anchors {
273 left: parent.left
274 top: parent.top
275 right: parent.right
276 }
277 Repeater {
278 id: overflowTrailingRepeater
279 model: root.trailingActions
280
281 delegate: overflowPanelDelegate
282 onItemAdded: {
283 item.action = model[index]
284 item.clicked.connect(function() {
285 actionsOverflowPopover.hide()
286 })
287
288 item.showDivider = (overflowLeadingRepeater.count === 0) ? (index !== overflowTrailingRepeater.count - 1) : true
289 }
290 }
291
292 Repeater {
293 id: overflowLeadingRepeater
294 model: root.leadingActions
295
296 delegate: overflowPanelDelegate
297 onItemAdded: {
298 item.action = model[index]
299 item.clicked.connect(function() {
300 actionsOverflowPopover.hide()
301 })
302
303 item.showDivider = (index !== overflowLeadingRepeater.count - 1)
304 }
305 }
306 }
307 }
308 }
309
310 Component {
311 id: overflowPanelDelegate
312
313 AbstractButton {
314 id: rootItem
315 implicitHeight: units.gu(6) + bottomDividerLine.height
316 width: parent ? parent.width : units.gu(31)
317
318 property bool showDivider: true
319 property color foregroundColor: Theme.palette.selected.backgroundText
320
321 Rectangle {
322 visible: parent.pressed
323 anchors {
324 left: parent.left
325 right: parent.right
326 top: parent.top
327 }
328 height: parent.height - bottomDividerLine.height
329 color: Theme.palette.selected.background
330 }
331
332 Icon {
333 id: actionIcon
334 source: action.iconSource
335 color: rootItem.foregroundColor
336 anchors {
337 verticalCenter: parent.verticalCenter
338 verticalCenterOffset: units.dp(-1)
339 left: parent.left
340 leftMargin: units.gu(2)
341 }
342 width: units.gu(2)
343 height: units.gu(2)
344 opacity: action.enabled ? 1.0 : 0.5
345 }
346
347 Label {
348 anchors {
349 verticalCenter: parent.verticalCenter
350 verticalCenterOffset: units.dp(-1)
351 left: actionIcon.right
352 leftMargin: units.gu(2)
353 right: parent.right
354 }
355 fontSize: "small"
356 elide: Text.ElideRight
357 text: action.text
358 color: rootItem.foregroundColor
359 opacity: action.enabled ? 1.0 : 0.5
360 }
361
362 ListItem.ThinDivider {
363 id: bottomDividerLine
364 anchors.bottom: parent.bottom
365 visible: rootItem.showDivider
366 }
367 }
368 }
369}
0370
=== modified file 'src/plugin/file-qml-plugin/documentmodel.cpp'
--- src/plugin/file-qml-plugin/documentmodel.cpp 2015-07-14 01:35:59 +0000
+++ src/plugin/file-qml-plugin/documentmodel.cpp 2015-08-04 16:03:21 +0000
@@ -240,15 +240,9 @@
240 QString rootPath = volume.rootPath();240 QString rootPath = volume.rootPath();
241241
242 if (rootPath.startsWith("/media/")) {242 if (rootPath.startsWith("/media/")) {
243 // In a Unix filesystem, names are case sentitive.
244 // For that reason we need to check twice.
245 QDir dir;243 QDir dir;
246
247 dir.setPath(rootPath + "/Documents");244 dir.setPath(rootPath + "/Documents");
248 if (dir.exists())
249 m_docsMonitor->addDirectory(dir.canonicalPath());
250245
251 dir.setPath(rootPath + "/documents");
252 if (dir.exists())246 if (dir.exists())
253 m_docsMonitor->addDirectory(dir.canonicalPath());247 m_docsMonitor->addDirectory(dir.canonicalPath());
254 }248 }
255249
=== modified file 'src/plugin/poppler-qml-plugin/CMakeLists.txt'
--- src/plugin/poppler-qml-plugin/CMakeLists.txt 2015-04-15 14:47:28 +0000
+++ src/plugin/poppler-qml-plugin/CMakeLists.txt 2015-08-04 16:03:21 +0000
@@ -11,7 +11,6 @@
11 plugin.cpp11 plugin.cpp
12 pdfdocument.cpp12 pdfdocument.cpp
13 pdfimageprovider.cpp13 pdfimageprovider.cpp
14 pdfthread.cpp
15 pdfitem.cpp14 pdfitem.cpp
16 verticalview.cpp15 verticalview.cpp
17 pdftocmodel.cpp16 pdftocmodel.cpp
@@ -23,7 +22,7 @@
2322
24target_link_libraries(popplerqmlplugin poppler-qt5)23target_link_libraries(popplerqmlplugin poppler-qt5)
2524
26qt5_use_modules(popplerqmlplugin Gui Qml Quick Xml)25qt5_use_modules(popplerqmlplugin Gui Qml Quick Xml Concurrent)
2726
28# Copy the plugin, the qmldir file and other assets to the build dir for running in QtCreator27# Copy the plugin, the qmldir file and other assets to the build dir for running in QtCreator
29if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")28if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
3029
=== modified file 'src/plugin/poppler-qml-plugin/pdfdocument.cpp'
--- src/plugin/poppler-qml-plugin/pdfdocument.cpp 2015-03-25 16:51:53 +0000
+++ src/plugin/poppler-qml-plugin/pdfdocument.cpp 2015-08-04 16:03:21 +0000
@@ -19,13 +19,13 @@
1919
20#include "pdfdocument.h"20#include "pdfdocument.h"
21#include "pdfimageprovider.h"21#include "pdfimageprovider.h"
22#include "pdfthread.h"
2322
24#include <poppler/qt5/poppler-qt5.h>23#include <poppler/qt5/poppler-qt5.h>
25#include <QDebug>24#include <QDebug>
26#include <QQmlEngine>25#include <QQmlEngine>
27#include <QQmlContext>26#include <QQmlContext>
28#include <QThread>27
28#include <QtConcurrent/QtConcurrent>
2929
30PdfDocument::PdfDocument(QAbstractListModel *parent):30PdfDocument::PdfDocument(QAbstractListModel *parent):
31 QAbstractListModel(parent)31 QAbstractListModel(parent)
@@ -145,12 +145,15 @@
145 if (!m_document)145 if (!m_document)
146 return false;146 return false;
147147
148 PdfThread *pdfThread = new PdfThread();148 Poppler::Document* document = m_document;
149 pdfThread->setDocument(m_document);149 QtConcurrent::run( [=] {
150150 PdfPagesList pages;
151 connect(pdfThread, SIGNAL(resultReady(PdfPagesList)), this, SLOT(_q_populate(PdfPagesList)));151
152 connect(pdfThread, SIGNAL(finished()), pdfThread, SLOT(deleteLater()));152 for( int i = 0; i < document->numPages(); ++i )
153 pdfThread->start();153 pages.append(document->page(i));
154
155 QMetaObject::invokeMethod(this, "_q_populate", Qt::QueuedConnection, Q_ARG(PdfPagesList, pages));
156 });
154157
155 return true;158 return true;
156}159}
157160
=== removed file 'src/plugin/poppler-qml-plugin/pdfthread.cpp'
--- src/plugin/poppler-qml-plugin/pdfthread.cpp 2015-01-30 18:42:00 +0000
+++ src/plugin/poppler-qml-plugin/pdfthread.cpp 1970-01-01 00:00:00 +0000
@@ -1,35 +0,0 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Stefano Verzegnassi <stefano92.100@gmail.com>
17 */
18
19#include "pdfthread.h"
20#include <QDebug>
21
22void PdfThread::run()
23{
24 PdfPagesList pages;
25
26 for( int i=0; i<m_document->numPages(); i++ )
27 pages.append(m_document->page(i));
28
29 Q_EMIT resultReady(pages);
30}
31
32void PdfThread::setDocument(Poppler::Document *document)
33{
34 m_document = document;
35}
360
=== removed file 'src/plugin/poppler-qml-plugin/pdfthread.h'
--- src/plugin/poppler-qml-plugin/pdfthread.h 2015-01-30 18:42:00 +0000
+++ src/plugin/poppler-qml-plugin/pdfthread.h 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
1/*
2 * Copyright (C) 2014-2015 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Stefano Verzegnassi <stefano92.100@gmail.com>
17 */
18
19#ifndef PDFTHREAD_H
20#define PDFTHREAD_H
21
22#include <QThread>
23#include <poppler/qt5/poppler-qt5.h>
24
25typedef QList<Poppler::Page*> PdfPagesList;
26
27class PdfThread : public QThread
28{
29 Q_OBJECT
30
31public:
32 void run();
33 void setDocument(Poppler::Document *document);
34
35Q_SIGNALS:
36 void resultReady(PdfPagesList pages);
37
38private:
39 Poppler::Document *m_document;
40};
41
42#endif // PDFTHREAD_H

Subscribers

People subscribed via source and target branches