Commit c6d60141 authored by Michael Winkelmann's avatar Michael Winkelmann

Changes in Slides

parent e738be36
......@@ -16,5 +16,5 @@ Project {
directory: "./common"
}
/* List of plugin directories passed to QML runtime */
importPaths: [ "common" ]
importPaths: [ "common", "Slides" ]
}
......@@ -5,10 +5,12 @@ import "../common"
SlideWithTitle {
id: root
property var items: ["Point1", "Point2", "Point3"]
property int itemFontSize: 24
BulletPointList {
id: bulletPointList
model: root.items
fontSize: root.itemFontSize
color: Style.black
anchors.top: titleItem.bottom
anchors.left: root.left
......
import QtQuick 2.0
import "../common" 1.0
import "../common"
Item {
SlideWithTitle {
id: root
property real margins: 60
property string title: "Test"
property var items: ["Point1", "Point2", "Point3"]
property int itemFontSize: 24
titleColor: Style.white
QtShape {
id: shape
......@@ -13,27 +14,15 @@ Item {
bottomRightCornerSize: root.margins
anchors.fill: parent
color: Style.blue5
}
SlideText {
id: titleText
text: root.title
anchors.top: root.top
anchors.left: root.left
anchors.right: root.right
anchors.margins: root.margins
color: Style.white
height: root.height / 5
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
font.pixelSize: height / 1.5
z: -100
}
BulletPointList {
model: [ "Point1", "*Point2", "**Point3" ]
color: Style.white
anchors.top: titleText.bottom
id: bulletPointList
model: root.items
fontSize: root.itemFontSize
color: Style.black
anchors.top: titleItem.bottom
anchors.left: root.left
anchors.right: root.right
anchors.margins: root.margins
......
import QtQuick 2.0
import "../common" 1.0
import "../common"
SlideBackground {
id: root
......
......@@ -39,9 +39,134 @@
**
****************************************************************************/
import QtQuick 2.5
import QtQuick.Window 2.0
Item {
Rectangle {
id: root
color: "black"
property variant slides: []
property variant masterSlides: []
property int currentSlide: 0
property alias mouseNavigation: mouseArea.enabled
property bool arrowNavigation: true
property bool keyShortcutsEnabled: true
property real slideWidth: 1280
property real slideHeight: 720
// Private API
property bool _faded: false
property int _userNum;
property int _lastShownSlide: 0
Component.onCompleted: {
var slideCount = 0;
var slides = [];
var masterSlides = [];
for (var i=0; i<root.children.length; ++i) {
var r = root.children[i];
if (r.isSlide) {
slides.width = root.slideWidth
slides.height = root.slideHeight
if (r.isMaster) {
r.visible = true;
masterSlides.push(r);
} else {
slides.push(r);
}
}
}
root.slides = slides;
root.masterSlides = masterSlides;
root._userNum = 0;
root.slides[root.currentSlide].onVisibleChanged.connect(function(){
for (var i = 0; i < root.masterSlides.length; i++) {
root.masterSlides[i].visible = !(root.slides[currentSlide].hideMaster ? root.slides[currentSlide].hideMaster : false);
root.masterSlides[i].slideNumber =
Qt.binding(function() {
return root.currentSlide;
});
}
});
// Make first slide visible...
if (root.slides.length > 0)
root.slides[root.currentSlide].visible = true;
}
function switchSlides(from, to, forward) {
from.visible = false
to.visible = true
return true
}
onCurrentSlideChanged: {
switchSlides(root.slides[_lastShownSlide], root.slides[currentSlide], currentSlide > _lastShownSlide)
_lastShownSlide = currentSlide;
}
function goToNextSlide() {
root._userNum = 0
if (_faded)
return
if (currentSlide + 1 < root.slides.length)
++currentSlide;
}
function goToPreviousSlide() {
root._userNum = 0
if (root._faded)
return
if (currentSlide - 1 >= 0)
--currentSlide;
}
function goToUserSlide() {
--_userNum;
if (root._faded || _userNum >= root.slides.length)
return
if (_userNum < 0)
goToNextSlide()
else {
currentSlide = _userNum;
root.focus = true;
}
}
// directly type in the slide number: depends on root having focus
Keys.onPressed: {
if (event.key >= Qt.Key_0 && event.key <= Qt.Key_9)
_userNum = 10 * _userNum + (event.key - Qt.Key_0)
else {
if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter)
goToUserSlide();
_userNum = 0;
}
}
// navigate with arrow keys
Shortcut { sequence: StandardKey.MoveToNextLine; enabled: root.arrowNavigation; onActivated: goToNextSlide() }
Shortcut { sequence: StandardKey.MoveToPreviousLine; enabled: root.arrowNavigation; onActivated: goToPreviousSlide() }
Shortcut { sequence: StandardKey.MoveToNextChar; enabled: root.arrowNavigation; onActivated: goToNextSlide() }
Shortcut { sequence: StandardKey.MoveToPreviousChar; enabled: root.arrowNavigation; onActivated: goToPreviousSlide() }
// standard shortcuts
Shortcut { sequence: StandardKey.MoveToNextPage; onActivated: goToNextSlide() }
Shortcut { sequence: StandardKey.MoveToPreviousPage; onActivated: goToPreviousSlide() }
Shortcut { sequence: StandardKey.Quit; onActivated: Qt.quit() }
MouseArea {
id: mouseArea
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
if (mouse.button == Qt.RightButton)
goToPreviousSlide()
else
goToNextSlide()
}
onPressAndHold: goToPreviousSlide(); //A back mechanism for touch only devices
}
}
import QtQuick 2.0
Item {
readonly property bool isSlide: true
// anchors.fill: parent
visible: false
width: 1280
height: 720
anchors.centerIn: parent
scale: {
var rw = parent.width / width;
var rh = parent.height / height;
var aspect = width / height;
var rAspect = parent.width / parent.height;
if (width > parent.width && height > parent.height) {
return Math.min(rw,rh);
}
if (width <= parent.width && height > parent.height) {
return Math.min(rw,rh);
}
if (width > parent.width && height <= parent.height) {
return Math.min(rw,rh);
}
if (width <= parent.width && height <= parent.height) {
return Math.min(rw,rh);
}
return 1.0;
}
anchors.margins: 45
anchors.leftMargin: 45
property real margins: 45
}
......@@ -2,11 +2,10 @@ import QtQuick 2.0
import "../common"
SlideBackground {
Slide {
id: root
property real margins: 60
property string title: "Test"
property real titleFontSize: 44
property real titleFontSize: 34
property color titleColor: Style.black
property string titleAlign: "Left"
readonly property Item titleItem: titleText
......@@ -19,10 +18,10 @@ SlideBackground {
anchors.right: root.right
anchors.margins: root.margins
color: root.titleColor
height: root.height / 5
verticalAlignment: Text.AlignVCenter
height: root.height / 8
verticalAlignment: Text.AlignTop
horizontalAlignment: Text.AlignLeft
font.pixelSize: root.titleFontSize
font.pointSize: root.titleFontSize
z: 100
}
}
import QtQuick 2.0
Item {
import "../common"
Slide {
id: root
property string title: "Title"
property string author: "Author"
property string email: "firstname.lastname@qt.io"
property string subtitle: "Subtitle"
Image {
id: image
source: "../common/qt_logo_green_256x256px.png"
width: 120
height: 120
fillMode: Image.PreserveAspectFit
anchors.left: root.left
anchors.top: root.top
anchors.leftMargin: root.margins
anchors.topMargin: root.margins
}
Item {
id: spacer
height: 40
anchors.top: image.bottom
anchors.left: root.left
}
SlideText {
id: titleText
anchors.top: spacer.bottom
text: root.title
font.pointSize: 60
height: 100
anchors.left: root.left
anchors.leftMargin: root.margins
}
SlideText {
id: authorText
height: 40
anchors.top: titleText.bottom
text: root.author
font.pointSize: 20
anchors.left: root.left
anchors.leftMargin: root.margins
}
SlideText {
id: emailText
anchors.top: authorText.bottom
height: 40
text: root.email
font.pointSize: 20
anchors.left: root.left
anchors.leftMargin: root.margins
}
SlideText {
text: root.subtitle
color: Style.gray3
anchors.bottom: root.bottom
font.pointSize: 20
anchors.left: root.left
anchors.leftMargin: root.margins
anchors.bottomMargin: root.margins
}
}
import QtQuick 2.0
Item {
import "../common"
Slide {
id: root
property string title: "Title"
Item {
id: spacer
height: root.height/4
anchors.top: root.top
anchors.left: root.left
}
SlideText {
id: titleText
anchors.top: spacer.bottom
text: root.title
font.pointSize: 60
height: 100
anchors.left: root.left
anchors.leftMargin: root.margins
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment