diff options
Diffstat (limited to 'examples/winextras/quickplayer')
18 files changed, 0 insertions, 493 deletions
diff --git a/examples/winextras/quickplayer/CMakeLists.txt b/examples/winextras/quickplayer/CMakeLists.txt deleted file mode 100644 index 9c46fb9..0000000 --- a/examples/winextras/quickplayer/CMakeLists.txt +++ /dev/null @@ -1,79 +0,0 @@ -# Generated from quickplayer.pro. - -cmake_minimum_required(VERSION 3.14) -project(quickplayer LANGUAGES CXX) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/winextras/quickplayer") - -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Quick) - -add_qt_gui_executable(quickplayer - main.cpp -) -target_link_libraries(quickplayer PUBLIC - Qt::Core - Qt::Gui - Qt::Quick -) - - -# Resources: -set_source_files_properties("images/media-pause-16.png" - PROPERTIES QT_RESOURCE_ALIAS "pause-16.png" -) -set_source_files_properties("images/media-pause-32.png" - PROPERTIES QT_RESOURCE_ALIAS "pause-32.png" -) -set_source_files_properties("images/media-play-16.png" - PROPERTIES QT_RESOURCE_ALIAS "play-16.png" -) -set_source_files_properties("images/media-play-32.png" - PROPERTIES QT_RESOURCE_ALIAS "play-32.png" -) -set_source_files_properties("images/media-seek-backward-32.png" - PROPERTIES QT_RESOURCE_ALIAS "backward-32.png" -) -set_source_files_properties("images/media-seek-forward-32.png" - PROPERTIES QT_RESOURCE_ALIAS "forward-32.png" -) -set_source_files_properties("images/media-stop-32.png" - PROPERTIES QT_RESOURCE_ALIAS "stop-32.png" -) -set_source_files_properties("qml/main.qml" - PROPERTIES QT_RESOURCE_ALIAS "main.qml" -) -set(quickplayer_resource_files - "images/media-pause-16.png" - "images/media-pause-32.png" - "images/media-play-16.png" - "images/media-play-32.png" - "images/media-seek-backward-32.png" - "images/media-seek-forward-32.png" - "images/media-stop-32.png" - "qml/main.qml" -) - -qt6_add_resources(quickplayer "quickplayer" - PREFIX - "/" - FILES - ${quickplayer_resource_files} -) - -install(TARGETS quickplayer - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-composited.png b/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-composited.png Binary files differdeleted file mode 100644 index 76c8734..0000000 --- a/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-composited.png +++ /dev/null diff --git a/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-taskbar.png b/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-taskbar.png Binary files differdeleted file mode 100644 index 17d62b8..0000000 --- a/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-taskbar.png +++ /dev/null diff --git a/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-thumbnail.png b/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-thumbnail.png Binary files differdeleted file mode 100644 index 0312ee2..0000000 --- a/examples/winextras/quickplayer/doc/images/qtwinextras-quickplayer-thumbnail.png +++ /dev/null diff --git a/examples/winextras/quickplayer/doc/src/qtwinextras-quickplayer.qdoc b/examples/winextras/quickplayer/doc/src/qtwinextras-quickplayer.qdoc deleted file mode 100644 index 1492865..0000000 --- a/examples/winextras/quickplayer/doc/src/qtwinextras-quickplayer.qdoc +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \example quickplayer - \title Quick Player - \ingroup examples-qtwinextras - \brief Demonstrates using QtWinExtras in Qt Quick. - - \image qtwinextras-quickplayer-composited.png Screenshot of the Quick Player example - - The Quick Player example demonstrates how to use the various features - provided by the QtWinExtras module in Qt Quick. - - \note This example is a simplified Qt Quick-based version of the \l {Music Player} example. - - \section1 DWM Features - - The example uses Windows DWM (Desktop Window Manager) features to visually - integrate the window content to the window frame and to make the window - translucent and blurred. - - \snippet quickplayer/qml/main.qml dwm - - \section1 Taskbar Overlay and Progress - - The example uses Windows Taskbar for two things; it sets an overlay icon - that represents the current music playback state, and it indicates the - playback progress in the taskbar button. - - \image qtwinextras-quickplayer-taskbar.png Screenshot of the Quick Player taskbar - - The following snippet shows how the taskbar button is prepared. The taskbar progress - indicator and the overlay icon are bound to the music playback, and will automatically - change whenever the state or attributes of the music playback change. - - \snippet quickplayer/qml/main.qml taskbar - - \section1 Thumbnail Toolbar - - \image qtwinextras-quickplayer-thumbnail.png Screenshot of the Quick Player thumbnail - - The Windows Thumbnail Toolbar is used for providing basic music playback - controls. These controls can be used to control the application without - having to activate the application. The thumbnail toolbar buttons are bound - to the music playback, and will automatically change whenever the state or - attributes of the music playback changes. - - \snippet quickplayer/qml/main.qml thumbbar -*/ diff --git a/examples/winextras/quickplayer/images/media-pause-16.png b/examples/winextras/quickplayer/images/media-pause-16.png Binary files differdeleted file mode 100644 index 8d06287..0000000 --- a/examples/winextras/quickplayer/images/media-pause-16.png +++ /dev/null diff --git a/examples/winextras/quickplayer/images/media-pause-32.png b/examples/winextras/quickplayer/images/media-pause-32.png Binary files differdeleted file mode 100644 index 3f172a0..0000000 --- a/examples/winextras/quickplayer/images/media-pause-32.png +++ /dev/null diff --git a/examples/winextras/quickplayer/images/media-play-16.png b/examples/winextras/quickplayer/images/media-play-16.png Binary files differdeleted file mode 100644 index d7ee3cc..0000000 --- a/examples/winextras/quickplayer/images/media-play-16.png +++ /dev/null diff --git a/examples/winextras/quickplayer/images/media-play-32.png b/examples/winextras/quickplayer/images/media-play-32.png Binary files differdeleted file mode 100644 index af8d2f7..0000000 --- a/examples/winextras/quickplayer/images/media-play-32.png +++ /dev/null diff --git a/examples/winextras/quickplayer/images/media-seek-backward-32.png b/examples/winextras/quickplayer/images/media-seek-backward-32.png Binary files differdeleted file mode 100644 index c14112e..0000000 --- a/examples/winextras/quickplayer/images/media-seek-backward-32.png +++ /dev/null diff --git a/examples/winextras/quickplayer/images/media-seek-forward-32.png b/examples/winextras/quickplayer/images/media-seek-forward-32.png Binary files differdeleted file mode 100644 index 00c0747..0000000 --- a/examples/winextras/quickplayer/images/media-seek-forward-32.png +++ /dev/null diff --git a/examples/winextras/quickplayer/images/media-stop-32.png b/examples/winextras/quickplayer/images/media-stop-32.png Binary files differdeleted file mode 100644 index aae24ba..0000000 --- a/examples/winextras/quickplayer/images/media-stop-32.png +++ /dev/null diff --git a/examples/winextras/quickplayer/images/qt-logo.ico b/examples/winextras/quickplayer/images/qt-logo.ico Binary files differdeleted file mode 100644 index b5ac59b..0000000 --- a/examples/winextras/quickplayer/images/qt-logo.ico +++ /dev/null diff --git a/examples/winextras/quickplayer/main.cpp b/examples/winextras/quickplayer/main.cpp deleted file mode 100644 index caf3a01..0000000 --- a/examples/winextras/quickplayer/main.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QQmlApplicationEngine> -#include <QGuiApplication> -#include <QCommandLineParser> -#include <QCommandLineOption> -#include <QWindow> -#include <QQmlContext> -#include <QStandardPaths> -#include <QDir> - -int main(int argc, char *argv[]) -{ - QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - QCoreApplication::setApplicationName(QStringLiteral("QuickPlayer")); - QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR)); - QCoreApplication::setOrganizationName(QStringLiteral("QtWinExtras")); - QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org")); - QGuiApplication::setApplicationDisplayName(QStringLiteral("QtWinExtras Quick Player")); - - QQmlApplicationEngine engine; - const QStringList musicPaths = QStandardPaths::standardLocations(QStandardPaths::MusicLocation); - const QUrl musicUrl = QUrl::fromLocalFile(musicPaths.isEmpty() ? QDir::homePath() : musicPaths.first()); - engine.rootContext()->setContextProperty(QStringLiteral("musicUrl"), musicUrl); - - QCommandLineParser parser; - parser.setApplicationDescription(QGuiApplication::applicationDisplayName()); - parser.addHelpOption(); - parser.addVersionOption(); - parser.addPositionalArgument(QStringLiteral("url"), QStringLiteral("The URL to open.")); - parser.process(app); - QUrl commandLineUrl; - if (!parser.positionalArguments().isEmpty()) - commandLineUrl = QUrl::fromUserInput(parser.positionalArguments().constFirst(), QDir::currentPath(), QUrl::AssumeLocalFile); - engine.rootContext()->setContextProperty(QStringLiteral("url"), commandLineUrl); - - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - QObject *root = engine.rootObjects().value(0); - if (QWindow *window = qobject_cast<QWindow *>(root)) - window->show(); - else - return -1; - return app.exec(); -} diff --git a/examples/winextras/quickplayer/qml/main.qml b/examples/winextras/quickplayer/qml/main.qml deleted file mode 100644 index ec309a5..0000000 --- a/examples/winextras/quickplayer/qml/main.qml +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Window 2.1 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 -import QtQuick.Dialogs 1.0 -import QtMultimedia 5.0 -import QtWinExtras 1.0 as Win - -Window { - id: window - - title: qsTr("QtWinExtras Quick Player") - - width: 300 - height: 60 - minimumWidth: row.implicitWidth + 18 - minimumHeight: column.implicitHeight + 18 - - //! [color] - color: "transparent" - //! [color] - - //! [dwm] - Win.DwmFeatures { - id: dwm - - topGlassMargin: -1 - leftGlassMargin: -1 - rightGlassMargin: -1 - bottomGlassMargin: -1 - } - //! [dwm] - - //! [taskbar] - Win.TaskbarButton { - id: taskbar - - progress.value: mediaPlayer.position - progress.maximum: mediaPlayer.duration - progress.visible: mediaPlayer.hasAudio - progress.paused: mediaPlayer.playbackState === MediaPlayer.PausedState - - overlay.iconSource: mediaPlayer.playbackState === MediaPlayer.PlayingState ? "qrc:/play-32.png" : - mediaPlayer.playbackState === MediaPlayer.PausedState ? "qrc:/pause-32.png" : "qrc:/stop-32.png" - } - //! [taskbar] - - //! [thumbbar] - Win.ThumbnailToolBar { - id: thumbbar - - Win.ThumbnailToolButton { - tooltip: qsTr("Rewind") - iconSource: "qrc:/backward-32.png" - - enabled: mediaPlayer.position > 0 - onClicked: mediaPlayer.seek(mediaPlayer.position - mediaPlayer.duration / 10) - } - - Win.ThumbnailToolButton { - tooltip: mediaPlayer.playbackState === MediaPlayer.PlayingState ? qsTr("Pause") : qsTr("Play") - iconSource: mediaPlayer.playbackState === MediaPlayer.PlayingState ? "qrc:/pause-32.png" : "qrc:/play-32.png" - - enabled: mediaPlayer.hasAudio - onClicked: mediaPlayer.playbackState === MediaPlayer.PlayingState ? mediaPlayer.pause() : mediaPlayer.play() - } - - Win.ThumbnailToolButton { - tooltip: qsTr("Fast forward") - iconSource: "qrc:/forward-32.png" - - enabled: mediaPlayer.position < mediaPlayer.duration - onClicked: mediaPlayer.seek(mediaPlayer.position + mediaPlayer.duration / 10) - } - } - //! [thumbbar] - - MediaPlayer { - id: mediaPlayer - autoPlay: true - source : url - readonly property string title: !!metaData.author && !!metaData.title - ? qsTr("%1 - %2").arg(metaData.author).arg(metaData.title) - : metaData.author || metaData.title || source - } - - ColumnLayout { - id: column - - anchors.margins: 9 - anchors.fill: parent - - Label { - id: infoLabel - - elide: Qt.ElideLeft - verticalAlignment: Qt.AlignVCenter - text: mediaPlayer.errorString || mediaPlayer.title - Layout.minimumHeight: infoLabel.implicitHeight - Layout.fillWidth: true - Layout.fillHeight: true - } - - RowLayout { - id: row - - Button { - id: openButton - - text: qsTr("...") - Layout.preferredWidth: openButton.implicitHeight - onClicked: fileDialog.open() - - FileDialog { - id: fileDialog - - folder : musicUrl - title: qsTr("Open file") - nameFilters: [qsTr("MP3 files (*.mp3)"), qsTr("All files (*.*)")] - onAccepted: mediaPlayer.source = fileDialog.fileUrl - } - } - - Button { - id: playButton - - enabled: mediaPlayer.hasAudio - Layout.preferredWidth: playButton.implicitHeight - iconSource: mediaPlayer.playbackState === MediaPlayer.PlayingState ? "qrc:/pause-16.png" : "qrc:/play-16.png" - onClicked: mediaPlayer.playbackState === MediaPlayer.PlayingState ? mediaPlayer.pause() : mediaPlayer.play() - } - - Slider { - id: positionSlider - - Layout.fillWidth: true - maximumValue: mediaPlayer.duration - - property bool sync: false - - onValueChanged: { - if (!sync) - mediaPlayer.seek(value) - } - - Connections { - target: mediaPlayer - onPositionChanged: { - positionSlider.sync = true - positionSlider.value = mediaPlayer.position - positionSlider.sync = false - } - } - } - - Label { - id: positionLabel - - readonly property int minutes: Math.floor(mediaPlayer.position / 60000) - readonly property int seconds: Math.round((mediaPlayer.position % 60000) / 1000) - - text: Qt.formatTime(new Date(0, 0, 0, 0, minutes, seconds), qsTr("mm:ss")) - } - } - } -} diff --git a/examples/winextras/quickplayer/quickplayer.pro b/examples/winextras/quickplayer/quickplayer.pro deleted file mode 100644 index 77f9c97..0000000 --- a/examples/winextras/quickplayer/quickplayer.pro +++ /dev/null @@ -1,18 +0,0 @@ -TEMPLATE = app -TARGET = quickplayer - -QT += quick - -SOURCES = \ - main.cpp - -OTHER_FILES += \ - qml/main.qml - -RESOURCES += \ - quickplayer.qrc - -RC_ICONS = images/qt-logo.ico - -target.path = $$[QT_INSTALL_EXAMPLES]/winextras/quickplayer -INSTALLS += target diff --git a/examples/winextras/quickplayer/quickplayer.qrc b/examples/winextras/quickplayer/quickplayer.qrc deleted file mode 100644 index e046252..0000000 --- a/examples/winextras/quickplayer/quickplayer.qrc +++ /dev/null @@ -1,12 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> - <file alias="main.qml">qml/main.qml</file> - <file alias="pause-16.png">images/media-pause-16.png</file> - <file alias="pause-32.png">images/media-pause-32.png</file> - <file alias="play-16.png">images/media-play-16.png</file> - <file alias="play-32.png">images/media-play-32.png</file> - <file alias="backward-32.png">images/media-seek-backward-32.png</file> - <file alias="forward-32.png">images/media-seek-forward-32.png</file> - <file alias="stop-32.png">images/media-stop-32.png</file> -</qresource> -</RCC> diff --git a/examples/winextras/quickplayer/quickplayer.rc b/examples/winextras/quickplayer/quickplayer.rc deleted file mode 100644 index 00a51ee..0000000 --- a/examples/winextras/quickplayer/quickplayer.rc +++ /dev/null @@ -1 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "images\\musicplayer.ico" |