Skip to content

Commit

Permalink
examples/QMLPlayer: add video effects
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed May 28, 2016
1 parent d299aee commit dd7b9f1
Show file tree
Hide file tree
Showing 9 changed files with 237 additions and 42 deletions.
Binary file modified examples/QMLPlayer/i18n/QMLPlayer_zh_CN.qm
Binary file not shown.
94 changes: 68 additions & 26 deletions examples/QMLPlayer/i18n/QMLPlayer_zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@
<translation>主页</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/About.qml" line="27"/>
<source>Install QtAV for Windows desktop/store, OSX, Linux and Android</source>
<translation>给Windows 桌面/商店, OSX, Linux和Android安装QtAV</translation>
<translation type="vanished">给Windows 桌面/商店, OSX, Linux和Android安装QtAV</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/About.qml" line="27"/>
<source>Install QtAV for Windows desktop/store, macOS, Linux and Android</source>
<translation>为Windows 桌面/商店, macOS, Linux 和 Android安装QtAV</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/About.qml" line="28"/>
Expand Down Expand Up @@ -213,25 +217,63 @@
</message>
<message>
<location filename="../qml/QMLPlayer/ConfigPanel.qml" line="35"/>
<source>Effect</source>
<translation>效果</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/ConfigPanel.qml" line="36"/>
<source>Subtitle</source>
<translation>字幕</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/ConfigPanel.qml" line="36"/>
<location filename="../qml/QMLPlayer/ConfigPanel.qml" line="37"/>
<source>Audio</source>
<translation>音频</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/ConfigPanel.qml" line="37"/>
<location filename="../qml/QMLPlayer/ConfigPanel.qml" line="38"/>
<source>Misc</source>
<translation>杂项</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/ConfigPanel.qml" line="38"/>
<location filename="../qml/QMLPlayer/ConfigPanel.qml" line="39"/>
<source>About</source>
<translation>关于</translation>
</message>
</context>
<context>
<name>EffectPage</name>
<message>
<location filename="../qml/QMLPlayer/EffectPage.qml" line="6"/>
<source>Effect</source>
<translation>效果</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/EffectPage.qml" line="27"/>
<source>Brightness</source>
<translation>亮度</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/EffectPage.qml" line="50"/>
<source>Contrast</source>
<translation>对比度</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/EffectPage.qml" line="73"/>
<source>Hue</source>
<translation>色调</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/EffectPage.qml" line="96"/>
<source>Saturation</source>
<translation>饱和度</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/EffectPage.qml" line="116"/>
<source>Reset</source>
<translation>重置</translation>
</message>
</context>
<context>
<name>MediaInfoPage</name>
<message>
Expand Down Expand Up @@ -404,7 +446,7 @@
<context>
<name>PlayListPanel</name>
<message>
<location filename="../qml/QMLPlayer/PlayListPanel.qml" line="39"/>
<location filename="../qml/QMLPlayer/PlayListPanel.qml" line="58"/>
<source>History</source>
<translation>播放历史</translation>
</message>
Expand All @@ -425,88 +467,88 @@
<translation>字幕</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="175"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="174"/>
<source>Font file</source>
<translation>字体文件</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="183"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="182"/>
<source>Force</source>
<translation>强制</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="193"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="224"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="192"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="223"/>
<source>Clear</source>
<translation>清除</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="216"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="215"/>
<source>Fonts dir</source>
<translation>字体目录</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="242"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="241"/>
<source>Embedded Subtitles</source>
<translation>内嵌字幕</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="272"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="271"/>
<source>External Subtitle</source>
<translation>外挂字幕</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="285"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="284"/>
<source>Enabled</source>
<translation>启用</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="294"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="293"/>
<source>Auto load</source>
<translation>自动加载</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="28"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="27"/>
<source>Delay</source>
<translation>延时</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="28"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="27"/>
<source>ms</source>
<translation>毫秒</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="326"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="325"/>
<source>Choose a font file</source>
<translation>选择一个字体文件</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="333"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="332"/>
<source>Choose a fonts dir</source>
<translation>选择一个字体目录</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="80"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="79"/>
<source>Supported formats</source>
<translation>支持格式</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="116"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="115"/>
<source>Font</source>
<translation>字体</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="131"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="130"/>
<source>Outline</source>
<translation>轮廓</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="103"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="102"/>
<source>Bottom margin</source>
<translation>底部距离</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="52"/>
<location filename="../qml/QMLPlayer/SubtitlePage.qml" line="51"/>
<source>Engine</source>
<translation>引擎</translation>
</message>
Expand Down Expand Up @@ -547,12 +589,12 @@
<context>
<name>main</name>
<message>
<location filename="../qml/QMLPlayer/main.qml" line="173"/>
<location filename="../qml/QMLPlayer/main.qml" line="190"/>
<source>Subtitle</source>
<translation>字幕</translation>
</message>
<message>
<location filename="../qml/QMLPlayer/main.qml" line="580"/>
<location filename="../qml/QMLPlayer/main.qml" line="559"/>
<source>Open a URL</source>
<translation>打开URL</translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions examples/QMLPlayer/qml/QMLPlayer/About.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ Page {
font.pixelSize: Utils.scaled(15)
onContentHeightChanged: parent.contentHeight = contentHeight + 2*anchors.margins
onLinkActivated: Qt.openUrlExternally(link)
text: "<img src='qrc:/QtAV.svg'><h3>QMLPlayer for " + Qt.platform.os + " " + qsTr("based on") + " QtAV 1.10.0</h3>"
text: "<img src='qrc:/QtAV.svg'><h3>QMLPlayer for " + Qt.platform.os + " " + qsTr("based on") + " QtAV 1.11.0</h3>"
+ "<p>" + qsTr("QtAV is a cross platform, high performance multimedia framework") + "</p>"
+ "<p>Distributed under the terms of LGPLv2.1 or later.</p>"
+ "<p>Copyright (C) 2012-2016 Wang Bin (aka. Lucas Wang) <a href='mailto:[email protected]'>[email protected]</a></p><p>"
+ qsTr("Home page") + ": <a href='http://qtav.org'>http://qtav.org</a></p>"
+ "<p><a href='http://qtav.org/install.html'>"+qsTr("Install QtAV for Windows desktop/store, OSX, Linux and Android")+"</a></p>"
+ "<p><a href='http://qtav.org/install.html'>"+qsTr("Install QtAV for Windows desktop/store, macOS, Linux and Android")+"</a></p>"
+ "\n<p>" + qsTr("Double click") + ": " + qsTr("show/hide control bar") + "</p><p>"
+ qsTr("Click right area") + ": " + qsTr("show config panel") + "</p><p>"
+ qsTr("Open") + " " + qsTr("a subtitle") + ": " + qsTr("press open button to select a subtitle, or a video + a subtitle") + "</p>"
Expand Down
1 change: 1 addition & 0 deletions examples/QMLPlayer/qml/QMLPlayer/ConfigPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Rectangle {
Component.onCompleted: {
contentModel.append({name: qsTr("Media info"), url: "MediaInfoPage.qml" })
contentModel.append({name: qsTr("Video codec"), url: "VideoCodec.qml" })
contentModel.append({name: qsTr("Effect"), url: "EffectPage.qml" })
contentModel.append({name: qsTr("Subtitle"), url: "SubtitlePage.qml" })
contentModel.append({name: qsTr("Audio"), url: "AudioPage.qml" })
contentModel.append({name: qsTr("Misc"), url: "MiscPage.qml" })
Expand Down
129 changes: 129 additions & 0 deletions examples/QMLPlayer/qml/QMLPlayer/EffectPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import QtQuick 2.0
import "utils.js" as Utils

Page {
id: root
title: qsTr("Effect")
property alias brightness : brightnessControl.value
property alias contrast : contrastControl.value
property alias hue: hueControl.value
property alias saturation: saturationControl.value
height: Math.min(maxHeight, scroll.contentHeight)
Flickable {
id: scroll
anchors.fill: content
contentHeight: titleHeight + brightnessControl.height + brightnessControl.height
+ hueControl.height + saturationControl.height
+ Utils.kItemHeight
+ Utils.kSpacing*6
Column {
anchors.fill: parent
spacing: Utils.kSpacing
Item {
width: parent.width
height: Utils.scaled(40)
Text {
color: "white"
text: qsTr("Brightness")
font.pixelSize: Utils.kFontSize
anchors.left: parent.left
height: parent.height
verticalAlignment: Text.AlignVCenter
}
Slider {
id: brightnessControl
lineColor: "gray"
anchors.right: parent.right
width: parent.width*3/4
height: parent.height
value: 0
min: -1
max: 1
orientation: Qt.Horizontal
}
}
Item {
width: parent.width
height: Utils.scaled(40)
Text {
color: "white"
text: qsTr("Contrast")
font.pixelSize: Utils.kFontSize
anchors.left: parent.left
height: parent.height
verticalAlignment: Text.AlignVCenter
}
Slider {
id: contrastControl
lineColor: "#ccddeeff"
anchors.right: parent.right
width: parent.width*3/4
height: parent.height
value: 0
min: -1
max: 1
orientation: Qt.Horizontal
}
}
Item {
width: parent.width
height: Utils.scaled(40)
Text {
color: "white"
text: qsTr("Hue")
font.pixelSize: Utils.kFontSize
anchors.left: parent.left
height: parent.height
verticalAlignment: Text.AlignVCenter
}
Slider {
id: hueControl
lineColor: "#eebb8899"
anchors.right: parent.right
width: parent.width*3/4
height: parent.height
value: 0
min: -1
max: 1
orientation: Qt.Horizontal
}
}
Item {
width: parent.width
height: Utils.scaled(40)
Text {
color: "white"
text: qsTr("Saturation")
font.pixelSize: Utils.kFontSize
anchors.left: parent.left
height: parent.height
verticalAlignment: Text.AlignVCenter
}
Slider {
id: saturationControl
lineColor: "#ee88ccaa"
anchors.right: parent.right
width: parent.width*3/4
height: parent.height
value: 0
min: -1
max: 1
orientation: Qt.Horizontal
}
}

Button {
text: qsTr("Reset")
bgColor: "#990000ff"
width: parent.width/4
height: Utils.kItemHeight
onClicked: {
brightness = 0
contrast = 0
hue = 0
saturation = 0
}
}
}
}
}
Loading

0 comments on commit dd7b9f1

Please sign in to comment.