Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
FIX #16
Browse files Browse the repository at this point in the history
  • Loading branch information
MerrickZ committed Sep 9, 2015
1 parent 998ddb2 commit eafe243
Show file tree
Hide file tree
Showing 13 changed files with 175 additions and 20 deletions.
2 changes: 1 addition & 1 deletion ZhihuDaily/.settings/com.rim.tad.tools.qml.core.prefs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
config-pri.hash=ACA53A00EF03CF8367CB78DD1559ED11
config-pri.hash=C6C6A7F74B1D22C12A933D68C6B3201A
config-pri.version=2.0
eclipse.preferences.version=1
4 changes: 3 additions & 1 deletion ZhihuDaily/assets/.assets.index
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
1
25
27
about.qml
ad.css
Common.qml
icon/icon_187.png
icon/icon_211.png
icon/ic_browser.png
icon/ic_decrease.png
Expand All @@ -23,5 +24,6 @@ image/logo.png
main.qml
settings.qml
VisualStyle.Dark/ad.css
VisualStyle.Dark/image/bg.png
webviewer.qml
webviewEx.qml
Binary file added ZhihuDaily/assets/VisualStyle.Dark/image/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZhihuDaily/assets/icon/ic_edit_bookmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZhihuDaily/assets/icon/icon_187.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ZhihuDaily/assets/image/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions ZhihuDaily/assets/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ NavigationPane {
id: aboutpage
}
}
settingsAction: SettingsActionItem {
onTriggered: {
var settings_page_obj = settingspage.createObject();
settings_page_obj.nav = navigationPane;
navigationPane.push(settings_page_obj);
}
attachedObjects: ComponentDefinition {
source: "settings.qml"
id: settingspage
}
}
actions: [
ActionItem {
title: qsTr("Review")
Expand Down
37 changes: 37 additions & 0 deletions ZhihuDaily/assets/settings.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import bb.cascades 1.4

Page {
property variant nav
actionBarVisibility: ChromeVisibility.Compact
actionBarAutoHideBehavior: ActionBarAutoHideBehavior.Disabled
ScrollView {
Container {
Header {
Expand Down Expand Up @@ -42,6 +45,40 @@ Page {
verticalAlignment: VerticalAlignment.Center
}
}
Header {
title: qsTr("Web Viewer Settings")
}
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
leftMargin: 20.0
rightMargin: 20.0
topPadding: 20.0
leftPadding: 20.0
bottomPadding: 20.0
rightPadding: 20.0
ImageView {
imageSource: "asset:///icon/icon_187.png"
scalingMethod: ScalingMethod.AspectFit
filterColor: Color.DarkGray
verticalAlignment: VerticalAlignment.Center
}
Label {
text: qsTr("Show Images")
verticalAlignment: VerticalAlignment.Center
layoutProperties: StackLayoutProperties {
spaceQuota: 1.0
}
}
ToggleButton {
checked: _app.getv("web_image_enabled", "true") == "true"
onCheckedChanged: {
checked ? _app.setv("web_image_enabled", "true") : _app.setv("web_image_enabled", "false")
}
verticalAlignment: VerticalAlignment.Center
}
}
}
}
}
1 change: 1 addition & 0 deletions ZhihuDaily/assets/webviewEx.qml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Page {
scrview.scrollViewProperties.maxContentScale = maxContentScale;
}
settings.webInspectorEnabled: true
settings.imageDownloadingEnabled: _app.getv("web_image_enabled", "true") == "true"
}
}
Container {
Expand Down
81 changes: 81 additions & 0 deletions ZhihuDaily/assets/webviewer.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import bb.cascades 1.4

Page {
function setActive() {
scrollview.scrollRole = ScrollRole.Main;
scrollview.requestFocus()
}
property alias uri: webv.url
property variant nav
titleBar: TitleBar {
title: webv.title
scrollBehavior: TitleBarScrollBehavior.NonSticky
}
actions: [
ActionItem {
title: qsTr("Open in browser")
onTriggered: {
Qt.openUrlExternally(uri)
}
imageSource: "asset:///icon/ic_open.png"
ActionBar.placement: ActionBarPlacement.Signature
}
]
actionBarAutoHideBehavior: ActionBarAutoHideBehavior.Disabled
actionBarVisibility: ChromeVisibility.Compact
Container {
verticalAlignment: VerticalAlignment.Fill
horizontalAlignment: HorizontalAlignment.Fill
background: ui.palette.background
ImageView {
imageSource: "asset:///image/bg.png"
scalingMethod: ScalingMethod.AspectFill
verticalAlignment: VerticalAlignment.Fill
horizontalAlignment: HorizontalAlignment.Fill
}
layout: DockLayout {

}
ScrollView {
id: scrollview
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
scrollRole: ScrollRole.Main
WebView {
id: webv
property bool isDapenti: webv.url.toString().indexOf("dapenti.com") > -1
property bool fontsizeset: false
visible: loadProgress > 10
horizontalAlignment: HorizontalAlignment.Fill
settings.userStyleSheetLocation: "ad.css"
preferredHeight: Infinity
onNavigationRequested: {
if (url.toString().trim().length == 0) {
return;
}
if (request.navigationType == WebNavigationType.LinkClicked || request.navigationType == WebNavigationType.OpenWindow) {
request.action = WebNavigationRequestAction.Ignore
var page = Qt.createComponent("webviewer.qml").createObject(nav);
page.uri = request.url;
page.nav = nav;
nav.push(page)
}
}
settings.userAgent: "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7"
settings.zoomToFitEnabled: true
settings.defaultFontSizeFollowsSystemFontSize: true
settings.textAutosizingEnabled: false
settings.imageDownloadingEnabled: _app.getv("web_image_enabled", "true") == "true"
}
}
ProgressIndicator {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Top
fromValue: 0.0
toValue: 100.0
value: webv.loadProgress
visible: webv.loading
}

}
}
5 changes: 5 additions & 0 deletions ZhihuDaily/config.pri
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ config_pri_assets {
OTHER_FILES += \
$$quote($$BASEDIR/assets/Common.qml) \
$$quote($$BASEDIR/assets/VisualStyle.Dark/ad.css) \
$$quote($$BASEDIR/assets/VisualStyle.Dark/image/bg.png) \
$$quote($$BASEDIR/assets/about.qml) \
$$quote($$BASEDIR/assets/ad.css) \
$$quote($$BASEDIR/assets/icon/ic_browser.png) \
Expand All @@ -52,6 +53,7 @@ config_pri_assets {
$$quote($$BASEDIR/assets/icon/ic_share.png) \
$$quote($$BASEDIR/assets/icon/ic_zoom_in.png) \
$$quote($$BASEDIR/assets/icon/ic_zoom_out.png) \
$$quote($$BASEDIR/assets/icon/icon_187.png) \
$$quote($$BASEDIR/assets/icon/icon_211.png) \
$$quote($$BASEDIR/assets/image/bg.png) \
$$quote($$BASEDIR/assets/image/dim.amd) \
Expand Down Expand Up @@ -91,6 +93,9 @@ lupdate_inclusion {
$$quote($$BASEDIR/../assets/VisualStyle.Dark/*.qml) \
$$quote($$BASEDIR/../assets/VisualStyle.Dark/*.js) \
$$quote($$BASEDIR/../assets/VisualStyle.Dark/*.qs) \
$$quote($$BASEDIR/../assets/VisualStyle.Dark/image/*.qml) \
$$quote($$BASEDIR/../assets/VisualStyle.Dark/image/*.js) \
$$quote($$BASEDIR/../assets/VisualStyle.Dark/image/*.qs) \
$$quote($$BASEDIR/../assets/icon/*.qml) \
$$quote($$BASEDIR/../assets/icon/*.js) \
$$quote($$BASEDIR/../assets/icon/*.qs) \
Expand Down
8 changes: 8 additions & 0 deletions ZhihuDaily/translations/ZhihuDaily.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@
<source>Use Dark Theme</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Web Viewer Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show Images</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>webviewEx</name>
Expand Down
46 changes: 28 additions & 18 deletions ZhihuDaily/translations/ZhihuDaily_zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
<message>
<location filename="../assets/about.qml" line="67"/>
<source>Project on Github</source>
<translation type="unfinished"></translation>
<translation>Github上的项目主页</translation>
</message>
<message>
<location filename="../assets/about.qml" line="82"/>
<source>Issues / Bug Report</source>
<translation type="unfinished"></translation>
<translation>问题 / 建议 / 反馈</translation>
</message>
<message>
<source>&lt;a href=&apos;https://github.com/BBDev-CN/zhihu&apos;&gt;Project on Github&lt;/a&gt;</source>
Expand Down Expand Up @@ -83,38 +83,38 @@
<translation type="obsolete">知乎日报</translation>
</message>
<message>
<location filename="../assets/main.qml" line="24"/>
<location filename="../assets/main.qml" line="35"/>
<source>Review</source>
<translation type="unfinished"></translation>
<translation>评论</translation>
</message>
<message>
<location filename="../assets/main.qml" line="31"/>
<location filename="../assets/main.qml" line="42"/>
<source>Theme</source>
<translation>主题切换</translation>
</message>
<message>
<location filename="../assets/main.qml" line="286"/>
<location filename="../assets/main.qml" line="355"/>
<location filename="../assets/main.qml" line="297"/>
<location filename="../assets/main.qml" line="366"/>
<source>Time Machine</source>
<translation>时光机</translation>
</message>
<message>
<location filename="../assets/main.qml" line="294"/>
<location filename="../assets/main.qml" line="305"/>
<source>Use this feature to navigate back in time.</source>
<translation>使用时光机来查阅往期杂志</translation>
</message>
<message>
<location filename="../assets/main.qml" line="303"/>
<location filename="../assets/main.qml" line="314"/>
<source>Date</source>
<translation>日期</translation>
</message>
<message>
<location filename="../assets/main.qml" line="324"/>
<location filename="../assets/main.qml" line="335"/>
<source>Back to Today</source>
<translation>今天</translation>
</message>
<message>
<location filename="../assets/main.qml" line="343"/>
<location filename="../assets/main.qml" line="354"/>
<source>Go!</source>
<translation>出发</translation>
</message>
Expand All @@ -126,25 +126,35 @@
<context>
<name>settings</name>
<message>
<location filename="../assets/settings.qml" line="7"/>
<location filename="../assets/settings.qml" line="10"/>
<source>Visual Style</source>
<translation>应用外观</translation>
</message>
<message>
<location filename="../assets/settings.qml" line="26"/>
<location filename="../assets/settings.qml" line="29"/>
<source>Use Dark Theme</source>
<translation>使用暗调主题</translation>
</message>
<message>
<location filename="../assets/settings.qml" line="49"/>
<source>Web Viewer Settings</source>
<translation>网页选项</translation>
</message>
<message>
<location filename="../assets/settings.qml" line="68"/>
<source>Show Images</source>
<translation>显示图片</translation>
</message>
</context>
<context>
<name>webviewEx</name>
<message>
<location filename="../assets/webviewEx.qml" line="110"/>
<location filename="../assets/webviewEx.qml" line="111"/>
<source>Zoom -</source>
<translation>缩小</translation>
</message>
<message>
<location filename="../assets/webviewEx.qml" line="120"/>
<location filename="../assets/webviewEx.qml" line="121"/>
<source>Zoom +</source>
<translation>放大</translation>
</message>
Expand All @@ -153,12 +163,12 @@
<translation type="obsolete">还原缩放级别</translation>
</message>
<message>
<location filename="../assets/webviewEx.qml" line="130"/>
<location filename="../assets/webviewEx.qml" line="131"/>
<source>Share</source>
<translation>共享网址</translation>
</message>
<message>
<location filename="../assets/webviewEx.qml" line="138"/>
<location filename="../assets/webviewEx.qml" line="139"/>
<source>Open in Browser</source>
<translation>在浏览器中打开</translation>
</message>
Expand Down Expand Up @@ -188,7 +198,7 @@
<message>
<location filename="../assets/webviewer.qml" line="16"/>
<source>Open in browser</source>
<translation type="unfinished"></translation>
<translation>在系统浏览器中打开</translation>
</message>
</context>
</TS>

0 comments on commit eafe243

Please sign in to comment.