1/************************************************************************** 2 ** ** 3 ** Copyright (C) 2018 Lukas Spies ** 4 ** Contact: http://photoqt.org ** 5 ** ** 6 ** This file is part of PhotoQt. ** 7 ** ** 8 ** PhotoQt is free software: you can redistribute it and/or modify ** 9 ** it under the terms of the GNU General Public License as published by ** 10 ** the Free Software Foundation, either version 2 of the License, or ** 11 ** (at your option) any later version. ** 12 ** ** 13 ** PhotoQt is distributed in the hope that it will be useful, ** 14 ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** 15 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** 16 ** GNU General Public License for more details. ** 17 ** ** 18 ** You should have received a copy of the GNU General Public License ** 19 ** along with PhotoQt. If not, see <http://www.gnu.org/licenses/>. ** 20 ** ** 21 **************************************************************************/ 22 23import QtQuick 2.5 24 25Rectangle { 26 27 id: top 28 29 anchors.fill: parent 30 31 color: settings.composite ? getanddostuff.convertRgbaToHex(settings.backgroundColorRed, settings.backgroundColorGreen, settings.backgroundColorBlue, settings.backgroundColorAlpha) : "#00000000" 32 33 // Fake transparency 34 Image { 35 id: fake 36 anchors.fill: parent 37 visible: !settings.composite && settings.backgroundImageScreenshot 38 source: (!settings.composite && settings.backgroundImageScreenshot) ? "file:/" + getanddostuff.getTempDir() +"/photoqt_screenshot_" + getanddostuff.getCurrentScreen(variables.windowXY.x, variables.windowXY.y) + ".jpg" : "" 39 cache: false 40 Rectangle { 41 anchors.fill: parent 42 visible: parent.visible 43 color: getanddostuff.convertRgbaToHex(settings.backgroundColorRed, settings.backgroundColorGreen, settings.backgroundColorBlue, settings.backgroundColorAlpha) 44 } 45 } 46 function reloadScreenshot() { 47 verboseMessage("MainView/Background", "reloadScreenshot()") 48 fake.source = "" 49 if(!settings.composite && settings.backgroundImageScreenshot) 50 fake.source = "file:/" + getanddostuff.getTempDir() +"/photoqt_screenshot_" + getanddostuff.getCurrentScreen(variables.windowXY.x+background.width/2,variables.windowXY.y+background.height/2) + ".jpg" 51 } 52 53 // Background screenshot 54 Image { 55 visible: settings.backgroundImageUse 56 anchors.fill: parent 57 horizontalAlignment: settings.backgroundImageCenter||settings.backgroundImageScale ? Image.AlignHCenter : Image.AlignLeft 58 verticalAlignment: settings.backgroundImageCenter||settings.backgroundImageScale ? Image.AlignVCenter : Image.AlignTop 59 fillMode: settings.backgroundImageScale ? Image.PreserveAspectFit 60 : (settings.backgroundImageScaleCrop ? Image.PreserveAspectCrop 61 : (settings.backgroundImageStretch ? Image.Stretch 62 : (settings.backgroundImageTile ? Image.Tile : Image.Pad))) 63 source: getanddostuff.doesThisExist(settings.backgroundImagePath) ? settings.backgroundImagePath : "qrc:/img/plainerrorimg.png" 64 Rectangle { 65 anchors.fill: parent 66 visible: parent.visible 67 color: getanddostuff.convertRgbaToHex(settings.backgroundColorRed, settings.backgroundColorGreen, settings.backgroundColorBlue, settings.backgroundColorAlpha) 68 } 69 70 } 71 72 // BACKGROUND COLOR 73 Rectangle { 74 anchors.fill: parent 75 color: getanddostuff.convertRgbaToHex(settings.backgroundColorRed, settings.backgroundColorGreen, settings.backgroundColorBlue, settings.backgroundColorAlpha) 76 visible: !settings.composite && !settings.backgroundImageScreenshot && !settings.backgroundImageUse 77 } 78 79 Text { 80 81 anchors.fill: parent 82 visible: variables.currentFile=="" && !variables.deleteNothingLeft && !variables.filterNoMatch 83 horizontalAlignment: Text.AlignHCenter 84 verticalAlignment: Text.AlignVCenter 85 font.pointSize: 50 86 color: colour.bg_label 87 wrapMode: Text.WordWrap 88 font.bold: true 89 text: em.pty+qsTr("Open a file to begin") 90 opacity: variables.guiBlocked ? 0.2 : 1 91 Behavior on opacity { NumberAnimation { duration: variables.animationSpeed } } 92 93 } 94 95 Text { 96 97 anchors.fill: parent 98 visible: variables.deleteNothingLeft 99 horizontalAlignment: Text.AlignHCenter 100 verticalAlignment: Text.AlignVCenter 101 font.pointSize: 50 102 color: colour.bg_label 103 wrapMode: Text.WordWrap 104 font.bold: true 105 text: em.pty+qsTr("Folder is now empty") 106 opacity: variables.guiBlocked ? 0.2 : 1 107 Behavior on opacity { NumberAnimation { duration: variables.animationSpeed } } 108 109 } 110 111 Text { 112 113 anchors.fill: parent 114 visible: variables.filterNoMatch 115 horizontalAlignment: Text.AlignHCenter 116 verticalAlignment: Text.AlignVCenter 117 font.pointSize: 50 118 color: colour.bg_label 119 wrapMode: Text.WordWrap 120 font.bold: true 121 text: em.pty+qsTr("No image matches selected filter") 122 opacity: variables.guiBlocked ? 0.2 : 1 123 Behavior on opacity { NumberAnimation { duration: variables.animationSpeed } } 124 125 } 126 127 // Arrow pointing to metadata widget 128 Image { 129 id: metadataarrow 130 visible: variables.currentFile=="" && !variables.deleteNothingLeft && !variables.filterNoMatch 131 opacity: variables.guiBlocked ? 0.2 : 1 132 x: 0 133 y: metadata.y+metadata.height/2-height/2 134 source: "qrc:/img/arrowleft.png" 135 width: 150 136 height: 60 137 } 138 139 // Arrow pointing to mainmenu widget 140 Image { 141 id: mainmenuarrow 142 visible: variables.currentFile=="" && !variables.deleteNothingLeft && !variables.filterNoMatch 143 opacity: variables.guiBlocked ? 0.2 : 1 144 x: background.width-width-5 145 y: mainmenu.y+mainmenu.height/2-height/2 146 source: "qrc:/img/arrowright.png" 147 width: 150 148 height: 60 149 } 150 151} 152