Warning, /office/calligra/gemini/qml/PresentationDJMode.qml is written in an unsupported language. File is not indexed.

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2014 Dan Leinir Turthra Jensen <admin@leinir.dk>
0003  *
0004  *  This program is free software; you can redistribute it and/or modify
0005  *  it under the terms of the GNU General Public License as published by
0006  *  the Free Software Foundation; either version 2 of the License, or
0007  *  (at your option) any later version.
0008  *
0009  *  This program is distributed in the hope that it will be useful,
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *  GNU General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU General Public License
0015  *  along with this program; if not, write to the Free Software
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0017  */
0018 
0019 import QtQuick 2.0
0020 import org.kde.kirigami 2.7 as Kirigami
0021 import "components"
0022 import org.calligra 1.0
0023 import org.kde.calligra 1.0 as Calligra
0024 
0025 Rectangle {
0026     id: base;
0027     color: "#22282f";
0028     property int currentSlide: 0;
0029     property int timePassed: 0;
0030     Connections {
0031         target: pageStack.layers;
0032         onCurrentPageChanged: timePassed = 0;
0033     }
0034     function changeSlide(goToSlide) {
0035         fakePieChart.opacity = 0;
0036         fakePieChartTapped.opacity = 0;
0037         laserScribbler.opacity = 1;
0038         laserScribbler.clear();
0039         scribbler.opacity = 0;
0040         scribbler.clear();
0041         if(mainWindow.lastScreen() > 0) {
0042             mainWindow.desktopKoView.presentationMode().navigateToPage(goToSlide);
0043         }
0044         base.currentSlide = goToSlide;
0045     }
0046     Item {
0047         id: currentSlideContainer;
0048         anchors {
0049             fill: parent;
0050             topMargin: Settings.theme.adjustedPixel(166);
0051             leftMargin: Settings.theme.adjustedPixel(10);
0052             rightMargin: parent.width / 3;
0053             bottomMargin: Settings.theme.adjustedPixel(200);
0054         }
0055         Rectangle {
0056             anchors.fill: parent;
0057             opacity: 0.6;
0058         }
0059         Calligra.ImageDataItem {
0060 //             id: thumbnail;
0061             anchors.fill: parent;
0062 //             anchors.horizontalCenter: parent.horizontalCenter;
0063 
0064 //             width: parent.ListView.view.thumbnailWidth;
0065 //             height: parent.ListView.view.thumbnailHeight;
0066 
0067             data: presentationModel.thumbnail(currentSlide);
0068             visible: fakePieChart.opacity === 0 && fakePieChartTapped.opacity === 0;
0069         }
0070 //         Thumbnail {
0071 //             anchors.fill: parent;
0072 //             content: presentationModel.thumbnail(currentSlide);
0073 //         }
0074         Image {
0075             id: fakePieChart;
0076             opacity: 0;
0077             Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration; } }
0078             anchors.fill: parent;
0079             fillMode: Image.PreserveAspectFit
0080             source: Settings.theme.image("intel-Stage-Slide-PieChart-Default.svg");
0081             MouseArea {
0082                 anchors.fill: parent;
0083                 enabled: parent.opacity > 0;
0084                 onClicked: fakePieChartTapped.opacity = 1;
0085             }
0086         }
0087         Image {
0088             id: fakePieChartTapped;
0089             opacity: 0;
0090             Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration; } }
0091             anchors.fill: parent;
0092             fillMode: Image.PreserveAspectFit
0093             source: Settings.theme.image("intel-Stage-Slide-PieChart-PieceTappedOn.svg");
0094             MouseArea {
0095                 anchors.fill: parent;
0096                 enabled: parent.opacity > 0;
0097                 onClicked: fakePieChartTapped.opacity = 0;
0098             }
0099         }
0100         ScribbleArea {
0101             id: laserScribbler;
0102             anchors.fill: parent;
0103             opacity: 1;
0104             color: "#ff0000";
0105             penWidth: 10;
0106             Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration; } }
0107             onPaintingStarted: laserTimer2.stop();
0108             onPaintingStopped: laserTimer2.start();
0109             Timer {
0110                 id: laserTimer;
0111                 repeat: false; interval: Kirigami.Units.shortDuration;
0112                 onTriggered: laserScribbler.clear();
0113             }
0114             Timer {
0115                 id: laserTimer2;
0116                 repeat: false; interval: 1000;
0117                 onTriggered: laserScribbler.clear();
0118             }
0119         }
0120         ScribbleArea {
0121             id: scribbler;
0122             anchors.fill: parent;
0123             opacity: 0;
0124             color: "#dff03c";
0125             penWidth: 40;
0126             Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration; } }
0127             Timer {
0128                 id: scribbleTimer;
0129                 repeat: false; interval: Kirigami.Units.shortDuration;
0130                 onTriggered: scribbler.clear();
0131             }
0132         }
0133     }
0134     Item {
0135         id: nextSlideContainer;
0136         anchors {
0137             top: parent.top;
0138             topMargin: Settings.theme.adjustedPixel(166);
0139             left: currentSlideContainer.right;
0140             leftMargin: Settings.theme.adjustedPixel(10);
0141             right: parent.right;
0142             rightMargin: Settings.theme.adjustedPixel(10);
0143         }
0144         height: width * (currentSlideContainer.height / currentSlideContainer.width);
0145         Rectangle {
0146             anchors.fill: parent;
0147             opacity: 0.6;
0148         }
0149         Calligra.ImageDataItem {
0150 //             id: thumbnail;
0151             anchors.fill: parent;
0152 //             anchors.horizontalCenter: parent.horizontalCenter;
0153 
0154 //             width: parent.ListView.view.thumbnailWidth;
0155 //             height: parent.ListView.view.thumbnailHeight;
0156 
0157             data: presentationModel.thumbnail(currentSlide + 1);
0158 //             visible: fakePieChart.opacity === 0 && fakePieChartTapped.opacity === 0;
0159         }
0160 //         Thumbnail {
0161 //             anchors.fill: parent;
0162 //             content: presentationModel.thumbnail(currentSlide + 1);
0163 //         }
0164         MouseArea {
0165             anchors.fill: parent;
0166             onClicked: {
0167                 if(base.currentSlide < presentationModel.canvas.slideCount()) {
0168                     base.changeSlide(base.currentSlide + 1);
0169                 }
0170             }
0171         }
0172     }
0173     Image {
0174         anchors {
0175             top: parent.top;
0176             right: parent.right;
0177             rightMargin: Settings.theme.adjustedPixel(20);
0178         }
0179         height: Settings.theme.adjustedPixel(166);
0180         width: Settings.theme.adjustedPixel(136);
0181         source: Settings.theme.icon("SVG-Exit-1");
0182         fillMode: Image.PreserveAspectFit
0183         MouseArea {
0184             anchors.fill: parent;
0185             onClicked: {
0186                 mainWindow.desktopKoView.stopPresentation();
0187                 pageStack.layers.pop();
0188                 if(mainWindow.fullScreen === true) {
0189                     mainWindow.fullScreen = false;
0190                 }
0191             }
0192         }
0193     }
0194     Label {
0195         anchors {
0196             top: parent.top;
0197             left: parent.left;
0198             right: parent.right;
0199         }
0200         horizontalAlignment: Text.AlignHCenter;
0201         verticalAlignment: Text.AlignVCenter;
0202         height: Settings.theme.adjustedPixel(166)
0203         font: Settings.theme.font("presentationTime");
0204         color: "#c1cdd1";
0205         Timer {
0206             interval: 1000;
0207             running: true;
0208             repeat: true;
0209             triggeredOnStart: true;
0210             function offset() {return new Date().getTimezoneOffset()*60000}
0211             onTriggered: {
0212                 base.timePassed = base.timePassed + 1000;
0213                 parent.text = Qt.formatTime(new Date(base.timePassed + offset()), "hh:mm:ss");
0214             }
0215         }
0216     }
0217     Row {
0218         anchors {
0219             left: parent.left;
0220             bottom: parent.bottom;
0221             margins: Kirigami.Units.largeSpacing;
0222         }
0223         height: Settings.theme.adjustedPixel(136);
0224         spacing: Kirigami.Units.largeSpacing;
0225         Button {
0226             height: parent.height;
0227             width: height;
0228             image: Settings.theme.icon("SVG-Nudge-1");
0229             checked: fakePieChart.opacity === 1 || fakePieChartTapped.opacity === 1;
0230             checkedColor: "#00adf5"; checkedOpacity: 0.6;
0231             radius: 8;
0232             onClicked: {
0233                 if(fakePieChart.opacity === 0) {
0234                     fakePieChart.opacity = 1;
0235                     laserScribbler.opacity = 0;
0236                     scribbler.opacity = 0;
0237                     scribbleTimer.start();
0238                 }
0239                 else {
0240                     fakePieChart.opacity = 0;
0241                     fakePieChartTapped.opacity = 0;
0242                 }
0243             }
0244         }
0245         Button {
0246             height: parent.height;
0247             width: height;
0248             image: Settings.theme.icon("SVG-Pointer-1");
0249             checked: laserScribbler.opacity === 1;
0250             checkedColor: "#00adf5"; checkedOpacity: 0.6;
0251             radius: 8;
0252             onClicked: {
0253                 if(laserScribbler.opacity === 0) {
0254                     fakePieChart.opacity = 0;
0255                     fakePieChartTapped.opacity = 0;
0256                     laserScribbler.opacity = 1;
0257                     scribbler.opacity = 0;
0258                     scribbleTimer.start();
0259                 }
0260                 else {
0261                     laserScribbler.opacity = 0;
0262                 }
0263             }
0264         }
0265         Button {
0266             height: parent.height;
0267             width: height;
0268             image: Settings.theme.icon("SVG-Highlighter-1");
0269             checked: scribbler.opacity === 0.7;
0270             checkedColor: "#00adf5"; checkedOpacity: 0.6;
0271             radius: 8;
0272             onClicked: {
0273                 if(scribbler.opacity === 0) {
0274                     fakePieChart.opacity = 0;
0275                     fakePieChartTapped.opacity = 0;
0276                     laserScribbler.opacity = 0;
0277                     scribbler.opacity = 0.7;
0278                     scribbleTimer.stop();
0279                 }
0280                 else {
0281                     scribbler.opacity = 0;
0282                     scribbleTimer.start();
0283                 }
0284             }
0285         }
0286     }
0287     Row {
0288         anchors {
0289             horizontalCenter: parent.horizontalCenter;
0290             bottom: parent.bottom;
0291             margins: Kirigami.Units.largeSpacing;
0292         }
0293         height: Settings.theme.adjustedPixel(136);
0294         spacing: Kirigami.Units.largeSpacing;
0295         Button {
0296             height: parent.height;
0297             width: height;
0298             image: Settings.theme.icon("SVG-PreviousSlide-1");
0299             onClicked: {
0300                 if(base.currentSlide > 0) {
0301                     base.changeSlide(base.currentSlide - 1);
0302                 }
0303             }
0304         }
0305         Button {
0306             height: parent.height;
0307             width: height;
0308             image: Settings.theme.icon("SVG-NextSlide-1");
0309             onClicked: {
0310                 if(base.currentSlide < presentationModel.canvas.slideCount()) {
0311                     base.changeSlide(base.currentSlide + 1);
0312                 }
0313             }
0314         }
0315     }
0316     Button {
0317         anchors {
0318             right: parent.right;
0319             bottom: parent.bottom;
0320             margins: Kirigami.Units.largeSpacing;
0321         }
0322         height: Settings.theme.adjustedPixel(136);
0323         width: height;
0324         image: Settings.theme.icon("SVG-FXTransition-1");
0325         onClicked: base.state = "sidebarShown";
0326     }
0327     states: State {
0328         name: "sidebarShown"
0329         AnchorChanges { target: fxSidebar; anchors.left: undefined; anchors.right: parent.right; }
0330     }
0331     transitions: Transition {
0332         AnchorAnimation { duration: Kirigami.Units.shortDuration; easing.type: Easing.InOutQuad; }
0333     }
0334     Item {
0335         id: fxSidebar;
0336         anchors {
0337             top: parent.top;
0338             left: parent.right;
0339             bottom: parent.bottom;
0340         }
0341         Rectangle {
0342             anchors.fill: parent;
0343             color: "#22282f";
0344             opacity: 0.96;
0345         }
0346         Rectangle {
0347             anchors {
0348                 top: parent.top;
0349                 left: parent.left;
0350                 right: parent.right;
0351             }
0352             height: Constants.GridHeight;
0353             color: "#4e5359";
0354             Label {
0355                 anchors.fill: parent;
0356                 horizontalAlignment: Text.AlignHCenter;
0357                 verticalAlignment: Text.AlignVCenter;
0358                 color: "#c1cdd1";
0359                 font: Settings.theme.font("small");
0360                 text: "SELECT A NEW\nTRANSITION EFFECT";
0361             }
0362             Rectangle {
0363                 anchors {
0364                     left: parent.left;
0365                     right: parent.right;
0366                     bottom: parent.bottom;
0367                 }
0368                 height: 1;
0369                 color: "#c1cccd";
0370             }
0371             MouseArea {
0372                 anchors.fill: parent;
0373                 onClicked: base.state = "";
0374             }
0375         }
0376         width: Constants.GridWidth * 2;
0377         Rectangle {
0378             anchors {
0379                 top: parent.top;
0380                 left: parent.left;
0381                 bottom: parent.bottom;
0382             }
0383             width: 1;
0384             color: "white";
0385         }
0386         ListView {
0387             anchors {
0388                 fill: parent;
0389                 topMargin: Constants.GridHeight;
0390                 leftMargin: 1;
0391             }
0392             clip: true;
0393             model: ListModel {
0394                 ListElement { text: "Fade"; }
0395                 ListElement { text: "Dissolve"; }
0396                 ListElement { text: "Slide in"; }
0397                 ListElement { text: "Bounce"; }
0398                 ListElement { text: "Fan"; }
0399                 ListElement { text: "Snake"; }
0400                 ListElement { text: "Spiral"; }
0401                 ListElement { text: "Swap effect"; }
0402             }
0403             delegate: Item {
0404                 height: Constants.GridHeight * 2;
0405                 width: ListView.view.width;
0406                 MouseArea {
0407                     anchors.fill: parent;
0408                     onClicked: {
0409                         base.state = "";
0410                         if(base.currentSlide < presentationModel.canvas.slideCount()) {
0411                             base.changeSlide(base.currentSlide + 1);
0412                         }
0413                     }
0414                     Rectangle {
0415                         anchors.fill: parent;
0416                         opacity: parent.pressed ? 0.6 : 0;
0417                         Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration; } }
0418                         radius: Settings.theme.adjustedPixel(8);
0419                         color: "#00adf5";
0420                     }
0421                 }
0422                 Image {
0423                     anchors.centerIn: parent;
0424                     height: Constants.GridHeight * 1.3;
0425                     width: height;
0426                     source: Settings.theme.icon("SVG-Icon-Animations-1");
0427                     sourceSize.width: width > height ? height : width;
0428                     sourceSize.height: width > height ? height : width;
0429                 }
0430                 Label {
0431                     anchors {
0432                         left: parent.left;
0433                         right: parent.right;
0434                         bottom: parent.bottom;
0435                         margins: Kirigami.Units.largeSpacing;
0436                     }
0437                     height: font.pixelSize;
0438                     horizontalAlignment: Text.AlignHCenter;
0439                     verticalAlignment: Text.AlignVCenter;
0440                     color: "#c1cdd1";
0441                     font: Settings.theme.font("presentationFx");
0442                     text: model.text;
0443                 }
0444                 Rectangle {
0445                     anchors {
0446                         left: parent.left;
0447                         right: parent.right;
0448                         bottom: parent.bottom;
0449                     }
0450                     height: 1;
0451                     color: "#c1cccd";
0452                 }
0453             }
0454         }
0455     }
0456 }