ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #01065
[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode into lp:ubuntu-docviewer-app
Stefano Verzegnassi has proposed merging lp:~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode into lp:ubuntu-docviewer-app.
Commit message:
Added night mode
Requested reviews:
Ubuntu Document Viewer Developers (ubuntu-docviewer-dev)
Related bugs:
Bug #1432420 in Ubuntu Document Viewer App: "[pdfView] Add a night mode with inverted colors"
https://bugs.launchpad.net/ubuntu-docviewer-app/+bug/1432420
For more details, see:
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode/+merge/254255
Added night mode
--
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode into lp:ubuntu-docviewer-app.
=== modified file 'po/com.ubuntu.docviewer.pot'
--- po/com.ubuntu.docviewer.pot 2015-03-12 19:00:33 +0000
+++ po/com.ubuntu.docviewer.pot 2015-03-26 14:10:17 +0000
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-03-12 19:59+0100\n"
+"POT-Creation-Date: 2015-03-26 15:05+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -19,8 +19,8 @@
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
#: ../src/app/qml/common/DetailsPage.qml:27
-#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:91
-#: ../src/app/qml/textView/TextViewDefaultHeader.qml:77
+#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:97
+#: ../src/app/qml/textView/TextViewDefaultHeader.qml:83
msgid "Details"
msgstr ""
@@ -189,7 +189,7 @@
msgstr ""
#: ../src/app/qml/documentPage/DocumentPage.qml:25
-#: /home/stefano/tmp/translations/build-ubuntu-docviewer-app-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1
+#: /home/stefano/Progetti/doc-viewer/build-ubuntu-docviewer-app-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_14_10_utopic-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1
msgid "Document Viewer"
msgstr ""
@@ -237,6 +237,16 @@
msgid "Go to page..."
msgstr ""
+#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:91
+#: ../src/app/qml/textView/TextViewDefaultHeader.qml:77
+msgid "Disable night mode"
+msgstr ""
+
+#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:91
+#: ../src/app/qml/textView/TextViewDefaultHeader.qml:77
+msgid "Enable night mode"
+msgstr ""
+
#: ../src/app/qml/pdfView/PdfViewGotoDialog.qml:25
msgid "Go to page"
msgstr ""
@@ -250,10 +260,10 @@
msgid "GO!"
msgstr ""
-#: ../src/app/qml/textView/TextView.qml:39
+#: ../src/app/qml/textView/TextView.qml:42
msgid "Loading..."
msgstr ""
-#: /home/stefano/tmp/translations/build-ubuntu-docviewer-app-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2
+#: /home/stefano/Progetti/doc-viewer/build-ubuntu-docviewer-app-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_14_10_utopic-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2
msgid "documents;viewer;pdf;reader;"
msgstr ""
=== added file 'src/app/qml/common/NightModeShader.qml'
--- src/app/qml/common/NightModeShader.qml 1970-01-01 00:00:00 +0000
+++ src/app/qml/common/NightModeShader.qml 2015-03-26 14:10:17 +0000
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2015 Canonical, Ltd.
+ *
+ * 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
+ * the Free Software Foundation; version 3.
+ *
+ * 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 General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.3
+
+ShaderEffect {
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+
+ void main() {
+ lowp vec4 p = texture2D(source, qt_TexCoord0);
+ p.r = 1.0 - p.r;
+ p.g = 1.0 - p.g;
+ p.b = 1.0 - p.b;
+ gl_FragColor = vec4(vec3(dot(p.rgb, vec3(0.344, 0.5, 0.156))), p.a) * qt_Opacity;
+ }
+ "
+}
+
=== modified file 'src/app/qml/pdfView/PdfView.qml'
--- src/app/qml/pdfView/PdfView.qml 2015-03-12 19:00:33 +0000
+++ src/app/qml/pdfView/PdfView.qml 2015-03-26 14:10:17 +0000
@@ -38,6 +38,9 @@
bottomEdgePageComponent: PdfContentsPage {}
bottomEdgeEnabled: poppler.tocModel.count > 0
+ // Reset night mode shader settings when closing the page
+ // Component.onDestruction: mainView.nightModeEnabled = false
+
PDF.VerticalView {
id: pdfView
objectName: "pdfView"
=== modified file 'src/app/qml/pdfView/PdfViewDefaultHeader.qml'
--- src/app/qml/pdfView/PdfViewDefaultHeader.qml 2015-03-04 12:28:46 +0000
+++ src/app/qml/pdfView/PdfViewDefaultHeader.qml 2015-03-26 14:10:17 +0000
@@ -87,6 +87,12 @@
},
Action {
+ iconName: "night-mode"
+ text: mainView.nightModeEnabled ? i18n.tr("Disable night mode") : i18n.tr("Enable night mode")
+ onTriggered: mainView.nightModeEnabled = !mainView.nightModeEnabled
+ },
+
+ Action {
objectName: "detailsAction"
text: i18n.tr("Details")
iconName: "info"
=== modified file 'src/app/qml/textView/TextView.qml'
--- src/app/qml/textView/TextView.qml 2015-02-13 15:30:01 +0000
+++ src/app/qml/textView/TextView.qml 2015-03-26 14:10:17 +0000
@@ -24,6 +24,9 @@
id: textPage
title: Utils.getNameOfFile(file.path);
+ // Reset night mode shader settings when closing the page
+ // Component.onDestruction: mainView.nightModeEnabled = false
+
TextArea {
id: textAreaMain
objectName: "textAreaMain"
=== modified file 'src/app/qml/textView/TextViewDefaultHeader.qml'
--- src/app/qml/textView/TextViewDefaultHeader.qml 2015-02-13 15:30:01 +0000
+++ src/app/qml/textView/TextViewDefaultHeader.qml 2015-03-26 14:10:17 +0000
@@ -73,6 +73,12 @@
actions: [
Action {
+ iconName: "night-mode"
+ text: mainView.nightModeEnabled ? i18n.tr("Disable night mode") : i18n.tr("Enable night mode")
+ onTriggered: mainView.nightModeEnabled = !mainView.nightModeEnabled
+ },
+
+ Action {
objectName: "detailsAction"
text: i18n.tr("Details")
iconName: "info"
=== modified file 'src/app/qml/ubuntu-docviewer-app.qml'
--- src/app/qml/ubuntu-docviewer-app.qml 2015-02-13 15:30:01 +0000
+++ src/app/qml/ubuntu-docviewer-app.qml 2015-03-26 14:10:17 +0000
@@ -20,6 +20,7 @@
import com.ubuntu.fileqmlplugin 1.0
import DocumentViewer 1.0
+import "common"
import "common/loadComponent.js" as LoadComponent
MainView {
@@ -98,4 +99,8 @@
}
}
}
+
+ property bool nightModeEnabled: false
+ layer.effect: NightModeShader {}
+ layer.enabled: nightModeEnabled && (pageStack.depth > 1)
}
Follow ups
-
[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode into lp:ubuntu-docviewer-app
From: noreply, 2015-04-07
-
[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode into lp:ubuntu-docviewer-app
From: Stefano Verzegnassi, 2015-04-07
-
Re: [Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode into lp:ubuntu-docviewer-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-04-07
-
Re: [Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode into lp:ubuntu-docviewer-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-04-07
-
Re: [Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode into lp:ubuntu-docviewer-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-04-02
-
[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode into lp:ubuntu-docviewer-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-04-02
-
[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode into lp:ubuntu-docviewer-app
From: Alan Pope , 2015-04-02
-
Re: [Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode into lp:ubuntu-docviewer-app
From: Alan Pope , 2015-04-02
-
Re: [Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode into lp:ubuntu-docviewer-app
From: Stefano Verzegnassi, 2015-03-26
-
Re: [Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode into lp:ubuntu-docviewer-app
From: Alan Pope , 2015-03-26
-
Re: [Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/add-night-mode into lp:ubuntu-docviewer-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-03-26