summaryrefslogtreecommitdiffstats
path: root/screenshot
diff options
context:
space:
mode:
authorKimmo Ollila <kimmo.ollila@qt.io>2022-12-02 12:16:07 +0200
committerKimmo Ollila <kimmo.ollila@qt.io>2023-12-13 07:18:24 +0000
commit2af89a712358461bfea60e7c2906406f521011dd (patch)
treece503633446890b1c4473e55d1099cae6ea717cc /screenshot
parentabbfc9fea93e5e72b6669d0cd086f7ba21805578 (diff)
New Boot2Qt Demo Launcher app for Qt 6
Task-number: QTBUG-106373 Change-Id: I4867d60b351a92f363e4c1891cb3e0280325e0fd Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
Diffstat (limited to 'screenshot')
-rw-r--r--screenshot/Button.qml65
-rw-r--r--screenshot/Main.qml191
-rw-r--r--screenshot/plugin/plugin.cpp77
-rw-r--r--screenshot/plugin/qmldir3
-rw-r--r--screenshot/plugin/screenshot.pro17
5 files changed, 0 insertions, 353 deletions
diff --git a/screenshot/Button.qml b/screenshot/Button.qml
deleted file mode 100644
index 0c03ac1..0000000
--- a/screenshot/Button.qml
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt for Device Creation.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-import QtQuick 2.0
-
-Rectangle {
-
- width: 100
- height: 40
-
- gradient: Gradient {
- GradientStop { position: 0; color: pressed ? "steelblue" : "white" }
- GradientStop { position: 1; color: pressed ? "lightsteelblue" : "darkgray" }
- }
-
- border.color: pressed ? "darkgray" : "lightgray"
- border.width: 1;
-
- radius: height / 4
-
- property alias text: label.text
- property alias pressed: mouse.pressed
-
- signal clicked;
-
- Text {
- id: label
- color: "black"
- font.pixelSize: parent.size / 2;
- anchors.centerIn: parent;
- }
-
- MouseArea {
- id: mouse
- anchors.fill: parent
-
- onClicked: parent.clicked()
-
- }
-}
diff --git a/screenshot/Main.qml b/screenshot/Main.qml
deleted file mode 100644
index 8aa0af5..0000000
--- a/screenshot/Main.qml
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt for Device Creation.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-import QtQuick 2.0
-
-import Qt.labs.screenshot 1.0
-import QtQuick.Window 2.0
-import com.qtcompany.B2QtLauncher 1.0
-
-
-Window
-{
- id: root
- visible: true
-
- width: 1280
- height: 720
-
- LauncherApplicationsModel {
- id: applicationsModel
- onReady: {
- engine.markApplicationsModelReady();
- }
- Component.onCompleted: {
- //Set the directory to parse for apps
- initialize(applicationSettings.appsRoot);
- }
- }
-
- LauncherEngine {
- id: engine
- bootAnimationEnabled: applicationSettings.isBootAnimationEnabled
- fpsEnabled: applicationSettings.isShowFPSEnabled
- }
-
- ListView {
- id: listView
-
- anchors.fill: parent;
-
- model: applicationsModel
-
- delegate: Loader {
- width: root.width
- height: root.height
- source: location + "/main.qml";
- focus: false
- clip: true
- }
-
- interactive: false
-
- property int listIndex: -1;
- onListIndexChanged: positionViewAtIndex(listIndex, ListView.Beginning);
- function next() {
- if (listIndex < count - 1)
- ++listIndex;
- print("next: updating list index to: ", listIndex, count);
- }
- function previous() {
- if (listIndex > 0)
- --listIndex;
- print("prev: updating list index to: ", listIndex);
- }
-
- }
-
- ScreenShot {
- id: screenshot;
- }
-
- SequentialAnimation {
- id: grabAnimation;
- PropertyAction{ target: controls; property: "visible"; value: false }
- PauseAnimation { duration: 100 }
- ScriptAction {
- script: {
- var isPortrait = root.width < root.height;
-
- var size = Qt.size(800, 450);
- var smallSize = Qt.size(128, 72);
- var loc = applicationsModel.locationAt(listView.listIndex) + "/"
- var name = "preview_l"
- var ext = ".jpg"
-
- if (isPortrait) {
- name = "preview_p"
- size = Qt.size(400, 225);
- smallSize = Qt.size(128, 72);
- }
-
- screenshot.grab(loc + name + ext, size); // medium resolution
- //screenshot.grab(loc + name + "_lr" + ext, smallSize); // low resolution
- }
- }
- PauseAnimation { duration: 100 }
- PropertyAction { target: controls; property: "visible"; value: true }
- }
-
- Item {
- id: controls
-
- height: 40
- width: parent.width
-
- Button {
- id: prevButton
- width: 100
- text: "<<";
- anchors.left: parent.left
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.margins: 2
-
- onClicked: listView.previous();
- }
-
- Button {
- id: nextButton
- width: 100
- height: parent.height
- text: ">>";
-
- anchors.right: parent.right
- anchors.margins: 2
- anchors.top: parent.top
- anchors.bottom: parent.bottom
-
- onClicked: listView.next();
- }
-
- Button {
- text: 'Grab: "' + applicationsModel.nameAt(listView.listIndex) + '"'
- height: parent.height
- anchors.left: prevButton.right
- anchors.right: nextButton.left
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.margins: 2
-
- onClicked: {
- grabAnimation.running = true;
- }
- }
- }
-
- Rectangle {
- id: blackOutLine
- anchors.fill: parent
- anchors.margins: 3
- color: "transparent"
- border.color: "black"
- border.width: 3
- visible: !controls.visible
- }
-
- Rectangle {
- id: whiteOutLine
- anchors.fill: parent
- color: "transparent"
- border.color: "white"
- border.width: 3
- visible: !controls.visible
- }
-
-}
diff --git a/screenshot/plugin/plugin.cpp b/screenshot/plugin/plugin.cpp
deleted file mode 100644
index f701b88..0000000
--- a/screenshot/plugin/plugin.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt for Device Creation.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QtQml/QQmlExtensionPlugin>
-
-#include <QtQuick/QQuickItem>
-#include <QtQuick/QQuickWindow>
-
-#include <QtGui/QImageWriter>
-
-class ScreenShot : public QQuickItem
-{
- Q_OBJECT
-
-public slots:
- bool grab(const QString &name, const QSize &size = QSize()) {
- if (window()) {
- QImage image = window()->grabWindow();
- if (size.width() > 0 && size.height() > 0)
- image = image.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-
- QImageWriter writer(name);
- writer.setQuality(95);
- bool ok = writer.write(image);
- if (ok)
- qDebug("ScreenShot::grab: saved '%s'", qPrintable(name));
- else
- qDebug("ScreenShot::grab: Failed to save '%s'", qPrintable(name));
- return ok;
- } else {
- qWarning("ScreenShot::grab: no window to grab !!");
- }
- return false;
- }
-};
-
-QML_DECLARE_TYPE(ScreenShot)
-
-class ScreenShotPlugin : public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
-
-public:
- virtual void registerTypes(const char *uri)
- {
- qmlRegisterType<ScreenShot>(uri, 1, 0, "ScreenShot");
- }
-};
-
-#include "plugin.moc"
-
diff --git a/screenshot/plugin/qmldir b/screenshot/plugin/qmldir
deleted file mode 100644
index 49db718..0000000
--- a/screenshot/plugin/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
-module Qt.labs.screenshot
-plugin screenshotplugin
-
diff --git a/screenshot/plugin/screenshot.pro b/screenshot/plugin/screenshot.pro
deleted file mode 100644
index 8d672dc..0000000
--- a/screenshot/plugin/screenshot.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-TEMPLATE = lib
-TARGET = screenshotplugin
-QT += quick
-CONFIG += qt plugin
-
-TARGETPATH=Qt/labs/screenshot
-
-SOURCES += plugin.cpp
-
-OTHER_FILES = qmldir
-
-target.path = $$[QT_INSTALL_QML]/$$TARGETPATH
-
-qmldir.files = qmldir
-qmldir.path = $$[QT_INSTALL_QML]/$$TARGETPATH
-
-INSTALLS = target qmldir