summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2012-11-07 20:48:25 +0100
committerGunnar Sletta <gunnar.sletta@digia.com>2012-11-07 20:48:25 +0100
commitc1364c4b65438a322955e3c65b03876c82f92130 (patch)
tree0558b3894d5c0e75ba330d7deeee16c37bf1475e
parent02cd7b25bee996459299d76ceb0b08b11a1ce193 (diff)
Added:
- SlideCounter - Clock - titleColor Changed: - Slide.slideTextColor -> Slide.fontColor - Slide.slideFontFamily -> Slide.fontFamily
-rw-r--r--examples/tutorial/SlideDeck.qml72
-rw-r--r--presentation.pro6
-rw-r--r--src/Clock.qml32
-rw-r--r--src/CodeSlide.qml48
-rw-r--r--src/Slide.qml25
-rw-r--r--src/SlideCounter.qml55
-rw-r--r--src/qmldir3
7 files changed, 222 insertions, 19 deletions
diff --git a/examples/tutorial/SlideDeck.qml b/examples/tutorial/SlideDeck.qml
index ee26630..7171e43 100644
--- a/examples/tutorial/SlideDeck.qml
+++ b/examples/tutorial/SlideDeck.qml
@@ -39,9 +39,14 @@ import QtQuick 2.0
Presentation
{
+ id: presentation
+
width: 1280
height: 720
+ SlideCounter {}
+ Clock {}
+
Slide {
centeredText: "Use [space] or [keypad] to see intro"
@@ -227,6 +232,73 @@ int main(int argc, char **argv) {
centeredText: 'Navigate back and forth using [left] and [right]\n[space] or [click] takes you to the next slide.'
}
+ CodeSlide {
+ title: "Slide Counter"
+ code:
+"Presentation {
+
+ SlideCounter {
+ // Defaults:
+ // anchors.right: parent.right
+ // anchors.bottom: parent.bottom
+ // anchors.margins: fontSize;
+ // textColor: 'black'
+ // fontFamily: 'Helvetica' (from presentation)
+ // fontScale: 0.5;
+ }
+ }
+
+ Slide {
+ ...
+ }
+}"
+ }
+
+ CodeSlide {
+ title: "Clock"
+ code:
+"Presentation {
+
+ Clock {
+ // Defaults:
+ // anchors.let: parent.left
+ // anchors.bottom: parent.bottom
+ // anchors.margins: fontSize;
+ // textColor: 'black'
+ // fontFamily: 'Helvetica' (from presentation)
+ // fontScale: 0.5;
+ }
+ }
+
+ Slide {
+ ...
+ }
+}"
+ }
+
+ Slide {
+ title: "Customizations"
+ titleColor: "white"
+
+ textColor: "green"
+ fontFamily: "Times New Roman"
+
+ Rectangle {
+ x: -parent.x
+ y: -parent.y
+ width: presentation.width
+ height: parent.y * 0.9
+ color: "black"
+ }
+
+ content: [
+ "Bullet points, centered text, write-in-text or code listings, can be changed using 'textColor'",
+ "Title can be changed with 'textColor'",
+ "Font can be changed using 'fontFamily'",
+ "Change 'fontScale' for bigger or smaller fonts",
+ "All can be set globally on the presentation (and then inherited in all Slide {} elements), or set directly on a specific Slide {} element."
+ ]
+ }
Slide {
centeredText: "Now go make our own presentations\n\nEnjoy!"
diff --git a/presentation.pro b/presentation.pro
index 8bf6cb6..946cfb9 100644
--- a/presentation.pro
+++ b/presentation.pro
@@ -5,9 +5,11 @@ CONFIG += plugin
qmldir.files += \
src/qmldir \
+ src/Clock.qml \
src/CodeSlide.qml \
src/Presentation.qml \
- src/Slide.qml
+ src/Slide.qml \
+ src/SlideCounter.qml
qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
@@ -15,3 +17,5 @@ INSTALLS += qmldir
+
+
diff --git a/src/Clock.qml b/src/Clock.qml
new file mode 100644
index 0000000..73417e8
--- /dev/null
+++ b/src/Clock.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+Text {
+ id: clock
+
+ property real fontSize: parent.height * 0.05
+ property real fontScale: 0.5
+ property color textColor: parent.textColor != undefined ? parent.textColor : "black"
+ property string fontFamily: parent.fontFamily != undefined ? parent.fontFamily : "Helvetica"
+
+ text: currentTime();
+
+ function currentTime() {
+ var d = new Date();
+ return d.getHours() + ":" + d.getMinutes();
+ }
+
+ color: textColor;
+ font.family: fontFamily;
+ font.pixelSize: fontSize * fontScale;
+
+ anchors.bottom: parent.bottom;
+ anchors.left: parent.left;
+ anchors.margins: font.pixelSize;
+
+ Timer {
+ interval: 60000;
+ repeat: true;
+ running: true
+ onTriggered: clock.text = clock.currentTime();
+ }
+}
diff --git a/src/CodeSlide.qml b/src/CodeSlide.qml
index ad4d470..419bc7e 100644
--- a/src/CodeSlide.qml
+++ b/src/CodeSlide.qml
@@ -1,3 +1,39 @@
+/***************************************************************************
+**
+** This file is part of QML Presentation System **
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).*
+**
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are met:
+**
+** * Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with ** the distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the
+** names of its contributors may be used to endorse or promote products
+** derived from this software without specific ** prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+**************************************************************************/
+
import QtQuick 2.0
Slide {
@@ -17,7 +53,7 @@ Slide {
GradientStop { position: 0; color: Qt.rgba(0.8, 0.8, 0.8, 0.5); }
GradientStop { position: 1; color: Qt.rgba(0.2, 0.2, 0.2, 0.5); }
}
- border.color: slide.slideTextColor;
+ border.color: slide.textColor;
border.width: height / 250;
antialiasing: true
}
@@ -75,15 +111,15 @@ Slide {
id: lineLabelBackground
width: lineLabel.height * 3;
height: lineLabel.height;
- color: slide.slideTextColor;
+ color: slide.textColor;
opacity: 0.1;
}
Text {
id: lineLabel
anchors.right: lineLabelBackground.right;
- text: line + ":"
- color: slide.slideTextColor;
+ text: (line+1) + ":"
+ color: slide.textColor;
font.family: slide.codeFontFamily
font.pixelSize: slide.codeFontSize
font.bold: itemDelegate.ListView.isCurrentItem;
@@ -95,7 +131,7 @@ Slide {
id: lineContentBackground
anchors.fill: lineContent;
anchors.leftMargin: -height / 2;
- color: slide.slideTextColor
+ color: slide.textColor
opacity: 0.2
visible: itemDelegate.ListView.isCurrentItem;
}
@@ -105,7 +141,7 @@ Slide {
anchors.left: lineLabelBackground.right
anchors.leftMargin: lineContent.height;
anchors.right: parent.right;
- color: slide.slideTextColor;
+ color: slide.textColor;
text: code;
font.family: slide.codeFontFamily
font.pixelSize: slide.codeFontSize
diff --git a/src/Slide.qml b/src/Slide.qml
index b44db9f..b00a0d7 100644
--- a/src/Slide.qml
+++ b/src/Slide.qml
@@ -64,8 +64,9 @@ Item {
property real masterWidth: parent.width
property real masterHeight: parent.height
- property color slideTextColor: parent.textColor != undefined ? parent.textColor : "black"
- property string slideFontFamily: parent.fontFamily != undefined ? parent.fontFamily : "Helvetica"
+ property color titleColor: parent.titleColor != undefined ? parent.titleColor : textColor;
+ property color textColor: parent.textColor != undefined ? parent.textColor : "black"
+ property string fontFamily: parent.fontFamily != undefined ? parent.fontFamily : "Helvetica"
visible: false
@@ -77,8 +78,8 @@ Item {
anchors.bottom: parent.top
anchors.bottomMargin: parent.fontSize * 1.5
font.bold: true;
- font.family: slide.slideFontFamily
- color: slideTextColor
+ font.family: slide.fontFamily
+ color: slide.titleColor
horizontalAlignment: Text.Center
z: 1
}
@@ -91,17 +92,17 @@ Item {
text: centeredText
horizontalAlignment: Text.Center
font.pixelSize: baseFontSize
- font.family: slide.slideFontFamily
- color: slideTextColor
+ font.family: slide.fontFamily
+ color: slide.textColor
wrapMode: Text.Wrap
}
Text {
id: writeInTextId
property int length;
- font.family: slide.slideFontFamily
+ font.family: slide.fontFamily
font.pixelSize: baseFontSize
- color: slideTextColor
+ color: slide.textColor
anchors.fill: parent;
wrapMode: Text.Wrap
@@ -112,7 +113,7 @@ Item {
from: 0;
to: slide.writeInText.length;
duration: slide.writeInText.length * 50;
- running: slide.visible && parent.visible
+ running: slide.visible && parent.visible && writeInTextId.length
}
visible: slide.writeInText != undefined;
@@ -142,7 +143,7 @@ Item {
y: baseFontSize * row.indentFactor / 2
width: baseFontSize / 4
height: baseFontSize / 4
- color: slide.slideTextColor
+ color: slide.textColor
radius: width / 2
smooth: true
opacity: text.text.length == 0 ? 0 : 1
@@ -162,9 +163,9 @@ Item {
text: content[index]
textFormat: Text.PlainText
wrapMode: Text.WordWrap
- color: slide.slideTextColor
+ color: slide.textColor
horizontalAlignment: Text.AlignLeft
- font.family: slide.slideFontFamily
+ font.family: slide.fontFamily
}
}
}
diff --git a/src/SlideCounter.qml b/src/SlideCounter.qml
new file mode 100644
index 0000000..e518de7
--- /dev/null
+++ b/src/SlideCounter.qml
@@ -0,0 +1,55 @@
+/***************************************************************************
+**
+** This file is part of QML Presentation System **
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).*
+**
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are met:
+**
+** * Redistributions of source code must retain the above copyright notice,
+** this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright notice,
+** this list of conditions and the following disclaimer in the documentation
+** and/or other materials provided with ** the distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the
+** names of its contributors may be used to endorse or promote products
+** derived from this software without specific ** prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+**************************************************************************/
+
+import QtQuick 2.0
+
+Text {
+ id: counter;
+
+ property real fontSize: parent.height * 0.05
+ property real fontScale: 0.5;
+ property color textColor: parent.textColor != undefined ? parent.textColor : "black"
+ property string fontFamily: parent.fontFamily != undefined ? parent.fontFamily : "Helvetica"
+
+ text: "# " + (parent.currentSlide + 1) + " / " + parent.slides.length;
+ color: counter.textColor;
+ font.family: counter.fontFamily;
+ font.pixelSize: fontSize * fontScale;
+
+ anchors.right: parent.right;
+ anchors.bottom: parent.bottom;
+ anchors.margins: font.pixelSize;
+}
diff --git a/src/qmldir b/src/qmldir
index ddd08ad..5ffe8b9 100644
--- a/src/qmldir
+++ b/src/qmldir
@@ -1,3 +1,6 @@
CodeSlide 1.0 CodeSlide.qml
Presentation 1.0 Presentation.qml
Slide 1.0 Slide.qml
+SlideCounter 1.0 SlideCounter.qml
+Clock 1.0 Clock.qml
+