Roman Shchekin has proposed merging lp:~mrqtros/ubuntu-rssreader-app/ubuntu-rssreader-app-night-mode-reworked into lp:ubuntu-rssreader-app.
Commit message: Cleanup in Shorts: * "night mode" switcher in main menu. * icons from theme instead of predefined in resources. * options reworked. Requested reviews: Ubuntu Shorts Developers (ubuntu-rssreader-dev) For more details, see: https://code.launchpad.net/~mrqtros/ubuntu-rssreader-app/ubuntu-rssreader-app-night-mode-reworked/+merge/274043 Cleanup in Shorts: * "night mode" switcher in main menu. * icons from theme instead of predefined in resources. * options reworked. -- Your team Ubuntu Shorts Developers is requested to review the proposed merge of lp:~mrqtros/ubuntu-rssreader-app/ubuntu-rssreader-app-night-mode-reworked into lp:ubuntu-rssreader-app.
=== modified file 'shorts/qml/components/ArticleViewItem.qml' --- shorts/qml/components/ArticleViewItem.qml 2015-09-16 08:52:25 +0000 +++ shorts/qml/components/ArticleViewItem.qml 2015-10-10 12:39:16 +0000 @@ -64,7 +64,7 @@ ListView { id: rssListview - property int contentFontSize: optionsKeeper.fontSize() + property int contentFontSize: optionsKeeper.fontSize width: parent.width anchors { @@ -78,7 +78,6 @@ delegate: xmlDelegate snapMode: ListView.SnapOneItem cacheBuffer: 90 // value in pixels, for what? - // boundsBehavior: Flickable.StopAtBounds orientation: ListView.Horizontal contentHeight: parent.width * count highlightFollowsCurrentItem: true @@ -157,14 +156,14 @@ anchors.horizontalCenter: parent.horizontalCenter spacing: units.gu(1) - Image { + Icon { id: imgFavourite - anchors.verticalCenter: labelTime.verticalCenter - fillMode: Image.PreserveAspectCrop - source: Qt.resolvedUrl("/img/qml/icons/favorite-selected.svg") - sourceSize.height: modelItem == null ? 0 : (modelItem.favourite == "1" ? units.gu(2) : 0) + anchors { + top: parent.top + bottom: parent.bottom + } + name: "favorite-selected" visible: modelItem == null ? false : (modelItem.favourite == "1") - smooth: true } Label { === modified file 'shorts/qml/components/ListModeItem.qml' --- shorts/qml/components/ListModeItem.qml 2015-07-19 14:29:20 +0000 +++ shorts/qml/components/ListModeItem.qml 2015-10-10 12:39:16 +0000 @@ -126,12 +126,13 @@ height: labelTime.paintedHeight spacing: units.gu(0.5) - Image { + Icon { id: imgFavourite - anchors.verticalCenter: labelTime.verticalCenter - fillMode: Image.PreserveAspectCrop - source: Qt.resolvedUrl("/img/qml/icons/favorite-selected.svg") - sourceSize.height: model.favourite == "1" ? units.gu(1.5) : 0 + anchors { + top: parent.top + bottom: parent.bottom + } + name: "favorite-selected" visible: model.favourite == "1" } === modified file 'shorts/qml/components/OptionsKeeper.qml' --- shorts/qml/components/OptionsKeeper.qml 2015-07-04 08:38:18 +0000 +++ shorts/qml/components/OptionsKeeper.qml 2015-10-10 12:39:16 +0000 @@ -2,15 +2,25 @@ import U1db 1.0 as U1db /* New interface for options. - * Currently it is just facade on DB logic. + * Currently it is just facade on U1DB. */ Item { - signal fontSizeChanged(int value) - signal useDarkThemeChanged(bool value) - signal useListModeChanged(bool value) - - function fontSize() { + property int fontSize + property bool useDarkTheme + property bool useListMode + + Component.onCompleted: { + fontSize = getFontSize() + useDarkTheme = getUseDarkTheme() + useListMode = getUseListMode() + } + + onFontSizeChanged: setFontSize(fontSize) + onUseDarkThemeChanged: setUseDarkTheme(useDarkTheme) + onUseListModeChanged: setUseListMode(useListMode) + + function getFontSize() { return settingsDocument.contents.fontSize } @@ -18,10 +28,9 @@ var cont = settingsDocument.contents cont.fontSize = value settingsDocument.contents = cont - fontSizeChanged(value) } - function useDarkTheme() { + function getUseDarkTheme() { return settingsDocument.contents.useDarkTheme } @@ -29,10 +38,9 @@ var cont = settingsDocument.contents cont.useDarkTheme = value settingsDocument.contents = cont - useDarkThemeChanged(value) } - function useListMode() { + function getUseListMode() { return settingsDocument.contents.useListMode } @@ -40,7 +48,6 @@ var cont = settingsDocument.contents cont.useListMode = value settingsDocument.contents = cont - useListModeChanged(value) } function dbVersion() { === modified file 'shorts/qml/components/OrganicGrid.qml' --- shorts/qml/components/OrganicGrid.qml 2015-07-04 08:38:18 +0000 +++ shorts/qml/components/OrganicGrid.qml 2015-10-10 12:39:16 +0000 @@ -51,8 +51,10 @@ var componentsPath = "../delegates/" + "Article" var alignNames = ["TextA", "TextB", "OneImgA", "FullImg"] for (var i = 0; i < alignNames.length; i++) { - var componentName = componentsPath + alignNames[i] + ".qml"; - delegateComponents[i] = Qt.createComponent(componentName); + var componentName = componentsPath + alignNames[i] + ".qml" + delegateComponents[i] = Qt.createComponent(componentName) + if (delegateComponents[i].status == Component.Error) + console.log("prepareComponents", delegateComponents[i].errorString()) } } === modified file 'shorts/qml/components/ReadingOptions.qml' --- shorts/qml/components/ReadingOptions.qml 2015-09-16 08:52:25 +0000 +++ shorts/qml/components/ReadingOptions.qml 2015-10-10 12:39:16 +0000 @@ -16,8 +16,7 @@ id: readingOptionsPopover Component.onCompleted: { - fontSizeSlider.value = optionsKeeper.fontSize() - buttonRow.updateButtonsState() + fontSizeSlider.value = optionsKeeper.fontSize } Column { @@ -39,25 +38,15 @@ Button { text: i18n.tr("Dark") width: units.gu(14) - gradient: buttonRow.useDark ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient - onClicked: { - optionsKeeper.setUseDarkTheme(true) - buttonRow.updateButtonsState() - } + gradient: optionsKeeper.useDarkTheme ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient + onClicked: optionsKeeper.useDarkTheme = true } Button { text: i18n.tr("Light") width: units.gu(14) - gradient: buttonRow.useDark ? UbuntuColors.greyGradient : UbuntuColors.orangeGradient - onClicked: { - optionsKeeper.setUseDarkTheme(false) - buttonRow.updateButtonsState() - } - } - - function updateButtonsState() { - useDark = optionsKeeper.useDarkTheme() + gradient: optionsKeeper.useDarkTheme ? UbuntuColors.greyGradient : UbuntuColors.orangeGradient + onClicked: optionsKeeper.useDarkTheme = false } } } @@ -99,7 +88,7 @@ res = 1 else res = 2 - optionsKeeper.setFontSize(res) + optionsKeeper.fontSize = res } function formatValue(v) { === modified file 'shorts/qml/delegates/ArticleFullImg.qml' --- shorts/qml/delegates/ArticleFullImg.qml 2015-09-16 08:52:25 +0000 +++ shorts/qml/delegates/ArticleFullImg.qml 2015-10-10 12:39:16 +0000 @@ -81,12 +81,13 @@ height: labelTime.height spacing: units.gu(0.5) - Image { + Icon { id: imgFavourite - anchors.verticalCenter: labelTime.verticalCenter - fillMode: Image.PreserveAspectCrop - source: Qt.resolvedUrl("/img/qml/icons/favorite-selected.svg") - sourceSize.height: invalid ? 0 : (modelItem.favourite == "1" ? units.gu(1.5) : 0) + anchors { + top: parent.top + bottom: parent.bottom + } + name: "favorite-selected" visible: invalid ? false : (modelItem.favourite == "1") } === modified file 'shorts/qml/delegates/ArticleOneImgA.qml' --- shorts/qml/delegates/ArticleOneImgA.qml 2015-07-19 14:29:20 +0000 +++ shorts/qml/delegates/ArticleOneImgA.qml 2015-10-10 12:39:16 +0000 @@ -79,12 +79,13 @@ height: labelTime.paintedHeight spacing: units.gu(0.5) - Image { + Icon { id: imgFavourite - anchors.verticalCenter: labelTime.verticalCenter - fillMode: Image.PreserveAspectCrop - source: Qt.resolvedUrl("/img/qml/icons/favorite-selected.svg") - sourceSize.height: invalid ? 0 : (modelItem.favourite == "1" ? units.gu(1.5) : 0) + anchors { + top: parent.top + bottom: parent.bottom + } + name: "favorite-selected" visible: invalid ? false : (modelItem.favourite == "1") } === modified file 'shorts/qml/delegates/ArticleTextA.qml' --- shorts/qml/delegates/ArticleTextA.qml 2015-07-19 14:29:20 +0000 +++ shorts/qml/delegates/ArticleTextA.qml 2015-10-10 12:39:16 +0000 @@ -55,12 +55,13 @@ height: labelTime.paintedHeight spacing: units.gu(0.5) - Image { + Icon { id: imgFavourite - anchors.verticalCenter: labelTime.verticalCenter - fillMode: Image.PreserveAspectCrop - source: Qt.resolvedUrl("/img/qml/icons/favorite-selected.svg") - sourceSize.height: invalid ? 0 : (modelItem.favourite == "1" ? units.gu(1.5) : 0) + anchors { + top: parent.top + bottom: parent.bottom + } + name: "favorite-selected" visible: invalid ? false : (modelItem.favourite == "1") } === modified file 'shorts/qml/delegates/ArticleTextB.qml' --- shorts/qml/delegates/ArticleTextB.qml 2015-07-19 14:29:20 +0000 +++ shorts/qml/delegates/ArticleTextB.qml 2015-10-10 12:39:16 +0000 @@ -51,12 +51,13 @@ height: labelTime.paintedHeight spacing: units.gu(0.5) - Image { + Icon { id: imgFavourite - anchors.verticalCenter: labelTime.verticalCenter - fillMode: Image.PreserveAspectCrop - source: Qt.resolvedUrl("/img/qml/icons/favorite-selected.svg") - sourceSize.height: invalid ? 0 : (modelItem.favourite == "1" ? units.gu(1.5) : 0) + anchors { + top: parent.top + bottom: parent.bottom + } + name: "favorite-selected" visible: invalid ? false : (modelItem.favourite == "1") } === modified file 'shorts/qml/pages/AppendFeedPage.qml' --- shorts/qml/pages/AppendFeedPage.qml 2015-07-19 14:29:20 +0000 +++ shorts/qml/pages/AppendFeedPage.qml 2015-10-10 12:39:16 +0000 @@ -141,13 +141,11 @@ anchors { horizontalCenter: parent.horizontalCenter } - primaryItem: Image { - height: parent.height*0.5 + primaryItem: Icon { + height: parent.height * 0.5 width: height anchors.verticalCenter: parent.verticalCenter - // anchors.verticalCenterOffset: -units.gu(0.2) - source: Qt.resolvedUrl("/img/qml/icons/find.svg") - smooth: true + name: "search" MouseArea { anchors.fill: parent === modified file 'shorts/qml/pages/ArticleViewPage.qml' --- shorts/qml/pages/ArticleViewPage.qml 2015-09-16 08:52:25 +0000 +++ shorts/qml/pages/ArticleViewPage.qml 2015-10-10 12:39:16 +0000 @@ -44,12 +44,9 @@ head.actions: [ Action { - text: innerArticleView.modelItem == null ? "" : (innerArticleView.modelItem.favourite == "0" ? i18n.tr("Save") : i18n.tr("Remove")) - iconSource: { - if (innerArticleView.modelItem == null || innerArticleView.modelItem.favourite == "0") - return Qt.resolvedUrl("/img/qml/icons/favorite-unselected.svg") - else return Qt.resolvedUrl("/img/qml/icons/favorite-selected.svg") - } + text: !innerArticleView.modelItem ? "" : (innerArticleView.modelItem.favourite == "0" ? i18n.tr("Save") : i18n.tr("Remove")) + iconName: (!innerArticleView.modelItem || innerArticleView.modelItem.favourite == "0") ? + "favorite-unselected" : "favorite-selected" onTriggered: { var fav = (innerArticleView.modelItem.favourite == "0" ? "1" : "0") var dbResult = DB.updateArticleFavourite(innerArticleView.modelItem.id, fav) @@ -61,7 +58,7 @@ Action { text: i18n.tr("Options") - iconSource: "/img/qml/icons/settings.svg" + iconName: "settings" onTriggered: { PopupUtils.open(readingOptionsPopoverComponent, fakeItem) } @@ -69,7 +66,7 @@ Action { text: i18n.tr("Open site") - iconSource: Qt.resolvedUrl("/img/qml/icons/go-to.svg") + iconName: "go-to" onTriggered: { Qt.openUrlExternally(innerArticleView.modelItem.link) } === modified file 'shorts/qml/pages/TopicComponent.qml' --- shorts/qml/pages/TopicComponent.qml 2015-07-21 19:42:29 +0000 +++ shorts/qml/pages/TopicComponent.qml 2015-10-10 12:39:16 +0000 @@ -172,14 +172,13 @@ } } // Row - Image { + Icon { id: imgArrow anchors { right: parent.right; top: parent.top; bottom: parent.bottom; topMargin: units.gu(1.5); bottomMargin: units.gu(1.5); rightMargin: units.gu(2) } - fillMode: Image.PreserveAspectFit - source: Qt.resolvedUrl("/img/qml/icons/go-to.svg") + name: "go-to" rotation: topicComponent.isExpanded ? 90 : 0 Behavior on rotation { UbuntuNumberAnimation{} } === modified file 'shorts/qml/shorts-app.qml' --- shorts/qml/shorts-app.qml 2015-09-16 08:52:25 +0000 +++ shorts/qml/shorts-app.qml 2015-10-10 12:39:16 +0000 @@ -118,8 +118,8 @@ id: pageStack objectName: "pageStack" - property bool isListView: optionsKeeper.useListMode() - property var commonHeadActions: [refreshAction, changeModeAction, /*addReadsAction,*/ editTopicsAction] + property bool isListView: optionsKeeper.useListMode + property var commonHeadActions: [refreshAction, changeModeAction, editTopicsAction, nightModeAction] anchors.fill: parent focus: true @@ -182,14 +182,13 @@ id: refreshAction text: i18n.tr("Refresh") - iconSource: "/img/qml/icons/reload.svg" + iconName: "reload" onTriggered: refresh() } Action { id: changeModeAction text: pageStack.isListView ? i18n.tr("Grid View") : i18n.tr("List view") - //iconSource: pageStack.isListView ? Qt.resolvedUrl("/img/qml/icons/view-fullscreen.svg") : Qt.resolvedUrl("/img/qml/icons/view-restore.svg") iconName: pageStack.isListView ? "view-grid-symbolic" : "view-list-symbolic" onTriggered: { pageStack.isListView = !pageStack.isListView @@ -216,12 +215,22 @@ id: editTopicsAction objectName:"editTopicsAction" text: i18n.tr("Edit topics") - iconSource: Qt.resolvedUrl("/img/qml/icons/edit.svg") + iconName: "edit" onTriggered: { pageStack.push(topicManagement) } } + Action { + id: nightModeAction + objectName:"nightModeAction" + text: optionsKeeper.useDarkTheme ? i18n.tr("Disable night mode") : i18n.tr("Enable night mode") + iconName: "night-mode" + onTriggered: { + optionsKeeper.useDarkTheme = !optionsKeeper.useDarkTheme + } + } + /* -------------------------- Pages & Tabs ---------------------------- */ BottomEdgeTabs { @@ -558,5 +567,5 @@ } layer.effect: DarkModeShader {} - layer.enabled: optionsKeeper.useDarkTheme() && pageStack.currentPage == articlePage + layer.enabled: optionsKeeper.useDarkTheme // && pageStack.currentPage == articlePage }
-- Mailing list: https://launchpad.net/~ubuntu-touch-coreapps-reviewers Post to : ubuntu-touch-coreapps-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~ubuntu-touch-coreapps-reviewers More help : https://help.launchpad.net/ListHelp